* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Hiragino Sans', 'Meiryo', sans-serif;
    background: #ffffff;
    min-height: 100vh;
    color: #1a1a1a;
}

.app-container {
    min-height: 100vh;
}

/* ===== 画面切り替え ===== */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* ===== スタート画面 ===== */
#start-screen {
    display: none;
    justify-content: center;
    align-items: center;
    background: #ffffff;
    position: relative;
    overflow: hidden;
}

#start-screen.active {
    display: flex;
}

/* キャラクター流れるアニメーション */
.character-marquee {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    height: 120px;
    overflow: hidden;
    pointer-events: none;
    opacity: 0.6;
}

.character-track {
    display: flex;
    gap: 60px;
    animation: marquee 25s linear infinite;
    width: max-content;
}

.character-track img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
    transition: transform 0.3s ease;
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* 2列目（逆方向） */
.character-marquee-reverse {
    position: absolute;
    top: 30px;
    left: 0;
    right: 0;
    height: 100px;
    overflow: hidden;
    pointer-events: none;
    opacity: 0.4;
}

.character-track-reverse {
    display: flex;
    gap: 80px;
    animation: marquee-right 40s linear infinite;
    width: max-content;
    transform: translateX(-25%);
}

.character-track-reverse img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.1));
}

@keyframes marquee-right {
    0% {
        transform: translateX(-25%);
    }

    100% {
        transform: translateX(0);
    }
}

.start-content {
    text-align: center;
    padding: 40px 20px;
}

.logo-section {
    margin-bottom: 50px;
}

.logo-image {
    width: 120px;
    height: 120px;
    margin-bottom: 25px;
    border-radius: 50%;
    object-fit: cover;
}

.start-content h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 15px;
    line-height: 1.4;
}

.tagline {
    color: #666666;
    font-size: 1.1rem;
    margin-bottom: 25px;
}

.election-info {
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
    margin-top: 25px;
}

.election-info span {
    background: #f5f5f5;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    border: 1px solid #e0e0e0;
    color: #333333;
}

.btn-primary {
    background: #1a1a1a;
    border: none;
    padding: 16px 40px;
    border-radius: 8px;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-primary:hover {
    background: #333333;
}

.btn-large {
    padding: 18px 45px;
    font-size: 1.2rem;
}

/* ===== カレンダー画面（タイムライン） ===== */
#calendar-screen {
    padding: 20px;
    padding-bottom: 60px;
    background: #ffffff;
}

.app-header {
    display: flex;
    align-items: center;
    padding: 20px 25px;
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 100;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 30px;
    gap: 20px;
}

.header-center {
    flex: 1;
    text-align: center;
}

.app-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a1a1a;
}

.app-header p {
    color: #888888;
    margin-top: 8px;
    font-size: 0.95rem;
}

.btn-home {
    flex-shrink: 0;
}

.timeline-container {
    max-width: 800px;
    margin: 0 auto;
}

/* 日付セクション */
.day-section {
    margin-bottom: 35px;
}

.day-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid #1a1a1a;
}

.day-date {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1a1a1a;
}

.day-label {
    background: #1a1a1a;
    color: #ffffff;
    padding: 4px 14px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.day-label.election-day {
    background: #333333;
}

.day-label.final-day {
    background: #555555;
}

.day-weekday {
    color: #888888;
    font-size: 0.9rem;
}

/* イベントリスト */
.event-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-left: 20px;
    border-left: 2px solid #e0e0e0;
}

.event-card {
    background: #fafafa;
    border-radius: 8px;
    padding: 16px 18px;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: grid;
    grid-template-columns: 65px 1fr auto;
    gap: 15px;
    align-items: center;
}

.event-card:hover {
    background: #f0f0f0;
    border-color: #999999;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.event-card::before {
    content: '';
    position: absolute;
    left: -25px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: #1a1a1a;
    border-radius: 50%;
}

.event-time {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
}

.event-info {
    flex: 1;
}

.event-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1a1a1a;
}

.event-type-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
    background: #e0e0e0 !important;
    color: #333333 !important;
}

.event-venue {
    color: #666666;
    font-size: 0.85rem;
}

.event-action {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #1a1a1a;
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.event-card:hover .event-action {
    opacity: 1;
}

/* ===== マップ画面 ===== */
#map-screen {
    display: none;
    flex-direction: column;
    height: 100vh;
    background: #ffffff;
}

#map-screen.active {
    display: flex;
}

.map-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
}

.btn-back {
    background: #ffffff;
    border: 1px solid #cccccc;
    padding: 10px 18px;
    border-radius: 6px;
    color: #1a1a1a;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-back:hover {
    background: #f5f5f5;
    border-color: #999999;
}

.current-task-info {
    margin-left: auto;
    text-align: right;
}

.current-task-info span {
    display: block;
    font-weight: 600;
    color: #1a1a1a;
    font-size: 1rem;
}

.current-task-info small {
    color: #888888;
}

.map-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 0;
    overflow: hidden;
}

.map-container {
    padding: 15px;
    background: #f5f5f5;
}

#map {
    height: 100%;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    z-index: 1;
}

.sidebar {
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #ffffff;
    border-left: 1px solid #e0e0e0;
}

