/* =============================================================
   GAME HEADER
   ============================================================= */
.game-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 20px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.game-title {
    font-size: 26px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--white);
    margin: 0;
}

.game-mode-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--purple);
    border: 1px solid var(--purple);
    border-radius: 99px;
    padding: 4px 12px;
    background: var(--purple-dim);
    white-space: nowrap;
}

/* =============================================================
   GAME HUD STRIP
   ============================================================= */
.game-hud {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 10px 28px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: fit-content;
    max-width: 90%;
}

/* Attempts/timer pill loses its own card style inside the HUD */
.game-hud .attempts {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    font-size: 14px;
    letter-spacing: 0;
}

.game-hud .timer-display { font-size: 22px; }

.game-hud .life-bar { margin-bottom: 0; height: auto; gap: 5px; }

/* Speedrun stats inside HUD */
.speedrun-hud {
    display: flex;
    gap: 20px;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.speedrun-hud strong { color: var(--white); font-weight: 700; }

/* Speedrun guess feedback flashes — toggled by JS */
.input-flash-correct {
    background-color: rgba(74, 127, 70, 0.35) !important;
    border-color: #4a7f46 !important;
    transition: none !important;
}

.input-flash-wrong {
    background-color: rgba(200, 50, 50, 0.25) !important;
    border-color: #c83535 !important;
    transition: none !important;
}

/* =============================================================
   GAME BOARD
   ============================================================= */
.game-board {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 1200px;
    min-width: 600px;
    width: 95%;
    min-height: 300px;
    margin: 0 auto;
}

/* =============================================================
   GUESS ROW & HEADER
   ============================================================= */
.header-row, .guess-row {
    display: grid;
    grid-template-columns: var(--image-size) 1fr 1fr 0.5fr 0.6fr 0.8fr;
    gap: 8px;
    width: 100%;
    align-items: center;
}

.header-row {
    padding: 8px 0;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
}

.header-row div {
    text-align: center;
    width: 100%;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-hi);
    padding-bottom: 6px;
}

/* =============================================================
   GUESS BOX
   ============================================================= */
.box {
    width: 100%;
    padding: 14px 8px;
    background-color: var(--surface-2);
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 66px;
    font-weight: 700;
    font-size: 13px;
    color: var(--white) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

/* Image box — no background */
.guess-row .box:first-child {
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
}

.guess-row .box:first-child img {
    box-shadow: 0 3px 10px rgba(0,0,0,0.4);
}

.box img {
    width: 100%;
    height: 96px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    display: block;
}

/* Period / Brands cell — allow multi-line */
.box.box-period {
    white-space: normal;
    line-height: 1.4;
    font-size: 11px;
    word-break: break-word;
}

/* Country cell with proximity sub-label */
.box.box-country {
    white-space: normal;
    flex-direction: column;
    gap: 3px;
    line-height: 1.2;
}
.box-region {
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    opacity: 0.7;
}

/* =============================================================
   HINT COLORS
   ============================================================= */
.green  { background-color: #4a7f46; }
.orange { background-color: #b86e1e; }
.yellow { background-color: #9a9e1a; }
.grey   { background-color: var(--surface-2); opacity: 0.75; }

/* =============================================================
   GAME OVER — ACTION BUTTONS ROW
   ============================================================= */
.go-action-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.go-action-row .menu-btn {
    flex: 1;
    min-width: 130px;
    max-width: 200px;
}
.btn-back-menu {
    width: 100%;
    opacity: 0.7;
    font-size: 13px;
}

/* =============================================================
   SPEEDRUN RESULT LIST (game-over modal)
   ============================================================= */
.speedrun-result-list {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 14px;
    line-height: 1.6;
    max-height: 110px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.25);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    text-align: left;
    scrollbar-color: var(--white) var(--surface-1);
}
.speedrun-result-empty {
    font-size: 13px;
    color: #e03b3b;
    margin-top: 14px;
}

/* =============================================================
   ATTEMPTS COUNTER
   ============================================================= */
.attempts {
    font-size: 16px;
    margin-bottom: 14px;
    background-color: var(--surface-1);
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 700;
    color: var(--text-muted);
    border: 1px solid var(--border);
    letter-spacing: 0.5px;
}

/* =============================================================
   TOOLTIP (in game box)
   ============================================================= */
.box.tooltip-container {
    position: relative;
    cursor: help;
    overflow: visible !important;
}

.box.tooltip-container:hover { z-index: 100; }

/* =============================================================
   ANIMATIONS
   ============================================================= */
@keyframes popIn {
    0%   { transform: scale(0);   opacity: 0; }
    80%  { transform: scale(1.06); opacity: 1; }
    100% { transform: scale(1);   opacity: 1; }
}

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

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

.guess-row { animation: slideDown 0.35s ease-out; }

.guess-row .box {
    animation: popIn 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards;
    opacity: 0;
    transform: scale(0);
}

/* =============================================================
   TIMER & SPEEDRUN
   ============================================================= */
.timer-display     { color: #e05555; font-size: 22px; font-weight: 700; }
.go-score-display  { font-size: 18px; color: var(--purple); font-weight: 700; }

/* =============================================================
   FILTER ROW
   ============================================================= */
.filter-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    width: 95%;
    max-width: 1000px;
    margin: 0 auto 24px auto;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }

/* =============================================================
   TIER LIST
   ============================================================= */
#tierlist-screen {
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-bottom: 50px;
    width: 100%;
}

#tier-rows-container {
    width: 95%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 20px;
}

.tier-row {
    display: flex;
    width: 100%;
    min-height: 96px;
    background-color: var(--surface-1);
    border: 1px solid var(--border);
}

.tier-label {
    width: 110px;
    min-width: 110px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 26px;
    font-weight: 800;
    color: #1c1c1e;
    cursor: pointer;
    text-align: center;
    padding: 5px;
    word-break: break-word;
    border-right: 1px solid rgba(0,0,0,0.2);
}

.tier-content {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 5px;
    width: 100%;
    transition: background-color 0.15s ease;
}

.tier-content.drag-over {
    background-color: var(--purple-dim);
    box-shadow: inset 0 0 0 2px var(--purple);
}

.tier-pool-container {
    width: 95%;
    max-width: 1200px;
    margin: 24px auto;
    background-color: var(--surface-1);
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.tier-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 110px;
    padding: 8px;
}

.tier-img {
    width: 68px;
    height: 68px;
    object-fit: cover;
    cursor: grab;
    transition: transform 0.1s;
    border-radius: var(--radius-sm);
}

.tier-img:active { cursor: grabbing; z-index: 100; }

.tier-card {
    position: relative;
    width: 78px;
    height: 78px;
    margin: 2px;
    cursor: grab;
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: transform 0.1s;
    -webkit-user-select: none;
    user-select: none;
    background-color: #000;
}

.tier-card:active {
    cursor: grabbing;
    transform: scale(1.04);
    z-index: 100;
}

.tier-card img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tier-name-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.65);
    color: var(--white);
    font-size: 9px;
    text-align: center;
    padding: 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.tier-rename-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(0,0,0,0.3);
    font-size: 22px;
    font-weight: 800;
    text-align: center;
    color: #1c1c1e;
    outline: none;
    font-family: inherit;
    padding: 0;
    margin: 0;
}

