/**
 * The Velvet Parlor - Styles v0.6
 * Visual novel style with cutscenes and portrait-based interaction
 */

/* ============================================
   CSS Variables
   ============================================ */
:root {
    --bg-dark: #1a0f1f;
    --bg-card: #261625;
    --bg-panel: #120a12;
    --text-primary: #f2e8dc;
    --text-secondary: #b5a89e;
    --text-muted: #6d5866;
    --accent-gold: #c9a227;
    --accent-purple: #8b4a5e;

    /* Layout dimensions based on 1920x1080 reference */
    /* Golden ratio split: 733px left (portrait), 1187px right (interaction) */
    --portrait-area-ratio: 0.382;  /* 733/1920 */
    --interaction-area-ratio: 0.618;  /* 1187/1920 */
    --portrait-center-offset: 663px;  /* Portrait center from left edge */

    /* Card dimensions */
    --card-width-large: 180px;
    --card-height-large: 316px;
    --card-width-medium: 140px;
    --card-height-medium: 246px;
    --card-width-small: 100px;
    --card-height-small: 176px;

    /* Typography */
    --font-display: 'Cinzel', serif;
    --font-body: 'Crimson Text', Georgia, serif;
}

/* ============================================
   Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

html {
    font-size: 18px;
}

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS Safari fix */
    line-height: 1.6;
    overflow: hidden;
    /* Prevent pull-to-refresh and bounce on iOS */
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

/* iOS safe area support */
@supports (padding: env(safe-area-inset-bottom)) {
    .client-welcome-btn,
    .btn-primary,
    .btn-secondary,
    .btn-ghost {
        padding-bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
    }

    .reading-interaction-area {
        padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    }
}

#app {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* ============================================
   Screen Management
   ============================================ */
.screen {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.screen.active {
    display: flex;
}

/* ============================================
   Title Screen
   ============================================ */
#title-screen {
    background: var(--bg-dark);
}

/* Full-bleed image */
.title-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    filter: brightness(0.4) saturate(0.8);
    transition: filter 0.5s ease-out;
}

.title-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(26, 15, 31, 0.6) 70%, rgba(26, 15, 31, 0.9) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Letterbox bars - absolute positioned, start off-screen */
.title-letterbox {
    position: absolute;
    left: 0;
    width: 100%;
    background: var(--bg-dark);
    z-index: 2;
}

.title-letterbox.top {
    top: 0;
    transform: translateY(-100%);
    /* Height set dynamically */
}

.title-letterbox.bottom {
    bottom: 0;
    transform: translateY(100%);
    /* Height set dynamically */
}

.title-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    animation: titleFadeIn 1.5s ease-out;
}

@keyframes titleFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-title {
    font-family: var(--font-display);
    font-size: 4rem;
    color: var(--accent-gold);
    text-shadow:
        0 0 40px rgba(201, 162, 39, 0.5),
        0 0 80px rgba(201, 162, 39, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.8);
    margin-bottom: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 3.5rem;
    font-style: italic;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

#title-screen .btn-primary {
    animation: buttonPulse 3s ease-in-out infinite;
}

#feedback-btn {
    margin-top: 0.75rem;
}

#rewatch-intro-btn,
#journal-btn {
    margin-top: 0.75rem;
}

@keyframes buttonPulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(201, 162, 39, 0.3);
    }
    50% {
        box-shadow: 0 4px 25px rgba(201, 162, 39, 0.5);
    }
}

#memorial-btn {
    margin-top: 0.75rem;
}

.title-credit {
    margin-top: 3rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 1);
}

.title-content-warning {
    margin-top: 2rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    max-width: 400px;
    line-height: 1.5;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 1);
}

/* Title screen transition to intro */
#title-screen.transitioning .title-content {
    animation: titleFadeOut 0.6s ease-in forwards;
}

/* Title vignette stays visible during transition (matches cutscene vignette) */

#title-screen.transitioning .title-bg {
    animation: bgToLetterbox 0.6s ease-in-out forwards;
}

#title-screen.transitioning .title-letterbox {
    transform: translateY(0);
    transition: transform 0.5s ease-out;
}

/* Image and vignette animate to match cutscene positioning */

@keyframes titleFadeOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

@keyframes bgToLetterbox {
    to {
        filter: brightness(1) saturate(1);
    }
}


/* ============================================
   Buttons
   ============================================ */
.btn-primary {
    font-family: var(--font-display);
    font-size: 1.1rem;
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, var(--accent-gold), #d4a931);
    color: var(--bg-dark);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(201, 162, 39, 0.4);
}

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

