/* === Base Reset & Variables === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-deep: #0a0a0f;
    --bg-surface: #12121a;
    --bg-elevated: #1a1a26;
    --bg-input: #0e0e16;
    --text-primary: #d4d0c8;
    --text-dim: #7a7670;
    --text-bright: #e8e4dc;
    --violet: #8b5cf6;
    --violet-dim: #6d28d9;
    --violet-glow: rgba(139, 92, 246, 0.15);
    --gold: #f5c542;
    --gold-dim: rgba(245, 197, 66, 0.2);
    --magenta: #e040a0;
    --magenta-dim: rgba(224, 64, 160, 0.2);
    --green: #34d399;
    --green-dim: rgba(52, 211, 153, 0.15);
    --red: #f87171;
    --red-dim: rgba(248, 113, 113, 0.15);
    --cyan: #67e8f9;
    --border: #2a2a38;
    --font-narration: 'Crimson Text', Georgia, serif;
    --font-ui: 'Inter', -apple-system, sans-serif;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--bg-deep);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

/* === Screens === */
.screen {
    display: none;
    width: 100%;
    height: 100%;
}
.screen.active { display: flex; }

/* === Login Screen === */
#login-screen {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #0a0a14 0%, #0f0a1a 50%, #0a0a0f 100%);
}

#login-screen .setup-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* === Setup Screen === */
#setup-screen {
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    padding: 2rem 1rem calc(2rem + var(--safe-bottom));
    background: linear-gradient(180deg, #0a0a14 0%, #0f0a1a 50%, #0a0a0f 100%);
}

.setup-container {
    max-width: 500px;
    width: 100%;
}

.title-block {
    text-align: center;
    margin-bottom: 2.5rem;
    padding: 2rem 0;
}

.title-eldritch {
    font-family: var(--font-narration);
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: 0.4em;
    color: var(--text-bright);
    margin-bottom: 0.2rem;
}

.title-investigation {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 300;
    letter-spacing: 0.6em;
    color: var(--violet);
    text-transform: uppercase;
}

.setup-section {
    margin-bottom: 1.8rem;
}

.setup-section h3 {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 0.8rem;
}

.option-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.9rem 1rem;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.option-card:hover {
    border-color: var(--violet-dim);
    background: var(--bg-elevated);
}

.option-card.selected {
    border-color: var(--violet);
    background: var(--violet-glow);
}

.option-card .option-title {
    font-weight: 500;
    color: var(--text-bright);
    font-size: 0.95rem;
}

.option-card .option-desc {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 0.2rem;
}

.character-preview {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-dim);
    margin-bottom: 0.8rem;
}

.character-name-edit {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.character-name-edit label {
    font-size: 0.85rem;
    color: var(--text-dim);
    white-space: nowrap;
}

.character-name-edit input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.7rem;
    color: var(--text-bright);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    outline: none;
}

.character-name-edit input:focus {
    border-color: var(--violet-dim);
}

.btn-start {
    display: block;
    width: 100%;
    margin-top: 2rem;
    padding: 1rem;
    background: var(--violet-dim);
    color: var(--text-bright);
    border: none;
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

.btn-start:hover:not(:disabled) {
    background: var(--violet);
}

.btn-start:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* === Game Screen === */
#game-screen {
    flex-direction: column;
    height: 100dvh;
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    min-height: 44px;
    flex-shrink: 0;
}

.header-title {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    color: var(--text-dim);
}

.header-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.3rem;
}

/* === Location Bar === */
.location-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.location-bar::-webkit-scrollbar { display: none; }

.location-current {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-bright);
    white-space: nowrap;
    flex-shrink: 0;
}

.location-connections {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.location-pill {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.2rem 0.6rem;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    color: var(--text-dim);
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.2s, color 0.2s;
}

.location-pill:active {
    border-color: var(--violet);
    color: var(--violet);
    background: var(--violet-glow);
}

/* === Vitals Bar === */
.vitals-bar {
    display: flex;
    gap: 2px;
    padding: 0 0.8rem;
    background: var(--bg-surface);
    flex-shrink: 0;
    cursor: pointer;
    padding-bottom: 3px;
}

.vital-track {
    flex: 1;
    height: 3px;
    background: var(--bg-elevated);
    border-radius: 2px;
    overflow: hidden;
}

.vital-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}

.composure-fill {
    background: var(--violet);
}

