/* =======================
   IMPOSTER MM — CYBERPUNK UI
   ======================= */
:root {
    --bg: #08001A;
    --bg-deep: #04000d;
    --bg-soft: #1a0030;
    --bg-card: #120026;
    --glass-bg: rgba(255, 0, 212, 0.10);
    --glass-border: rgba(0, 144, 255, 0.2);
    --accent-cyan: #FF00D4;
    --accent-teal: #0090FF;
    --accent-steel: #0090FF;
    --accent-purple: #8a00a8;
    --accent-green: #00FFB3;
    --accent-red: #FF6200;
    --accent-yellow: #FF00D4;
    --accent-blue: #0090FF;
    --text-main: #ffffff;
    --text-muted: #c77fdb;
    --text-dim: #5a3a6a;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition: 0.2s ease;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

@font-face {
    font-family: 'MyanmarPixelSmooth';
    src: url('fonts/MyanmarPixelSmooth.ttf') format('truetype');
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg-deep);
    background-image:
        radial-gradient(ellipse 90% 60% at 50% -20%, rgba(255, 0, 212, 0.25), transparent),
        radial-gradient(ellipse 70% 50% at 100% 100%, rgba(0, 144, 255, 0.18), transparent),
        radial-gradient(ellipse 50% 40% at 0% 80%, rgba(0, 255, 179, 0.10), transparent);

    color: var(--text-main);

    font-family: 'MyanmarPixelSmooth';
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 16px 0 32px;
    overflow-x: hidden;
}

#game-container {
    width: 100%;
    max-width: 420px;
    padding: 24px 16px 28px;
    margin: 0 12px;
    position: relative;
}

/* =======================
   SETUP SCREEN — CARD UX
   ======================= */
.app-header {
    margin-bottom: 20px;
    text-align: center;
}

.app-header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.app-subtitle {
    margin: 4px 0 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.settings-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    width: 100%;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    font-family: inherit;
    text-align: left;
    cursor: default;
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row--nav {
    cursor: pointer;
    transition: background var(--transition);
}

.settings-row--nav:hover,
.settings-row--nav:active {
    background: rgba(39, 230, 236, 0.04);
}

.settings-row--nav.expanded .row-chevron {
    transform: rotate(90deg);
}

.row-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.row-icon--mode {
    color: var(--accent-steel);
}

.row-icon--players {
    color: var(--accent-green);
}

.row-icon--imposter {
    color: var(--accent-red);
}

.row-icon--timer {
    color: var(--accent-teal);
}

.row-icon--rounds {
    color: var(--accent-purple);
}

.row-icon--hint {
    color: var(--accent-steel);
}

.row-icon--category {
    color: var(--accent-teal);
}

.row-label {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
}

.row-label--sub {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.row-value {
    font-size: 0.9rem;
    color: var(--text-dim);
    flex-shrink: 0;
}

.row-chevron {
    font-size: 1.25rem;
    color: var(--text-dim);
    flex-shrink: 0;
    line-height: 1;
    transition: transform var(--transition);
}

.settings-row--toggle {
    cursor: default;
}

.settings-row--toggle .toggle-switch {
    margin-left: auto;
}

.setup-footer {
    margin: 20px 0 0;
    text-align: center;
}

/* Mode picker (expandable) */
.mode-picker {
    display: none;
    padding: 0 12px 12px;
    gap: 8px;
    flex-direction: column;
}

.mode-picker.open {
    display: flex;
}

.mode-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    font-family: inherit;
    text-align: left;
    width: 100%;
}

.mode-option.active {
    background: rgba(39, 230, 236, 0.1);
    border-color: var(--accent-cyan);
    color: var(--text-main);
}

.mode-option-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.mode-option-desc {
    font-size: 0.72rem;
    line-height: 1.35;
    color: var(--text-dim);
}

.mode-option.active .mode-option-desc {
    color: var(--accent-teal);
}

/* Expandable panels */
.player-names-panel,
.categories-panel {
    display: none;
    padding: 0 12px 12px;
}

.player-names-panel.open,
.categories-panel.open {
    display: block;
}

.player-names-panel .settings-row {
    padding-left: 50px;
    border-bottom: none;
}

.category-hint {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin: 0 0 10px;
    padding: 0 4px;
}

/* =======================
   STEPPERS — INLINE UX
   ======================= */
.stepper {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.stepper--inline {
    margin-left: auto;
}

.stepper button {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 1.4rem;
    font-weight: 400;
    cursor: pointer;
    transition: color var(--transition), transform var(--transition);
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
}

.stepper button:hover {
    color: var(--accent-cyan);
}

.stepper button:active {
    transform: scale(0.92);
    color: var(--accent-cyan);
}

.stepper-value {
    min-width: 24px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dim);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.stepper input {
    display: none;
}

.stepper-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-right: 4px;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* =======================
   HINT TOGGLE
   ======================= */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    transition: background var(--transition);
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: var(--text-dim);
    border-radius: 50%;
    transition: transform var(--transition), background var(--transition);
}

.toggle-switch input:checked+.toggle-slider {
    background: rgba(39, 230, 236, 0.25);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(20px);
    background: var(--accent-cyan);
}

/* =======================
   CATEGORIES
   ======================= */
.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.category-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    padding: 18px 10px 14px;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    overflow: hidden;
}