.btn-secondary {
    font-family: var(--font-display);
    font-size: 1rem;
    padding: 0.85rem 2rem;
    background: transparent;
    color: var(--accent-gold);
    border: 2px solid var(--accent-gold);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.btn-secondary:hover {
    background: rgba(201, 162, 39, 0.2);
    transform: translateY(-2px);
}

.btn-ghost {
    font-family: var(--font-display);
    font-size: 1rem;
    padding: 0.85rem 2rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* ============================================
   Cutscene Screen
   ============================================ */
#cutscene-screen {
    background: var(--bg-dark);
}

/* Full-bleed image */
.cutscene-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.cutscene-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.cutscene-image-overlay.visible {
    opacity: 1;
}

/* Token overlays for closing cutscene */
.closing-tokens {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.closing-tokens.visible {
    opacity: 1;
}

.closing-token {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.cutscene-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(26, 15, 31, 0.6) 70%, rgba(26, 15, 31, 0.9) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Letterbox bars - absolute positioned overlays */
.cutscene-letterbox {
    position: absolute;
    left: 0;
    width: 100%;
    background: var(--bg-dark);
    z-index: 2;
}

.cutscene-letterbox.top {
    top: 0;
    /* Height set dynamically */
}

.cutscene-letterbox.bottom {
    bottom: 0;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 1.5rem 3rem;
    box-sizing: border-box;
    /* Height set dynamically */
}

.cutscene-text {
    font-family: var(--font-body);
    font-size: 1.3rem;
    color: var(--text-primary);
    text-align: left;
    max-width: none;  /* Allow full width */
    width: 100%;
    line-height: 1.6;
    min-height: 4em;
}

/* ============================================
   Parlor Screen (between clients)
   ============================================ */
#parlor-screen {
    background: var(--bg-dark);
}

.parlor-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.parlor-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.parlor-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.parlor-image-overlay.visible {
    opacity: 1;
}

/* Pip the cat - transparent overlay, clickable via canvas hit detection */
.parlor-cat {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    pointer-events: none;
    display: none;
}

.parlor-cat.visible {
    display: block;
}

.parlor-buttons {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 2;
    transition: opacity 0.4s ease;
}

.parlor-btn {
    font-size: 0.85rem;
    padding: 0.6rem 1.4rem;
    text-align: center;
}

#parlor-await-btn.nudge {
    animation: gentle-nudge 0.6s ease;
}

@keyframes gentle-nudge {
    0%, 100% { transform: rotate(0deg); }
    20%      { transform: rotate(-1.5deg); }
    40%      { transform: rotate(1.5deg); }
    60%      { transform: rotate(-0.75deg); }
    80%      { transform: rotate(0.75deg); }
}

.parlor-text {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    max-width: 40%;
    font-size: 1.1rem;
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.6;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 1);
    z-index: 2;
    transition: opacity 0.4s ease;
}

/* ============================================
   Tea Ritual (Parlor Hub)
   ============================================ */
.parlor-tea {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 3;
    max-width: 540px;
    width: 90%;
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.parlor-tea.visible {
    opacity: 1;
}

.parlor-tea-prompt {
    font-size: 1.15rem;
    color: var(--text-primary);
    font-style: italic;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 1);
    margin-bottom: 1.2rem;
    transition: opacity 0.3s ease;
}

.parlor-tea-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.parlor-tea-ingredient {
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 0.5rem 1.1rem;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    opacity: 0;
    animation: teaIngredientIn 0.35s ease both;
}

@keyframes teaIngredientIn {
    from { opacity: 0; transform: translateY(8px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.parlor-tea-ingredient:hover:not(.selected):not(.faded) {
    background: rgba(201, 162, 39, 0.2);
    border-color: rgba(201, 162, 39, 0.5);
    transform: translateY(-2px);
}

.parlor-tea-ingredient.selected {
    background: rgba(201, 162, 39, 0.25);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(201, 162, 39, 0.3);
    cursor: default;
}

.parlor-tea-ingredient.faded {
    opacity: 0.2;
    pointer-events: none;
    transform: scale(0.95);
}

.parlor-tea-result {
    margin-top: 0.8rem;
}

.parlor-tea-comment {
    font-size: 1rem;
    color: var(--text-primary);
    font-style: italic;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 1);
    margin-top: 0.5rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.parlor-tea-comment.visible {
    opacity: 1;
    transform: translateY(0);
}

.parlor-tea-name {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-style: italic;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 1);
    margin-top: 1rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.parlor-tea-name.visible {
    opacity: 1;
    transform: translateY(0);
}

.parlor-tea-name em {
    font-style: normal;
    font-family: var(--font-display);
    color: var(--accent-gold);
    text-shadow: 0 0 15px rgba(201, 162, 39, 0.4), 0 2px 8px rgba(0, 0, 0, 1);
    letter-spacing: 0.05em;
}

.parlor-tea-back {
    margin-top: 1.5rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.parlor-tea-back.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Client Description Screen
   ============================================ */
#client-screen {
    background: var(--bg-dark);
}

.client-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.client-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.client-portrait {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.client-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(26, 15, 31, 0.6) 70%, rgba(26, 15, 31, 0.9) 100%);
    pointer-events: none;
    z-index: 2;
}

.client-info {
    position: absolute;
    bottom: 60px;
    left: 60px;
    max-width: 500px;
    z-index: 3;
}

.client-name {
    font-family: var(--font-display);
    font-size: 3rem;
    color: var(--text-primary);
    text-shadow: 0 0 12px rgba(0, 0, 0, 0.95), 0 2px 6px rgba(0, 0, 0, 0.9);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.client-description {
    font-family: var(--font-body);
    font-size: 1.2rem;
    color: var(--text-secondary);
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.95), 0 2px 6px rgba(0, 0, 0, 0.9);
    line-height: 1.5;
}

.client-welcome-btn {
    position: absolute;
    bottom: 60px;
    right: 60px;
    font-family: var(--font-display);
    font-size: 1.2rem;
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, var(--accent-gold), #d4a931);
    color: var(--bg-dark);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    z-index: 3;
    opacity: 0;
    transform: translateY(10px);
}

.client-welcome-btn.visible {
    opacity: 1;
    transform: translateY(0);
}

.client-welcome-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(201, 162, 39, 0.4);
}

/* ============================================
   Reading Screen (main gameplay)
   ============================================ */
#reading-screen {
    background: var(--bg-dark);
}

