/**
 * Cluemarker - Main Stylesheet
 * Your Secret Word Game Companion
 *
 * Fonts:
 * - Special Elite: Headings (typewriter/spy dossier feel)
 * - Nunito: Body text (friendly, readable)
 * - Share Tech Mono: Codes (techy, monospace)
 */

/* =============================================================================
   BRAND COLOR VARIABLES
   Easy to customize - just change these values to reskin the app
   ============================================================================= */
:root {
    /* Primary Brand Colors */
    --brand-red: #e8363b;
    --brand-navy: #102634;
    --brand-blue: #2d809b;
    --brand-white: #FDFDFD;
    --brand-beige: #E8D6CB;

    /* Derived Colors - lighter shades of navy (keeping the same hue) */
    --brand-navy-light: #18344a;
    --brand-navy-lighter: #1f4260;
    --brand-red-dark: #c42d31;
    --brand-blue-dark: #236a82;
    --brand-beige-dark: #d4c0b3;

    /* Semantic Colors */
    --bg-primary: var(--brand-navy);
    --bg-secondary: #0c1c28;
    --bg-tertiary: var(--brand-navy-light);
    --bg-card: rgba(253, 253, 253, 0.05);
    --bg-card-hover: rgba(253, 253, 253, 0.1);

    --text-primary: var(--brand-white);
    --text-secondary: var(--brand-beige);
    --text-muted: #9aa5ae;

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

    --border-subtle: rgba(253, 253, 253, 0.08);
    --border-medium: rgba(253, 253, 253, 0.15);

    /* Team Colors (can be overridden per game) */
    --team1-color: var(--brand-red);
    --team2-color: var(--brand-blue);
    --killer-color: #228b22;
    --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(253, 253, 253, 0.08);
    --input-border: rgba(253, 253, 253, 0.15);
    --input-focus-border: var(--brand-blue);

    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-glow: rgba(232, 54, 59, 0.3);
}

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

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

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--brand-navy);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    padding: 16px;
    width: 100%;
    overflow-x: hidden;
}

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

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

/* Logo Header */
.logo-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

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

.logo-text {
    font-family: 'Special Elite', cursive;
    font-size: 26px;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: 2px;
    text-transform: lowercase;
}

h1 {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 32px;
    font-weight: 400;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--brand-red) 0%, var(--brand-beige) 50%, var(--brand-red) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 3px;
    animation: titleShimmer 4s linear infinite;
}

@keyframes titleShimmer {
    to { background-position: 200% center; }
}

.tagline {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 13px;
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin: 0;
    font-weight: 400;
}

.status-bar {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 14px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 4px 15px var(--shadow-color);
}

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

.dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { opacity: 0.8; }
    to { opacity: 1; }
}

.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: 16px;
    overflow: hidden;
    /* Enable pinch zoom */
    touch-action: pan-x pan-y pinch-zoom;
}

/* Add styling only when board has an image */
.board-container.has-board {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 8px 32px var(--shadow-color);
}

.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: 10;
}

/* 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: 5; /* Below grid-overlay so clicks pass through */
    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;
    text-shadow: 1px 1px 1px rgba(255,255,255,0.3);
    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 0.15s ease;
    padding: 3px;
    border-radius: 4px;
    position: relative;
}

.grid-cell:hover {
    background: rgba(255,255,255,0.15);
    box-shadow: inset 0 0 20px rgba(255,255,255,0.1);
}

/* 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.4);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.15);
}

/* Yellow outline for cluemaster view */
.cluemaster-view .grid-cell.marked .mark-border {
    border: 3px solid #ffd700;
    background: transparent;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.6), inset 0 0 8px rgba(255, 215, 0, 0.2);
}

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