.category-card input {
    display: none;
}

.category-card .cat-emoji {
    font-size: 1.8rem;
    line-height: 1;
}

.category-card span:last-child {
    color: var(--text-main);
}

.category-card::after {
    content: "";
    position: absolute;
    top: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
    transition: background var(--transition), border-color var(--transition);
}

.category-card:has(input:checked) {
    background: rgba(39, 230, 236, 0.08);
    border-color: var(--accent-cyan);
}

.category-card:has(input:checked)::after {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

.category-card:has(input:checked)::before {
    content: "✓";
    position: absolute;
    top: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: var(--bg-deep);
    z-index: 1;
}

/* =======================
   PLAYER NAMES
   ======================= */
.player-names-section {
    margin: 4px 0 12px;
}

.player-names-panel #player-names-list {
    padding: 0 4px 4px 50px;
}

.player-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.player-name-row label {
    flex-shrink: 0;
    width: 24px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-teal);
    text-align: center;
}

.player-name-row input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.25);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.9rem;
    outline: none;
    -webkit-user-select: text;
    user-select: text;
}

.player-name-row input:focus {
    border-color: var(--accent-cyan);
}

.player-name-row input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

/* =======================
   BUTTONS
   ======================= */
.btn {
    width: 100%;
    border: none;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition);
    margin-top: 10px;
    font-family: inherit;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary,
.btn-blue {
    background: var(--accent-cyan);
    color: var(--bg-deep);
}

.btn-primary:hover,
.btn-blue:hover {
    opacity: 0.92;
    box-shadow: 0 0 20px rgba(39, 230, 236, 0.35);
}

.btn-start {
    margin-top: 24px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}

/* =======================
   GAME SCREEN — TURN FLOW
   ======================= */
#setup-screen,
#game-screen {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#game-screen {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 20px 16px;
    text-align: center;
}

.game-header {
    margin-bottom: 16px;
}

.round-badge {
    display: inline-block;
    padding: 4px 12px;
    margin-bottom: 10px;
    border-radius: 999px;
    background: rgba(111, 113, 161, 0.15);
    border: 1px solid rgba(111, 113, 161, 0.3);
    color: var(--accent-purple);
    font-size: 0.78rem;
    font-weight: 600;
}

.turn-progress {
    text-align: left;
}

.turn-progress-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.turn-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.phase-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
}

.phase-tag--active {
    color: var(--accent-cyan);
    background: rgba(39, 230, 236, 0.12);
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent-cyan);
    border-radius: 2px;
    transition: width 0.35s ease;
}

.player-label {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 999px;
    background: rgba(39, 230, 236, 0.1);
    border: 1px solid rgba(39, 230, 236, 0.25);
    color: var(--accent-cyan);
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 8px;
}

.turn-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 0 12px;
    line-height: 1.4;
}

/* =======================
   GAME CARD
   ======================= */
