/* ========================================
   CSS RESET & BASE
   ======================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    background-color: #040e25;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    color: #ffffff;
    overflow-x: hidden;
    min-height: 100vh;
}

img {
    max-width: 100%;
    display: block;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ========================================
   CSS VARIABLES
   ======================================== */
:root {
    --color-accent: #b10834;
    --color-accent-light: #d40a40;
    --color-accent-muted: rgba(177, 8, 52, 0.3);

    --bg-dark: #091940;
    --bg-darker: #061230;
    --bg-card: #0c1e4a;

    --border-color: rgba(177, 8, 52, 0.3);
    --border-color-bright: rgba(177, 8, 52, 0.8);

    --font-heading: 'Bebas Neue', sans-serif;
    --font-body: 'Inter', sans-serif;

    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   PORTRAIT OVERLAY (Mobile Landscape Enforcement)
   ======================================== */
.portrait-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    background: var(--bg-darker);
    justify-content: center;
    align-items: center;
    text-align: center;
}

.portrait-overlay.visible {
    display: flex;
}

.portrait-overlay-content {
    padding: 2rem;
}

.rotate-icon {
    width: 80px;
    height: 80px;
    color: var(--color-accent);
    margin-bottom: 1.5rem;
    animation: rotateHint 2s ease-in-out infinite;
}

@keyframes rotateHint {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

.portrait-text {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.85);
}

/* ========================================
   HEADER
   ======================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background: rgba(6, 18, 48, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.75rem 0;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    height: 32px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

.header-right {
    display: flex;
    align-items: center;
}

.header-cta {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #fff;
    background: var(--color-accent);
    padding: 0.6rem 1.25rem;
    border: 2px solid var(--color-accent);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.header-cta:hover {
    background: transparent;
    color: var(--color-accent);
}

/* ========================================
   SCREENS
   ======================================== */
.screen {
    display: none;
    width: 100%;
    min-height: 100vh;
}

.screen.active {
    display: flex;
}

/* ========================================
   WELCOME SCREEN
   ======================================== */
.screen-welcome {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(to bottom, rgba(4, 14, 37, 0.88) 0%, rgba(9, 25, 64, 0.84) 50%, rgba(4, 14, 37, 0.90) 100%),
        url('assets/images/welcome-bg.webp') center / cover no-repeat;
    background-color: var(--bg-dark);
    padding: 4rem 1.5rem 2rem;
}

.welcome-content {
    text-align: center;
    max-width: 700px;
    width: 100%;
}

.welcome-logo {
    height: 40px;
    margin: 0 auto 2rem;
}

.welcome-title {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

.welcome-sub {
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.04em;
    margin-bottom: 3rem;
}

/* Character Select */
.character-select {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.char-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    transition: border-color var(--transition-normal), transform var(--transition-normal);
    width: 200px;
}

.char-card:hover {
    border-color: var(--border-color-bright);
    transform: translateY(-4px);
}

.char-card.selected {
    border-color: var(--color-accent);
    background: rgba(177, 8, 52, 0.1);
}

.char-image-wrap {
    width: 140px;
    height: 140px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
}

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

.char-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: rgba(255, 255, 255, 0.15);
}

.char-placeholder svg {
    width: 60px;
    height: 60px;
}

.char-label {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #ffffff;
}

/* Name Input */
.name-input-wrap {
    margin-top: 1rem;
    animation: fadeInUp 0.4s ease;
}

.name-input-wrap.hidden {
    display: none;
}

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

.name-form {
    display: flex;
    gap: 0;
    justify-content: center;
}

.name-input {
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: rgba(6, 18, 48, 0.9);
    border: 2px solid var(--color-accent);
    border-right: none;
    padding: 0.875rem 1.25rem;
    outline: none;
    width: 220px;
    transition: border-color var(--transition-fast);
}

.name-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.name-input:focus {
    border-color: var(--color-accent-light);
}

