/**
 * Cluemarker - Main Stylesheet
 * Your Secret Word Game Companion
 *
 * Fonts:
 * - Special Elite: Headings (typewriter/spy dossier feel)
 * - Crimson Pro: Body text (case file / newspaper aesthetic)
 * - IBM Plex Mono: Codes (refined monospace)
 *
 * Design Philosophy: Film noir detective aesthetic with atmosphere and depth
 */

/* =============================================================================
   BRAND COLOR VARIABLES
   Refined noir palette - sophisticated, atmospheric, memorable
   ============================================================================= */
:root {
    /* Primary Brand Colors - Refined Noir */
    --brand-red: #b83235;           /* Deeper crimson - more sinister */
    --brand-navy: #0d1a24;          /* Darker midnight base */
    --brand-blue: #2d809b;          /* Steel blue - unchanged */
    --brand-white: #f5f5f5;         /* Slightly warm white */
    --brand-beige: #d4c5a9;         /* Aged parchment */
    --brand-gold: #c9a227;          /* Evidence highlight / brass */

    /* Derived Colors - atmospheric layers */
    --brand-navy-light: #152836;    /* Elevated surfaces */
    --brand-navy-lighter: #1e3548;  /* Cards and panels */
    --brand-red-dark: #8a2528;      /* Deep blood red */
    --brand-blue-dark: #1f5f75;     /* Deep steel */
    --brand-beige-dark: #b8a78e;    /* Worn paper */

    /* Semantic Colors - layered backgrounds */
    --bg-primary: var(--brand-navy);
    --bg-secondary: #081018;        /* Near black */
    --bg-tertiary: var(--brand-navy-light);
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --bg-elevated: rgba(30, 53, 72, 0.8);

    --text-primary: var(--brand-white);
    --text-secondary: var(--brand-beige);
    --text-muted: #7a8a94;

    --accent-primary: var(--brand-red);
    --accent-secondary: var(--brand-blue);
    --accent-gold: var(--brand-gold);

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(184, 50, 53, 0.4);

    /* Team Colors (can be overridden per game) */
    --team1-color: var(--brand-red);
    --team2-color: var(--brand-blue);
    --killer-color: #1a472a;        /* Darker, more sinister green */
    --neutral-color: var(--brand-beige);

    /* UI Element Colors */
    --btn-primary-bg: var(--brand-red);
    --btn-primary-text: var(--brand-white);
    --btn-secondary-bg: var(--brand-blue);
    --btn-secondary-text: var(--brand-white);

    --input-bg: rgba(255, 255, 255, 0.05);
    --input-border: rgba(255, 255, 255, 0.12);
    --input-focus-border: var(--brand-gold);

    --shadow-color: rgba(0, 0, 0, 0.4);
    --shadow-glow: rgba(184, 50, 53, 0.25);
    --shadow-gold: rgba(201, 162, 39, 0.3);

    /* Animation timing */
    --transition-fast: 0.15s ease;
    --transition-medium: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    width: 100%;
    overflow-x: hidden;
    background: var(--bg-primary);
}

body {
    font-family: 'Crimson Pro', 'Georgia', 'Times New Roman', serif;
    background: var(--brand-navy);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    padding: 16px;
    width: 100%;
    overflow-x: hidden;
    line-height: 1.6;
    font-size: 15px;
    letter-spacing: 0.01em;
}

/* Atmospheric vignette overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.4) 100%);
    pointer-events: none;
    z-index: 9998;
}

/* Subtle film grain texture - simplified for better performance */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.025;
    pointer-events: none;
    z-index: 9997;
    will-change: opacity;
}

/* Reduced motion - disable atmospheric effects */
@media (prefers-reduced-motion: reduce) {
    body::before,
    body::after {
        display: none;
    }
}

.container {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    overflow-x: hidden;
}

header {
    text-align: center;
    margin-bottom: 24px;
    width: 100%;
}

/* Logo Header */
.logo-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.logo-link:hover {
    opacity: 0.85;
}


.logo-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
}

.logo-icon {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 12px;
}

.logo-title {
    height: 48px;
    width: auto;
    object-fit: contain;
}

h1 {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 32px;
    font-weight: 400;
    margin-bottom: 8px;
    color: var(--brand-beige);
    letter-spacing: 1px;
}

.tagline {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 13px;
    color: #7a8a94;
    letter-spacing: 0.5px;
    margin: 4px 0 0 0;
    font-weight: 400;
    text-align: center;
    line-height: 1.4;
    width: 100%;
}

.header-divider {
    border: none;
    height: 1px;
    background: rgba(253, 253, 253, 0.06);
    margin: 24px 60px;
}

.status-bar {
    display: flex;
    justify-content: center;
    gap: 24px;
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-size: 13px;
    padding: 12px 16px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--border-subtle);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 4px 12px rgba(0, 0, 0, 0.2);
    position: relative;
}

/* Decorative line under status bar */
.status-bar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--team1-color) 20%,
        transparent 50%,
        var(--team2-color) 80%,
        transparent 100%);
    opacity: 0.4;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    box-shadow:
        0 0 8px currentColor,
        inset 0 2px 3px rgba(255, 255, 255, 0.3);
}