.card-container {
    position: relative;
    width: 100%;
    height: 340px;
    margin: 0 auto 16px;
    background: var(--bg-soft);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.secret-layer {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px;
    position: relative;
    z-index: 1;
}

.secret-layer.hidden {
    visibility: hidden;
}

.word-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.secret-word {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    text-align: center;
    line-height: 1.2;
}

.cover-layer {
    position: absolute;
    inset: 0;
    background: linear-gradient(150deg, #FF00D4 0%, #8a00a8 50%, #be12b0 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    padding: 20px;
}

.cover-layer.revealed {
    transform: translateY(-100%);
    pointer-events: none;
}

.cover-layer.no-transition {
    transition: none !important;
}

.cover-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.cover-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 6px;
    color: white;
}

.cover-sub {
    font-size: 0.78rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.4;
    max-width: 220px;
}

/* =======================
   HINT BOX
   ======================= */
.hint-box {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(39, 230, 236, 0.06);
    border: 1px solid rgba(39, 230, 236, 0.2);
    border-radius: var(--radius-sm);
    text-align: center;
    width: 100%;
}

.hint-label {
    display: block;
    font-size: 0.75rem;
    color: var(--accent-cyan);
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.hint-words {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.hint-tag {
    background: rgba(39, 230, 236, 0.1);
    border: 1px solid rgba(39, 230, 236, 0.25);
    color: var(--text-main);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.88rem;
    font-weight: 600;
}

/* =======================
   DISCUSSION & RESULTS
   ======================= */
.result-card {
    padding: 4px 0;
    text-align: center;
}

.phase-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.phase-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 12px;
}

.phase-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 16px;
    line-height: 1.5;
}

.timer-display {
    font-size: 2.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--accent-cyan);
    margin: 8px 0 16px;
    letter-spacing: 0.02em;
}

.timer-urgent {
    color: var(--accent-red);
}

.timer-done {
    font-size: 1.4rem;
    color: var(--accent-red);
}

.starter-box {
    background: rgba(39, 230, 236, 0.06);
    border: 1px solid rgba(39, 230, 236, 0.15);
    padding: 16px;
    border-radius: var(--radius-md);
    margin: 0 0 20px;
}

.starter-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.starter-name {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent-cyan);
}

.round-badge-inline {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(111, 113, 161, 0.15);
    border: 1px solid rgba(111, 113, 161, 0.3);
    color: var(--accent-purple);
    font-size: 0.75rem;
    font-weight: 600;
}

.answer-box {
    background: rgba(0, 0, 0, 0.25);
    border: 1px dashed var(--glass-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin: 16px 0;
    text-align: left;
}

.answer-box p {
    margin: 0 0 4px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.answer-box h3 {
    margin: 0 0 12px;
    font-size: 1.1rem;
}

.red-text {
    color: var(--accent-red);
    font-weight: 800;
}

.green-text {
    color: var(--accent-green);
    font-weight: 800;
}

.yellow-text {
    color: var(--accent-cyan);
    font-weight: 800;
}

.hidden-result {
    background: rgba(0, 0, 0, 0.25);
    border: 1px dashed var(--glass-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin: 16px 0;
    text-align: left;
}

/* =======================
   VOTING
   ======================= */
.voting-card {
    text-align: center;
}

.vote-progress {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.voter-box {
    background: rgba(39, 230, 236, 0.06);
    border: 1px solid rgba(39, 230, 236, 0.15);
    padding: 16px;
    border-radius: var(--radius-md);
    margin: 12px 0;
}

.voter-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.voter-name {
    display: block;
    font-size: 1.5rem;
    color: var(--accent-cyan);
    margin-top: 4px;
    font-weight: 800;
}

.vote-hint {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.vote-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vote-option-btn {
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    font-family: inherit;
}

.vote-option-btn:hover {
    background: rgba(39, 230, 236, 0.08);
    border-color: var(--accent-cyan);
}

.vote-option-btn.selected {
    background: rgba(39, 230, 236, 0.15);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(39, 230, 236, 0.2);
}

.vote-confirm-box {
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--radius-md);
    background: rgba(39, 230, 236, 0.06);
    border: 1px solid rgba(39, 230, 236, 0.15);
}

.vote-confirm-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.vote-confirm-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent-cyan);
    margin-bottom: 12px;
}

.vote-confirm-btn {
    width: 100%;
}

.vote-results-box {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin: 12px 0;
    text-align: left;
}

.vote-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 4px;
}

.vote-row:last-child {
    margin-bottom: 0;
}

.vote-row-top {
    background: rgba(39, 230, 236, 0.08);
    border: 1px solid rgba(39, 230, 236, 0.15);
}

.vote-row-name {
    font-weight: 600;
}

.vote-row-count {
    color: var(--accent-cyan);
    font-weight: 700;
}

.vote-badge {
    display: inline-block;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 999px;
    margin-left: 4px;
}

.imposter-badge {
    background: rgba(178, 59, 43, 0.15);
    color: var(--accent-red);
}

.winner-banner {
    padding: 16px;
    border-radius: var(--radius-md);
    margin: 12px 0;
}

.winner-banner h2 {
    margin: 6px 0 4px;
    font-size: 1.15rem;
}

.winner-banner p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.winner-icon {
    font-size: 2rem;
    display: block;
}

.winner-civilians {
    background: rgba(50, 205, 50, 0.08);
    border: 1px solid rgba(50, 205, 50, 0.2);
}

.winner-imposters {
    background: rgba(178, 59, 43, 0.08);
    border: 1px solid rgba(178, 59, 43, 0.2);
}

.score-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 8px 0 12px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    font-weight: 700;
    font-size: 0.9rem;
}

