/* ─────────────────────────────────────────────────────────────────
   SightLine — Editorial Dark Aesthetic
   Fonts: DM Serif Display (headlines) · Syne (UI) · DM Mono (tags)
   ───────────────────────────────────────────────────────────────── */

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

:root {
    --bg: #0d0d0f;
    --surface: #141418;
    --surface-2: #1c1c22;
    --border: rgba(255, 255, 255, 0.08);
    --border-act: rgba(255, 255, 255, 0.2);
    --text: #f0ede8;
    --text-2: #8a8790;
    --text-3: #4a4852;
    --accent: #e8d5a3;
    /* warm gold */
    --accent-2: #a89070;
    --live-green: #5ddc8c;
    --red: #e87060;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-pill: 999px;
    --font-head: 'DM Serif Display', Georgia, serif;
    --font-ui: 'Syne', sans-serif;
    --font-mono: 'DM Mono', monospace;
}

html,
body {
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    -webkit-font-smoothing: antialiased;
}

/* ── Grain overlay ─────────────────────────────────── */
.grain {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

/* ── Screens ───────────────────────────────────────── */
.screen {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.screen.active {
    display: flex;
}

/* ── Header ────────────────────────────────────────── */
.sl-header {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.sl-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text);
    text-decoration: none;
}

.sl-logo-eye {
    color: var(--accent);
    flex-shrink: 0;
}

.sl-version {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-3);
    letter-spacing: 0.05em;
}

.sl-header-title {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-2);
}

/* ── Back button ───────────────────────────────────── */
.back-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: none;
    border: none;
    color: var(--text-2);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.15s;
}

.back-btn:hover {
    color: var(--text);
}

/* ══════════════════════════════════════════════════════
   SCREEN 1: SETUP
══════════════════════════════════════════════════════ */
#screen-setup {
    background: var(--bg);
}

.setup-main {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding: 40px 28px 48px;
    flex: 1;
}

.setup-hero {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hero-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-2);
    border: 1px solid var(--accent-2);
    border-radius: var(--radius-pill);
    width: fit-content;
    padding: 5px 12px;
}

.hero-headline {
    font-family: var(--font-head);
    font-size: clamp(48px, 12vw, 72px);
    font-weight: 400;
    line-height: 1.05;
    color: var(--text);
    letter-spacing: -0.01em;
}

.hero-headline em {
    font-style: italic;
    color: var(--accent);
}

.hero-sub {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-2);
    font-weight: 400;
    max-width: 340px;
}

/* ── Setup card ──────────────────────────────────── */
.setup-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card-question {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--text-2);
    text-transform: uppercase;
}

.card-choices {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.choice-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 16px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    font-family: var(--font-ui);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.choice-btn:hover {
    border-color: var(--border-act);
    background: var(--surface-2);
    transform: translateY(-1px);
}

.choice-btn:active {
    transform: translateY(0);
}

.choice-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-2);
    border: 1px solid var(--border);
}

.choice-primary .choice-icon {
    background: var(--accent);
    color: var(--bg);
    border-color: transparent;
}

.choice-primary {
    border-color: var(--accent);
}

.choice-primary:hover {
    background: rgba(232, 213, 163, 0.06);
}