.vitality-fill {
    background: var(--red);
}

/* === Thinking Indicator === */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0;
}

.thinking-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--violet);
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1); }
}

.thinking-text {
    font-family: var(--font-narration);
    font-style: italic;
    font-size: 0.9rem;
    color: var(--text-dim);
}

/* === Narration Zone === */
.narration-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

.narration-zone {
    height: 100%;
    overflow-y: auto;
    padding: 1.2rem 1rem;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.scroll-down-btn {
    position: absolute;
    bottom: 0.8rem;
    right: 0.8rem;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.95;
    transition: opacity 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.scroll-down-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.scroll-down-btn.hidden {
    display: none;
}

#narration-content {
    font-family: var(--font-narration);
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-primary);
}

#narration-content p {
    margin-bottom: 1em;
}

#narration-content em {
    color: var(--text-bright);
}

#narration-content strong {
    color: var(--text-bright);
    font-weight: 600;
}

#narration-content blockquote {
    border-left: 3px solid var(--violet-dim);
    padding-left: 1em;
    margin: 1em 0;
    color: var(--text-dim);
    font-style: italic;
}

.player-message {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--violet);
    padding: 0.6rem 1rem;
    margin: 1em 0;
    border-left: 3px solid var(--violet-dim);
    background: var(--violet-glow);
    border-radius: 0 6px 6px 0;
}

.streaming-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: var(--violet);
    animation: blink 0.8s infinite;
    vertical-align: text-bottom;
    margin-left: 2px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* === Event Zone === */
.event-zone {
    flex-shrink: 0;
    padding: 0 0.8rem;
}

.event-card {
    margin: 0.4rem 0;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    animation: slideIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.event-card.skill-check {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}

.event-card.skill-check.triumph {
    border-color: var(--gold);
    background: var(--gold-dim);
}

.event-card.skill-check.success,
.event-card.skill-check.exceptional,
.event-card.skill-check.solid {
    border-color: var(--green);
    background: var(--green-dim);
}

.event-card.skill-check.failure {
    border-color: var(--red);
    background: var(--red-dim);
}

.event-card.skill-check.catastrophe {
    border-color: var(--magenta);
    background: var(--magenta-dim);
}

.event-card.composure-check {
    background: var(--bg-elevated);
    border: 1px solid var(--violet-dim);
}

.event-card.location-change {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-bright);
}

.event-card.clue {
    background: var(--gold-dim);
    border: 1px solid rgba(245, 197, 66, 0.3);
    color: var(--gold);
}

.dice-icon {
    font-size: 1.2rem;
    animation: diceRoll 0.6s ease-out;
}

@keyframes diceRoll {
    0% { transform: rotate(0deg) scale(0.5); opacity: 0; }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); opacity: 1; }
}

.event-result {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.event-detail {
    color: var(--text-dim);
    font-size: 0.8rem;
}

/* === Suggestions Zone === */
.suggestions-zone {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    flex-shrink: 0;
}

.suggestion-chip {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0.4rem 0.8rem;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    min-height: 36px;
    display: flex;
    align-items: center;
    transition: background 0.15s, border-color 0.15s;
}

.suggestion-chip:active {
    background: var(--violet-glow);
    border-color: var(--violet);
    color: var(--violet);
}

/* === Input Zone === */
.input-zone {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

#player-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.7rem 1rem;
    color: var(--text-bright);
    font-family: var(--font-ui);
    font-size: 16px;
    outline: none;
}

#player-input:focus {
    border-color: var(--violet-dim);
}

#player-input:disabled {
    opacity: 0.5;
}

.btn-send {
    width: 44px;
    height: 44px;
    background: var(--violet-dim);
    border: none;
    border-radius: 8px;
    color: var(--text-bright);
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.btn-send:hover:not(:disabled) {
    background: var(--violet);
}

.btn-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* === Autocomplete Popup === */
.autocomplete-popup {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    max-height: 220px;
    overflow-y: auto;
    z-index: 50;
    margin-bottom: 2px;
}

.ac-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    min-height: 44px;
    transition: background 0.1s;
}

.ac-item.selected {
    background: var(--violet-glow);
}

.ac-prefix {
    color: var(--violet);
    font-weight: 700;
    font-size: 0.85rem;
}

.ac-label {
    color: var(--text-bright);
    font-size: 0.85rem;
    flex: 1;
}