.score-civilians {
    color: var(--accent-green);
}

.score-imposters {
    color: var(--accent-red);
}

.score-divider {
    color: var(--text-muted);
    opacity: 0.5;
}

.final-winner-banner {
    margin: 12px 0;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: rgba(39, 230, 236, 0.06);
    border: 1px solid rgba(39, 230, 236, 0.15);
}

.final-winner-banner.winner-civilians {
    background: rgba(50, 205, 50, 0.08);
    border-color: rgba(50, 205, 50, 0.2);
}

.final-winner-banner.winner-imposters {
    background: rgba(178, 59, 43, 0.08);
    border-color: rgba(178, 59, 43, 0.2);
}

/* =======================
   MODAL & MISC
   ======================= */
.online-leave-fab {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 50;
    background: rgba(255, 98, 0, 0.15);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}

.online-leave-fab:hover {
    background: rgba(255, 98, 0, 0.3);
    transform: scale(1.04);
}

.help-link {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 999px;
    transition: color var(--transition);
}

.help-link:hover {
    color: var(--accent-cyan);
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 100;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-soft);
    border: 1px solid var(--glass-border);
    padding: 24px;
    border-radius: var(--radius-lg);
    max-width: 360px;
    max-height: 85vh;
    overflow-y: auto;
    text-align: left;
}

.modal-content h2 {
    margin: 0 0 16px;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent-cyan);
}

.rules-text {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-main);
    margin: 0 0 16px;
}

.rules-text p {
    margin: 0 0 12px;
}

.mute-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background var(--transition);
}

.mute-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

.mute-btn.muted {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--accent-red);
}

/* =======================
   TOUCH & RESPONSIVE
   ======================= */
@media (hover: none) and (pointer: coarse) {

    .stepper button,
    .category-card,
    .btn,
    .settings-row--nav,
    .vote-option-btn {
        min-height: 44px;
    }

    .cover-layer {
        touch-action: manipulation;
    }
}

@media (max-width: 380px) {
    #game-container {
        padding: 20px 16px 24px;
        margin: 0 8px;
    }

    .card-container {
        height: 300px;
    }

    .secret-word {
        font-size: 1.75rem;
    }

    .stepper button {
        width: 36px;
        height: 36px;
    }
}

/* === SCOREBOARD & BADGES === */
.scoreboard-box {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sb-gamecount {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.sb-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.sb-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.sb-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sb-name {
    color: var(--text-main);
    font-weight: 700;
    font-size: 15px;
}

.sb-winrate {
    color: var(--accent-green);
    font-weight: 700;
    font-size: 14px;
}

.mvp-badge {
    display: block;
    font-size: 11px;
    color: var(--accent-yellow);
    font-weight: 500;
    margin-top: 4px;
}

.sb-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.sb-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    padding: 6px 4px;
}

.sb-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.sb-stat-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}

.sb-stat-win .sb-stat-value { color: var(--accent-green); }
.sb-stat-loss .sb-stat-value { color: var(--accent-red); }
.sb-stat-imp .sb-stat-value { color: var(--accent-cyan); }
.sb-stat-caught .sb-stat-value { color: var(--accent-blue); }

/* SVG icon replacements for emoji */
.cat-icon {
    display: inline-block;
    width: 1.1em;
    height: 1.1em;
    vertical-align: -0.2em;
    flex-shrink: 0;
}

.cover-icon .cat-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: block;
    margin: 0 auto 8px;
}

.winner-icon .cat-icon {
    width: 2rem;
    height: 2rem;
    display: block;
    margin: 0 auto;
}

