/* Modern Dark Theme - Liiga Scores */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0d0d0d;
    color: #ffffff;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

/* Header */
header {
    margin-bottom: 24px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.date-info {
    font-size: 14px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 12px;
}

.reveal-all-btn {
    cursor: pointer;
    width: 20px;
    height: 20px;
    opacity: 0.7;
    transition: opacity 0.2s;
    filter: invert(1);
}

.reveal-all-btn:hover {
    opacity: 1;
}

.sim-btn {
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
    transition: all 0.2s;
    border: 1px solid rgba(96, 165, 250, 0.2);
}

.sim-btn:hover {
    background: rgba(96, 165, 250, 0.2);
}

.sim-btn.sim-active {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.page-info {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

/* Matches Container */
.matches-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.loading {
    text-align: center;
    padding: 48px;
    color: #6b7280;
    font-size: 16px;
}

.no-games-message {
    text-align: center;
    padding: 48px 16px;
    color: #9ca3af;
    font-size: 18px;
    font-weight: 500;
}

/* Match Card */
.match {
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    transition: border-color 0.2s;
    container-type: inline-size;
}

.match:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Match Header - teams left, score right */
.match-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* Teams container - both teams together */
.teams-container {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.teams-separator {
    color: #6b7280;
    font-weight: 500;
    flex-shrink: 0;
}

/* Team with logo */
.team {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.team.home {
    justify-content: flex-start;
}

.team.away {
    justify-content: flex-start;
}

.team-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

.team-name {
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Show full name by default, hide short name */
.team-name-full {
    display: inline;
}

.team-name-short {
    display: none;
}

/* Container query: switch to short names only when the match card is ultra-narrow */
@container (max-width: 240px) {
    .team-name-full {
        display: none;
    }

    .team-name-short {
        display: inline;
    }
}

/* Score Display - Right side */
.score-display {
    text-align: right;
    min-width: 56px;
    flex-shrink: 0;
}

.score {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 2px;
}

.score.final {
    color: #22c55e;
}

.score.live {
    color: #f59e0b;
}

.score.hidden-score {
    color: #6b7280;
    cursor: pointer;
}

.score.hidden-score:hover {
    color: #9ca3af;
}

.match-status {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.match-time {
    font-size: 13px;
    color: #9ca3af;
}

/* Scoring Events */
.scoring-data {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    min-height: 20px;
}

.scoring-line {
    display: grid;
    grid-template-columns: 1fr 80px 1fr;
    padding: 2px 0;
    font-size: 13px;
    line-height: 1.3;
}

.scoring-line.hidden-row {
    display: none;
}

/* Single-column scoring display for page 222 data */
.scoring-line-single {
    padding: 4px 0;
    font-size: 13px;
    line-height: 1.4;
    color: #d1d5db;
}

.scoring-line-single.hidden-row {
    display: none;
}

/* Goal colors - Home team (left in data) = Green, Away team (right) = Cyan */
.scoring-line-single.goal-home {
    color: #22c55e;
}

.scoring-line-single.goal-away {
    color: #00ffff;
}

.visiting-scorer {
    text-align: left;
    color: #d1d5db;
}

.home-scorer {
    text-align: left;
    color: #d1d5db;
    grid-column: 3;
}

/* Show More Button */
.score-container {
    margin-top: 12px;
}

.final-score.show-more {
    display: block;
    width: 100%;
    padding: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.2);
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.final-score.show-more:hover {
    background: rgba(96, 165, 250, 0.15);
}

.final-score.hidden {
    display: none;
}

/* Navigation Buttons */
.page-nav-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    background: #2563eb;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 60px;
}

.page-nav-btn:hover {
    background: #1d4ed8;
}

.page-nav-btn:active {
    transform: scale(0.98);
}

.page-number {
    font-size: 14px;
    font-weight: 700;
}

.page-label {
    font-size: 10px;
    font-weight: 400;
    opacity: 0.8;
    margin-top: 1px;
}

.page-nav-btn-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 24px 0;
}

.page-nav-btn-container.mestis-nav {
    margin-top: 12px;
}

/* Mestis/Divari button styling */
.page-nav-btn.mestis-btn {
    background: #7c3aed;
}

.page-nav-btn.mestis-btn:hover {
    background: #6d28d9;
}

/* Refresh Button */
.refresh-btn-container {
    text-align: center;
    margin-top: 24px;
    padding-bottom: 24px;
}

.refresh-btn {
    padding: 12px 32px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    background: #374151;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: #4b5563;
}

.refresh-btn:active {
    transform: scale(0.98);
}

.refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Data Container (for standings, stats pages) */
.data-container {
    max-width: 600px;
    margin: 0 auto 24px auto;
    padding: 0 16px;
}

.stats-line {
    font-size: 13px;
    padding: 3px 0;
    color: #d1d5db;
}

/* Standings Table - Page 223 */
.standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
}

.standings-table thead {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.standings-table th {
    padding: 4px 4px 6px;
    font-weight: 600;
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
}

.standings-table td {
    padding: 2px 4px;
}

.standings-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.standings-table .st-team {
    text-align: left;
    color: #00ffff;
    font-weight: 500;
    white-space: nowrap;
}

.standings-table th.st-team {
    text-align: left;
    color: #6b7280;
}

.standings-table .st-num {
    text-align: right;
    color: #ffffff;
    min-width: 24px;
}

.standings-table .st-goals {
    text-align: right;
    color: #ffffff;
    white-space: nowrap;
    min-width: 60px;
}

.standings-table .st-pts {
    text-align: right;
    color: #22c55e;
    font-weight: 600;
    min-width: 28px;
}

.standings-info {
    margin-top: 16px;
    padding: 8px 0;
    color: #22c55e;
    font-size: 13px;
    text-align: center;
}

/* Playoff indicator lines */
.playoff-line td {
    padding: 0 !important;
    height: 2px;
}

.playoff-line.playoff-top td {
    background: linear-gradient(90deg, transparent 0%, #22c55e 20%, #22c55e 80%, transparent 100%);
}

.playoff-line.playoff-bottom td {
    background: linear-gradient(90deg, transparent 0%, #ef4444 20%, #ef4444 80%, transparent 100%);
}

/* Upcoming Games - Page 223 */
.upcoming-date {
    color: #22c55e;
    font-size: 14px;
    font-weight: 600;
    margin-top: 12px;
    margin-bottom: 4px;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
}

.upcoming-date:first-child {
    margin-top: 0;
}

.upcoming-game {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 2px 0;
    font-size: 14px;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
}

.upcoming-team {
    color: #ffffff;
}

.upcoming-team:first-child {
    text-align: left;
}

.upcoming-team:nth-child(3) {
    text-align: left;
}

.upcoming-separator {
    color: #6b7280;
    text-align: center;
}

.upcoming-time {
    color: #00ffff;
    text-align: right;
    min-width: 45px;
}

/* Leaders Table (Pistepörssi) - Page 223 */
.leaders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
}

.leaders-table thead {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaders-table th {
    padding: 4px 4px 6px;
    font-weight: 600;
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
}

.leaders-table td {
    padding: 2px 4px;
}

.leaders-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.leaders-table .ld-player {
    text-align: left;
    color: #00ffff;
    font-weight: 500;
    white-space: nowrap;
}

.leaders-table th.ld-player {
    text-align: left;
    color: #6b7280;
}

.leaders-table .ld-team {
    text-align: center;
    color: #9ca3af;
    font-size: 12px;
}

.leaders-table .ld-num {
    text-align: right;
    color: #ffffff;
    min-width: 24px;
}

.leaders-table .ld-stats {
    text-align: right;
    color: #ffffff;
    white-space: nowrap;
}

.leaders-table .ld-pm {
    text-align: right;
    color: #22c55e;
    font-weight: 600;
    min-width: 28px;
}

/* Goalies Table (Maalivahdit) - Page 223 */
.goalies-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
}

.goalies-table thead {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.goalies-table th {
    padding: 4px 4px 6px;
    font-weight: 600;
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
}

.goalies-table td {
    padding: 2px 4px;
}

.goalies-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.goalies-table .gl-player {
    text-align: left;
    color: #00ffff;
    font-weight: 500;
    white-space: nowrap;
}

.goalies-table th.gl-player {
    text-align: left;
    color: #6b7280;
}

.goalies-table .gl-team {
    text-align: center;
    color: #9ca3af;
    font-size: 12px;
}

.goalies-table .gl-num {
    text-align: right;
    color: #ffffff;
    min-width: 24px;
}

.goalies-table .gl-pct {
    text-align: right;
    color: #22c55e;
    font-weight: 600;
    white-space: nowrap;
}

.goalies-table .gl-gaa {
    text-align: right;
    color: #ffffff;
    min-width: 40px;
}

/* Stats Grid */
.stats-line-grid {
    display: grid;
    grid-template-columns: minmax(50px, 1fr) auto;
    gap: 8px;
    align-items: center;
}

/* Player + Team + stat columns */
.stats-line-grid-full {
    display: grid;
    grid-template-columns: minmax(50px, 1fr) 3ch minmax(3ch, auto) minmax(2ch, auto) minmax(1ch, auto) minmax(1ch, auto) minmax(4ch, auto);
    gap: 6px;
    align-items: center;
}

/* Simpler layout for scoring leaders */
.stats-line-grid-simple {
    display: grid;
    grid-template-columns: 140px 36px 1fr;
    gap: 4px;
    align-items: center;
}

@media (max-width: 400px) {
    .stats-line-grid-simple {
        grid-template-columns: 110px 32px 1fr;
    }
}

.stats-player {
    font-weight: 500;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.stats-team {
    text-align: right;
    color: #9ca3af;
    white-space: nowrap;
}

.stats-mplus,
.stats-pm,
.stats-shots,
.stats-penalty,
.stats-time {
    text-align: right;
    color: #9ca3af;
    white-space: nowrap;
}

/* Schedule Grid - upcoming games */
.stats-line-schedule {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
}

.schedule-teams {
    color: #ffffff;
}

.schedule-time {
    text-align: right;
    color: #60a5fa;
    white-space: nowrap;
}

.stats-header {
    font-weight: 600;
    color: #6b7280;
    padding-bottom: 2px;
    margin-bottom: 2px;
}

/* Quick Reveal Button */
.quick-reveal-btn {
    cursor: pointer;
    transition: opacity 0.2s;
}

.quick-reveal-btn:hover {
    opacity: 0.8;
}

.unreveal-score-btn {
    cursor: pointer;
}

.unreveal-score-btn:hover {
    opacity: 0.8;
}

/* Tab Navigation for Page 223 */
.tab-container {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.tab-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Roster Display */
.roster-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.roster-team {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 12px;
}

.roster-team-header {
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.roster-player {
    font-size: 12px;
    color: #9ca3af;
    padding: 2px 0;
}

/* Responsive */
@media (max-width: 400px) {
    .container {
        padding: 12px;
    }

    .header-content {
        padding: 12px;
    }

    .header-title {
        font-size: 16px;
    }

    .match {
        padding: 12px;
    }

    .match-header {
        gap: 8px;
    }

    .teams-container {
        gap: 4px;
    }

    .team {
        gap: 4px;
    }

    .team-name {
        font-size: 13px;
    }

    .team-logo {
        width: 22px;
        height: 22px;
    }

    .score {
        font-size: 17px;
    }

    .scoring-line {
        font-size: 12px;
        gap: 8px;
    }

    .scoring-line-single {
        font-size: 12px;
    }

    .standings-table {
        font-size: 12px;
    }

    .standings-table th,
    .standings-table td {
        padding: 2px 2px;
    }

    .standings-table .st-num {
        min-width: 18px;
    }

    .standings-table .st-goals {
        min-width: 50px;
    }

    .leaders-table,
    .goalies-table {
        font-size: 12px;
    }

    .leaders-table th,
    .leaders-table td,
    .goalies-table th,
    .goalies-table td {
        padding: 2px 2px;
    }

    .leaders-table .ld-player,
    .goalies-table .gl-player {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .roster-container {
        grid-template-columns: 1fr;
    }
}

/* Safe area for iPhone notch */
@supports (padding: max(0px)) {
    body {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

/* Touch feedback */
.match, .final-score, .refresh-btn, .page-nav-btn, .tab-btn {
    -webkit-tap-highlight-color: rgba(96, 165, 250, 0.2);
}

/* Running score color */
.running-score-cyan {
    color: #f59e0b !important;
}

/* Final score color */
.final-score-green {
    color: #22c55e !important;
}