.ac-detail {
    color: var(--text-dim);
    font-size: 0.75rem;
}

/* === Tab Bar === */
.tab-bar {
    display: flex;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-bottom);
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    padding: 0.7rem 0;
    background: none;
    border: none;
    color: var(--text-dim);
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: color 0.2s;
    text-transform: uppercase;
}

.tab-btn:hover, .tab-btn.active {
    color: var(--violet);
}

/* === Slide-up Panels === */
.panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

.slide-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 70vh;
    background: var(--bg-surface);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.25s ease-out;
    padding-bottom: var(--safe-bottom);
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.panel-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-bright);
}

.panel-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.panel-body {
    padding: 1rem 1.2rem;
    overflow-y: auto;
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.6;
}

.panel-body .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border);
}

.panel-body .stat-label {
    color: var(--text-dim);
}

.panel-body .stat-value {
    color: var(--text-bright);
    font-weight: 500;
}

.panel-body .section-title {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--violet);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

/* === Character Sheet (RPG card) === */
.char-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.char-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--violet-dim);
    color: var(--text-bright);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.char-identity {
    flex: 1;
    min-width: 0;
}

.char-name {
    font-weight: 600;
    color: var(--text-bright);
    font-size: 1rem;
}

.char-occupation {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.char-difficulty {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    flex-shrink: 0;
}

.char-difficulty.normal {
    color: var(--green);
    background: var(--green-dim);
}

.char-difficulty.hard {
    color: var(--red);
    background: var(--red-dim);
}

/* === Character Gauges === */
.char-gauges {
    margin-bottom: 1rem;
}

.char-gauge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.gauge-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    width: 70px;
    flex-shrink: 0;
}

.gauge-track {
    flex: 1;
    height: 6px;
    background: var(--bg-deep);
    border-radius: 3px;
    overflow: hidden;
}

.gauge-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.gauge-fill.vitality { background: var(--red); }
.gauge-fill.composure { background: var(--violet); }
.gauge-fill.luck { background: var(--gold); }

.gauge-value {
    font-size: 0.75rem;
    color: var(--text-bright);
    font-weight: 500;
    width: 36px;
    text-align: right;
    flex-shrink: 0;
}

/* === Attributes Grid === */
.attr-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.attr-cell {
    text-align: center;
    padding: 0.5rem 0.3rem;
    background: var(--bg-elevated);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.attr-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-bright);
}

.attr-name {
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.1rem;
}

/* === Skills Grid === */
.skills-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem 0.8rem;
}

.skill-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0;
}

.skill-name {
    font-size: 0.75rem;
    color: var(--text-dim);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.skill-bar {
    width: 40px;
    height: 4px;
    background: var(--bg-deep);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}

.skill-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

.skill-fill.low { background: var(--red); }
.skill-fill.neutral { background: var(--text-dim); }
.skill-fill.good { background: var(--green); }
.skill-fill.excellent { background: var(--violet); }

.skill-val {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-bright);
    width: 22px;
    text-align: right;
    flex-shrink: 0;
}

/* === Clue Items (investigation notes) === */
.panel-body .clue-item {
    background: var(--bg-elevated);
    border-left: 3px solid var(--gold);
    border-radius: 0 4px 4px 0;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.5rem;
    font-style: italic;
    color: var(--text-primary);
    font-family: var(--font-narration);
    font-size: 0.9rem;
    line-height: 1.5;
}

.panel-body .clue-item::before {
    content: none;
}

/* === Inventory Grid === */
.inv-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
}

.inv-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.6rem 0.4rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    text-align: center;
}

.inv-icon {
    font-size: 1.4rem;
}

.inv-name {
    font-size: 0.7rem;
    color: var(--text-primary);
    line-height: 1.3;
    word-break: break-word;
}

/* === Document Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.document-modal {
    background: #1c1a14;
    border: 1px solid #3a3520;
    border-radius: 4px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.5rem;
    box-shadow: 0 0 60px rgba(245, 197, 66, 0.08);
}

.document-title {
    font-family: var(--font-narration);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gold);
    text-align: center;
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid #3a3520;
}

.document-content {
    font-family: var(--font-narration);
    font-size: 0.95rem;
    line-height: 1.7;
    color: #c4b99a;
    white-space: pre-wrap;
}

.document-close {
    display: block;
    margin: 1.2rem auto 0;
    padding: 0.5rem 2rem;
    background: transparent;
    border: 1px solid #3a3520;
    border-radius: 4px;
    color: var(--text-dim);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    cursor: pointer;
}

.document-close:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* === Menu Modal === */
.menu-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 300px;
    width: 100%;
    text-align: center;
}