.dot.red { background: var(--team1-color, #e8363b); color: var(--team1-color, #e8363b); }
.dot.blue { background: var(--team2-color, #2d809b); color: var(--team2-color, #2d809b); }
.dot.green { background: var(--killer-color, #228b22); color: var(--killer-color, #228b22); }

.board-container {
    position: relative;
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
    /* Enable pinch zoom */
    touch-action: pan-x pan-y pinch-zoom;
}

/* Add styling only when board has an image - Evidence Board aesthetic */
.board-container.has-board {
    background: linear-gradient(145deg, rgba(20, 35, 50, 0.9) 0%, rgba(10, 20, 30, 0.95) 100%);
    border: 3px double var(--brand-beige);
    box-shadow:
        inset 0 0 40px rgba(0, 0, 0, 0.6),
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(212, 197, 169, 0.1);
}

/* Evidence Board label - removed */

/* Corner pins decorative elements - removed */

.board-container.zoomed {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.board-container.zoomed #board-image {
    transform-origin: center center;
    transition: transform 0.2s ease;
}

#board-image {
    width: 100%;
    display: block;
    border-radius: 12px;
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    z-index: 5;
}

/* Word overlay for digital boards - renders text client-side for accessibility */
.word-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    z-index: 10; /* Above grid-overlay so text is always visible */
    pointer-events: none; /* Don't capture clicks */
    /* Base font size is set dynamically via --base-font-size CSS variable */
    --base-font-size: 14px;
}

.word-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Padding matches the card inset (4px margin in board_generator) */
    padding: 2.2% 2.2%;
    text-align: center;
    font-weight: bold;
    color: #23211e;
    /* Strong text outline for visibility against colored overlays */
    text-shadow:
        -1px -1px 0 rgba(255,255,255,0.9),
        1px -1px 0 rgba(255,255,255,0.9),
        -1px 1px 0 rgba(255,255,255,0.9),
        1px 1px 0 rgba(255,255,255,0.9),
        0 0 4px rgba(255,255,255,0.8);
    overflow: hidden;
    word-break: break-word;
    line-height: 1.1;
    /* Font size scales with container and user preference */
    font-size: calc(var(--base-font-size, 14px) * var(--word-scale, 1));
}

/* Font style classes */
.word-overlay.font-styled .word-cell {
    font-family: 'Special Elite', 'Courier New', monospace;
}

.word-overlay.font-clean .word-cell {
    font-family: Arial, Helvetica, sans-serif;
}

/* Text rotation via CSS variable */
.word-overlay .word-cell {
    transform: rotate(calc(var(--word-rotation, 0) * 1deg));
}

/* Landscape mode rotation */
.board-container.landscape-mode .word-overlay {
    transform: rotate(-90deg);
    transform-origin: center center;
    /* Override default 100% sizing - position and size set by JavaScript */
    width: auto;
    height: auto;
}

.grid-cell {
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 3px;
    border-radius: 4px;
    position: relative;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.grid-cell:hover {
    background: rgba(255, 255, 255, 0.12);
    box-shadow:
        inset 0 0 20px rgba(255, 255, 255, 0.08),
        0 0 15px rgba(201, 162, 39, 0.15);
}

/* Accessibility: Keyboard focus for grid cells */
.grid-cell:focus {
    outline: none;
}

.grid-cell:focus-visible {
    outline: 3px solid var(--brand-gold);
    outline-offset: 2px;
    box-shadow: 0 0 0 6px var(--shadow-gold);
}

/* Card reveal animation */
.grid-cell.revealing {
    animation: cardReveal 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    z-index: 10;
    will-change: transform;
}

@keyframes cardReveal {
    0% {
        transform: rotateY(0) scale(1);
        filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
    }
    35% {
        transform: rotateY(90deg) scale(1.08);
        filter: drop-shadow(-15px 0 25px rgba(0, 0, 0, 0.4)) drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
    }
    50% {
        transform: rotateY(90deg) scale(1.08);
        filter: drop-shadow(0 15px 40px rgba(201, 162, 39, 0.25));
    }
    65% {
        transform: rotateY(90deg) scale(1.08);
        filter: drop-shadow(15px 0 25px rgba(0, 0, 0, 0.4)) drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
    }
    100% {
        transform: rotateY(0) scale(1);
        filter: none;
    }
}

/* Subtle indicator for marked cards - colors are in the image overlay */
.grid-cell.marked .mark-border {
    width: 100%;
    height: 100%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

/* Golden outline for cluemaster view */
.cluemaster-view .grid-cell.marked .mark-border {
    border: 3px solid var(--brand-gold);
    background: transparent;
    box-shadow:
        0 0 12px rgba(201, 162, 39, 0.5),
        inset 0 0 10px rgba(201, 162, 39, 0.15);
}

.grid-cell:active {
    transform: scale(0.92);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .grid-cell.revealing {
        animation: none;
    }
}

/* Consider badge - shows vote count from teammates */
.consider-badge {
    display: none;
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--bg-primary);
    font-size: 13px;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 5;
    pointer-events: none;
}

.consider-badge.my-consider {
    background: var(--brand-beige);
    color: var(--bg-primary);
    box-shadow: 0 0 8px rgba(254, 202, 87, 0.6);
}

/* Considering mode - show visual indicator on cells */
.grid-overlay.considering-mode .grid-cell:not(.revealed) {
    animation: considerPulse 2s ease-in-out infinite;
}

.grid-overlay.considering-mode .grid-cell:not(.revealed)::after {
    content: '';
    position: absolute;
    inset: 2px;
    border: 2px dashed rgba(254, 202, 87, 0.5);
    border-radius: 4px;
    pointer-events: none;
}

@keyframes considerPulse {
    0%, 100% { box-shadow: inset 0 0 0 rgba(254, 202, 87, 0); }
    50% { box-shadow: inset 0 0 12px rgba(254, 202, 87, 0.3); }
}

.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #a0a0a0;
    padding: 24px;
    text-align: center;
}

.placeholder > svg {
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
    opacity: 0.5;
    color: #7a8a94;
}

.placeholder .btn svg {
    width: 40px;
    height: 40px;
    margin: 0;
    opacity: 1;
    color: inherit;
}

#btn-camera-main {
    min-width: 160px;
}

.placeholder p {
    font-size: 16px;
    line-height: 1.6;
    max-width: 260px;
    color: var(--text-muted);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    width: 100%;
}

.btn {
    flex: 1;
    min-width: 120px;
    padding: 16px 24px;
    border: none;
    border-radius: 8px;
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(2px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none !important;
}

/* Accessibility: Keyboard focus styles - golden highlight */
.btn:focus {
    outline: none;
}

.btn:focus-visible {
    outline: 3px solid var(--brand-gold);
    outline-offset: 2px;
    box-shadow: 0 0 0 6px var(--shadow-gold);
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-red) 0%, var(--brand-red-dark) 100%);
    color: white;
    border: none;
    box-shadow:
        0 4px 0 var(--brand-red-dark),
        0 6px 20px rgba(184, 50, 53, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #c73a3d 0%, var(--brand-red) 100%);
    box-shadow:
        0 4px 0 var(--brand-red-dark),
        0 8px 25px rgba(184, 50, 53, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:active {
    box-shadow:
        0 1px 0 var(--brand-red-dark),
        0 2px 10px rgba(184, 50, 53, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-secondary {
    background: linear-gradient(135deg, rgba(45, 128, 155, 0.25) 0%, rgba(31, 95, 117, 0.35) 100%);
    color: var(--text-primary);
    border: 1px solid rgba(45, 128, 155, 0.4);
    box-shadow:
        0 3px 0 rgba(31, 95, 117, 0.5),
        0 4px 12px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, rgba(45, 128, 155, 0.35) 0%, rgba(31, 95, 117, 0.45) 100%);
    border-color: rgba(45, 128, 155, 0.6);
    transform: translateY(-2px);
    box-shadow:
        0 5px 0 rgba(31, 95, 117, 0.5),
        0 8px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-secondary:active {
    transform: translateY(1px);
    box-shadow:
        0 1px 0 rgba(31, 95, 117, 0.5),
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Subtle close/dismiss button - noir aesthetic */
.btn-close-modal {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 10px 20px;
    box-shadow: none;
    transition: all var(--transition-fast);
}

.btn-close-modal:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.25);
    transform: none;
    box-shadow: none;
}

.btn-close-modal:active {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%);
    color: var(--brand-white);
    border: none;
    box-shadow:
        0 4px 0 var(--brand-blue-dark),
        0 6px 20px rgba(45, 128, 155, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-success:hover {
    background: linear-gradient(135deg, #3a9ab8 0%, var(--brand-blue) 100%);
    box-shadow:
        0 4px 0 var(--brand-blue-dark),
        0 8px 25px rgba(45, 128, 155, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-success:active {
    box-shadow:
        0 1px 0 var(--brand-blue-dark),
        0 2px 10px rgba(45, 128, 155, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-purple {
    background: linear-gradient(135deg, #9b59b6 0%, #7d3c98 100%);
    color: white;
    border: none;
    box-shadow:
        0 4px 0 #6c2d82,
        0 6px 20px rgba(155, 89, 182, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-purple:hover {
    background: linear-gradient(135deg, #a569bd 0%, #9b59b6 100%);
    box-shadow:
        0 4px 0 #6c2d82,
        0 8px 25px rgba(155, 89, 182, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-share {
    background: linear-gradient(135deg, var(--brand-red) 0%, var(--brand-red-dark) 100%);
    color: white;
    border: none;
    box-shadow:
        0 4px 0 var(--brand-red-dark),
        0 6px 20px rgba(184, 50, 53, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-share:hover {
    background: linear-gradient(135deg, #c73a3d 0%, var(--brand-red) 100%);
    box-shadow:
        0 4px 0 var(--brand-red-dark),
        0 8px 25px rgba(184, 50, 53, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.cluemaster-waiting {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.5);
    border-radius: 8px;
    padding: 8px 12px;
}

.waiting-text {
    color: #ffc107;
    font-size: 13px;
    animation: pulse 1.5s ease-in-out infinite;
}

.btn-cancel {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
}

.btn-cancel:hover {
    background: rgba(231, 76, 60, 0.3);
    border-color: #e74c3c;
}

.btn-small {
    padding: 12px 16px;
    font-size: 13px;
    border-radius: 6px;
}

/* Considering mode toggle button */
button.considering-toggle {
    background: rgba(100, 100, 100, 0.15) !important;
    border: 1px solid rgba(150, 150, 150, 0.4) !important;
    color: #aaa !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

button.considering-toggle:hover {
    background: rgba(150, 150, 150, 0.25) !important;
    border-color: rgba(150, 150, 150, 0.6) !important;
    color: #ccc !important;
}

button.considering-toggle.active {
    background: rgba(255, 193, 7, 0.35) !important;
    border-color: #ffc107 !important;
    color: #ffc107 !important;
    box-shadow: 0 0 8px rgba(255, 193, 7, 0.4);
}

.secondary-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* Modal styles - Case File aesthetic */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(135deg, rgba(8, 16, 24, 0.98) 0%, rgba(13, 26, 36, 0.98) 100%);
    backdrop-filter: blur(12px);
    z-index: 1000;
    flex-direction: column;
}

.modal.active {
    display: flex;
    animation: modalFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Manila folder tab header */
.modal-header {
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, var(--brand-beige) 0%, var(--brand-beige-dark) 100%);
    border-bottom: none;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    clip-path: polygon(0 0, 85% 0, 100% 100%, 0 100%);
    margin-right: 40px;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.modal-header span {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-weight: 400;
    font-size: 14px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--bg-primary);
}

.modal-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    min-height: 0;
    /* Subtle paper texture effect */
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, transparent 20%),
        linear-gradient(to right, rgba(0, 0, 0, 0.05) 0%, transparent 5%, transparent 95%, rgba(0, 0, 0, 0.05) 100%);
}

/* Compact modal variant - for dialogs like timer settings */
.modal.modal-compact {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
}

.modal.modal-compact .modal-dialog {
    background: var(--brand-navy-light);
    border-radius: 12px;
    width: 90vw;
    max-width: 400px;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.modal.modal-compact .modal-header {
    clip-path: none;
    margin-right: 0;
    padding: 12px 16px;
    background: var(--brand-navy-lighter);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal.modal-compact .modal-header span {
    font-size: 12px;
    letter-spacing: 1.5px;
}

.modal.modal-compact .modal-body {
    padding: 16px;
    background: none;
    flex: none;
}

.modal.modal-compact .close-btn {
    width: 28px;
    height: 28px;
    font-size: 18px;
}

/* Timer modal specific styles */
#timer-modal .modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#timer-modal .timer-label {
    margin: 0;
    color: var(--text-secondary);
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 14px;
    font-weight: 600;
}

#timer-modal .timer-input {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    text-align: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 20px;
    font-weight: 500;
    -moz-appearance: textfield;
}

#timer-modal .timer-input::-webkit-outer-spin-button,
#timer-modal .timer-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#timer-modal .timer-input:focus {
    outline: none;
    border-color: var(--brand-gold);
}

#timer-modal .timer-btn-full {
    width: 100%;
    padding: 14px;
    font-size: 14px;
    border-radius: 8px;
}

#timer-modal .btn-ghost {
    background: transparent;
    border: 1px solid var(--border-medium);
    color: var(--text-muted);
}

#timer-modal .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

#timer-modal .timer-divider {
    height: 1px;
    background: var(--border-medium);
    margin: 4px 0;
}

#timer-modal .timer-current {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

#timer-modal .timer-current strong {
    color: var(--brand-gold);
    font-family: 'IBM Plex Mono', monospace;
}

#camera-video {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.1);
}

.modal-footer {
    padding: 16px;
    display: flex;
    justify-content: center;
    gap: 12px;
    background: rgba(253, 253, 253, 0.02);
    border-top: 1px solid rgba(253, 253, 253, 0.06);
}

.capture-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--brand-red);
    cursor: pointer;
    transition: transform 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
}

.capture-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--brand-red);
    transition: transform 0.15s ease;
}

.capture-btn:hover {
    transform: scale(1.05);
}

.capture-btn:active {
    transform: scale(0.95);
}

.capture-btn:active::after {
    transform: translate(-50%, -50%) scale(0.9);
}

.close-btn {
    position: absolute;
    right: -32px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--brand-red);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: all var(--transition-fast);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 3px 0 var(--brand-red-dark),
        0 4px 12px rgba(0, 0, 0, 0.3);
}

.close-btn:hover {
    background: #c73a3d;
    transform: translateY(-50%) scale(1.1);
}

.close-btn:active {
    transform: translateY(calc(-50% + 2px));
    box-shadow:
        0 1px 0 var(--brand-red-dark),
        0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Corner Adjustment */
.corner-adjust-container {
    position: relative;
    max-width: 100%;
    max-height: 60vh;
    touch-action: none;
}

#corner-image {
    max-width: 100%;
    max-height: 60vh;
    display: block;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.1);
}

.corner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.corner-overlay svg {
    width: 100%;
    height: 100%;
}

.corner-marker {
    position: absolute;
    width: 48px;
    height: 48px;
    border: 3px solid var(--brand-red);
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.4) 0%, rgba(255, 107, 107, 0.4) 100%);
    transform: translate(-50%, -50%);
    cursor: grab;
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
    transition: transform 0.1s, box-shadow 0.1s;
}

.corner-marker:active {
    cursor: grabbing;
}

.corner-marker.dragging {
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.8) 0%, rgba(255, 107, 107, 0.8) 100%);
    transform: translate(-50%, -50%) scale(1.15);
    z-index: 10;
    box-shadow: 0 6px 25px rgba(233, 69, 96, 0.6);
}

.corner-instructions {
    text-align: center;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-muted);
    background: linear-gradient(135deg, rgba(22, 33, 62, 0.5) 0%, rgba(26, 26, 46, 0.5) 100%);
    letter-spacing: 0.3px;
}

/* Magnifying loupe */
.loupe {
    display: none;
    position: fixed;
    width: 110px;
    height: 110px;
    border: 3px solid var(--brand-red);
    border-radius: 50%;
    overflow: hidden;
    pointer-events: none;
    z-index: 2000;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 20px rgba(233, 69, 96, 0.3);
}

.loupe.active {
    display: block;
    animation: loupeAppear 0.2s ease;
}

@keyframes loupeAppear {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.loupe-canvas {
    width: 100%;
    height: 100%;
}

.loupe-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    pointer-events: none;
}

.loupe-crosshair::before,
.loupe-crosshair::after {
    content: '';
    position: absolute;
    background: linear-gradient(135deg, var(--brand-red) 0%, var(--brand-red) 100%);
    box-shadow: 0 0 4px rgba(233, 69, 96, 0.5);
}

.loupe-crosshair::before {
    width: 2px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
}

.loupe-crosshair::after {
    width: 100%;
    height: 2px;
    top: 50%;
    transform: translateY(-50%);
}

/* Grid Preview Modal */
.grid-preview-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 12px;
}

/* Photo orientation preview modal container - uses ID for specificity */
/* The shared .modal-body is a row-flex built to centre a single child; the grid
   preview stacks several (subtitle, board, size + rotation controls), so force a
   column here — otherwise the board collapses to ~0 width and the preview is blank. */
#grid-preview-modal .modal-body {
    flex-direction: column;
    align-items: stretch;
}

