/* HerpQuest landing page — pixel-art terrarium style. */
:root {
    --bg: #0b1510;
    --bg-deep: #060d09;
    --panel: #12251a;
    --panel-2: #172d1f;
    --panel-3: #1d3827;
    --line: #2b4b34;
    --line-bright: #4f7d5b;
    --text: #d9f2da;
    --muted: #8fb69a;
    --accent: #8fe39b;
    --accent-2: #4fbe75;
    --amber: #f4c96b;
    --danger: #e88a7a;
    --shadow: #040906;
    --font-display: "Press Start 2P", "Courier New", monospace;
    --font-body: "Pixelify Sans", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); scroll-behavior: smooth; }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.45;
    background:
        radial-gradient(circle at 18% 8%, rgba(86, 151, 101, 0.16), transparent 34rem),
        radial-gradient(circle at 82% 24%, rgba(50, 106, 74, 0.12), transparent 28rem),
        linear-gradient(180deg, #0d1b13 0%, var(--bg) 46%, #08110c 100%);
    overflow-x: hidden;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(circle at 50% 0%, transparent 40%, rgba(2, 6, 4, 0.55) 100%);
}

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(118, 184, 131, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(118, 184, 131, 0.055) 1px, transparent 1px);
    background-size: 32px 32px;
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.45) 58%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.45) 58%, transparent 100%);
}

.fireflies {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.firefly {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: 4px;
    height: 4px;
    background: #d7ff8f;
    box-shadow: 0 0 8px 2px rgba(190, 247, 111, 0.55);
    animation: firefly-float var(--d, 8s) ease-in-out infinite alternate;
    animation-delay: var(--delay, 0s);
    opacity: 0.65;
}

@keyframes firefly-float {
    0% { transform: translate3d(0, 0, 0); opacity: 0.25; }
    40% { opacity: 0.9; }
    100% { transform: translate3d(14px, -42px, 0); opacity: 0.55; }
}

.topbar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: min(1120px, calc(100% - 40px));
    margin: 0 auto;
    padding: 22px 0 8px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
}

.brand__logo {
    image-rendering: pixelated;
    filter: drop-shadow(2px 2px 0 var(--shadow));
}

.brand__name {
    font-family: var(--font-display);
    font-size: 12px;
    letter-spacing: 0.04em;
}

.topbar__tag {
    color: var(--muted);
    font-family: var(--font-body);
    font-size: 14px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.page {
    width: min(1120px, calc(100% - 40px));
    margin: 0 auto;
    padding-bottom: 48px;
}

.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 42px 0 30px;
}

.logo-frame {
    position: relative;
    width: 176px;
    height: 176px;
    padding: 14px;
    background: linear-gradient(145deg, #1b3b27, #0c1b12);
    border: 3px solid var(--line-bright);
    box-shadow:
        0 0 0 3px var(--bg-deep),
        8px 8px 0 0 rgba(3, 8, 5, 0.8),
        inset 0 0 0 3px #0b1710;
    image-rendering: pixelated;
}

.logo-frame::before,
.logo-frame::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--accent);
    box-shadow: 0 0 12px rgba(143, 227, 155, 0.45);
}

.logo-frame::before { top: -3px; left: -3px; }
.logo-frame::after { right: -3px; bottom: -3px; }

.logo-frame__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(4px 5px 0 rgba(3, 8, 5, 0.65));
}

.eyebrow {
    margin: 30px 0 14px;
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 9px;
    line-height: 1.8;
    letter-spacing: 0.1em;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
    margin-bottom: 18px;
    color: #e9ffe8;
    font-family: var(--font-display);
    font-size: clamp(30px, 6vw, 58px);
    line-height: 1.15;
    letter-spacing: 0.02em;
    text-shadow: 4px 4px 0 #071009, 8px 8px 0 rgba(20, 62, 33, 0.55);
}

.hero__subtitle {
    max-width: 620px;
    margin: 0 auto;
    color: var(--muted);
    font-size: 21px;
    line-height: 1.55;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: min(100%, 430px);
    margin-top: 34px;
}