.choice-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.choice-label {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.choice-desc {
    font-size: 12px;
    color: var(--text-2);
    font-weight: 400;
}

.choice-arrow {
    font-size: 18px;
    color: var(--text-3);
    transition: color 0.15s;
}

.choice-btn:hover .choice-arrow {
    color: var(--text-2);
}

/* ── Footnote pills ───────────────────────────────── */
.setup-footnote {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.footnote-pill {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 5px 11px;
}

/* ══════════════════════════════════════════════════════
   SCREEN 2: MODE SELECT
══════════════════════════════════════════════════════ */
#screen-mode {
    background: var(--bg);
}

.mode-main {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding: 40px 28px 48px;
    flex: 1;
}

.mode-heading {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mode-step {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    color: var(--text-3);
    text-transform: uppercase;
}

.mode-title {
    font-family: var(--font-head);
    font-size: clamp(38px, 9vw, 56px);
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.mode-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mode-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 22px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    font-family: var(--font-ui);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    position: relative;
    overflow: hidden;
}

.mode-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(232, 213, 163, 0.04) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.2s;
}

.mode-item:hover {
    border-color: var(--border-act);
    background: var(--surface);
    transform: translateX(4px);
}

.mode-item:hover::before {
    opacity: 1;
}

.mode-item:active {
    transform: translateX(2px);
}

/* Separator line between items */
.mode-item+.mode-item {
    border-top: 1px solid var(--border);
}

.mode-item:hover+.mode-item {
    border-top-color: transparent;
}

.mode-num {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-3);
    letter-spacing: 0.05em;
    width: 24px;
    flex-shrink: 0;
}

.mode-glyph {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.mode-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mode-name {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.mode-desc {
    font-size: 13px;
    color: var(--text-2);
    font-weight: 400;
    line-height: 1.5;
}

.mode-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-2);
    border: 1px solid rgba(232, 213, 163, 0.2);
    border-radius: var(--radius-pill);
    padding: 4px 10px;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════
   SCREEN 3: LIVE
══════════════════════════════════════════════════════ */
#screen-live {
    background: #000;
    overflow: hidden;
}

#camera-feed {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
}

.live-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to bottom, rgba(0, 0, 0, 0.7) 0%, transparent 30%),
        linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 40%);
    pointer-events: none;
    z-index: 1;
}

/* ── Scan frame corners ─────────────────────────── */
.scan-frame {
    position: absolute;
    inset: 72px 40px;
    z-index: 2;
    pointer-events: none;
}

.sf-corner {
    position: absolute;
    width: 22px;
    height: 22px;
    border-color: rgba(232, 213, 163, 0.6);
    border-style: solid;
}

.sf-tl {
    top: 0;
    left: 0;
    border-width: 2px 0 0 2px;
    border-radius: 4px 0 0 0;
}

.sf-tr {
    top: 0;
    right: 0;
    border-width: 2px 2px 0 0;
    border-radius: 0 4px 0 0;
}

.sf-bl {
    bottom: 0;
    left: 0;
    border-width: 0 0 2px 2px;
    border-radius: 0 0 0 4px;
}

.sf-br {
    bottom: 0;
    right: 0;
    border-width: 0 2px 2px 0;
    border-radius: 0 0 4px 0;
}

/* ── Live top bar ───────────────────────────────── */
.live-top {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
}

.live-back-btn,
.live-settings-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s;
}

.live-back-btn:hover,
.live-settings-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.live-mode-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-pill);
    padding: 8px 16px;
}

.live-mode-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--live-green);
    box-shadow: 0 0 8px var(--live-green);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.live-mode-text {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    color: var(--text);
}

/* ── Narration bar ──────────────────────────────── */
.narration-bar {
    position: absolute;
    bottom: 180px;
    left: 20px;
    right: 20px;
    z-index: 10;
    background: rgba(13, 13, 15, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: opacity 0.3s;
}

.nb-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-3);
}

.nb-text {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    letter-spacing: 0.01em;
}

/* ── Text display (deaf/mute reading) ───────────── */
.text-display {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.92);
    padding: 40px 32px;
}

.text-display.hidden {
    display: none;
}

.display-text {
    font-family: var(--font-head);
    font-size: clamp(36px, 10vw, 60px);
    line-height: 1.2;
    color: var(--text);
    text-align: center;
}

.asl-display {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 140px;
    margin-bottom: 20px;
}

.asl-display svg {
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.4));
    animation: sign-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes sign-pop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* ── Type input (mute mode) ─────────────────────── */