#grid-preview-container {
    position: relative;
    width: 100%;
    min-height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}

#grid-preview-image {
    width: 100%;
    height: auto;
    max-height: 45vh;
    object-fit: contain;
    display: block;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.grid-lines-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transition: transform 0.3s ease;
}

.grid-lines-overlay line {
    stroke: rgba(255, 230, 0, 0.9);
    stroke-width: 2;
    stroke-dasharray: 8, 4;
}

.grid-size-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.grid-size-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.grid-size-controls input[type="number"] {
    width: 60px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 16px;
    text-align: center;
}

.grid-size-controls .grid-size-x {
    color: var(--text-muted);
    font-size: 16px;
}

.rotation-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 12px 0;
}

.rotation-controls .btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 14px;
}

.rotation-controls .btn svg {
    flex-shrink: 0;
}

/* Share info panel (on page) */
.share-info-panel {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(233, 69, 96, 0.3);
}

.share-info-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.share-info-header span:first-child {
    color: var(--text-muted);
    font-size: 14px;
}

.share-info-header .game-code {
    font-size: 24px;
    font-weight: 700;
    color: var(--brand-beige);
    font-family: 'Courier New', monospace;
    letter-spacing: 3px;
}

.share-info-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.share-info-buttons .btn {
    flex: none;
    min-width: auto;
    padding: 8px 16px;
    font-size: 13px;
}