.pixel-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 64px;
    padding: 17px 20px;
    border: 3px solid;
    border-radius: 0;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 11px;
    line-height: 1.6;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 6px 6px 0 var(--shadow);
    transition: transform 90ms steps(2), box-shadow 90ms steps(2), background-color 120ms;
    -webkit-tap-highlight-color: transparent;
}

.pixel-btn::after {
    content: "";
    position: absolute;
    inset: 5px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    pointer-events: none;
}

.pixel-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 8px 8px 0 var(--shadow);
}

.pixel-btn:active {
    transform: translate(3px, 3px);
    box-shadow: 2px 2px 0 var(--shadow);
}

.pixel-btn:focus-visible {
    outline: 3px dashed var(--amber);
    outline-offset: 4px;
}

.pixel-btn:disabled {
    cursor: not-allowed;
    transform: none;
    box-shadow: 3px 3px 0 var(--shadow);
    filter: saturate(0.45);
}

.pixel-btn--primary {
    background: var(--accent-2);
    border-color: #a9efb3;
    color: #07130b;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.25);
}

.pixel-btn--primary:hover { background: #63d184; }

.pixel-btn--secondary {
    background: var(--panel);
    border-color: var(--line-bright);
    color: var(--amber);
}

.pixel-btn--secondary:hover { background: var(--panel-2); }
.pixel-btn--full { width: 100%; margin-top: 4px; }

.pixel-btn--small {
    width: auto;
    min-height: 46px;
    padding: 10px 18px;
    font-size: 9px;
}

.pixel-btn__icon {
    font-family: Arial, sans-serif;
    font-size: 17px;
    line-height: 1;
}

.review-state {
    margin: 4px 0 0;
    padding: 11px 14px;
    border: 2px solid var(--amber);
    background: rgba(244, 201, 107, 0.08);
    color: var(--amber);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.35;
}

.review-state.is-done {
    border-color: var(--accent);
    background: rgba(143, 227, 155, 0.08);
    color: var(--accent);
}

.hero__hint {
    margin: 22px 0 0;
    color: #72937a;
    font-size: 15px;
    letter-spacing: 0.02em;
}

.hero__hint span {
    padding-right: 6px;
    color: var(--accent-2);
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 10px 0 56px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 12px;
    background: linear-gradient(180deg, rgba(23, 45, 31, 0.9), rgba(13, 27, 19, 0.9));
    border: 2px solid var(--line);
    box-shadow: 4px 4px 0 rgba(3, 8, 5, 0.55);
}

.stat__value {
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 20px;
    text-shadow: 2px 2px 0 #071009;
}

.stat__label {
    color: var(--muted);
    font-size: 16px;
    text-align: center;
}

/* «∞» нет в Press Start 2P: фолбэк-глиф выходит заметно мельче цифр,
   поэтому рисуем его основным шрифтом и поднимаем размер. */
.stat__value--glyph {
    font-family: var(--font-body);
    font-size: 30px;
    line-height: 1.2;
}

.section-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}

.section-head h2 {
    flex: 0 0 auto;
    margin: 0;
    font-family: var(--font-display);
    font-size: 12px;
    line-height: 1.8;
    letter-spacing: 0.04em;
}

.section-head__line {
    flex: 1;
    height: 2px;
    background: repeating-linear-gradient(90deg, var(--line-bright) 0 8px, transparent 8px 14px);
}

.count-chip {
    display: inline-grid;
    place-items: center;
    min-width: 36px;
    height: 30px;
    padding: 0 8px;
    border: 2px solid var(--line-bright);
    background: var(--panel);
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 9px;
}

/* Пометка «локальный режим» под заголовком отзывов: без ключей Supabase
   отзывы живут только в браузере, и об этом надо сказать честно. */
.reviews__mode {
    margin: 12px 0 0;
    padding: 9px 13px;
    border: 2px dashed rgba(143, 227, 155, 0.35);
    background: rgba(143, 227, 155, 0.05);
    color: #8fb89a;
    font-size: 14px;
    line-height: 1.4;
}