.reading-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.reading-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(1);
    transition: filter 0.6s ease-in-out;
}

.reading-bg.dimmed {
    filter: brightness(0.2);
}

.reading-portrait {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    transition: left 0.6s ease-in-out, filter 0.6s ease-in-out;
}

.reading-portrait.shifted {
    left: -250px;
    filter: brightness(0.5);
}

.reading-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(26, 15, 31, 0.6) 70%, rgba(26, 15, 31, 0.9) 100%);
    pointer-events: none;
    z-index: 2;
}

.reading-info {
    position: absolute;
    bottom: 60px;
    left: 60px;
    max-width: 400px;
    z-index: 3;
}

.reading-client-name {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--text-primary);
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color 0.6s ease-in-out;
}

.reading-client-name.muted {
    color: #afa79d;
}

.reading-client-description {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-secondary);
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8);
    line-height: 1.4;
    transition: color 0.6s ease-in-out, opacity 0.6s ease-in-out;
}

.reading-client-description.muted {
    color: #afa79d;
    opacity: 0.7;
}

/* Interaction area - positioned in the right portion (golden ratio) */
.reading-interaction-area {
    position: absolute;
    top: 0;
    /* Golden ratio: 733px on 1920 = 38.2% from left */
    left: 38.2%;
    right: 0;
    height: 100%;
    padding: 40px 60px;
    display: flex;
    flex-direction: column;
    z-index: 3;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Flexible vertical layout for all reading phases */
.reading-area,
.probe-area,
.draw-area {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.reading-area .spread-area,
.probe-area .spread-area,
.draw-area .spread-area {
    flex: 0 0 auto;
}

.reading-area .interaction-bottom,
.probe-area .interaction-bottom {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow-y: auto;
}

/* Greeting phase */
.interaction-greeting {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
    height: 100%;
}

.interaction-header {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
}

.interaction-subheader {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 1rem;
}

.interaction-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-right: 8px;  /* Accommodate button translateX on hover */
}

/* Choice Buttons */
.choice-btn {
    font-family: var(--font-body);
    font-size: 1.1rem;
    padding: 0.7rem 1.5rem;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
    line-height: 1.4;
    backdrop-filter: blur(4px);
}

.choice-btn:hover:not(:disabled):not(.selected):not(.faded),
.choice-btn.highlight-temp {
    background: rgba(201, 162, 39, 0.2);
    border-color: rgba(201, 162, 39, 0.5);
    transform: translateX(4px);
}

.choice-btn:disabled {
    cursor: default;
}

.choice-btn.selected {
    background: rgba(201, 162, 39, 0.25);
    border-color: var(--accent-gold);
}

.choice-btn.faded {
    opacity: 0.5;
    pointer-events: none;
    transition: all 0.25s ease;
}

.choice-btn .choice-text {
    font-style: italic;
}

/* Response exchange area */
.exchange-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
    animation: fadeSlideIn 0.4s ease;
}

.exchange-you,
.exchange-them {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    max-width: 85%;
    line-height: 1.5;
    backdrop-filter: blur(4px);
}

.exchange-you {
    background: rgba(201, 162, 39, 0.2);
    border: 1px solid rgba(201, 162, 39, 0.35);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    font-style: italic;
    color: var(--text-primary);
}

.exchange-them {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    color: var(--text-secondary);
    animation: fadeSlideIn 0.4s ease 0.2s both;
}

.continue-btn-container {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

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

/* ============================================
   Farewell Phase Styles
   ============================================ */

/* Card spread fade out animation */
.spread-area.fading-out {
    animation: cardsFadeOut 0.7s ease forwards;
}

@keyframes cardsFadeOut {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.farewell-area {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 2rem;
}

.farewell-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    max-width: 600px;
    animation: fadeSlideIn 0.6s ease;
}

.farewell-header {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
    text-align: center;
}

.farewell-reflection {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem 2rem;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    backdrop-filter: blur(4px);
    animation: fadeSlideIn 0.5s ease 0.3s both;
}

.reflection-text {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 1.15rem;
    line-height: 1.7;
    text-align: center;
}

#farewell-btn {
    animation: fadeSlideIn 0.4s ease 0.6s both;
}

/* Card spread area - unified for all phases */
.spread-area {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 1.5rem;
    overflow: visible;
}