/* 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: #777;
    padding: 24px;
    text-align: center;
}

.placeholder > svg {
    width: 90px;
    height: 90px;
    margin-bottom: 24px;
    opacity: 0.6;
    color: var(--brand-red);
    filter: drop-shadow(0 0 15px rgba(233, 69, 96, 0.3));
    animation: placeholderPulse 3s ease-in-out infinite;
}
.placeholder .btn svg {
    width: 40px;
    height: 40px;
    margin: 0;
    opacity: 1;
    color: inherit;
    filter: none;
    animation: none;
}
#btn-camera-main {
    min-width: 160px;
}

@keyframes placeholderPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

.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: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

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

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

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

.btn-primary {
    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);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    color: var(--text-primary);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn-success {
    background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%);
    color: var(--brand-white);
    box-shadow: 0 4px 15px rgba(45, 128, 155, 0.4);
}

.btn-purple {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.4);
}

.btn-share {
    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);
}

.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: 10px 16px;
    font-size: 12px;
    border-radius: 8px;
}

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

.considering-toggle:hover {
    background: rgba(255, 193, 7, 0.25);
    border-color: rgba(255, 193, 7, 0.6);
}

.considering-toggle.active {
    background: rgba(255, 193, 7, 0.35);
    border-color: #ffc107;
    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 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(10, 10, 20, 0.98) 0%, rgba(15, 15, 35, 0.98) 100%);
    backdrop-filter: blur(10px);
    z-index: 1000;
    flex-direction: column;
}

.modal.active {
    display: flex;
    animation: modalFadeIn 0.3s ease;
}

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

.modal-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(22, 33, 62, 0.8) 0%, rgba(26, 26, 46, 0.8) 100%);
    border-bottom: 1px solid rgba(233, 69, 96, 0.2);
}

.modal-header span {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-weight: 400;
    font-size: 16px;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--brand-red) 0%, var(--brand-red) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}

#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: 20px;
    display: flex;
    justify-content: center;
    gap: 16px;
    background: linear-gradient(135deg, rgba(22, 33, 62, 0.5) 0%, rgba(26, 26, 46, 0.5) 100%);
}

.capture-btn {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
    border: 4px solid var(--brand-red);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.4), inset 0 -2px 10px rgba(0,0,0,0.1);
    position: relative;
}

.capture-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-red) 0%, var(--brand-red) 100%);
    transition: transform 0.2s;
}

.capture-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(233, 69, 96, 0.5);
}

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

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

.close-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    line-height: 1;
}

.close-btn:hover {
    background: rgba(233, 69, 96, 0.3);
    transform: scale(1.1);
}

/* 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: 14px 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%);
}

/* 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: 10px 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 14px;
    border-radius: 10px;
    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: 10px;
    margin-bottom: 10px;
    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: 20px;
}

.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: 14px 16px;
    border-radius: 10px;
    margin: 10px 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: 20px;
    max-width: 360px;
    width: calc(100vw - 32px);
}

.share-codes-modal-content h3 {
    text-align: center;
    font-size: 18px;
    margin-bottom: 20px;
    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: 28px;
    font-weight: 700;
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    letter-spacing: 4px;
    color: var(--brand-beige);
}

.share-code-hidden {
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 10px;
    background: rgba(233, 69, 96, 0.2);
    border-radius: 6px;
    text-align: center;
    display: inline-block;
}

.share-code-hidden:hover {
    background: rgba(233, 69, 96, 0.3);
}

.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 14px;
    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: 6px;
}

/* QR Code Modal */
.qr-modal-content {
    padding: 20px;
    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: #666;
    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 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 20, 0.95);
    backdrop-filter: blur(8px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 2000;
}

.loading.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

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

.spinner {
    width: 56px;
    height: 56px;
    border: 4px solid rgba(233, 69, 96, 0.2);
    border-top-color: var(--brand-red);
    border-right-color: var(--brand-red);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    box-shadow: 0 0 25px rgba(233, 69, 96, 0.3);
}

.loading-text {
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #fff 0%, #aaa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

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

.text-control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    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: 6px 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: 6px 14px;
}

.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: 20px;
    font-size: 12px;
    color: #777;
    margin-top: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(22, 33, 62, 0.5) 0%, rgba(26, 26, 46, 0.5) 100%);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.03);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    box-shadow: 0 2px 8px currentColor;
}

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

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    color: white;
    padding: 14px 28px;
    border-radius: 16px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 3000;
    border: 1px solid rgba(233, 69, 96, 0.3);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 20px rgba(233, 69, 96, 0.2);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* 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: 10px;
    padding: 8px 16px;
    background: rgba(0,0,0,0.3);
    border-radius: 25px;
}
.timer-time {
    font-size: 28px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: #fff;
    min-width: 70px;
    text-align: center;
}
.timer-time.warning {
    color: #f39c12;
    animation: pulse 1s infinite;
}
.timer-time.critical {
    color: #e74c3c;
    animation: pulse 0.5s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.timer-ctrl-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.timer-ctrl-btn:hover {
    background: rgba(255,255,255,0.2);
}
.timer-ctrl-btn.paused {
    background: rgba(231, 76, 60, 0.3);
}
.timer-ctrl-btn.start {
    background: rgba(46, 204, 113, 0.3);
}
.timer-ctrl-btn.start:hover {
    background: rgba(46, 204, 113, 0.5);
}

.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 10px;
    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 10px;
    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: 10px 16px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    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;
}