.reviews__mode.is-local {
    border-color: var(--amber);
    color: #d8be86;
}

.review-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.review-card {
    position: relative;
    padding: 18px 18px 15px;
    background: linear-gradient(160deg, rgba(26, 51, 35, 0.95), rgba(12, 25, 17, 0.95));
    border: 2px solid var(--line);
    box-shadow: 4px 4px 0 rgba(3, 8, 5, 0.6);
}

.review-card::before {
    content: "";
    position: absolute;
    top: -2px;
    bottom: -2px;
    left: -2px;
    width: 4px;
    background: var(--accent-2);
}

.review-card__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.review-card__name {
    overflow: hidden;
    color: var(--text);
    font-size: 19px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.review-card__stars {
    flex: 0 0 auto;
    color: var(--amber);
    font-family: Arial, sans-serif;
    font-size: 14px;
    letter-spacing: 2px;
}

.review-card__text {
    margin-bottom: 12px;
    color: #b6d5bb;
    font-size: 17px;
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.review-card__date {
    color: #6f9177;
    font-size: 14px;
}

.review-empty {
    grid-column: 1 / -1;
    padding: 30px 18px;
    border: 2px dashed var(--line);
    color: var(--muted);
    text-align: center;
}

.footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    margin-top: 64px;
    padding-top: 18px;
    border-top: 2px solid rgba(79, 125, 91, 0.35);
    color: #6f9177;
    font-size: 15px;
}

.footer p { margin: 0; }
.footer__note { color: #5c7d64; }

/* --------------------------------------------------------------------------
   Review dialog
   -------------------------------------------------------------------------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 20px;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 7, 4, 0.84);
    backdrop-filter: blur(3px);
}

.modal__card {
    position: relative;
    width: min(560px, 100%);
    max-height: min(90vh, 780px);
    overflow: auto;
    padding: 30px;
    background: linear-gradient(160deg, rgba(27, 54, 37, 0.98), rgba(10, 22, 15, 0.99));
    border: 3px solid var(--line-bright);
    box-shadow: 0 0 0 3px var(--bg-deep), 12px 12px 0 rgba(2, 7, 4, 0.85);
}

.modal__card::-webkit-scrollbar { width: 10px; }
.modal__card::-webkit-scrollbar-track { background: var(--bg-deep); }
.modal__card::-webkit-scrollbar-thumb { background: var(--line-bright); }

.modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 2px solid var(--line-bright);
    background: var(--bg-deep);
    color: var(--muted);
    font-family: Arial, sans-serif;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.modal__close:hover { border-color: var(--amber); color: var(--amber); }
.modal__card .eyebrow { margin: 0 0 12px; }

.modal__card h2 {
    margin-bottom: 10px;
    font-family: var(--font-display);
    font-size: 17px;
    line-height: 1.7;
    text-shadow: 3px 3px 0 #071009;
}

.modal__lead { margin-bottom: 22px; color: var(--muted); font-size: 17px; }

.rating-fieldset { margin: 0 0 18px; padding: 0; border: 0; }

.rating-fieldset legend,
.field__label {
    display: block;
    margin-bottom: 8px;
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 8px;
    line-height: 1.6;
    letter-spacing: 0.06em;
}

.star-picker { display: flex; gap: 6px; }

.star {
    padding: 0 2px;
    border: 0;
    background: transparent;
    color: #355540;
    font-family: Arial, sans-serif;
    font-size: 38px;
    line-height: 1;
    cursor: pointer;
    text-shadow: 2px 2px 0 #061009;
    transition: color 90ms, transform 90ms steps(2);
    -webkit-tap-highlight-color: transparent;
}

.star:hover,
.star.is-on { color: var(--amber); }
.star:hover { transform: translateY(-3px); }
.star:focus-visible { outline: 2px dashed var(--amber); outline-offset: 2px; }

.rating-hint { margin: 7px 0 0; color: #6f9177; font-size: 15px; }
.field { display: block; margin-bottom: 16px; }

.field input,
.field textarea {
    display: block;
    width: 100%;
    padding: 11px 12px;
    border: 2px solid var(--line);
    border-radius: 0;
    outline: 0;
    background: #09140d;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.4;
}

.field input::placeholder,
.field textarea::placeholder { color: #52715a; }

.field input:focus,
.field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(143, 227, 155, 0.14);
}

.field textarea { min-height: 116px; resize: vertical; }

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] { border-color: var(--danger); }

.form-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 24px;
    margin-bottom: 12px;
}

.char-count { flex: 0 0 auto; color: #6f9177; font-size: 14px; }
.form-error { color: var(--danger); font-size: 15px; line-height: 1.3; text-align: right; }
.form-note { margin: 11px 0 0; color: #5c7d64; font-size: 14px; text-align: center; }

.already-review {
    padding: 18px;
    border: 2px solid var(--accent-2);
    background: rgba(79, 190, 117, 0.07);
    text-align: center;
}

.already-review__stars {
    margin-bottom: 8px;
    color: var(--amber);
    font-family: Arial, sans-serif;
    font-size: 26px;
    letter-spacing: 4px;
}

.already-review h3 {
    margin-bottom: 8px;
    color: var(--accent);
    font-family: var(--font-body);
    font-size: 21px;
}

.already-review p { margin-bottom: 0; color: var(--muted); }

/* --------------------------------------------------------------------------
   Fullscreen game overlay
   -------------------------------------------------------------------------- */
.game-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: #050a07;
}

.game-stage {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0b1510;
}

#gameFrame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #0b1510;
}