.sb-detail { display: none; }
.sb-open .sb-detail { display: block; }
.sb-arrow { font-size: 14px; transition: transform 0.2s; color: #aaa; }
.sb-open .sb-arrow { transform: rotate(180deg); }
.sb-card-top { user-select: none; }

/* === result screen redesign === */
.result-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.result-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-cyan);
}
.winner-banner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin: 10px 0;
    gap: 2px;
}
.winner-eyebrow {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}
.winner-main {
    font-size: 1.15rem;
    font-weight: 700;
}
.winner-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 1px;
}
.vote-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.vote-row:last-child { border-bottom: none; }
.vote-row-left { flex: 1; min-width: 0; }
.vote-row-namerow {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}
.vote-row-name { font-size: 0.9rem; font-weight: 600; }
.vote-bar-bg {
    height: 3px;
    background: rgba(255,255,255,0.07);
    border-radius: 2px;
    overflow: hidden;
}
.vote-bar {
    height: 100%;
    border-radius: 2px;
    background: rgba(255,255,255,0.18);
    transition: width 0.5s ease;
}
.vote-bar-top { background: var(--accent-cyan); }
.vote-row-count {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-cyan);
    min-width: 18px;
    text-align: right;
}
.reveal-box {
    margin: 12px 0;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}
.reveal-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.reveal-cell {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}
.reveal-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.reveal-val {
    font-size: 0.95rem;
    font-weight: 700;
    text-align: right;
}
.result-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}
.result-actions .btn { flex: 1; }

/* =======================
   ONLINE MODE — MODE SELECT, LOBBY, JOIN
   ======================= */
.mode-select-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.mode-select-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    padding: 16px 18px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    color: var(--text-main);
    cursor: pointer;
    text-align: left;
    transition: border-color var(--transition), transform var(--transition);
    font-family: inherit;
}

.mode-select-btn:active {
    transform: scale(0.98);
}

.mode-select-btn--online {
    border-color: rgba(0, 144, 255, 0.25);
}

.mode-select-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.mode-select-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.mode-select-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.lobby-code-card {
    background: var(--bg-card);
    border: 1px solid rgba(0, 144, 255, 0.3);
    border-radius: var(--radius-md);
    padding: 20px 16px;
    text-align: center;
    margin-bottom: 12px;
}

.lobby-code-card--readonly {
    border-color: rgba(255, 255, 255, 0.08);
}

.lobby-code-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.lobby-code-value {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 0.25em;
    color: var(--accent-teal);
    margin-bottom: 12px;
}

.lobby-code-value--sm {
    font-size: 1.5rem;
    letter-spacing: 0.15em;
    margin-bottom: 0;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.lobby-nickname-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    padding: 8px 12px;
    min-width: 0;
}

.lobby-code-input {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
    text-align: center;
}

.settings-row--input {
    flex-wrap: wrap;
    gap: 8px;
}

.settings-row--input .row-label {
    width: 100%;
}

.settings-row--static {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.lobby-players-list {
    padding: 8px 12px 12px;
}

.lobby-player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    background: rgba(0, 0, 0, 0.15);
}

.lobby-player-host {
    border: 1px solid rgba(0, 144, 255, 0.25);
}

.lobby-player-name {
    font-size: 0.95rem;
    font-weight: 600;
}

.lobby-host-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-teal);
    background: rgba(0, 144, 255, 0.15);
    padding: 3px 8px;
    border-radius: 999px;
}

.lobby-empty {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    padding: 12px 0;
    margin: 0;
}

.lobby-wait-hint {
    text-align: center;
    margin-top: 16px;
}

.join-error-msg {
    color: var(--accent-red);
    font-size: 0.85rem;
    text-align: center;
    margin: 0 0 12px;
}

.online-wait-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 16px;
}

.online-role-card .online-word-reveal {
    margin: 16px 0;
}

.online-secret-word {
    font-size: 1.6rem;
    margin-top: 8px;
}

.host-vote-wait-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin: 16px 0;
    text-align: center;
}

#host-vote-wait {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.online-role-continue {
    margin-top: 8px;
}

.setup-screen--online-locked .stepper button {
    opacity: 0.35;
    pointer-events: none;
}

.setup-screen--online-locked .player-name-input {
    opacity: 0.7;
    pointer-events: none;
}

/* =======================
   LOBBY CHAT
   ======================= */
.lobby-chat {
    position: fixed;
    right: 12px;
    bottom: 12px;
    z-index: 900;
    font-family: 'MyanmarPixelSmooth', 'Noto Sans Myanmar', sans-serif;
}