.type-input-area {
    position: absolute;
    bottom: 200px;
    left: 20px;
    right: 20px;
    z-index: 10;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.type-input-area.hidden {
    display: none;
}

.type-input {
    flex: 1;
    background: rgba(13, 13, 15, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 15px;
    padding: 14px 16px;
    resize: none;
    outline: none;
    transition: border-color 0.15s;
}

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

.type-input::placeholder {
    color: var(--text-3);
}

.speak-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--bg);
    border: none;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
}

.speak-btn:hover {
    opacity: 0.88;
}

/* ── Action button ──────────────────────────────── */
.live-bottom {
    position: absolute;
    bottom: 52px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.action-btn {
    position: relative;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: rgba(232, 213, 163, 0.1);
    border: 2px solid rgba(232, 213, 163, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    cursor: pointer;
    transition: transform 0.12s, border-color 0.15s;
}

.action-btn:hover {
    transform: scale(1.06);
    border-color: var(--accent);
}

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

.action-ring {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 1px solid rgba(232, 213, 163, 0.2);
    animation: ring-pulse 3s ease-in-out infinite;
}

.action-ring-2 {
    inset: -20px;
    border-color: rgba(232, 213, 163, 0.1);
    animation-delay: 0.8s;
}

@keyframes ring-pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.3;
        transform: scale(1.04);
    }
}

.action-label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
}

/* ── Live status ────────────────────────────────── */
.live-status {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 0.06em;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--live-green);
}

/* ══════════════════════════════════════════════════════
   SCREEN 4: SETTINGS
══════════════════════════════════════════════════════ */
#screen-settings {
    background: var(--bg);
}

.settings-main {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 32px 0 48px;
    flex: 1;
}

.settings-section {
    padding: 24px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-section-label {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-3);
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.settings-row-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-row-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.settings-row-val {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent-2);
}

/* Range input */
.sl-range {
    -webkit-appearance: none;
    appearance: none;
    width: 140px;
    height: 3px;
    background: var(--surface-2);
    border-radius: 999px;
    outline: none;
    border: 1px solid var(--border);
}

.sl-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg);
    box-shadow: 0 0 0 1px rgba(232, 213, 163, 0.3);
    transition: transform 0.1s;
}

.sl-range::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.sl-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg);
}

/* Select */
.sl-select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 13px;
    padding: 8px 12px;
    outline: none;
    cursor: pointer;
}

/* Button outline */
.sl-btn-outline {
    border: 1px solid var(--border-act);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    padding: 10px 16px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.sl-btn-outline:hover {
    border-color: var(--accent);
    background: rgba(232, 213, 163, 0.04);
}

/* About section */
.settings-about {
    padding: 40px 28px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.about-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-ui);
    font-size: 18px;
    font-weight: 800;
    color: var(--text-2);
}

.about-text {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-3);
    letter-spacing: 0.06em;
}

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

/* Smooth screen transitions */
.screen {
    animation: screen-in 0.25s ease both;
}

@keyframes screen-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 999px;
}

/* ── Responsive tweaks ──────────────────────────── */
@media (min-width: 600px) {

    .setup-main,
    .mode-main {
        max-width: 500px;
        margin: 0 auto;
    }

    .settings-main {
        max-width: 500px;
        margin: 0 auto;
    }

    .hero-headline {
        font-size: 64px;
    }
}

/* ── Tutor Screen Polishes ─────────────────────── */
#next-sign-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--gold);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 12px;
    padding: 15px 40px;
    transition: all 0.3s ease;
    cursor: pointer;
    border-radius: 4px;
}

#next-sign-btn:hover {
    background: var(--gold);
    color: var(--black);
    border-color: var(--gold);
}

.success-pulse {
    animation: success-glow 0.8s ease-out;
}

@keyframes success-glow {
    0% { box-shadow: 0 0 0 0 rgba(168, 230, 207, 0.4); transform: scale(1); }
    50% { box-shadow: 0 0 40px 20px rgba(168, 230, 207, 0); transform: scale(1.02); }
    100% { box-shadow: 0 0 0 0 rgba(168, 230, 207, 0); transform: scale(1); }
}