.spread-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.3s ease, opacity 0.3s ease;
    will-change: transform, opacity;
    /* Fixed width to prevent jumping when meanings appear */
    width: 200px;
}

.spread-card.inactive {
    opacity: 0.5;
    transform: scale(0.95);
}

.spread-card.inactive .position-label,
.spread-card.inactive .card-name {
    color: var(--text-muted);
}

.spread-card.active {
    animation: cardActivate 0.3s ease forwards;
}

@keyframes cardActivate {
    from {
        opacity: 0.5;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.spread-card .position-label {
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

.spread-card.active .position-label {
    color: var(--accent-gold);
}

/* Card frame - contains either placeholder or revealed card */
.spread-card .card-frame {
    width: var(--card-width-large);
    height: var(--card-height-large);
    border-radius: 6px;
    border: 2px solid var(--text-muted);
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
}

.spread-card.unrevealed .card-frame {
    border-style: dashed;
    border-color: rgba(201, 162, 39, 0.25);
}

/* Only animate when explicitly marked as just-revealed */
.spread-card.just-revealed .card-frame {
    animation: cardReveal 0.5s ease;
}

.spread-card.active .card-frame {
    border-color: var(--accent-gold);
    box-shadow: 0 0 20px rgba(201, 162, 39, 0.4);
}

.spread-card .card-placeholder {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--text-muted);
    opacity: 0.3;
}

.spread-card .card-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

.spread-card .card-name {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    text-align: center;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    min-height: 1.2em;
    white-space: nowrap;
}

.spread-card.active .card-name {
    color: var(--accent-gold);
}

.spread-card .card-meanings {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.5rem;
    width: 100%;
    /* Reserve space for 3 meaning tags to prevent layout jump */
    min-height: calc(3 * (1.4em + 0.6rem) + 2 * 0.3rem);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.spread-card .card-meanings.visible {
    opacity: 1;
}

.meaning-tag {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    background: rgba(38, 22, 37, 0.95);
    border-radius: 8px;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    transition: background 0.4s ease, color 0.4s ease;
}

.meaning-tag.selected {
    background: rgba(201, 162, 39, 0.3);
    color: var(--accent-gold);
}

/* Card drawing phase */
.draw-area {
    align-items: center;
}

.draw-area .draw-btn {
    margin-top: auto;
    margin-bottom: 2rem;
}

@keyframes cardReveal {
    0% { transform: scale(0.8) rotateY(90deg); opacity: 0; }
    100% { transform: scale(1) rotateY(0); opacity: 1; }
}

.draw-btn {
    font-family: var(--font-display);
    font-size: 1rem;
    padding: 1rem 2rem;
    background: transparent;
    color: var(--accent-gold);
    border: 2px solid var(--accent-gold);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    animation: pulseGlow 2s ease-in-out infinite;
}

.draw-btn:hover:not(:disabled) {
    background: rgba(201, 162, 39, 0.2);
    transform: translateY(-2px);
    animation: none;
    box-shadow: 0 0 20px rgba(201, 162, 39, 0.4);
}

.draw-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    animation: none;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(201, 162, 39, 0.2);
    }
    50% {
        box-shadow: 0 0 20px rgba(201, 162, 39, 0.5), 0 0 30px rgba(201, 162, 39, 0.3);
    }
}

/* Probe phase */
.probe-area {
    display: flex;
    flex-direction: column;
}

.probe-header {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
}

.probe-round {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* ============================================
   Closing Screen (reading complete)
   ============================================ */
#closing-screen {
    background: var(--bg-dark);
}

.closing-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.closing-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.closing-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 20%, rgba(26, 15, 31, 0.5) 60%, rgba(26, 15, 31, 0.85) 100%);
    pointer-events: none;
    z-index: 1;
}

.closing-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem;
}

.closing-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--accent-gold);
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
    margin-bottom: 1rem;
}

.closing-subtitle {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    font-style: italic;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8);
}

/* ============================================
   Epilogue Screen (unfolding)
   ============================================ */
#epilogue-screen {
    background: var(--bg-dark);
    overflow-y: auto;
}

#epilogue-screen.active {
    display: block;
}

.epilogue-container {
    width: 100%;
    min-height: 100%;
    padding: 40px 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.epilogue-title {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 2rem;
}

/* Portrait and text as a horizontal unit */
.epilogue-content {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 2rem;
}

.epilogue-portrait-container {
    flex-shrink: 0;
    width: 200px;
    height: 294px;
    border: 3px solid var(--accent-gold);
    border-radius: 8px;
    overflow: hidden;
    transform: rotate(-3deg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    background-image: url('../images/backgrounds/BG clients.png');
    background-size: cover;
    background-position: 20% center;
}

.epilogue-portrait {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 20% center;
}

.epilogue-text {
    max-width: 550px;
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    border-top: 3px solid var(--accent-gold);
    text-align: left;
}

.epilogue-text p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.epilogue-text p:last-child {
    margin-bottom: 0;
}

/* ============================================
   Memorial Screen (interactive, after closing cutscene)
   ============================================ */
#memorial-screen {
    background: var(--bg-dark);
}

.memorial-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.memorial-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.memorial-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(26, 15, 31, 0.4) 70%, rgba(26, 15, 31, 0.8) 100%);
    pointer-events: none;
    z-index: 5;
}