.name-submit-btn {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #fff;
    background: var(--color-accent);
    border: 2px solid var(--color-accent);
    padding: 0.875rem 1.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.name-submit-btn:hover {
    background: var(--color-accent-light);
    border-color: var(--color-accent-light);
}

/* ========================================
   GAME SCREEN
   ======================================== */
.screen-game {
    flex-direction: column;
    position: relative;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.game-panel {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.panel-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.5s ease;
}

.panel-image.fade-out {
    opacity: 0;
}

/* Speech Bubble */
.speech-bubble {
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(6, 18, 48, 0.92);
    border: 2px solid var(--color-accent);
    padding: 1rem 1.75rem;
    max-width: 600px;
    width: 90%;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.speech-bubble.visible {
    opacity: 1;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid var(--color-accent);
}

.bubble-text {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    font-weight: 500;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.95);
    text-align: center;
}

/* Game Controls */
.game-controls {
    position: relative;
    background: var(--bg-darker);
    padding: 0;
    flex-shrink: 0;
}

/* Timer Bar */
.timer-bar-wrap {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.timer-bar {
    height: 100%;
    width: 100%;
    background: var(--color-accent);
    transition: width 0.1s linear;
}

.timer-bar.warning {
    background: #e74c3c;
}

.timer-bar.critical {
    animation: timerPulse 0.5s ease-in-out infinite;
}

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

/* Choices */
.choices {
    display: flex;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    justify-content: center;
}

.choice-btn {
    flex: 1;
    max-width: 350px;
    font-family: var(--font-heading);
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #fff;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    padding: 1rem 1.5rem;
    transition: border-color var(--transition-fast), background var(--transition-fast);
    text-align: center;
}

.choice-btn:hover {
    border-color: var(--color-accent);
    background: rgba(177, 8, 52, 0.15);
}

.choice-btn:active {
    background: var(--color-accent);
}

.choice-btn.selected {
    background: var(--color-accent);
    border-color: var(--color-accent);
}

/* ========================================
   END SCREEN
   ======================================== */
.screen-end {
    position: relative;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.end-panel {
    width: 100%;
    height: 100%;
    position: relative;
}

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

.end-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(4, 14, 37, 0.95) 0%, rgba(4, 14, 37, 0.6) 50%, rgba(4, 14, 37, 0.3) 100%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 2rem;
}

.end-content {
    text-align: center;
    max-width: 600px;
    width: 100%;
    padding-bottom: 2rem;
}

.end-text {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #ffffff;
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

.end-logo {
    height: 36px;
    margin: 0 auto 2rem;
    opacity: 0.8;
}

.end-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.end-btn {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 0.875rem 2rem;
    transition: all var(--transition-fast);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.end-btn-retry {
    color: #fff;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.end-btn-retry:hover {
    border-color: #fff;
}

.end-btn-cta {
    color: #fff;
    background: var(--color-accent);
    border: 2px solid var(--color-accent);
}

.end-btn-cta:hover {
    background: var(--color-accent-light);
    border-color: var(--color-accent-light);
}

.btn-arrow {
    font-size: 1.2em;
    transition: transform var(--transition-fast);
}

.end-btn-cta:hover .btn-arrow {
    transform: translateX(4px);
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
    background: #040e25;
    border-top: 1px solid var(--border-color);
    padding: 3rem 1.5rem 1.5rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-care {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.care-logo {
    height: 28px;
    width: auto;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.care-logo:hover {
    opacity: 1;
}

.footer-disclaimer {
    max-width: 800px;
    margin: 0 auto 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.5);
}

.footer-disclaimer p {
    margin-bottom: 0.5rem;
}

.demo-notice {
    color: var(--color-accent);
    font-weight: 600;
}

.footer-legal {
    text-align: center;
    margin-bottom: 1rem;
}

.legal-link {
    color: var(--color-accent);
    font-size: 0.8rem;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.legal-link:hover {
    color: var(--color-accent-light);
}

.separator {
    margin: 0 0.75rem;
    color: rgba(255, 255, 255, 0.2);
}

.footer-copyright {
    text-align: center;
    font-size: 0.7rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.3);
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ========================================
   LEGAL PAGES (shared styles for faq/tos/privacy)
   ======================================== */
.legal-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 100px 20px 60px;
    color: #c8d6e5;
    line-height: 1.7;
}

.legal-page h1 {
    font-family: var(--font-heading);
    font-size: 2.4rem;
    color: #fff;
    margin-bottom: 0.3em;
}

.legal-page .last-updated {
    font-size: 0.9rem;
    color: #8395a7;
    margin-bottom: 2.5em;
}

.legal-page h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: #fff;
    margin-top: 2em;
    margin-bottom: 0.5em;
}

.legal-page h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #dfe6ed;
    margin-top: 1.4em;
    margin-bottom: 0.4em;
}

.legal-page p {
    margin-bottom: 1em;
}

.legal-page ul, .legal-page ol {
    margin: 0.5em 0 1em 1.5em;
}

.legal-page li {
    margin-bottom: 0.4em;
}

.legal-page a {
    color: var(--color-accent);
    text-decoration: underline;
}

.legal-page a:hover {
    color: #fff;
}

/* ========================================
   FAQ SECTION
   ======================================== */
.faq-search-container {
    max-width: 100%;
    margin: 0 auto 2rem;
}

.faq-search {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: var(--font-body);
    font-size: 16px;
    color: #fff;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    transition: border-color var(--transition-fast);
}

.faq-search::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.faq-search:focus {
    outline: none;
    border-color: var(--color-accent);
}

.faq-not-found {
    padding: 2rem;
    text-align: center;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    margin-bottom: 1rem;
}

.faq-not-found p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.6);
}

.faq-not-found.hidden {
    display: none;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.faq-item {
    border: 2px solid var(--border-color);
    overflow: hidden;
    background: var(--bg-card);
    transition: border-color var(--transition-normal);
}

.faq-item.hidden {
    display: none;
}

.faq-item:hover {
    border-color: var(--border-color-bright);
}

.faq-question {
    width: 100%;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #ffffff;
    text-align: left;
    transition: color var(--transition-fast);
    cursor: pointer;
}

.faq-question:hover {
    color: var(--color-accent);
}

.faq-icon {
    font-size: 1.4em;
    font-weight: 300;
    color: var(--color-accent);
    transition: transform var(--transition-normal);
    flex-shrink: 0;
    margin-left: 1rem;
}

.faq-item.active .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

.faq-item.active .faq-answer {
    max-height: 500px;
}

.faq-answer p {
    padding: 0 1.25rem 1.25rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.7;
    font-size: 0.95rem;
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* Mobile Portrait — show overlay */
@media (max-width: 767px) and (orientation: portrait) {
    .portrait-overlay {
        display: flex;
    }
}

/* Mobile — hide header during game (not end screen) */
@media (max-width: 1000px), (hover: none) and (pointer: coarse) {
    body.game-active .header {
        display: none;
    }
}

/* Mobile Landscape */
@media (max-height: 500px) {
    .welcome-logo {
        height: 28px;
        margin-bottom: 1rem;
    }

    .welcome-title {
        font-size: 2rem;
        margin-bottom: 0.25rem;
    }

    .welcome-sub {
        font-size: 0.85rem;
        margin-bottom: 1.5rem;
    }

    .char-card {
        padding: 0.75rem;
        width: 150px;
    }

    .char-image-wrap {
        width: 80px;
        height: 80px;
    }

    .char-label {
        font-size: 1rem;
    }

    .character-select {
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .speech-bubble {
        top: 5%;
        padding: 0.75rem 1.25rem;
    }

    .choices {
        padding: 0.75rem 1rem;
    }

    .choice-btn {
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
    }

    .end-content {
        padding-bottom: 1rem;
    }

    .end-text {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    .end-logo {
        height: 28px;
        margin-bottom: 1rem;
    }
}

/* Small screens */
@media (max-width: 480px) {
    .character-select {
        gap: 1rem;
    }

    .char-card {
        width: 140px;
        padding: 1rem;
    }

    .char-image-wrap {
        width: 100px;
        height: 100px;
    }

    .header-cta {
        font-size: 11px;
        padding: 0.5rem 0.75rem;
    }

    .logo {
        height: 26px;
    }

    .footer-care {
        gap: 0.75rem;
    }

    .care-logo {
        height: 22px;
    }
}

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--color-accent);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-accent) var(--bg-dark);
}