.game-loading {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    background:
        radial-gradient(circle at 50% 45%, rgba(31, 65, 42, 0.45), transparent 28rem),
        #07110b;
    text-align: center;
}

.loader {
    width: 42px;
    height: 42px;
    margin-bottom: 12px;
    border: 4px solid #29452f;
    border-top-color: var(--accent);
    border-right-color: var(--accent-2);
    animation: loader-spin 1.1s steps(8) infinite;
}

@keyframes loader-spin { to { transform: rotate(360deg); } }

.game-loading__title {
    margin: 0;
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 12px;
    line-height: 1.8;
}

.game-loading__note { margin: 0 0 8px; color: var(--muted); font-size: 16px; }

.exit-game {
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    z-index: 6;
    min-height: 42px;
    padding: 8px 12px;
    border: 2px solid rgba(143, 227, 155, 0.6);
    background: rgba(5, 12, 8, 0.78);
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 8px;
    line-height: 1.5;
    cursor: pointer;
    backdrop-filter: blur(2px);
}

.exit-game:hover { border-color: var(--amber); color: var(--amber); }
body.is-locked { overflow: hidden; }

@media (max-width: 620px) {
    .topbar, .page { width: calc(100% - 28px); }
    .topbar { padding-top: 14px; }
    .topbar__tag { display: none; }
    .hero { padding-top: 24px; }
    .logo-frame { width: 132px; height: 132px; padding: 10px; }
    .eyebrow { margin-top: 24px; font-size: 8px; }
    .hero__subtitle { font-size: 19px; }
    .actions { margin-top: 28px; }
    .pixel-btn { min-height: 60px; font-size: 10px; }
    .stats { gap: 8px; margin-bottom: 42px; }
    .stat { padding: 14px 6px; }
    .stat__value { font-size: 15px; }
    .stat__value--glyph { font-size: 24px; }
    .stat__label { font-size: 14px; }
    .section-head { gap: 10px; }
    .section-head h2 { font-size: 10px; }
    .review-list { grid-template-columns: 1fr; }
    .footer { margin-top: 44px; }
    .modal { padding: 12px; }
    .modal__card { max-height: 94vh; padding: 24px 18px 20px; }
    .modal__card h2 { font-size: 13px; }
    .star { font-size: 34px; }
    .game-loading__title { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .firefly { animation: none; opacity: 0.4; }
    .pixel-btn, .star { transition: none; }
    .loader { animation-duration: 2.4s; }
}