/* Memorial objects layer - transparent PNGs, canvas hit detection */
.memorial-objects {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.memorial-object {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.3s ease;
}

.memorial-object.glow {
    filter: drop-shadow(0 0 5px rgba(201, 162, 39, 0.9)) drop-shadow(0 0 10px rgba(201, 162, 39, 0.5));
}

/* Brief shimmer highlight for intro animation */
.memorial-object.highlight {
    filter: brightness(1.4) drop-shadow(0 0 6px rgba(255, 255, 255, 0.5));
    transition: filter 0.1s ease-out !important;
}

/* Picture frame portrait - positioned via JS to match BG scaling */
.memorial-frame-portrait {
    position: absolute;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow: hidden;
    /* Rotate the container so the clip boundary rotates with it */
    transform: rotate(10deg);
    transform-origin: center center;
    /* Position and size set by JavaScript */
}

.memorial-frame-portrait.visible {
    opacity: 1;
}

.memorial-frame-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 30% center;
    opacity: 0.3;
    /* No rotation here - container handles it */
}

/* Floating community shares - appear when hovering tokens */
.memorial-shares {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.memorial-shares.visible {
    opacity: 1;
}

.memorial-shares-content {
    position: relative;
    width: 100%;
    height: 100%;
}

.floating-share {
    position: absolute;
    bottom: 0;
    max-width: 320px;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease;
    line-height: 1.5;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    font-style: italic;
    text-shadow: 0 0 16px rgba(0, 0, 0, 0.95), 0 2px 8px rgba(0, 0, 0, 0.9),
                 0 0 40px rgba(0, 0, 0, 0.6);
    animation: floatUpDrift 16s linear forwards;
}

.floating-share.visible {
    opacity: 1;
}

/* position = -20 - 17t - 2.5t^2: faster start, gentle acceleration */
@keyframes floatUpDrift {
    0%   { transform: translateX(-50%) translateY(-20vh); }
    20%  { transform: translateX(-50%) translateY(-23.5vh); }
    40%  { transform: translateX(-50%) translateY(-27.2vh); }
    60%  { transform: translateX(-50%) translateY(-31.1vh); }
    80%  { transform: translateX(-50%) translateY(-35.2vh); }
    100% { transform: translateX(-50%) translateY(-39.5vh); }
}

/* Player's own entry - fixed at bottom center of memorial */
.memorial-own-entry {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 500px;
    z-index: 8;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
    text-align: center;
}

.memorial-own-entry.visible {
    opacity: 1;
}

.memorial-own-label {
    font-family: var(--font-display);
    font-size: 0.75rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: block;
    margin-bottom: 0.4rem;
}

.memorial-own-text {
    font-size: 1.1rem;
    font-style: italic;
    color: var(--text-primary);
    line-height: 1.5;
    text-shadow: 0 0 16px rgba(0, 0, 0, 0.9), 0 2px 8px rgba(0, 0, 0, 0.9),
                 0 0 40px rgba(0, 0, 0, 0.6);
}

/* Subtle close button - bottom right */
.memorial-close-btn {
    position: absolute;
    bottom: 30px;
    right: 30px;
    z-index: 10;
    font-family: var(--font-display);
    font-size: 0.9rem;
    padding: 0.6rem 1.2rem;
    background: rgba(0, 0, 0, 0.5);
    color: var(--text-muted);
    border: 1px solid var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    backdrop-filter: blur(4px);
}

.memorial-close-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.7);
}

/* ============================================
   Credits Screen (matches release-screen style)
   ============================================ */
#credits-screen {
    background: radial-gradient(ellipse at center, #2a1525 0%, var(--bg-panel) 100%);
    justify-content: center;
    align-items: center;
    text-align: center;
}

.credits-content {
    max-width: 500px;
    padding: 2rem;
}

.credits-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    margin-bottom: 2rem;
}

.credits-attribution {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 2.5rem;
}

.credits-review {
    font-size: 1rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    border-top: 1px solid rgba(201, 162, 39, 0.2);
    border-bottom: 1px solid rgba(201, 162, 39, 0.2);
}

#credits-btn {
    margin-top: 1.5rem;
}

/* ============================================
   Release/Reflection Screen
   ============================================ */
#release-screen {
    background: radial-gradient(ellipse at center, #2a1525 0%, var(--bg-panel) 100%);
    justify-content: center;
    align-items: center;
    text-align: center;
}

.release-container {
    max-width: 500px;
    width: 100%;
    padding: 2rem;
    box-sizing: border-box;
}

.cleansing-phrase {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-style: italic;
}

.thematic-observation {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin: 2.5rem 0;
    padding: 1.5rem;
    border-top: 1px solid rgba(201, 162, 39, 0.2);
    border-bottom: 1px solid rgba(201, 162, 39, 0.2);
}

