/**
 * The front door — login.html and request-place.html.
 * ============================================================================
 * The first thing a newcomer sees, so it wears the game's own clothes rather
 * than a generic form: the logo's night-navy sky with drifting embers, the
 * logo plaque itself, and a panel in the "How to play" modal's house style
 * (#1e1e2e, faint gold edge, gold heading) with the app's purple buttons.
 *
 * Sizes come from styles/type-scale.css tokens (always with a fallback).
 * Only transform/opacity animate (compositor-only), and nothing moves at all
 * under prefers-reduced-motion.
 * ============================================================================
 */

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

html, body { overscroll-behavior-y: contain; }

body.front-door {
    font-family: var(--font-ui, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif);
    /* The logo's own sky: a lifted navy centre falling away to near-black. */
    background: radial-gradient(ellipse at 50% 30%, #23265a 0%, #141634 45%, #0a0b1c 100%) fixed;
    background-color: #0a0b1c;
    color: #e8e8f4;
    min-height: var(--vh-fix, 100dvh);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    overflow-x: hidden;
}

/* ---- Embers ------------------------------------------------------------ */
.fd-embers { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.fd-embers i {
    position: absolute;
    bottom: -10px;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: #ffb347;
    box-shadow: 0 0 6px 2px rgba(255, 170, 60, 0.55);
    opacity: 0;
    animation: fd-rise linear infinite;
}
.fd-embers i:nth-child(1)  { left: 8%;  animation-duration: 14s; animation-delay: 0s; }
.fd-embers i:nth-child(2)  { left: 19%; animation-duration: 18s; animation-delay: 3s;  transform: scale(.7); }
.fd-embers i:nth-child(3)  { left: 31%; animation-duration: 16s; animation-delay: 7s; }
.fd-embers i:nth-child(4)  { left: 44%; animation-duration: 20s; animation-delay: 1s;  width: 3px; height: 3px; }
.fd-embers i:nth-child(5)  { left: 57%; animation-duration: 15s; animation-delay: 9s; }
.fd-embers i:nth-child(6)  { left: 68%; animation-duration: 19s; animation-delay: 5s;  width: 3px; height: 3px; }
.fd-embers i:nth-child(7)  { left: 79%; animation-duration: 17s; animation-delay: 2s; }
.fd-embers i:nth-child(8)  { left: 91%; animation-duration: 21s; animation-delay: 11s; width: 3px; height: 3px; }
@keyframes fd-rise {
    0%   { transform: translate3d(0, 0, 0);        opacity: 0; }
    10%  { opacity: .9; }
    50%  { transform: translate3d(14px, -50vh, 0); opacity: .7; }
    100% { transform: translate3d(-10px, -105vh, 0); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .fd-embers i { animation: none; opacity: .5; }
    .fd-embers i:nth-child(odd)  { bottom: 30%; }
    .fd-embers i:nth-child(even) { bottom: 70%; }
}

/* ---- Logo plaque ------------------------------------------------------- */
/* logo.jpg is square with the plaque across the middle; show just the plaque
   band and feather its edges into the page's own navy. */
.fd-logo {
    display: block;
    width: 100%;
    aspect-ratio: 2.6 / 1;
    background: url('/assets/logo.jpg') center 51% / 118% auto no-repeat;
    -webkit-mask-image: radial-gradient(ellipse 62% 70% at 50% 50%, #000 70%, transparent 100%);
            mask-image: radial-gradient(ellipse 62% 70% at 50% 50%, #000 70%, transparent 100%);
    margin: -8px 0 4px;
}
.fd-logo-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- The panel (house modal style) ------------------------------------ */
.fd-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 30rem;
    background: rgba(30, 30, 46, 0.94);
    border: 1px solid rgba(255, 215, 0, 0.22);
    border-radius: 18px;
    padding: 22px 22px 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(255, 170, 60, 0.08);
    animation: fd-arrive .5s ease-out both;
}
@keyframes fd-arrive { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .fd-panel { animation: none; } }

.fd-title {
    font-family: var(--font-display, 'Caveat', 'Segoe UI', cursive);
    font-size: var(--fs-display, 2.6rem);
    line-height: var(--lh-tight, 1.2);
    font-weight: 700;
    color: #ffd700;
    text-align: center;
    text-shadow: 0 0 18px rgba(255, 200, 80, 0.35);
    margin-bottom: 14px;
}

.fd-panel p {
    font-size: var(--fs-ui, 1rem);
    line-height: var(--lh-body, 1.5);
    color: #dcdcec;
    margin-bottom: 14px;
}
.fd-panel strong { color: #fff; }
.fd-panel a:not(.fd-btn):not(.fd-google) { color: #c7d2fe; }

/* A note box — gold edge for "good to know", red for a problem. */
.fd-note {
    background: rgba(255, 215, 0, 0.07);
    border-left: 3px solid rgba(255, 215, 0, 0.6);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: var(--fs-label, 0.9rem);
    line-height: var(--lh-body, 1.5);
    color: #ece4c4;
    margin-bottom: 16px;
}
.fd-note.fd-error {
    background: rgba(239, 68, 68, 0.12);
    border-left-color: #ef4444;
    color: #fecaca;
}
.fd-note.fd-ok {
    background: rgba(34, 197, 94, 0.12);
    border-left-color: #22c55e;
    color: #bbf7d0;
}

/* Signed-in chip */
.fd-who {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(102, 126, 234, 0.14);
    border: 1px solid rgba(102, 126, 234, 0.35);
    border-radius: 999px;
    padding: 8px 14px;
    margin: 0 auto 16px;
    width: fit-content;
    max-width: 100%;
    font-size: var(--fs-label, 0.9rem);
    color: #c7d2fe;
    overflow-wrap: anywhere;
}
.fd-who b { color: #fff; font-weight: 600; }

/* ---- Form -------------------------------------------------------------- */
.fd-field { margin-bottom: 16px; }
.fd-field label {
    display: block;
    font-weight: 600;
    font-size: var(--fs-ui, 1rem);
    color: #fff;
    margin-bottom: 8px;
}
.fd-field label .fd-opt { font-weight: 400; color: #c7d2fe; }
.fd-field input[type="text"],
.fd-field textarea,
.fd-panel select {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    color: #fff;
    font: inherit;
    font-size: 16px;            /* 16px stops iOS zooming into the field */
    transition: border-color .2s, background-color .2s;
}
.fd-field textarea { min-height: 7.5em; resize: vertical; }
.fd-field input::placeholder, .fd-field textarea::placeholder { color: rgba(220, 220, 236, 0.55); }
.fd-field input:focus, .fd-field textarea:focus, .fd-panel select:focus {
    outline: none;
    border-color: #ffd700;
    background: rgba(255, 255, 255, 0.09);
}
.fd-panel select option { background: #1e1e2e; color: #fff; }

/* ---- Buttons ----------------------------------------------------------- */
.fd-btn {
    display: block;
    width: 100%;
    padding: 14px 18px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font: inherit;
    font-size: var(--fs-ui, 1rem);
    font-weight: 700;
    letter-spacing: .3px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: transform .15s, box-shadow .15s, filter .15s;
}
.fd-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(102, 126, 234, 0.55), inset 0 1px 0 rgba(255,255,255,.2); }
.fd-btn:active { transform: translateY(0); filter: brightness(.95); }
.fd-btn:disabled { opacity: .55; cursor: default; transform: none; }
/* Gold for the one big "go" on a screen */
.fd-btn.fd-gold {
    background: linear-gradient(135deg, #f7c948 0%, #e09b1a 100%);
    color: #2a1a00;
    box-shadow: 0 4px 16px rgba(240, 170, 40, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.fd-btn.fd-gold:hover { box-shadow: 0 8px 24px rgba(240, 170, 40, 0.6), inset 0 1px 0 rgba(255,255,255,.4); }
.fd-btn.fd-quiet {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #dcdcec;
    box-shadow: none;
}
.fd-btn.fd-quiet:hover { border-color: rgba(255, 215, 0, 0.5); box-shadow: none; }

/* Google button: Google's own white style (their brand rules), on the dark panel */
.fd-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 18px;
    background: #fff;
    color: #3c4043;
    border-radius: 12px;
    font-size: var(--fs-ui, 1rem);
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    transition: transform .15s, box-shadow .15s;
}
.fd-google:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45); }
.fd-google svg { width: 20px; height: 20px; flex: 0 0 auto; }

/* Quote of what they sent */
.fd-quote {
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid rgba(199, 210, 254, 0.5);
    border-radius: 10px;
    padding: 12px 14px;
    margin: 0 0 16px;
    color: #e8e8f4;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: var(--fs-ui, 1rem);
}

/* Footer links */
.fd-foot {
    margin-top: 16px;
    text-align: center;
    font-size: var(--fs-label, 0.9rem);
    line-height: var(--lh-body, 1.5);
    color: #b9bbd6;
}
.fd-foot a { color: #c7d2fe; }

/* Panels that swap on request-place */
.fd-step { display: none; }
.fd-step.show { display: block; animation: fd-arrive .35s ease-out both; }
@media (prefers-reduced-motion: reduce) { .fd-step.show { animation: none; } }

/* Small phones */
@media (max-width: 380px) {
    .fd-panel { padding: 18px 16px 14px; }
}