.menu-modal h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 1rem;
}

.menu-item {
    display: block;
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.menu-item:hover {
    border-color: var(--violet-dim);
}

.menu-close-btn {
    color: var(--text-dim);
    background: transparent;
    border-color: transparent;
}

/* === Session End Banner === */
.session-end-banner {
    text-align: center;
    padding: 1.5rem 1rem;
    margin: 2rem 0 1rem;
    border-radius: 8px;
    font-family: var(--font-narration);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.session-end-banner .end-icon {
    display: block;
    font-size: 2rem;
    margin-bottom: 0.4rem;
}

.session-end-banner.victory {
    color: var(--gold);
    background: var(--gold-dim);
    border: 1px solid rgba(245, 197, 66, 0.3);
}

.session-end-banner.defeat {
    color: var(--red);
    background: var(--red-dim);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

/* === Font Size Control === */
.font-size-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    padding: 0.8rem 0;
}

.font-size-btn {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-bright);
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.font-size-btn:active {
    border-color: var(--violet);
    background: var(--violet-glow);
}

.font-size-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 3rem;
    text-align: center;
}

/* === Loading Spinner === */
.loading-dots::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* === Login === */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: 100%;
    max-width: 280px;
}

.login-form input[type="password"] {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    color: var(--text-bright);
    font-family: var(--font-ui);
    font-size: 16px;
    outline: none;
    text-align: center;
}

.login-form input[type="password"]:focus {
    border-color: var(--violet-dim);
}

.login-error {
    text-align: center;
    color: var(--red);
    font-size: 0.85rem;
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* === Responsive for larger screens === */
@media (min-width: 768px) {
    #setup-screen {
        justify-content: center;
    }

    .narration-zone {
        padding: 1.5rem 2rem;
    }

    #narration-content {
        max-width: 640px;
        margin: 0 auto;
    }
}

/* === Phone breakpoint (480px) === */
@media (max-width: 480px) {
    html, body {
        font-size: 14px;
    }

    .header-title {
        letter-spacing: 0.12em;
        font-size: 0.65rem;
    }

    #narration-content {
        font-size: 1rem;
        line-height: 1.6;
    }

    .event-card {
        font-size: 0.8rem;
        padding: 0.5rem 0.6rem;
    }

    .event-detail {
        font-size: 0.72rem;
    }

    .slide-panel {
        max-height: 60vh;
    }

    .narration-zone {
        padding: 0.8rem 0.8rem;
    }

    .setup-container {
        padding: 0 0.2rem;
    }

    .title-block {
        margin-bottom: 1.5rem;
        padding: 1rem 0;
    }

    .title-eldritch {
        font-size: 1.8rem;
        letter-spacing: 0.25em;
    }

    .title-investigation {
        font-size: 0.7rem;
        letter-spacing: 0.4em;
    }

    .setup-section {
        margin-bottom: 1.2rem;
    }

    .option-card {
        padding: 0.7rem 0.8rem;
    }

    /* Inventory 2 columns on phone */
    .inv-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Attributes 2 columns on phone */
    .attr-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Skills single column on phone */
    .skills-grid {
        grid-template-columns: 1fr;
    }

    .suggestion-chip {
        font-size: 0.75rem;
        padding: 0.35rem 0.7rem;
    }

    .location-bar {
        padding: 0.3rem 0.6rem;
    }

    .player-message {
        font-size: 0.82rem;
        padding: 0.5rem 0.8rem;
    }
}

/* === Small phone breakpoint (375px) === */
@media (max-width: 375px) {
    .slide-panel {
        max-height: 55vh;
    }

    .title-eldritch {
        font-size: 1.5rem;
        letter-spacing: 0.2em;
    }

    .title-investigation {
        font-size: 0.65rem;
        letter-spacing: 0.3em;
    }

    .narration-zone {
        padding: 0.6rem;
    }

    .input-zone {
        padding: 0.5rem 0.6rem;
    }

    .location-pill {
        font-size: 0.65rem;
        padding: 0.15rem 0.5rem;
    }
}