/* Release phase containers */
.release-phase {
    width: 100%;
}

.release-continue {
    margin-top: 2rem;
    opacity: 0;
    animation: fadeIn 1.5s ease 0.5s forwards;
}

.release-response-header {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeIn 1.2s ease 0.3s forwards;
}

/* Community share on release screen - shown before reflection options */
.release-community-share {
    position: relative;
    margin: 1.5rem 0;
    padding: 1rem 0;
}

.release-heart-group {
    position: absolute;
    bottom: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.release-community-share:hover .release-heart-group {
    opacity: 1;
}

.release-heart-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-body);
}

.release-heart-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.3rem;
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1px var(--text-muted);
    transition: color 0.2s ease;
}

.release-heart-btn.hearted {
    color: var(--text-primary);
    -webkit-text-stroke: 1px var(--text-primary);
}

.release-share-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    font-family: var(--font-display);
}

.release-share-text {
    font-size: 1rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.6;
    min-height: calc(1.6em * 3);
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}


.release-share-text span {
    opacity: 0;
    transition: opacity 1.2s ease;
}

.release-share-text span.visible {
    opacity: 1;
}

/* Reflection (post-reading) */
.reflection-area {
    margin: 1.5rem 0;
    opacity: 0;
    animation: fadeIn 1s ease forwards;
}

.reflection-prompt {
    font-size: 1rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 1.2rem;
}

.reflection-options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.reflection-btn {
    font-family: var(--font-display);
    font-size: 0.9rem;
    padding: 0.7rem 1.2rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(201, 162, 39, 0.25);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.reflection-btn:hover {
    border-color: rgba(201, 162, 39, 0.5);
    color: var(--text-primary);
}

.reflection-btn-selected {
    border-color: rgba(201, 162, 39, 0.6);
    color: var(--text-primary);
    background: rgba(201, 162, 39, 0.1);
    pointer-events: none;
}

.reflection-btn-faded {
    opacity: 0.3;
    pointer-events: none;
    transform: scale(0.97);
}

.reflection-btn-skip {
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.reflection-btn-skip:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
}

.reflection-writing {
    animation: fadeSlideIn 0.4s ease;
}

.reflection-writing-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.8rem;
    min-height: 1.2em;
}

.reflection-textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(201, 162, 39, 0.2);
    border-radius: 4px;
    padding: 0.8rem;
    resize: none;
    box-sizing: border-box;
    line-height: 1.5;
    user-select: text;
    -webkit-user-select: text;
}

.reflection-textarea:focus {
    outline: none;
    border-color: rgba(201, 162, 39, 0.4);
}

.reflection-textarea::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.reflection-textarea-wrapper {
    position: relative;
}

.reflection-char-count {
    position: absolute;
    top: 0.5rem;
    right: 0.8rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-body);
    pointer-events: none;
}

.reflection-char-count.reflection-char-warn {
    color: var(--accent-gold);
}

.reflection-writing-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    margin-top: 0.8rem;
}

.reflection-cancel {
    font-size: 0.85rem;
    color: var(--text-muted);
    border-color: var(--text-muted);
}

.reflection-submit {
    /* no extra margin needed - footer handles spacing */
}

.reflection-thanks {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-style: italic;
    margin: 1.5rem 0 1rem;
    animation: fadeIn 0.6s ease;
}

/* ============================================
   Journal Screen (reader's notes)
   ============================================ */
#journal-screen {
    background: radial-gradient(ellipse at center, #2a1525 0%, var(--bg-panel) 100%);
    overflow-y: auto;
}

#journal-screen.active {
    display: block;
}

.journal-container {
    width: 100%;
    min-height: 100%;
    max-width: 550px;
    margin: 0 auto;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.journal-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 2.5rem;
}

.journal-entries {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.journal-client {
    border-top: 1px solid rgba(201, 162, 39, 0.15);
    padding-top: 1.2rem;
}

.journal-client-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.6rem;
}

.journal-client-portrait {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    object-position: 20% center;
    border: 2px solid rgba(201, 162, 39, 0.3);
    flex-shrink: 0;
}

