/**
 * @author      Mike Fairbrother <mike@fairbrother.me>
 * @copyright   2024-2026 Mike Fairbrother. All rights reserved.
 * @license     PROPRIETARY - No rights to copy, modify, distribute, or reuse
 *              any part of this code without explicit written permission from the author.
 */
/* ============================================================
   Order - Game Styles
   ============================================================ */

/* ---- Logo ---- */
.game-logo {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
}
.logo-num {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    color: #1a1640;
    animation: logo-pop 0.4s ease backwards;
}
.logo-num:nth-child(1) { background: #ff6b6b; animation-delay: 0.1s; }
.logo-num:nth-child(2) { background: #ffd93d; animation-delay: 0.2s; }
.logo-num:nth-child(3) { background: #2ed573; animation-delay: 0.3s; }
.logo-num:nth-child(4) { background: #45b7ff; animation-delay: 0.4s; }

@keyframes logo-pop {
    0% { transform: scale(0) rotate(-20deg); opacity: 0; }
    70% { transform: scale(1.15) rotate(3deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* ---- Menu ---- */
.game-title {
    font-size: 52px;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ffd93d, #ff9f43, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.game-subtitle {
    font-size: 16px;
    color: var(--gp-text-secondary);
    margin-bottom: 20px;
}
.menu-best {
    font-size: 14px;
    color: var(--gp-text-secondary);
    margin-bottom: 24px;
    font-weight: 600;
}
.menu-best span {
    color: var(--gp-accent);
    font-weight: 800;
}
.settings-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
}

/* ---- Timer Bar ---- */
#timer-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    position: relative;
    flex-shrink: 0;
}
#timer-bar {
    height: 100%;
    background: linear-gradient(90deg, #2ed573, #ffd93d);
    border-radius: 0 3px 3px 0;
    width: 100%;
    transition: width 0.1s linear;
}
#timer-bar.warning {
    background: linear-gradient(90deg, #ff4757, #ff6b6b);
}
#timer-bar.critical {
    background: #ff4757;
    animation: timer-pulse 0.5s ease infinite;
}
@keyframes timer-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ---- Round Type Label ---- */
#round-type-label {
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--gp-text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 8px 0 4px;
    flex-shrink: 0;
}

/* ---- Combo Display ---- */
#combo-display {
    text-align: center;
    font-size: 16px;
    font-weight: 800;
    color: var(--gp-accent);
    padding: 2px 0;
    flex-shrink: 0;
    animation: combo-glow 0.4s ease;
}
#combo-display.hidden { display: none; }
#combo-count {
    font-size: 20px;
}
@keyframes combo-glow {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* ---- Tile Area ---- */
#tile-area {
    flex: 1;
    position: relative;
    padding: 8px 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
#tile-grid {
    display: grid;
    gap: 10px;
    width: 100%;
    max-width: 380px;
    justify-content: center;
    justify-items: center;
    align-content: center;
}

/* ---- Tiles ---- */
.order-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    position: relative;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    animation: tile-pop-in 0.3s ease backwards;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.order-tile:active {
    transform: scale(0.93);
}

/* Tile sizes based on item count */
.tile-size-4 .order-tile { width: 120px; height: 120px; font-size: 32px; }
.tile-size-5 .order-tile { width: 105px; height: 105px; font-size: 28px; }
.tile-size-6 .order-tile { width: 100px; height: 100px; font-size: 26px; }
.tile-size-7 .order-tile { width: 88px;  height: 88px;  font-size: 24px; }
.tile-size-8 .order-tile { width: 82px;  height: 82px;  font-size: 22px; }
.tile-size-9 .order-tile { width: 76px;  height: 76px;  font-size: 20px; }
.tile-size-10 .order-tile { width: 72px; height: 72px;  font-size: 18px; }
.tile-size-11 .order-tile,
.tile-size-12 .order-tile { width: 68px; height: 68px;  font-size: 16px; }

/* Tile pop-in with staggered delay */
@keyframes tile-pop-in {
    0% { transform: scale(0) rotate(-10deg); opacity: 0; }
    70% { transform: scale(1.08) rotate(2deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* Correct tile */
.order-tile.correct {
    background: var(--gp-success);
    border-color: var(--gp-success);
    color: #fff;
    transform: scale(0.85);
    opacity: 0.5;
    pointer-events: none;
    transition: all 0.25s ease;
}

/* Wrong flash */
.order-tile.wrong {
    animation: tile-shake 0.4s ease;
    border-color: var(--gp-danger);
    box-shadow: 0 0 20px rgba(255, 71, 87, 0.6);
}
@keyframes tile-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* Rainbow color tiles */
.order-tile.rainbow-tile {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border-width: 3px;
}
.tile-size-4 .order-tile.rainbow-tile { width: 100px; height: 100px; }
.tile-size-5 .order-tile.rainbow-tile { width: 90px;  height: 90px; }
.tile-size-6 .order-tile.rainbow-tile { width: 82px;  height: 82px; }
.tile-size-7 .order-tile.rainbow-tile { width: 76px;  height: 76px; }

/* ---- Next Indicator ---- */
#next-indicator {
    text-align: center;
    padding: 8px 0 12px;
    font-size: 15px;
    font-weight: 700;
    color: var(--gp-text-secondary);
    flex-shrink: 0;
}
#next-value {
    color: var(--gp-accent);
    font-size: 18px;
}

/* ---- Ready Screen ---- */
.ready-round {
    font-size: 18px;
    font-weight: 700;
    color: var(--gp-text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}
.ready-type {
    font-size: 36px;
    font-weight: 900;
    background: linear-gradient(135deg, #ffd93d, #ff9f43);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}
.ready-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 24px;
    max-width: 300px;
}
.ready-preview-item {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--gp-text-secondary);
}
.ready-countdown {
    font-size: 64px;
    font-weight: 900;
    color: #fff;
    animation: ready-pulse 0.8s ease infinite;
}
@keyframes ready-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.8; }
}

/* ---- Game Over ---- */
.gameover-title {
    font-size: 36px;
    font-weight: 900;
    margin-bottom: 8px;
    color: #fff;
}
#new-best-badge {
    font-size: 18px;
    font-weight: 800;
    color: var(--gp-accent);
    margin-bottom: 12px;
    animation: gp-badge-pop 0.5s ease backwards;
}
.final-score-block {
    margin-bottom: 8px;
}
.final-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gp-text-secondary);
    font-weight: 600;
}
.final-value {
    font-size: 56px;
    font-weight: 900;
    color: var(--gp-accent);
    line-height: 1.1;
}
.final-value-small {
    font-size: 28px;
    color: var(--gp-text-secondary);
}
.final-best-block {
    margin-bottom: 20px;
}
.final-stats {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 24px;
}
.final-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.final-stat-num {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
}
.final-stat-label {
    font-size: 11px;
    color: var(--gp-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* ---- Help Sections ---- */
.help-section {
    margin-bottom: 16px;
}
.help-text {
    font-size: 14px;
    color: var(--gp-text-secondary);
    line-height: 1.5;
}
.help-text strong {
    color: #fff;
}

/* ---- Sound Off State ---- */
.sound-off {
    opacity: 0.4;
}

/* ---- Game Screen Layout ---- */
#screen-game {
    display: flex;
    flex-direction: column;
}

/* ---- Responsive tile grid columns ---- */
#tile-grid.cols-2 { grid-template-columns: repeat(2, auto); }
#tile-grid.cols-3 { grid-template-columns: repeat(3, auto); }
#tile-grid.cols-4 { grid-template-columns: repeat(4, auto); }

/* ---- Screen transitions ---- */
.gp-screen {
    will-change: opacity;
}
