@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    --bg-primary: #f5f7fa;
    --bg-white: #ffffff;
    --bg-light: #eef1f6;
    --bg-hover: #f0f3f8;
    --border-color: #dfe3eb;
    --border-light: #e8ecf2;
    --text-primary: #1a2030;
    --text-secondary: #5a6478;
    --text-muted: #8b95a8;

    --pasifik-purple: #0077B6;
    --pasifik-purple-light: #00B4D8;
    --pasifik-purple-dark: #005f8a;
    --pasifik-dark: #0a1628;
    --pasifik-mid: #0077B6;
    --pasifik-light: #00B4D8;
    --pasifik-gradient: linear-gradient(135deg, #0077B6, #00B4D8, #00E5FF);

    --ditravo-blue: #1a3fc7;

    --icredible-black: #1a1a1a;
    --proline-orange: #e87511;
    --proline-gray: #6b6b6b;
    --destel-teal: #3a98a8;
    --destel-dark: #1e6070;

    --accent-green: #16a34a;
    --accent-red: #dc2626;
    --accent-cyan: #06b6d4;
    --accent-gold: #d4a017;
    --accent-silver: #8a94a6;
    --accent-bronze: #b87333;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.05);

    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    line-height: 1.6;
    overflow: hidden;
}

/* ---- Layout ---- */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

.page-wrapper {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
    overflow: hidden;
}

/* ---- Header ---- */

.header {
    text-align: center;
    margin-bottom: 40px;
}

.header__logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
}

.header__logo {
    height: 40px;
    object-fit: contain;
}

.header__logo--holding {
    height: 48px;
}

.header__divider {
    width: 1px;
    height: 32px;
    background: var(--border-color);
}

.header__badge {
    display: inline-block;
    padding: 6px 16px;
    background: linear-gradient(135deg, rgba(0, 119, 182, 0.08), rgba(0, 119, 182, 0.04));
    border: 1px solid rgba(0, 119, 182, 0.2);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--pasifik-purple);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 16px;
}

.header__title {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--pasifik-purple-dark);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.header__subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ---- Cards ---- */

.card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 36px;
    box-shadow: var(--shadow-card);
    transition: all 0.25s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* ---- Game cards ---- */

.games-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    width: 100%;
}

.game-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: var(--shadow-card);
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.game-card--icredible::before { background: var(--icredible-black); }
.game-card--destel::before { background: linear-gradient(90deg, var(--destel-dark), var(--destel-teal)); }
.game-card--proline::before { background: var(--proline-orange); }
.game-card--ditravo::before { background: var(--ditravo-blue); }

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.game-card__logo {
    height: 52px;
    object-fit: contain;
    margin-bottom: 20px;
    mix-blend-mode: screen;
}

.game-card__company {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 6px;
}

.game-card--icredible .game-card__company { color: var(--icredible-black); }
.game-card--destel .game-card__company { color: var(--destel-teal); }
.game-card--proline .game-card__company { color: var(--proline-orange); }
.game-card--ditravo .game-card__company { color: var(--ditravo-blue); }

.game-card__name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.game-card__desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

.game-card__play {
    padding: 10px 28px;
    border: none;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: auto;
}

.game-card--icredible .game-card__play { background: var(--icredible-black); }
.game-card--destel .game-card__play { background: var(--destel-teal); }
.game-card--proline .game-card__play { background: var(--proline-orange); }
.game-card--ditravo .game-card__play { background: var(--ditravo-blue); }

.game-card__play:hover {
    transform: scale(1.05);
    filter: brightness(1.15);
}

/* ---- Form ---- */

.form-container {
    width: 100%;
    max-width: 440px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus {
    border-color: var(--pasifik-purple);
    box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.1);
    background: var(--bg-white);
}

.form-group .error-text {
    font-size: 0.8rem;
    color: var(--accent-red);
    margin-top: 6px;
    display: none;
}

.form-group.has-error input {
    border-color: var(--accent-red);
}

.form-group.has-error .error-text {
    display: block;
}

/* ---- Buttons ---- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s;
    text-decoration: none;
}

.btn--primary {
    background: var(--pasifik-gradient);
    color: #fff;
    width: 100%;
}

.btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 119, 182, 0.3);
}

.btn--primary:active {
    transform: translateY(0);
}

.btn--outline {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn--outline:hover {
    background: var(--bg-light);
    border-color: var(--pasifik-purple);
    color: var(--pasifik-purple);
}

.btn--sm {
    padding: 10px 20px;
    font-size: 0.85rem;
}

/* ---- Leaderboard ---- */

.leaderboard {
    width: 100%;
    max-width: 700px;
}

.leaderboard__table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 4px;
}

.leaderboard__table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
}

.leaderboard__table th:last-child {
    text-align: right;
}

.leaderboard__row {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    transition: background 0.2s;
}

.leaderboard__row:hover {
    background: var(--bg-hover);
}

.leaderboard__row td {
    padding: 14px 16px;
    font-size: 0.95rem;
}

.leaderboard__row td:first-child {
    border-radius: var(--radius) 0 0 var(--radius);
    font-weight: 700;
    width: 60px;
}

.leaderboard__row td:last-child {
    border-radius: 0 var(--radius) var(--radius) 0;
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.leaderboard__row--gold td:first-child { color: var(--accent-gold); }
.leaderboard__row--silver td:first-child { color: var(--accent-silver); }
.leaderboard__row--bronze td:first-child { color: var(--accent-bronze); }

.leaderboard__rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 0.85rem;
}