/* Combined Turn & Clue Panel */
.turn-clue-panel {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    border: 2px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

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

.turn-clue-panel .turn-team {
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 16px;
    border-radius: 8px;
    display: inline-block;
}

.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: 10px;
}

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

.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;
}

.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: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.clue-input-row input {
    flex: 1 1 120px;
    min-width: 0;
    padding: 12px 14px;
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    background: rgba(0,0,0,0.3);
    color: var(--text-primary);
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.clue-input-row input:focus {
    outline: none;
    border-color: var(--brand-red);
    box-shadow: 0 0 15px rgba(233, 69, 96, 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;
}

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

.clue-word {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    letter-spacing: 2px;
}

.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: 10px 0;
    margin-bottom: 16px;
}

.join-section h3 {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 14px;
    color: #aaa;
    margin-bottom: 16px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.join-input-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    width: 100%;
}

.join-input-row input {
    flex: 1;
    min-width: 150px;
    padding: 14px;
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    background: rgba(0,0,0,0.3);
    color: #fff;
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    font-size: 20px;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 6px;
    font-weight: 400;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.join-input-row input:focus {
    outline: none;
    border-color: var(--brand-red);
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.3);
}

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

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

.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: 14px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    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: 20px 0;
    color: #555;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #333, transparent);
}

.divider span {
    padding: 0 16px;
}

/* Viewer mode notice */
.viewer-notice {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    padding: 14px 20px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 16px;
    font-size: 14px;
    color: #aaa;
    border: 1px solid rgba(255,255,255,0.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.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: fixed;
    top: 12px;
    left: 12px;
    z-index: 100;
}

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

.settings-btn,
.help-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(30, 30, 50, 0.9);
    border: 1px solid rgba(255,255,255,0.1);
    color: #aaa;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.help-btn {
    width: 44px;
    height: 44px;
    font-weight: bold;
    font-size: 22px;
}

.settings-btn:hover,
.help-btn:hover {
    background: rgba(50, 50, 80, 0.95);
    color: #fff;
}

/* Settings Modal */
.settings-modal-content {
    padding: 20px;
}

/* 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 20px;
    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: #666;
    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: 10px 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: #666;
    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: 20px;
}
.stat-card {
    background: rgba(30, 30, 50, 0.8);
    border-radius: 10px;
    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: 20px;
}
.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: 10px 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: 6px 8px;
    font-size: 16px;
    cursor: pointer;
    width: 54px;
}
.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: 6px;
    cursor: pointer;
    padding: 8px 14px;
    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: #666;
    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 {
    width: 100%;
    margin-top: 12px;
}

/* Cell marker for manual key mode - matches server overlay inset (3.5%) */
.cell-marker {
    position: absolute;
    top: 3.5%;
    left: 3.5%;
    right: 3.5%;
    bottom: 3.5%;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    pointer-events: none;
    opacity: 0.6;
}

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

/* Colorblind text labels - actual span elements for custom team names */
.colorblind-label {
    display: none;
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 3px;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(0, 0, 0, 0.7);
    white-space: nowrap;
}
.colorblind-mode .colorblind-label {
    display: block;
}

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

/* Help Modal */
.help-modal .modal-body {
    overflow-y: auto;
    max-height: 80vh;
    padding: 0;
}

.help-content {
    padding: 16px 20px 20px;
}

.help-section {
    margin-bottom: 20px;
}

.help-section:last-of-type {
    margin-bottom: 0;
}

.help-section h3 {
    font-family: 'Special Elite', monospace;
    font-size: 15px;
    color: var(--brand-red);
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(233, 69, 96, 0.3);
}

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

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

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

.help-item {
    margin-bottom: 8px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    line-height: 1.4;
    font-size: 13px;
    color: #bbb;
}

.help-item strong {
    color: var(--brand-beige);
    display: block;
    margin-bottom: 2px;
    font-size: 13px;
}

/* =============================================================================
   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;
}

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