.journal-client-name {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.journal-entry {
    margin-bottom: 0.6rem;
}

.journal-entry-text {
    font-size: 1.05rem;
    font-style: italic;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-line;
}

.journal-entry-date {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.journal-empty {
    font-size: 1rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    margin: 3rem 0;
}

.journal-close-btn {
    margin-top: auto;
}

.feedback-choice {
    margin: 1.5rem 0;
}

.feedback-question {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-style: italic;
}

.feedback-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.feedback-buttons button {
    font-size: 0.9rem;
    padding: 0.65rem 1.5rem;
}

.credits-review-link {
    color: var(--accent-gold);
    text-decoration: underline;
    transition: opacity 0.3s;
}

.credits-review-link:hover {
    opacity: 0.7;
}

/* ============================================
   Fade Overlay
   ============================================ */
.fade-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
    transition: opacity 0.25s ease;
}

.fade-overlay.active {
    opacity: 1;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* ============================================
   Utilities
   ============================================ */
.hidden {
    display: none !important;
}

/* ============================================
   Escape Menu
   ============================================ */
.escape-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.escape-menu.active {
    display: flex;
}

.escape-menu-content {
    background: var(--bg-panel);
    border: 1px solid rgba(201, 162, 39, 0.3);
    border-radius: 8px;
    padding: 1.75rem 2.5rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.escape-menu-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--accent-gold);
    margin-bottom: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.volume-control {
    margin-bottom: 1rem;
    text-align: left;
}

.volume-control label {
    display: block;
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.volume-control input[type="range"] {
    width: calc(100% - 50px);
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-dark);
    border-radius: 3px;
    outline: none;
    vertical-align: middle;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-gold);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.volume-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.volume-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--accent-gold);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.volume-control span {
    display: inline-block;
    width: 45px;
    text-align: right;
    font-size: 0.9rem;
    color: var(--text-muted);
    vertical-align: middle;
    margin-left: 5px;
}

.escape-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.escape-menu-actions button {
    width: 100%;
}

.escape-menu-hint {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Debug Menu Client List */
.debug-client-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.debug-client-btn {
    padding: 0.75rem 1rem;
    background: rgba(201, 162, 39, 0.1);
    border: 1px solid var(--accent-gold);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.debug-client-btn:hover {
    background: rgba(201, 162, 39, 0.25);
}

/* Debug action buttons (compact) */
.debug-action-btn {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    font-family: var(--font-display);
    font-size: 1rem;
    background: transparent;
    color: var(--accent-gold);
    border: 1px solid var(--accent-gold);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.debug-action-btn:first-of-type {
    margin-top: 1rem;
}

.debug-action-btn:hover {
    background: rgba(201, 162, 39, 0.2);
}

.debug-action-btn--danger {
    color: #e74c3c;
    border-color: #e74c3c;
}

.debug-action-btn--danger:hover {
    background: rgba(231, 76, 60, 0.2);
}

.debug-action-btn--ghost {
    color: var(--text-secondary);
    border-color: var(--text-secondary);
}

.debug-action-btn--ghost:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

/* ============================================
   Responsive - Same layout, just scaled down
   ============================================ */

/* Large screens - 1400px and below */
@media (max-width: 1400px) {
    :root {
        --card-width-large: 140px;
        --card-height-large: 246px;
    }

    .reading-interaction-area {
        padding: 30px 40px;
    }

    .epilogue-portrait-container {
        width: 180px;
        height: 265px;
    }

    .epilogue-text {
        max-width: 500px;
    }
}

/* Medium screens - 1200px and below */
@media (max-width: 1200px) {
    html {
        font-size: 16px;
    }

    :root {
        --card-width-large: 120px;
        --card-height-large: 211px;
    }

    .reading-interaction-area {
        left: 35%;
        padding: 25px 30px;
    }

    .reading-portrait.shifted {
        left: -200px;
    }

    .spread-card {
        width: 160px;
    }

    .client-info,
    .reading-info {
        left: 30px;
        bottom: 30px;
    }

    .client-welcome-btn {
        right: 30px;
        bottom: 30px;
    }

    .client-name {
        font-size: 2.5rem;
    }

    .epilogue-portrait-container {
        width: 160px;
        height: 235px;
    }

    .epilogue-text {
        max-width: 450px;
    }

    .epilogue-title {
        font-size: 1.8rem;
    }
}

/* Small screens - 1024px and below */
@media (max-width: 1024px) {
    html {
        font-size: 15px;
    }

    :root {
        --card-width-large: 100px;
        --card-height-large: 176px;
    }

    .reading-interaction-area {
        left: 30%;
        padding: 20px;
    }

    .reading-portrait.shifted {
        left: -180px;
    }

    .spread-area {
        gap: 1rem;
    }

    .spread-card {
        width: 140px;
    }

    .meaning-tag {
        font-size: 0.7rem;
        padding: 0.15rem 0.4rem;
    }

    .client-info {
        left: 20px;
        bottom: 20px;
        max-width: 28%;
    }

    .client-name {
        font-size: 2rem;
    }

    .client-description {
        font-size: 1rem;
    }

    .client-welcome-btn {
        right: 20px;
        bottom: 20px;
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }

    .reading-info {
        left: 20px;
        bottom: 20px;
        max-width: 25%;
    }

    .epilogue-container {
        padding: 20px;
    }

    .epilogue-content {
        gap: 1.5rem;
    }

    .epilogue-portrait-container {
        width: 120px;
        height: 176px;
    }

    .epilogue-title {
        font-size: 1.5rem;
    }

    .epilogue-text {
        padding: 1.5rem;
        max-width: 400px;
    }
}

/* Tablet - 850px and below */
@media (max-width: 850px) {
    :root {
        --card-width-large: 85px;
        --card-height-large: 149px;
    }

    .reading-interaction-area {
        left: 25%;
        padding: 15px;
    }

    .reading-portrait.shifted {
        left: -150px;
    }

    .spread-area {
        gap: 0.75rem;
    }

    .spread-card {
        width: 125px;
    }

    .spread-card .card-name {
        font-size: 0.85rem;
    }

    .choice-btn {
        font-size: 0.95rem;
        padding: 0.5rem 0.8rem;
    }

    .interaction-header,
    .probe-header {
        font-size: 1rem;
    }

    .client-info {
        max-width: 22%;
    }

    .client-name {
        font-size: 1.6rem;
    }

    .reading-info {
        max-width: 20%;
    }

    .epilogue-content {
        gap: 1rem;
    }

    .epilogue-portrait-container {
        width: 100px;
        height: 147px;
    }

    .epilogue-text {
        max-width: 350px;
        padding: 1rem;
    }

    .game-title {
        font-size: 3rem;
    }
}

/* Portrait mobile - 600px and below: Different layout */
@media (max-width: 600px) {
    html {
        font-size: 14px;
    }

    :root {
        --card-width-large: 75px;
        --card-height-large: 132px;
    }

    /* Hide portrait, full-width interaction */
    .reading-portrait,
    .reading-bg {
        display: none;
    }

    .reading-interaction-area {
        left: 0;
        background: var(--bg-dark);
        padding: 15px;
    }

    .spread-card {
        width: 110px;
    }

    .spread-card .card-meanings {
        /* Adjust min-height for smaller font */
        min-height: calc(3 * (1.2em + 0.4rem) + 2 * 0.3rem);
    }

    .meaning-tag {
        font-size: 0.6rem;
        padding: 0.1rem 0.3rem;
    }

    .game-title {
        font-size: 2.2rem;
    }

    .subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .title-content-warning {
        max-width: 95%;
    }

    /* Client screen - adjust portrait position and stack info */
    .client-portrait,
    .client-bg {
        object-position: 30% center;
    }

    .client-info {
        left: 15px;
        right: 15px;
        bottom: 90px;
        max-width: none;
    }

    .client-name {
        font-size: 1.6rem;
    }

    .client-welcome-btn {
        left: 15px;
        right: 15px;
        bottom: 15px;
        width: calc(100% - 30px);
        text-align: center;
    }

    /* Epilogue - stack vertically on mobile */
    .epilogue-content {
        flex-direction: column;
        align-items: center;
    }

    .epilogue-portrait-container {
        width: 100px;
        height: 147px;
        transform: none;
    }

    .epilogue-title {
        font-size: 1.3rem;
    }

    .epilogue-text {
        padding: 1rem;
        max-width: 100%;
    }

    /* Tea ritual */
    .parlor-tea-ingredient {
        font-size: 0.85rem;
        padding: 0.4rem 0.9rem;
    }

    .parlor-tea-prompt {
        font-size: 1rem;
    }

    .parlor-tea-comment {
        font-size: 0.9rem;
    }

    /* Cutscene */
    .cutscene-letterbox.bottom {
        padding: 1rem;
    }

    .cutscene-text {
        font-size: 1rem;
    }

    /* Other screens */
    .closing-title {
        font-size: 1.6rem;
    }

    .closing-subtitle {
        font-size: 0.95rem;
    }

    /* Hide frame portrait on mobile - coordinates won't match small viewport */
    .memorial-frame-portrait {
        display: none;
    }

    .floating-share {
        left: 50% !important;
        max-width: 85vw;
        font-size: 1.1rem !important;
    }

    .memorial-own-entry {
        left: 15px;
        right: 15px;
        bottom: 50px;
        max-width: none;
        transform: none;
    }

    .memorial-close-btn {
        bottom: 15px;
        right: 15px;
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }

    .escape-menu-content {
        padding: 1.5rem;
    }
}

/* Very small mobile - 400px and below */
@media (max-width: 400px) {
    :root {
        --card-width-large: 65px;
        --card-height-large: 114px;
    }

    .game-title {
        font-size: 1.8rem;
    }

    .spread-area {
        gap: 0.25rem;
    }

    .spread-card {
        width: 95px;
    }

    .spread-card .card-meanings {
        min-height: calc(3 * (1.1em + 0.35rem) + 2 * 0.3rem);
    }

    .spread-card .card-name {
        font-size: 0.7rem;
    }

    .spread-card .position-label {
        font-size: 0.65rem;
    }

    .meaning-tag {
        font-size: 0.55rem;
        padding: 0.1rem 0.25rem;
    }
}

/* Landscape mobile - short height */
@media (max-height: 500px) {
    :root {
        --card-width-large: 60px;
        --card-height-large: 105px;
    }

    .spread-area {
        padding: 5px 0;
    }

    .spread-card {
        width: 90px;
    }

    .spread-card .card-meanings {
        min-height: calc(3 * (1.1em + 0.35rem) + 2 * 0.3rem);
    }

    .spread-card .position-label {
        margin-bottom: 0.25rem;
        font-size: 0.65rem;
    }

    .spread-card .card-name {
        margin-top: 0.25rem;
        font-size: 0.7rem;
    }

    .meaning-tag {
        font-size: 0.55rem;
        padding: 0.1rem 0.25rem;
    }

    .epilogue-portrait-container {
        display: none;
    }

    .cutscene-text {
        font-size: 1rem;
        min-height: 2.5em;
    }
}