#add-tier-btn {
    display: block;
    width: 100%;
    max-width: 1200px;
    margin: 8px auto;
    padding: 14px;
    background-color: var(--surface-1);
    color: var(--text-muted);
    border: 1px dashed var(--border-hi);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}

#add-tier-btn:hover {
    border-color: var(--border-hi);
    color: var(--white);
    background-color: var(--surface-2);
}

/* Tier list search */
.tier-search-bar {
    padding: 9px 16px;
    width: 240px;
    background-color: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--white);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: all var(--transition);
    margin-top: 4px;
    margin-bottom: 10px;
}

.tier-search-bar:focus {
    border-color: var(--purple);
    width: 290px;
}

/* Tier list scrollbar */
#tierlist-screen::-webkit-scrollbar       { width: 8px; }
#tierlist-screen::-webkit-scrollbar-track { background: var(--bg); }
#tierlist-screen::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 4px; }
#tierlist-screen::-webkit-scrollbar-thumb:hover { background: #6e6e75; }

/* =============================================================
   IMPORT MODAL
   ============================================================= */
.file-name-box {
    background-color: var(--bg);
    border: 1px solid var(--border);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-style: italic;
    font-size: 13px;
    min-height: 20px;
    word-break: break-all;
}

/* =============================================================
   CUSTOM DRAG SYSTEM
   ============================================================= */
body.is-dragging,
body.is-dragging * {
    cursor: none !important;
    -webkit-user-select: none;
    user-select: none;
}

body.hide-cursor,
body.hide-cursor * { cursor: none !important; }

#custom-drag-ghost {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: 1 !important;
    transform: scale(1.06);
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

/* =============================================================
   DAILY MISSIONS PANEL (dashboard)
   ============================================================= */
.daily-missions-panel {
    width: 100%;
    max-width: 480px;
    margin-top: 24px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.missions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.missions-all-done {
    font-size: 11px;
    color: #4a8a45;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

.missions-tabs {
    display: flex;
    gap: 4px;
}

.mission-tab-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 3px 10px;
    cursor: pointer;
    transition: all var(--transition);
}

.mission-tab-btn.active {
    background: var(--purple-dim);
    border-color: var(--purple);
    color: var(--white);
}

.mission-tab-btn:hover:not(.active) {
    border-color: var(--border-hi);
    color: var(--text);
}

.mission-progress {
    margin-left: 4px;
    font-size: 11px;
    color: var(--purple);
    font-weight: 600;
}

.missions-list {
    display: flex;
    flex-direction: column;
}

.mission-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.mission-row:last-child { border-bottom: none; }

.mission-row.mission-done {
    opacity: 0.55;
}

.mission-check {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border-hi);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #4a8a45;
    flex-shrink: 0;
    background: transparent;
}