.leaderboard__row--gold .leaderboard__rank-badge {
    background: rgba(212, 160, 23, 0.1);
}
.leaderboard__row--silver .leaderboard__rank-badge {
    background: rgba(138, 148, 166, 0.1);
}
.leaderboard__row--bronze .leaderboard__rank-badge {
    background: rgba(184, 115, 51, 0.1);
}

.leaderboard__score {
    color: var(--pasifik-mid);
    font-weight: 800;
}

.leaderboard__empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
    font-size: 1rem;
}

/* ---- Nav ---- */

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    padding: 0 24px;
}

.nav__inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.nav__brand {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.nav__brand-logo {
    height: 28px;
    object-fit: contain;
}

.nav__links {
    display: flex;
    gap: 4px;
}

.nav__link {
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav__link:hover {
    color: var(--text-primary);
    background: var(--bg-light);
}

.nav__link--active {
    color: var(--pasifik-purple);
    background: rgba(0, 119, 182, 0.06);
    font-weight: 600;
}

.nav__player {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.nav__player-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--pasifik-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

.nav__player-name {
    font-weight: 600;
    color: var(--text-primary);
}

.has-nav {
    padding-top: 60px;
}

/* ---- Refresh indicator ---- */

.refresh-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0 4px;
}

.refresh-bar__text {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.refresh-bar__dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-green);
    margin-right: 6px;
    animation: pulse 2s infinite;
}

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

/* ---- Footer strip ---- */

.footer-strip {
    margin-top: 48px;
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid var(--border-light);
    width: 100%;
    max-width: 1100px;
}

.footer-strip__text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer-strip__logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 8px;
}

.footer-strip__logo {
    height: 20px;
    object-fit: contain;
    opacity: 0.5;
    mix-blend-mode: screen;
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .header__title {
        font-size: 1.75rem;
    }

    .card {
        padding: 24px;
    }

    .header__logos {
        gap: 16px;
    }

    .header__logo {
        height: 30px;
    }

    .header__logo--holding {
        height: 36px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---- Game page specific ---- */

.game-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 20px;
}

.game-stat {
    text-align: center;
}

.game-stat__value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--pasifik-mid);
}

.game-stat__label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.game-play-area {
    transition: opacity 0.3s;
}

.game-play-area.hidden {
    display: none;
}

.game-result {
    display: none;
    padding: 32px;
    text-align: center;
}

.game-result.visible {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.game-result__score {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--pasifik-dark);
}

/* ---- Utility ---- */

.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-col { flex-direction: column; }

/* ---- Spinner ---- */

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--pasifik-mid);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Toast ---- */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(120%);
    transition: transform 0.3s ease;
    z-index: 999;
}

.toast--visible {
    transform: translateY(0);
}

.toast--success { border-left: 3px solid var(--accent-green); }
.toast--error { border-left: 3px solid var(--accent-red); }

/* ---- Idle Overlay ---- */

#idle-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(10, 10, 26, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#idle-overlay.idle-overlay--visible {
    opacity: 1;
    pointer-events: all;
}

.idle-overlay__content {
    text-align: center;
    color: #fff;
}

.idle-overlay__icon {
    margin-bottom: 16px;
    color: rgba(255, 255, 255, 0.5);
}

.idle-overlay__title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.idle-overlay__text {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 24px;
}

.idle-overlay__countdown {
    font-size: 4rem;
    font-weight: 900;
    color: var(--pasifik-purple-light);
    line-height: 1;
    margin-bottom: 4px;
}

.idle-overlay__subtext {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.4);
}

/* ---- Kiosk / 1920x1080 Optimizations ---- */

@media (min-width: 1200px) {
    html { font-size: 18px; }

    .container { max-width: 1400px; }

    .nav__inner { max-width: 1400px; height: 64px; }

    .nav__brand-logo { height: 36px; }

    .nav__link { font-size: 0.95rem; padding: 10px 20px; }

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

    .header__logo--holding { height: 56px; }

    .header__title { font-size: 2.5rem; }

    .header__subtitle { font-size: 1.1rem; }

    .games-grid { gap: 24px; }

    .game-card { padding: 36px 28px; }

    .game-card__logo { height: 60px; margin-bottom: 24px; }

    .game-card__name { font-size: 1.25rem; }

    .game-card__desc { font-size: 0.9rem; }

    .game-card__play {
        padding: 12px 32px;
        font-size: 0.9rem;
    }

    .btn { padding: 16px 36px; font-size: 1.05rem; }

    .btn--sm { padding: 12px 24px; font-size: 0.9rem; }

    .form-group input {
        padding: 16px 20px;
        font-size: 1.05rem;
    }

    .leaderboard { max-width: 800px; }

    .leaderboard__table th { padding: 14px 20px; font-size: 0.75rem; }

    .leaderboard__row td { padding: 16px 20px; font-size: 1.05rem; }

    .leaderboard__rank-badge { width: 36px; height: 36px; font-size: 0.9rem; }

    .footer-strip { max-width: 1400px; }

    .footer-strip__logo { height: 24px; }
}

/* ---- Holding Logo Banner (all pages) ---- */

.holding-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}

.holding-banner__logo {
    height: 44px;
    object-fit: contain;
}

.holding-banner__divider {
    width: 1px;
    height: 28px;
    background: var(--border-color);
}

.holding-banner__fuar {
    height: 40px;
    object-fit: contain;
}