.share-codes-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.share-code-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(0,0,0,0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.share-code-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.share-code-chip:active {
    transform: scale(0.95);
}

.share-code-chip.cluemaster {
    border: 2px solid rgba(233, 69, 96, 0.5);
}

.share-code-chip.cluemaster:hover {
    background: rgba(233, 69, 96, 0.2);
}

.share-code-chip.blue {
    border: 2px solid var(--team2-color, #2d809b);
    border-color: color-mix(in srgb, var(--team2-color, #2d809b) 50%, transparent);
}

.share-code-chip.blue:hover {
    background: color-mix(in srgb, var(--team2-color, #2d809b) 20%, transparent);
}

.share-code-chip.red {
    border: 2px solid var(--team1-color, #e8363b);
    border-color: color-mix(in srgb, var(--team1-color, #e8363b) 50%, transparent);
}

.share-code-chip.red:hover {
    background: color-mix(in srgb, var(--team1-color, #e8363b) 20%, transparent);
}

.chip-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chip-code {
    font-size: 18px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    color: var(--brand-beige);
}

/* URL selection modal checkboxes */
.url-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.url-option:hover {
    background: rgba(0,0,0,0.5);
}

.url-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.url-option-label {
    flex: 1;
}

.url-option-name {
    font-weight: 600;
    font-size: 14px;
}

.url-option-url {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

/* Share modal */
.share-content {
    text-align: center;
    padding: 16px;
    max-width: 400px;
    width: calc(100vw - 32px);
    overflow-x: hidden;
}

.share-content > p {
    font-size: 15px;
    color: #aaa;
    margin-bottom: 16px;
}

.share-section {
    background: linear-gradient(135deg, rgba(22, 33, 62, 0.6) 0%, rgba(26, 26, 46, 0.6) 100%);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(255,255,255,0.05);
}

.share-section-label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.share-url {
    background: rgba(0,0,0,0.4);
    padding: 12px 16px;
    border-radius: 8px;
    margin: 8px 0;
    word-break: break-all;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--brand-red);
    border: 1px solid rgba(233, 69, 96, 0.2);
    text-align: left;
}

.share-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Share Codes Modal */
.share-codes-modal-content {
    padding: 16px;
    max-width: 360px;
    width: calc(100vw - 32px);
}

.share-codes-modal-content h3 {
    text-align: center;
    font-size: 18px;
    margin-bottom: 16px;
    color: #fff;
}

.share-code-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 12px;
    background: rgba(0,0,0,0.3);
}

.share-code-row.blue {
    border-left: 4px solid var(--team2-color, #2d809b);
}

.share-code-row.red {
    border-left: 4px solid var(--team1-color, #e8363b);
}

.share-code-row.cluemaster {
    border-left: 4px solid var(--brand-red);
}

.share-code-label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.share-code-value {
    font-size: 26px;
    font-weight: 600;
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    letter-spacing: 5px;
    color: var(--brand-gold);
    text-shadow: 0 0 15px rgba(201, 162, 39, 0.3);
}

.share-intro {
    margin: 0 0 16px 0;
    color: #aaa;
    text-align: center;
    font-size: 13px;
}

.share-code-value.share-code-hidden {
    font-size: 12px;
    color: #999;
    cursor: pointer;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    text-align: center;
    display: inline-block;
    letter-spacing: 1px;
    font-family: 'Crimson Pro', Georgia, serif;
    font-weight: 500;
    transition: all 0.2s ease;
}

.share-code-value.share-code-hidden:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ccc;
}

.share-code-value.share-code-hidden .code-hidden-text {
    font-style: italic;
}

/* Witness code is always clickable (toggleable) */
#modal-code-admin {
    cursor: pointer;
    transition: opacity 0.15s ease;
}

#modal-code-admin:hover {
    opacity: 0.8;
}

.share-code-copy {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}

.share-code-copy:hover {
    background: linear-gradient(135deg, #1a2a4e 0%, #2a2a4e 100%);
    transform: translateY(-1px);
}

.share-code-copy:active {
    transform: scale(0.95);
}

.share-code-buttons {
    display: flex;
    gap: 8px;
}

/* Per-team witness codes */
.share-code-row.witness-code {
    background: rgba(0,0,0,0.4);
}

.share-code-row.your-code {
    background: rgba(255,215,0,0.1);
    border-left-width: 4px;
    position: relative;
}

.share-code-row.your-code::after {
    content: 'YOU';
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 9px;
    font-weight: 700;
    color: #ffd700;
    background: rgba(255,215,0,0.2);
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 1px;
}

.share-codes-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    margin: 16px 0;
}

/* Team Selection Buttons in Game Setup */
.team-select-buttons {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.team-select-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    background: rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.team-select-btn:hover {
    background: rgba(0,0,0,0.4);
    border-color: rgba(255,255,255,0.2);
}

.team-select-btn.selected {
    background: rgba(255,215,0,0.1);
    border-color: #ffd700;
    color: #fff;
}

.team-select-btn.selected[data-team="red"] {
    background: rgba(var(--team1-rgb, 232,54,59),0.15);
    border-color: var(--team1-color, #e8363b);
}

.team-select-btn.selected[data-team="blue"] {
    background: rgba(var(--team2-rgb, 52,152,219),0.15);
    border-color: var(--team2-color, #3498db);
}

.team-select-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.team-select-name {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* QR Code Modal */
.qr-modal-content {
    padding: 16px;
    text-align: center;
}

.qr-modal-content p {
    color: #aaa;
    margin-bottom: 16px;
}

.qr-code-container {
    background: #fff;
    padding: 16px;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 12px;
}

.qr-code-container img {
    display: block;
    width: 200px;
    height: 200px;
}

.qr-url {
    font-size: 11px;
    color: #a0a0a0;
    word-break: break-all;
    padding: 8px;
    background: rgba(0,0,0,0.2);
    border-radius: 6px;
}

/* Hidden elements */
#file-input, #canvas-capture, #download-canvas {
    display: none;
}

/* Loading overlay - Investigation in progress */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at center, rgba(13, 26, 36, 0.98) 0%, rgba(8, 16, 24, 0.99) 100%);
    backdrop-filter: blur(12px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    z-index: 2000;
}

.loading.active {
    display: flex;
    animation: loadingFadeIn 0.4s ease;
}

@keyframes loadingFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(201, 162, 39, 0.15);
    border-top-color: var(--brand-gold);
    border-right-color: var(--brand-gold);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    box-shadow:
        0 0 30px rgba(201, 162, 39, 0.2),
        inset 0 0 15px rgba(201, 162, 39, 0.1);
}

.loading-text {
    font-family: 'Special Elite', 'Courier New', monospace;
    color: var(--brand-beige);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 3px;
    text-transform: uppercase;
}

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

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation: none;
        border-color: var(--brand-gold);
    }
}

/* Board Text Controls (for digital boards) */
.board-text-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

.text-control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.text-control-group label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.text-control-group input[type="range"] {
    width: 100px;
    cursor: pointer;
}

.text-ctrl-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.text-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.text-ctrl-btn.rotate-btn {
    font-size: 20px;
    padding: 8px 12px;
}

.text-ctrl-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: center;
    flex-shrink: 0;
}

/* Legend */
.legend {
    display: flex;
    justify-content: center;
    gap: 4px 8px;
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    flex-wrap: wrap;
    max-width: 100%;
}

.legend-item {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-size: 10px;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 4px;
    color: #fff;
}

/* Colored pill backgrounds */
.legend-item.red {
    background: var(--team1-color, #e8363b);
}
.legend-item.blue {
    background: var(--team2-color, #2d809b);
}
.legend-item.neutral {
    background: var(--neutral-color, #d4c5a9);
    color: #222;
}
.legend-item.killer {
    background: var(--killer-color, #228b22);
}

/* Toast - Refined notification */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background:
        linear-gradient(145deg, rgba(21, 40, 54, 0.98) 0%, rgba(13, 26, 36, 0.98) 100%);
    color: var(--brand-beige);
    padding: 16px 32px;
    border-radius: 8px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10000;
    border: 1px solid var(--border-accent);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(184, 50, 53, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.3px;
    backdrop-filter: blur(8px);
    will-change: transform, opacity;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    animation: toastEntrance 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Victory toast - newspaper headline style */
.toast.victory-toast {
    background:
        linear-gradient(180deg, #f5f0e6 0%, #e8e0d0 100%);
    color: #1a1a1a;
    border: none;
    border-top: 4px double #1a1a1a;
    border-bottom: 4px double #1a1a1a;
    padding: 24px 40px;
    min-width: 300px;
    text-align: center;
    box-shadow:
        0 15px 50px rgba(0, 0, 0, 0.5),
        inset 0 0 30px rgba(0, 0, 0, 0.05);
}

.toast.victory-toast strong {
    display: block;
    font-family: 'Special Elite', 'Times New Roman', serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    line-height: 1.2;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.toast.victory-toast span {
    display: block;
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 14px;
    font-style: italic;
    letter-spacing: 0.5px;
}

/* Newspaper masthead decoration */
.toast.victory-toast::before {
    content: '★ EXTRA ★ EXTRA ★';
    display: block;
    font-family: 'Special Elite', monospace;
    font-size: 9px;
    letter-spacing: 4px;
    color: #666;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ccc;
}

.toast.victory-toast::after {
    content: '— THE DAILY DETECTIVE —';
    display: block;
    font-family: 'Special Elite', monospace;
    font-size: 8px;
    letter-spacing: 2px;
    color: #888;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #ccc;
}

@keyframes toastEntrance {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

/* Turn Indicator styles */
.turn-indicator {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    text-align: center;
    border: 2px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.turn-indicator .turn-team {
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.timer-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
    padding: 12px 24px;
    /* Vintage clock face */
    background:
        radial-gradient(ellipse at 30% 30%, rgba(212, 197, 169, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at center, rgba(20, 15, 10, 0.95) 0%, rgba(10, 8, 5, 0.98) 100%);
    border-radius: 50px;
    border: 3px solid;
    border-color: #8b7355 #6b5344 #5a4435 #7a6345;
    box-shadow:
        inset 0 0 30px rgba(0, 0, 0, 0.7),
        inset 0 2px 0 rgba(255, 255, 255, 0.05),
        0 4px 15px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(139, 115, 85, 0.3);
    position: relative;
}

/* Vintage clock bezel highlight */
.timer-display::before {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 47px;
    border: 1px solid rgba(201, 162, 39, 0.2);
    pointer-events: none;
}

.timer-time {
    font-size: 32px;
    font-weight: 600;
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    color: var(--brand-beige);
    min-width: 80px;
    text-align: center;
    /* Warm glow like old display */
    text-shadow:
        0 0 8px rgba(212, 197, 169, 0.4),
        0 0 20px rgba(201, 162, 39, 0.2);
    letter-spacing: 2px;
}
.timer-time.warning {
    color: var(--brand-gold);
    text-shadow: 0 0 15px rgba(201, 162, 39, 0.5);
    animation: timerPulse 1s infinite;
}
.timer-time.critical {
    color: var(--brand-red);
    text-shadow: 0 0 20px rgba(184, 50, 53, 0.6);
    animation: timerPulse 0.5s infinite;
}
@keyframes timerPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.02); }
}

/* Reduced motion for timer */
@media (prefers-reduced-motion: reduce) {
    .timer-time.warning,
    .timer-time.critical {
        animation: none;
    }
}
.timer-ctrl-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--brand-beige);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.timer-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--brand-gold);
    transform: scale(1.1);
}
.timer-ctrl-btn:active {
    transform: scale(0.95);
}
.timer-ctrl-btn.paused {
    background: rgba(184, 50, 53, 0.25);
    border-color: var(--brand-red);
    color: var(--brand-red);
}
.timer-ctrl-btn.start {
    background: rgba(46, 204, 113, 0.2);
    border-color: #2ecc71;
    color: #2ecc71;
}
.timer-ctrl-btn.start:hover {
    background: rgba(46, 204, 113, 0.35);
    box-shadow: 0 0 12px rgba(46, 204, 113, 0.3);
}

.timer-row {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.timer-toggle-collapsed {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    color: rgba(255,255,255,0.7);
    transition: all 0.2s;
}
.timer-toggle-collapsed:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* Mini timer that appears next to End Turn when collapsed */
.mini-timer {
    display: none;
    align-items: center;
    gap: 4px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 16px;
    padding: 4px 8px;
    font-size: 13px;
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    margin-left: 8px;
}
.mini-timer:hover {
    background: rgba(0,0,0,0.6);
}
.mini-timer .mini-timer-icon {
    font-size: 12px;
}
.mini-timer .mini-timer-time {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-weight: 600;
}
.mini-timer .mini-timer-time.warning {
    color: var(--brand-beige);
}
.mini-timer .mini-timer-time.critical {
    color: var(--brand-red);
    animation: pulse 0.5s ease-in-out infinite;
}
.mini-timer.paused {
    background: rgba(100,100,100,0.4);
    border-style: dashed;
}
.mini-timer.paused .mini-timer-time {
    color: rgba(255,255,255,0.5);
}

/* Floating timer for collapse/expand animation */
.timer-float {
    position: fixed;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 16px;
    padding: 4px 8px;
    font-size: 13px;
    color: rgba(255,255,255,0.9);
    z-index: 1000;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
}
.timer-float.animating {
    opacity: 1;
}
.timer-float .timer-float-icon {
    font-size: 12px;
}
.timer-float .timer-float-time {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-weight: 600;
}

.turn-indicator .turn-clue {
    font-size: 18px;
    color: #fff;
    margin: 12px 0;
    padding: 8px 16px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    display: inline-block;
}

.turn-indicator .turn-clue strong {
    color: var(--brand-beige);
    font-size: 22px;
    letter-spacing: 1px;
}

.turn-indicator .guess-count {
    display: inline-block;
    margin-left: 12px;
    font-size: 14px;
    color: var(--text-muted);
}

.turn-indicator .btn {
    margin-top: 12px;
    display: inline-flex;
    flex: none;
    min-width: auto;
}

/* Turn Header - Above the board (turn indicator + legend) */
.turn-header {
    background:
        linear-gradient(145deg, rgba(21, 40, 54, 0.95) 0%, rgba(13, 26, 36, 0.98) 100%);
    border-radius: 12px;
    padding: 16px 24px;
    margin-bottom: 16px;
    border: 1px solid var(--border-subtle);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.turn-header.turn-changing {
    animation: spotlightSweep 1.2s ease-out;
    will-change: background, box-shadow;
}

.turn-header .turn-row {
    margin-bottom: 8px;
}

/* Combined Turn & Clue Panel - Case briefing aesthetic */
.turn-clue-panel {
    background:
        linear-gradient(145deg, rgba(21, 40, 54, 0.95) 0%, rgba(13, 26, 36, 0.98) 100%);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border-subtle);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

/* Spotlight sweep animation on turn change */
.turn-clue-panel.turn-changing {
    animation: spotlightSweep 1.2s ease-out;
    will-change: background, box-shadow;
}

@keyframes spotlightSweep {
    0% {
        background:
            radial-gradient(circle at -50% 50%, rgba(255, 255, 255, 0.12), transparent 60%),
            linear-gradient(145deg, rgba(21, 40, 54, 0.95) 0%, rgba(13, 26, 36, 0.98) 100%);
        box-shadow:
            0 8px 32px rgba(0, 0, 0, 0.35),
            inset 0 1px 0 rgba(255, 255, 255, 0.05),
            inset -20px 0 40px rgba(255, 255, 255, 0.03);
    }
    50% {
        box-shadow:
            0 8px 32px rgba(0, 0, 0, 0.35),
            inset 0 1px 0 rgba(255, 255, 255, 0.05),
            inset 0 0 60px rgba(201, 162, 39, 0.08);
    }
    100% {
        background:
            radial-gradient(circle at 150% 50%, rgba(255, 255, 255, 0.12), transparent 60%),
            linear-gradient(145deg, rgba(21, 40, 54, 0.95) 0%, rgba(13, 26, 36, 0.98) 100%);
        box-shadow:
            0 8px 32px rgba(0, 0, 0, 0.35),
            inset 0 1px 0 rgba(255, 255, 255, 0.05),
            inset 20px 0 40px rgba(255, 255, 255, 0.03);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .turn-clue-panel.turn-changing {
        animation: none;
    }
}

.turn-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    text-align: center;
}

.turn-clue-panel .turn-team,
.turn-header .turn-team {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 14px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 3px;
    padding: 12px 24px;
    border-radius: 2px;
    display: inline-block;
    text-align: center;
    line-height: 1.3;
    margin: 0 auto;
    position: relative;
    /* Case file stamp effect */
    border: 3px double currentColor;
    box-shadow:
        inset 0 0 0 1px currentColor,
        0 3px 10px rgba(0, 0, 0, 0.3);
    /* Aged stamp look */
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.03) 2px,
            rgba(0, 0, 0, 0.03) 4px
        );
}

/* Stamp label above - removed */
.turn-clue-panel .turn-team::before,
.turn-header .turn-team::before {
    content: none;
}

.clue-display-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
}

.clue-info-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.clue-info-inline .clue-word {
    font-size: 22px;
    font-weight: 700;
    color: var(--brand-beige);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0;
    background: none;
    -webkit-text-fill-color: var(--brand-beige);
}

.clue-number-badge {
    background: rgba(254, 202, 87, 0.2);
    color: var(--brand-beige);
    padding: 2px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 18px;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
}

/* Evidence mode: style directly on the badge element */
.clue-number-badge.evidence-mode {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    gap: 4px;
}

.clue-number-badge.evidence-mode.weak {
    background: rgba(45, 128, 155, 0.15);
    border: 1px solid rgba(45, 128, 155, 0.3);
    color: #2d809b;
}

.clue-number-badge.evidence-mode.solid {
    background: rgba(232, 214, 203, 0.25);
    border: 1px solid rgba(232, 214, 203, 0.5);
    color: #E8D6CB;
}

.clue-number-badge.evidence-mode.hard {
    background: rgba(232, 54, 59, 0.15);
    border: 1px solid rgba(232, 54, 59, 0.3);
    color: #e8363b;
}

.guess-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Legacy clue panel styles for backwards compat */
.clue-panel {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    display: none;
    border: 1px solid rgba(255,255,255,0.05);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    text-align: center;
}

.clue-panel.active {
    display: block;
}

.clue-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.clue-input-row input {
    flex: 1 1 120px;
    min-width: 0;
    padding: 12px 16px;
    border: 2px solid var(--brand-beige-dark);
    border-radius: 4px;
    background:
        linear-gradient(135deg, rgba(212, 197, 169, 0.12) 0%, rgba(184, 167, 142, 0.08) 100%);
    color: var(--brand-beige);
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 16px;
    letter-spacing: 1px;
    transition: all var(--transition-fast);
    box-sizing: border-box;
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.05);
}

.clue-input-row input::placeholder {
    color: rgba(212, 197, 169, 0.4);
    font-style: italic;
}

.clue-input-row input:focus {
    outline: none;
    border-color: var(--brand-gold);
    background:
        linear-gradient(135deg, rgba(212, 197, 169, 0.18) 0%, rgba(184, 167, 142, 0.12) 100%);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.25),
        0 0 20px rgba(201, 162, 39, 0.2),
        0 0 0 1px rgba(201, 162, 39, 0.3);
}

.clue-input-row input[type="number"] {
    flex: 0 0 70px;
    max-width: 70px;
    text-align: center;
    font-weight: bold;
}

.clue-input-row .btn {
    flex: 0 0 auto;
}

/* Evidence Strength Section */
.evidence-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.evidence-prompt {
    font-size: 10px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.evidence-strength-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.evidence-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #aaa;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 60px;
}

.evidence-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.evidence-btn.selected {
    color: #fff;
}

.evidence-btn[data-strength="weak"].selected {
    background: #2d809b;
    border-color: #2d809b;
    box-shadow: 0 0 15px rgba(45, 128, 155, 0.4);
}

.evidence-btn[data-strength="solid"].selected {
    background: #E8D6CB;
    border-color: #E8D6CB;
    color: #102634;
    box-shadow: 0 0 15px rgba(232, 214, 203, 0.4);
}

.evidence-btn[data-strength="hard"].selected {
    background: #e8363b;
    border-color: #e8363b;
    box-shadow: 0 0 15px rgba(232, 54, 59, 0.4);
}

.evidence-icon {
    font-size: 18px;
    line-height: 1;
}

.evidence-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Evidence display in clue display section */
.evidence-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    color: #ffd700;
    font-size: 13px;
    font-weight: 600;
}

.evidence-badge.weak {
    background: rgba(45, 128, 155, 0.15);
    border-color: rgba(45, 128, 155, 0.3);
    color: #2d809b;
}

.evidence-badge.solid {
    background: rgba(232, 214, 203, 0.25);
    border-color: rgba(232, 214, 203, 0.5);
    color: #E8D6CB;
}

.evidence-badge.hard {
    background: rgba(232, 54, 59, 0.15);
    border-color: rgba(232, 54, 59, 0.3);
    color: #e8363b;
}

/* ============================================================================
   Interrogation UI Styles
   ============================================================================ */

/* Interrogation question input row (Detective) */
.interrogation-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.interrogation-input-row input {
    flex: 1 1 200px;
    min-width: 0;
    padding: 12px 16px;
    border: 2px solid var(--brand-beige-dark);
    border-radius: 4px;
    background:
        linear-gradient(135deg, rgba(212, 197, 169, 0.12) 0%, rgba(184, 167, 142, 0.08) 100%);
    color: var(--brand-beige);
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 16px;
    letter-spacing: 1px;
    transition: all var(--transition-fast);
    box-sizing: border-box;
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.05);
}

.interrogation-input-row input::placeholder {
    color: rgba(212, 197, 169, 0.4);
    font-style: italic;
}

.interrogation-input-row input:focus {
    outline: none;
    border-color: var(--brand-gold);
    background:
        linear-gradient(135deg, rgba(212, 197, 169, 0.18) 0%, rgba(184, 167, 142, 0.12) 100%);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.25),
        0 0 20px rgba(201, 162, 39, 0.2),
        0 0 0 1px rgba(201, 162, 39, 0.3);
}

.interrogation-input-row .btn {
    flex: 0 0 auto;
}

/* Witness answer panel */
.witness-answer-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: rgba(201, 162, 39, 0.08);
    border: 2px solid var(--brand-gold);
    border-radius: 8px;
    margin-bottom: 12px;
    animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% { border-color: var(--brand-gold); box-shadow: 0 0 10px rgba(201, 162, 39, 0.3); }
    50% { border-color: rgba(201, 162, 39, 0.6); box-shadow: 0 0 20px rgba(201, 162, 39, 0.5); }
}

.pending-question {
    text-align: center;
}

.question-label {
    display: block;
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.question-text {
    display: block;
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 18px;
    color: var(--brand-beige);
    font-style: italic;
}

.answer-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.answer-btn {
    flex: 1;
    max-width: 120px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.answer-btn .answer-icon {
    margin-right: 8px;
}

.answer-yes {
    background: rgba(34, 139, 34, 0.2);
    border: 2px solid #228b22;
    color: #4caf50;
}

.answer-yes:hover {
    background: rgba(34, 139, 34, 0.4);
    box-shadow: 0 0 15px rgba(34, 139, 34, 0.5);
}

.answer-no {
    background: rgba(231, 76, 60, 0.2);
    border: 2px solid #e74c3c;
    color: #e74c3c;
}

.answer-no:hover {
    background: rgba(231, 76, 60, 0.4);
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.5);
}

/* Q&A display row */
.qa-display-row {
    display: flex;
    gap: 16px;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 12px 16px;
    background: rgba(50, 50, 50, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(212, 197, 169, 0.2);
}

.qa-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.qa-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.questions-remaining {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.8;
}

.qa-question {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 16px;
    color: var(--brand-beige);
    font-style: italic;
}

.qa-answer-badge {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.qa-answer-badge.yes {
    background: rgba(34, 139, 34, 0.3);
    border: 1px solid #228b22;
    color: #4caf50;
}

.qa-answer-badge.no {
    background: rgba(231, 76, 60, 0.3);
    border: 1px solid #e74c3c;
    color: #e74c3c;
}

.qa-answer-badge.waiting {
    background: rgba(201, 162, 39, 0.3);
    border: 1px solid var(--brand-gold);
    color: var(--brand-gold);
    animation: pulse-opacity 1.5s ease-in-out infinite;
}

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

/* Clue history entry types */
.clue-history-entry.interrogation {
    border-left-color: var(--brand-gold);
}

.clue-history-entry.interrogation .question-text {
    font-style: italic;
    color: var(--brand-beige);
}

.clue-history-entry.interrogation .answer-indicator {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

.clue-history-entry.interrogation .answer-indicator.yes {
    background: rgba(34, 139, 34, 0.3);
    color: #4caf50;
}

.clue-history-entry.interrogation .answer-indicator.no {
    background: rgba(231, 76, 60, 0.3);
    color: #e74c3c;
}

.clue-display {
    text-align: center;
    padding: 16px;
}

.clue-word {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 28px;
    font-weight: 400;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--brand-gold) 0%, var(--brand-beige) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 4px;
    text-transform: uppercase;
    filter: drop-shadow(0 0 20px rgba(201, 162, 39, 0.3));
}

.clue-info {
    font-size: 14px;
    color: #aaa;
}

.guess-count {
    font-size: 20px;
    font-weight: 600;
    color: var(--brand-red);
    margin-top: 12px;
}

/* Join game styles */
.join-section {
    padding: 16px 0;
    margin-bottom: 16px;
}

.join-section h3 {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 600;
}

.join-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 0;
    width: 100%;
}

.join-input-row input {
    flex: 1;
    min-width: 0;
    padding: 16px;
    border: 2px solid var(--border-medium);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    color: var(--brand-beige);
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-size: 18px;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 5px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.join-input-row input:focus {
    outline: none;
    border-color: var(--brand-gold);
    box-shadow: 0 0 20px rgba(201, 162, 39, 0.25);
}

.join-input-row input::placeholder {
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
    color: #556;
    font-size: 14px;
}

.join-roles {
    display: none;
    flex-direction: column;
    gap: 8px;
}

.join-roles.active {
    display: flex;
    animation: slideIn 0.3s ease;
}

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

.join-role-btn {
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.join-role-btn.cluemaster {
    background: linear-gradient(135deg, var(--brand-red) 0%, var(--brand-red) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

.join-role-btn.blue {
    background: var(--team2-color, #2d809b);
    color: white;
    box-shadow: 0 4px 15px color-mix(in srgb, var(--team2-color, #2d809b) 40%, transparent);
}

.join-role-btn.red {
    background: var(--team1-color, #e8363b);
    color: white;
    box-shadow: 0 4px 15px color-mix(in srgb, var(--team1-color, #e8363b) 40%, transparent);
}

.join-role-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.join-role-btn:active {
    transform: translateY(0) scale(0.98);
}

.divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: #556;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(253, 253, 253, 0.08);
}

.divider span {
    padding: 0 16px;
}

/* Viewer mode notice */
.viewer-notice {
    background: rgba(253, 253, 253, 0.03);
    padding: 16px 24px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 16px;
    font-size: 14px;
    color: #7a8a94;
    border: 1px solid rgba(253, 253, 253, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Legend inside viewer-notice (Witness view) */
.viewer-notice .legend {
    margin: 0;
    background: transparent;
    padding: 0;
}

.viewer-counts {
    margin-left: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    color: #ccc;
}

.viewer-counts .dot {
    width: 10px;
    height: 10px;
    margin-left: 8px;
}

/* Top Left Help Button */
.top-left-buttons {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 100;
}

/* Top Right Buttons Container */
.top-buttons {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    z-index: 100;
}

.settings-btn,
.help-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(253, 253, 253, 0.04);
    border: 1px solid rgba(253, 253, 253, 0.1);
    color: #7a8a94;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.help-btn {
    font-weight: 600;
    font-size: 16px;
}

.settings-btn:hover,
.help-btn:hover {
    background: rgba(253, 253, 253, 0.08);
    border-color: rgba(253, 253, 253, 0.15);
    color: var(--text-primary);
}

/* Settings Modal */
#settings-modal .modal-body {
    display: block;
    padding: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.settings-modal-content {
    padding: 16px;
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

/* Game setup modal needs scrolling */
#game-setup-modal .modal-body {
    overflow-y: auto;
    align-items: flex-start;
    justify-content: flex-start;
    padding-bottom: 70px;
}
#game-setup-modal .settings-modal-content {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}
#game-setup-modal .setup-continue-btn {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 24px;
    background: linear-gradient(to top, rgba(15, 15, 35, 1) 0%, rgba(15, 15, 35, 0.95) 80%, rgba(15, 15, 35, 0) 100%);
    z-index: 10;
}
#game-setup-modal .setup-continue-btn button {
    width: 100%;
    max-width: 500px;
    display: block;
    margin: 0 auto;
}
.settings-section {
    margin-bottom: 24px;
}
.settings-section h4 {
    color: #fff;
    font-size: 14px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.setting-item:last-child {
    border-bottom: none;
}
.setting-label {
    color: #ccc;
    font-size: 14px;
}
.setting-desc {
    color: #999;
    font-size: 11px;
    margin-top: 2px;
}

/* Toggle Switch */
.toggle {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}
.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: 0.3s;
    border-radius: 26px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: 0.3s;
    border-radius: 50%;
}
.toggle input:checked + .toggle-slider {
    background-color: var(--brand-red);
}
.toggle input:checked + .toggle-slider:before {
    transform: translateX(22px);
    background-color: #fff;
}

/* Clue History Panel - Dropdown */
.clue-history {
    background: rgba(20, 20, 35, 0.95);
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid rgba(255,255,255,0.05);
    overflow: hidden;
}
.clue-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.clue-history-header:hover {
    background: rgba(255,255,255,0.03);
}
.clue-history-header h4 {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}
.clue-history-header .dropdown-arrow {
    color: #999;
    font-size: 10px;
    transition: transform 0.2s;
}
.clue-history.expanded .dropdown-arrow {
    transform: rotate(180deg);
}
.clue-history-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
}
.clue-history.expanded .clue-history-content {
    max-height: 200px;
    overflow-y: auto;
}
.clue-history-list {
    padding: 0 12px 12px 12px;
}
.clue-history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.clue-history-item:last-child {
    border-bottom: none;
}
.clue-history-item .team-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.clue-history-item .team-dot.red { background: var(--team1-color, #e8363b); }
.clue-history-item .team-dot.blue { background: var(--team2-color, #2d809b); }
.clue-history-item .clue-text {
    color: #ddd;
    font-weight: 500;
}
.clue-history-item .clue-number {
    color: var(--text-muted);
    font-size: 12px;
}

/* Game Stats Modal */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.stat-card {
    background: rgba(30, 30, 50, 0.8);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}
.stat-card.red { border-left: 3px solid var(--team1-color, #e8363b); }
.stat-card.blue { border-left: 3px solid var(--team2-color, #2d809b); }
.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
}
.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 4px;
}

/* Game Setup Modal */
.setup-section {
    margin-bottom: 16px;
}
.setup-section h4 {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}
.setup-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.setup-row label {
    flex: 1;
    color: #ccc;
    font-size: 14px;
}
.setup-row select,
.setup-row input[type="number"],
.setup-row input[type="text"] {
    background: rgba(30, 30, 50, 0.8);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: #fff;
    padding: 8px 12px;
    font-size: 14px;
}
.setup-row select {
    min-width: 100px;
}
.setup-row input[type="number"] {
    width: 70px;
    text-align: center;
}
.setup-row input[type="text"] {
    width: 120px;
}
.setup-row input[type="color"] {
    width: 40px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
}
.team-setup {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(30, 30, 50, 0.5);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}
.icon-select {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    color: #fff;
    padding: 4px 8px;
    font-size: 20px;
    cursor: pointer;
    min-width: 52px;
    height: 38px;
    line-height: 1;
    vertical-align: middle;
}
.icon-select option {
    font-size: 18px;
    padding: 4px;
}
.icon-select:focus {
    outline: none;
    border-color: var(--brand-red);
}
/* Team name inputs - minimal style with bottom border only on focus */
.team-setup input[type="text"] {
    background: rgba(30, 30, 50, 0.8);
    border: none;
    border-bottom: 2px solid rgba(255,255,255,0.2);
    border-radius: 0;
    color: #fff;
    padding: 8px 12px;
    font-size: 14px;
}
.team-setup input[type="text"]:focus {
    outline: none;
    border-bottom-color: var(--brand-red);
}
.first-team-options, .timer-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    background: rgba(30, 30, 50, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.2s;
}
.radio-option:hover {
    background: rgba(50, 50, 70, 0.6);
}
.radio-option input[type="radio"] {
    accent-color: var(--brand-red);
}
.radio-option span {
    color: #ccc;
    font-size: 14px;
}
.team-setup .team-color-preview {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
}
.team-color-orb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    flex-shrink: 0;
}
/* Grid preview in setup modal */
.grid-preview-container {
    margin-top: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    text-align: center;
}
.grid-preview-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.grid-preview {
    display: inline-grid;
    gap: 3px;
    padding: 8px;
    background: rgba(30, 30, 50, 0.8);
    border-radius: 6px;
}
.grid-preview-card {
    width: 28px;
    height: 18px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.grid-preview-info {
    font-size: 11px;
    color: #999;
    margin-top: 8px;
}
.color-preview-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.color-preview-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
#color-preview {
    display: flex;
    gap: 8px;
}
.color-preview-item {
    flex: 1;
    padding: 8px 4px;
    border-radius: 4px;
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.key-mode-toggle {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.key-mode-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    background: rgba(30, 30, 50, 0.5);
    color: #aaa;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}
.key-mode-btn:hover {
    border-color: rgba(255,255,255,0.2);
}
.key-mode-btn.active {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.2);
    color: #fff;
}
.key-mode-btn .mode-icon {
    font-size: 24px;
    margin-bottom: 4px;
}
.key-mode-btn .mode-label {
    font-size: 12px;
    font-weight: 600;
}

/* Manual Color Marking Interface */
.color-marking-bar {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: rgba(20, 20, 35, 0.95);
    border-radius: 12px;
    margin-bottom: 12px;
}
.color-paint-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.color-paint-btn:hover {
    transform: scale(1.1);
}
.color-paint-btn.active {
    border-color: #fff;
    box-shadow: 0 0 12px rgba(255,255,255,0.5);
}
.color-paint-btn.team1 { background: var(--team1-color, #e8363b); }
.color-paint-btn.team2 { background: var(--team2-color, #2d809b); }
.color-paint-btn.killer {
    background: var(--killer-color, #228b22);
    border-radius: 8px;
    width: auto;
    padding: 0 12px;
}
.color-paint-btn.neutral {
    background: var(--neutral-color, #d4c5a9);
    border-radius: 8px;
    width: auto;
    padding: 0 12px;
    color: #333;
    text-shadow: none;
}
.paint-label {
    font-size: 12px;
    font-weight: 500;
}
.marking-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 8px;
}
.marking-done-btn {
    display: block;
    margin: 12px auto 0;
    padding: 12px 32px;
    max-width: 200px;
}

/* Cell marker for icons on marked cards */
.cell-marker {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40%;
    height: 40%;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(16px, 4vw, 32px);
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    pointer-events: none;
    z-index: 10;
}

/* Only show cell-marker when it has content */
.cell-marker:empty {
    display: none;
}

/* Marking mode done button */
.marking-done-container {
    text-align: center;
    padding: 8px;
}

/* =============================================================================
   COLORBLIND LABELS - DISABLED
   Feature disabled due to layout issues with grid overlays
   ============================================================================= */

/* Colorblind text labels - always hidden (feature disabled) */
.colorblind-label {
    display: none !important;
}

/* Colorblind shape icons - corner indicators */
.colorblind-shape-icon {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 22px;
    font-weight: bold;
    line-height: 1;
    pointer-events: none;
    text-shadow:
        1px 1px 2px rgba(0, 0, 0, 0.9),
        -1px -1px 2px rgba(0, 0, 0, 0.9),
        0 0 6px rgba(0, 0, 0, 0.8);
    z-index: 5;
}

/* Rotate shape icons in landscape mode */
.board-container.landscape-mode .colorblind-shape-icon {
    transform: rotate(90deg);
    top: 6px;
    left: auto;
    right: 6px;
}

/* Dyslexia-friendly font (OpenDyslexic) */
.dyslexic-font,
.dyslexic-font * {
    font-family: 'OpenDyslexic', sans-serif !important;
}

/* Slightly increase letter spacing for dyslexic font */
.dyslexic-font .word-cell {
    letter-spacing: 0.5px;
}

/* =============================================================================
   COLORBLIND MODE
   Color-replacing modes (protanopia, deuteranopia, tritanopia) are now rendered
   server-side. CSS variables are still used for UI elements (turn indicator, legend).
   ============================================================================= */

/* Pinch zoom container */
.board-zoom-container {
    overflow: hidden;
    touch-action: pan-x pan-y pinch-zoom;
}

/* Help Modal */
.help-modal .modal-body {
    display: block;
    padding: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.help-content {
    padding: 20px;
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.help-content > *:first-child {
    margin-top: 0;
}

/* Quick start - always visible */
.help-quick-start {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.help-quick-start ol {
    margin: 0;
    padding-left: 24px;
    color: #ccc;
}

.help-quick-start ol li {
    margin-bottom: 8px;
    line-height: 1.5;
    font-size: 14px;
}

.help-quick-start ol li strong {
    color: #fff;
}

/* Accordion sections */
.help-accordion {
    margin-bottom: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.help-accordion summary {
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    font-family: 'Special Elite', monospace;
    font-size: 14px;
    color: var(--brand-beige);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.help-accordion summary::-webkit-details-marker {
    display: none;
}

.help-accordion summary::after {
    content: '+';
    font-size: 18px;
    color: var(--brand-red);
    font-weight: bold;
}

.help-accordion[open] summary::after {
    content: '−';
}

.help-accordion[open] summary {
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.help-accordion-content {
    padding: 12px 16px;
    font-size: 13px;
    color: #bbb;
    line-height: 1.5;
}

.help-accordion-content p {
    margin: 0 0 8px 0;
}

.help-accordion-content p:last-child {
    margin-bottom: 0;
}

.help-accordion-content strong {
    color: #fff;
}

.help-accordion-content.story-intro {
    font-style: italic;
    border-left: 3px solid var(--primary-color, #2d809b);
    padding-left: 16px;
    background: rgba(45, 128, 155, 0.05);
    margin: 8px 0;
}

.help-accordion-content.story-intro p:last-child {
    font-style: normal;
    margin-top: 12px;
    color: var(--primary-color, #2d809b);
    font-weight: 500;
}

/* Help Modal - Enhanced Styles */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    opacity: 0.85;
}

.help-icon svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Lore/Story Text */
.help-lore {
    font-family: 'Crimson Pro', Georgia, serif;
    font-style: italic;
    color: #a0a8b0;
    font-size: 14px;
    line-height: 1.6;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-left: 3px solid var(--team2-color, #3498db);
    border-radius: 0 6px 6px 0;
}

/* Quick Start Steps */
.help-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.help-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.step-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--brand-red) 0%, #c42d31 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(232, 54, 59, 0.3);
}

.step-content {
    font-size: 13px;
    color: #999;
    line-height: 1.5;
}

.step-content strong {
    color: #fff;
}

/* Card Types Display */
.help-card-types {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0;
}

.help-card-type {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.card-swatch {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.2);
}

.card-swatch.team1 {
    background: var(--team1-color, #e8363b);
}

.card-swatch.team2 {
    background: var(--team2-color, #2d809b);
}

.card-swatch.killer {
    background: var(--killer-color, #228b22);
}

.card-swatch.neutral {
    background: var(--neutral-color, #d4c5a9);
}

.help-card-type strong {
    color: #fff;
    font-size: 13px;
    display: block;
}

.card-desc {
    font-size: 11px;
    color: #888;
}

/* Turn Flow Display */
.help-turn-flow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 8px 0 16px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
}

.turn-phase {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.phase-label {
    flex-shrink: 0;
    width: 70px;
    font-size: 11px;
    font-weight: 700;
    color: var(--brand-beige);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.phase-action {
    font-size: 12px;
    color: #aaa;
}

.turn-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-gold);
    opacity: 0.6;
    padding: 4px 0;
}

.turn-arrow svg {
    width: 16px;
    height: 16px;
}

/* Clue Modes */
.help-subsection {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.help-subsection > strong {
    display: block;
    font-size: 12px;
    color: var(--brand-beige);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.help-clue-modes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.clue-mode {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border-left: 3px solid var(--brand-red);
}

.mode-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
}

.mode-desc {
    font-size: 11px;
    color: #888;
    line-height: 1.4;
}

/* Roles Display */
.help-roles {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.help-role {
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    position: relative;
}

.help-role::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-beige);
}

.help-role.witness::before {
    background: var(--brand-beige);
    box-shadow: 0 0 6px var(--brand-beige);
}

.help-role.suspect::before {
    background: var(--team2-color, #3498db);
    box-shadow: 0 0 6px var(--team2-color, #3498db);
}

.help-role.detective::before {
    background: var(--team1-color, #e74c3c);
    box-shadow: 0 0 6px var(--team1-color, #e74c3c);
}

.role-title {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    margin-left: 16px;
    font-family: 'Special Elite', monospace;
}

.role-intro {
    font-size: 12px;
    color: #aaa;
    margin: 0 0 8px 18px;
    line-height: 1.4;
}

.role-perms {
    margin: 0 0 0 18px;
    padding-left: 16px;
    list-style: none;
}

.role-perms li {
    position: relative;
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
    line-height: 1.4;
}

.role-perms li::before {
    content: '›';
    position: absolute;
    left: -12px;
    color: #666;
    font-weight: bold;
}

.role-perms li:last-child {
    margin-bottom: 0;
}

/* Outcomes Display */
.help-outcomes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.outcome {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    border-radius: 8px;
}

.outcome.win {
    background: rgba(45, 128, 155, 0.15);
    border-left: 3px solid var(--brand-blue);
}

.outcome.lose {
    background: rgba(232, 54, 59, 0.1);
    border-left: 3px solid var(--brand-red);
}

.outcome strong {
    font-size: 13px;
    color: #fff;
}

.outcome span {
    font-size: 12px;
    color: #999;
    line-height: 1.4;
}

/* Role intro paragraph */
.role-intro {
    font-size: 12px;
    color: #aaa;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.help-tip {
    font-size: 12px;
    color: #888;
    padding: 8px 12px;
    background: rgba(254, 202, 87, 0.08);
    border-radius: 6px;
    border-left: 3px solid rgba(254, 202, 87, 0.4);
}

.help-tip strong {
    color: var(--brand-beige);
}

/* Options Grid */
.help-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.help-option {
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.help-option strong {
    display: block;
    font-size: 12px;
    color: #fff;
    margin-bottom: 2px;
}

.help-option span {
    font-size: 11px;
    color: #777;
    line-height: 1.3;
}

/* Notes & inline icons */
.help-note {
    font-size: 11px;
    color: #666;
    font-style: italic;
    margin-top: 8px;
}

.icon-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px;
    border-radius: 4px;
    font-style: normal;
    vertical-align: middle;
}

.icon-inline svg {
    display: block;
}

/* Story Section - Visual separation */
.help-story-section {
    margin-top: 16px;
    border-color: rgba(45, 128, 155, 0.3);
    background: rgba(45, 128, 155, 0.03);
}

.help-story-section summary {
    color: var(--brand-blue);
    opacity: 0.8;
}

.help-story-section summary::after {
    color: var(--brand-blue);
}

.story-goal {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(45, 128, 155, 0.2);
    font-style: normal !important;
    font-size: 14px;
    color: var(--brand-blue) !important;
    text-align: center;
}

/* Responsive adjustments for help modal */
@media (max-width: 400px) {
    .help-options-grid {
        grid-template-columns: 1fr;
    }

    .phase-label {
        width: 60px;
        font-size: 10px;
    }

    .phase-action {
        font-size: 11px;
    }
}

/* =============================================================================
   MOBILE RESPONSIVE FIXES
   ============================================================================= */
@media (max-width: 480px) {
    /* Toast - ensure it stays on screen */
    .toast {
        left: 16px;
        right: 16px;
        transform: translateY(100px);
        max-width: calc(100% - 32px);
        padding: 12px 16px;
        font-size: 13px;
    }
    .toast.show {
        transform: translateY(0);
    }
    .toast.victory-toast {
        padding: 16px 24px;
        min-width: auto;
    }
    .toast.victory-toast strong {
        font-size: 18px;
        letter-spacing: 2px;
    }
    .toast.victory-toast span {
        font-size: 12px;
    }
    .toast.victory-toast::before {
        font-size: 8px;
        letter-spacing: 2px;
    }
    .toast.victory-toast::after {
        font-size: 7px;
        letter-spacing: 1px;
    }

    /* Header - add padding to prevent overlap with corner buttons */
    header {
        padding-top: 48px;
    }
    .logo-header {
        flex-direction: column;
        gap: 4px;
    }
    .logo-icon {
        width: 48px;
        height: 48px;
    }
    .logo-title {
        max-width: 180px;
    }
    .tagline {
        font-size: 11px;
        padding: 0 40px;
    }
    .header-divider {
        margin: 16px 20px;
    }

    /* Legend - smaller text to fit mobile screens */
    .legend {
        gap: 3px 4px;
        padding: 4px 8px;
    }
    .legend-item {
        font-size: 8px;
        padding: 4px 8px;
        letter-spacing: 0.2px;
    }
}

/* =============================================================================
   RESPONSIVE LANDSCAPE/PORTRAIT DISPLAY
   On desktop (wide screens), show the board in landscape orientation
   On mobile (narrow/portrait), show the board in portrait orientation
   ============================================================================= */

/* Desktop landscape mode - rotate the portrait image to display landscape */
.board-container.landscape-mode {
    /* Container sized by JavaScript to fit rotated content */
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.board-container.landscape-mode #board-image {
    /* Rotate the portrait image 90° counter-clockwise to show landscape */
    transform: rotate(-90deg);
    transform-origin: center center;
    /* Override default width: 100% - size controlled by JavaScript */
    width: auto;
    max-width: none;
}

.board-container.landscape-mode .grid-overlay {
    /* Grid overlay also rotates to match the image */
    transform: rotate(-90deg);
    transform-origin: center center;
    /* Override default 100% sizing - position and size set by JavaScript */
    width: auto;
    height: auto;
}

/* Counter-rotate cell markers and labels in landscape mode so they appear upright */
.board-container.landscape-mode .cell-marker {
    transform: translate(-50%, -50%) rotate(90deg);
}

/* Colorblind labels disabled - see COLORBLIND LABELS section */

.board-container.landscape-mode .consider-badge {
    transform: rotate(90deg);
    transform-origin: center center;
}

.board-container.landscape-mode .mark-border {
    /* Content inside mark-border should also be rotated if any */
}

/* Media query for landscape mode on larger screens */
@media screen and (min-width: 768px) and (orientation: landscape) {
    .container {
        max-width: 1000px;
    }
}

/* =============================================================================
   UTILITY CLASSES
   Common utility classes for consistent styling
   ============================================================================= */
.hidden {
    display: none !important;
}

/* =============================================================================
   ACCESSIBILITY
   Focus states, reduced motion, high contrast support
   ============================================================================= */

/* Global focus-visible styling - golden highlight for keyboard navigation */
:focus-visible {
    outline: 3px solid var(--brand-gold) !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 6px rgba(201, 162, 39, 0.25) !important;
}

/* Skip link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--brand-gold);
    color: var(--bg-primary);
    padding: 8px 16px;
    font-weight: 600;
    text-decoration: none;
    z-index: 10001;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Reduced motion - disable all animations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* Keep essential transforms but remove animation */
    .btn:hover,
    .btn:active {
        transform: none !important;
    }

    /* Remove atmospheric effects */
    body::before,
    body::after {
        display: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-subtle: rgba(255, 255, 255, 0.3);
        --border-medium: rgba(255, 255, 255, 0.5);
    }

    .btn {
        border: 2px solid currentColor !important;
    }

    .grid-cell:hover {
        background: rgba(255, 255, 255, 0.25);
    }

    .modal-header {
        border-bottom: 2px solid var(--brand-beige);
    }
}