.mission-done .mission-check {
    background: rgba(74, 138, 69, 0.2);
    border-color: #4a8a45;
}

.mission-label {
    flex: 1;
    font-size: 13px;
    color: var(--text);
}

.mission-xp {
    font-size: 12px;
    font-weight: 700;
    color: var(--purple);
    white-space: nowrap;
}

/* =============================================================
   HINT BUTTON & STRIP
   ============================================================= */
.hint-btn {
    font-size: 12px;
    padding: 5px 14px;
    min-height: 32px;
    border-color: var(--purple) !important;
    color: var(--purple) !important;
}

.hint-btn:hover:not(:disabled) {
    background: var(--purple-dim) !important;
}

.hint-panel-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 6px 0 8px;
    justify-content: center;
}

.hint-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--purple);
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 12px;
    color: var(--text);
    animation: hintPop 0.25s ease;
}

.hint-strip .hint-icon { font-size: 14px; }
.hint-strip .hint-attr { color: var(--text-muted); font-weight: 600; }
.hint-strip .hint-value { color: var(--white); font-weight: 700; }

@keyframes hintPop {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}

/* =============================================================
   MISSION COMPLETE TOAST
   ============================================================= */
#missionToast,
.mission-toast {
    background: var(--surface-2);
    border: 1px solid var(--purple);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text);
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
    opacity: 0;
    transform: translateY(12px);
    transition: transform 0.35s ease, opacity 0.35s ease;
    text-align: center;
    flex-wrap: wrap;
    justify-content: center;
    white-space: nowrap;
}

.mission-toast.mission-toast-show {
    transform: translateY(0);
    opacity: 1;
}

.mission-toast-label {
    color: var(--text-muted);
    font-size: 12px;
}

.mission-toast-xp {
    font-weight: 700;
    color: var(--purple);
}

/* =============================================================
   COLORBLIND MODE
   Uses a Paul-Tol-inspired palette: blue / orange / magenta / grey.
   Symbols add shape-coding so colour is not the only signal.
   ============================================================= */
body.colorblind-mode .box.green  { background-color: #0077bb; }
body.colorblind-mode .box.orange { background-color: #ee7733; }
body.colorblind-mode .box.yellow { background-color: #aa3377; }

body.colorblind-mode .box { position: relative; }

body.colorblind-mode .box.green::after,
body.colorblind-mode .box.orange::after,
body.colorblind-mode .box.yellow::after,
body.colorblind-mode .box.grey::after {
    position: absolute;
    top: 4px;
    right: 5px;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    pointer-events: none;
}

body.colorblind-mode .box.green::after  { content: '✓'; color: rgba(255,255,255,0.95); }
body.colorblind-mode .box.orange::after { content: '≈'; color: rgba(255,255,255,0.95); }
body.colorblind-mode .box.yellow::after { content: '~'; color: rgba(255,255,255,0.95); }
body.colorblind-mode .box.grey::after   { content: '✗'; color: rgba(255,255,255,0.55); }

/* =============================================================
   HIGH CONTRAST MODE
   ============================================================= */
body.high-contrast {
    --border:     #909098;
    --border-hi:  #c0c0cc;
    --text-muted: #d5d5de;
    --surface-1:  #1e1e22;
    --surface-2:  #2a2a30;
}
body.high-contrast .menu-btn,
body.high-contrast input { border-width: 2px; }
body.high-contrast .suggestions { border-width: 2px; border-color: var(--border); }
body.high-contrast .suggestions li { border-bottom: 2px solid var(--border); }
body.high-contrast .box { outline: 2px solid rgba(255,255,255,0.25); outline-offset: -2px; }
body.high-contrast .guess-row .box:first-child { outline: none; }

/* =============================================================
   FONT SIZE SCALE
   ============================================================= */
body.font-sm .menu-btn         { font-size: 13px; }
body.font-sm input             { font-size: 13px; }
body.font-sm .suggestions li   { font-size: 12px; }
body.font-sm .box              { font-size: 11px; }

body.font-lg .menu-btn         { font-size: 18px; }
body.font-lg input             { font-size: 17px; }
body.font-lg .suggestions li   { font-size: 16px; }
body.font-lg .box              { font-size: 15px; }

/* =============================================================
   REDUCED MOTION
   ============================================================= */
body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
}

/* OS-level reduced motion preference is also respected */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
    }
}

/* =============================================================
   TIMER STATE COLOURS (replaces JS style.color assignments)
   ============================================================= */
.timer-warn   { color: #ffa502 !important; }
.timer-danger { color: #ff4757 !important; }