.chat-toggle-btn {
    min-width: 72px;
    height: 48px;
    border-radius: 24px;
    border: 2px solid var(--glass-border);
    background: linear-gradient(145deg, rgba(255, 0, 212, 0.35), rgba(0, 144, 255, 0.35));
    color: var(--text-main);
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 0, 212, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 1.4rem;
    transition: transform var(--transition), box-shadow var(--transition);
}

.chat-toggle-label {
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
}

.chat-toggle-btn:active {
    transform: scale(0.95);
}

.lobby-chat--expanded .chat-toggle-btn {
    display: none;
}

.chat-panel {
    display: none;
    flex-direction: column;
    width: min(360px, calc(100vw - 24px));
    height: min(480px, calc(100dvh - 24px));
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.lobby-chat--expanded .chat-panel {
    display: flex;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0, 144, 255, 0.08);
}

.chat-title {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-teal);
}

.chat-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.chat-speaking-indicator {
    margin: 0;
    padding: 6px 12px;
    font-size: 0.75rem;
    color: var(--accent-green);
    background: rgba(0, 255, 179, 0.08);
    border-bottom: 1px solid rgba(0, 255, 179, 0.15);
}

.chat-error-msg {
    margin: 0;
    padding: 6px 12px;
    font-size: 0.75rem;
    color: var(--accent-red);
    background: rgba(255, 98, 0, 0.1);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    -webkit-user-select: text;
    user-select: text;
}

.chat-empty {
    margin: 0;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.8rem;
    padding: 24px 8px;
}

.chat-msg {
    max-width: 88%;
    align-self: flex-start;
}

.chat-msg--mine {
    align-self: flex-end;
}

.chat-msg-meta {
    display: flex;
    gap: 8px;
    align-items: baseline;
    margin-bottom: 2px;
}

.chat-msg--mine .chat-msg-meta {
    justify-content: flex-end;
}

.chat-msg-name {
    font-size: 0.7rem;
    color: var(--accent-teal);
    font-weight: 600;
}

.chat-msg--mine .chat-msg-name {
    color: var(--accent-cyan);
}

.chat-msg-time {
    font-size: 0.65rem;
    color: var(--text-dim);
}

.chat-msg-text {
    background: rgba(0, 144, 255, 0.12);
    border: 1px solid rgba(0, 144, 255, 0.2);
    border-radius: 10px 10px 10px 4px;
    padding: 6px 10px;
    font-size: 0.85rem;
    line-height: 1.4;
    font-family: system-ui, 'Noto Sans Myanmar', sans-serif;
    direction: ltr;
    unicode-bidi: plaintext;
    text-align: left;
    word-break: break-word;
    -webkit-user-select: text;
    user-select: text;
}

.chat-msg--mine .chat-msg-text {
    background: rgba(255, 0, 212, 0.15);
    border-color: rgba(255, 0, 212, 0.25);
    border-radius: 10px 10px 4px 10px;
}

.chat-text-form {
    display: flex;
    gap: 6px;
    padding: 10px 12px 8px;
    border-top: 1px solid var(--glass-border);
}

.chat-text-input {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: var(--bg-soft);
    color: var(--text-main);
    font-family: system-ui, 'Noto Sans Myanmar', sans-serif;
    font-size: 0.95rem;
    direction: ltr;
    unicode-bidi: plaintext;
    text-align: left;
    -webkit-user-select: text;
    user-select: text;
}

.chat-text-input:focus {
    outline: none;
    border-color: var(--accent-teal);
}

.chat-send-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    flex: 0 0 48px;
    padding: 0;
    font-size: 1rem;
}

.chat-voice-btn {
    margin: 0 12px 12px;
    min-height: 58px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: rgba(0, 255, 179, 0.1);
    color: var(--accent-green);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    transition: background var(--transition), border-color var(--transition);
    touch-action: none;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.chat-voice-btn--active,
.chat-voice-btn:active {
    background: rgba(0, 255, 179, 0.25);
    border-color: var(--accent-green);
    box-shadow: 0 0 12px rgba(0, 255, 179, 0.3);
}

.chat-voice-icon,
.chat-voice-copy {
    pointer-events: none;
}

.chat-voice-icon {
    font-size: 1.25rem;
}

.chat-voice-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-voice-copy strong {
    font-size: 0.86rem;
}

.chat-voice-copy span {
    color: var(--text-muted);
    font-size: 0.68rem;
}

@media (max-width: 380px) {
    .lobby-chat {
        right: 8px;
        bottom: 8px;
    }

    .chat-panel {
        width: calc(100vw - 16px);
    }
}

.chat-status {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 0.67rem;
}