/* マップ画面のサイドバー */
.map-sidebar {
    padding: 0;
    gap: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
}

.sidebar-header h2 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.sidebar-date {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.today-mini {
    background: #f0c040;
    color: #1a1a1a;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-left: 8px;
}

.sidebar-schedule {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.sidebar-event {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    margin-bottom: 8px;
}

.sidebar-event:hover {
    background: #f5f5f5;
}

.sidebar-event.selected {
    background: #fff9e6;
    border-color: #f0c040;
}

.sidebar-event-time {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a1a1a;
    min-width: 50px;
}

.sidebar-event-info {
    flex: 1;
}

.sidebar-event-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.sidebar-event-venue {
    font-size: 0.85rem;
    color: #666;
}

.info-panel,
.legend-panel {
    background: #fafafa;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e0e0e0;
}

.info-panel h2,
.legend-panel h2 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: #1a1a1a;
    font-weight: 600;
}

.info-item {
    margin-bottom: 12px;
}

.info-item:last-child {
    margin-bottom: 0;
}

.info-item label {
    display: block;
    font-size: 0.7rem;
    color: #888888;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-value {
    background: #ffffff;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #1a1a1a;
    border: 1px solid #e0e0e0;
}

.memo-content {
    background: #ffffff;
    padding: 12px;
    border-radius: 6px;
    min-height: 50px;
    color: #333333;
    line-height: 1.5;
    border: 1px solid #e0e0e0;
    font-size: 0.9rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.legend-color {
    width: 18px;
    height: 18px;
    border-radius: 3px;
}

/* Leaflet customization */
.leaflet-popup-content-wrapper {
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.leaflet-popup-content {
    color: #1a1a1a;
    font-family: 'Segoe UI', 'Hiragino Sans', 'Meiryo', sans-serif;
}

.leaflet-popup-tip {
    background: #ffffff;
    border: 1px solid #cccccc;
}

/* 今日の日程 */
.today-section {
    background: linear-gradient(135deg, #fff9e6 0%, #fff5cc 100%);
    border-radius: 12px;
    padding: 15px;
    margin: -10px -10px 25px -10px;
    border: 2px solid #f0c040;
}

.today-section .day-header {
    border-bottom-color: #f0c040;
}

.today-badge {
    background: #f0c040;
    color: #1a1a1a;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* 過去の日程 */
.past-section {
    opacity: 0.5;
}

.past-section .event-card {
    pointer-events: none;
}

.past-badge {
    background: #999999;
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* マップポップアップ */
.custom-popup .leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.map-popup {
    font-size: 14px;
    min-width: 220px;
    line-height: 1.5;
}

.popup-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.popup-icon {
    font-size: 1.5rem;
}

.popup-title {
    font-size: 1.1rem;
    color: #1a1a1a;
}

.popup-datetime {
    background: #f5f5f5;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.popup-venue {
    font-weight: 600;
    margin-bottom: 4px;
    color: #1a1a1a;
}

.popup-address {
    color: #666;
    font-size: 0.9rem;
}

/* Responsive - PC/タブレット */
@media (max-width: 1000px) {
    .map-content {
        grid-template-columns: 1fr;
    }

    .sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        max-height: 180px;
        border-left: none;
        border-top: 1px solid #e0e0e0;
    }

    .info-panel,
    .legend-panel {
        flex: 1;
        min-width: 180px;
    }
}

/* Responsive - スマートフォン */
@media (max-width: 600px) {

    /* ヘッダー */
    .header-main {
        padding: 12px 15px;
    }

    .header-main h1 {
        font-size: 1rem;
    }

    .btn-back {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    /* トップ画面 */
    .start-content h1 {
        font-size: 1.5rem;
    }

    .start-content .subtitle {
        font-size: 0.9rem;
    }

    .election-info {
        flex-direction: column;
        gap: 10px;
    }

    .info-item {
        font-size: 0.9rem;
    }

    /* タイムライン */
    .timeline-container {
        padding: 15px;
    }

    .day-header {
        flex-wrap: wrap;
        padding: 12px;
        gap: 8px;
    }

    .date-main {
        font-size: 1.1rem;
    }

    .day-of-week {
        font-size: 0.85rem;
    }

    /* イベントカード */
    .event-card {
        grid-template-columns: 50px 1fr;
        padding: 12px;
        gap: 10px;
    }

    .event-time {
        font-size: 1rem;
    }

    .event-name {
        font-size: 0.95rem;
    }

    .event-venue {
        font-size: 0.85rem;
    }

    .event-action {
        display: none;
    }

    /* マップ画面 */
    .map-screen {
        flex-direction: column;
    }

    .map-container {
        height: 60vh;
        min-height: 300px;
    }

    .sidebar {
        max-height: 40vh;
        overflow-y: auto;
    }

    .sidebar-header {
        padding: 10px 15px;
        font-size: 1rem;
    }

    .sidebar-date {
        font-size: 0.85rem;
    }

    /* マップポップアップ */
    .map-popup {
        min-width: 180px;
        font-size: 13px;
    }

    .popup-title {
        font-size: 1rem;
    }

    /* フッターナビ（タッチ操作最適化） */
    .event-card:active {
        background: #e8e8e8;
        transform: scale(0.98);
    }
}