/* Always light, regardless of the user's Telegram theme: --tg-theme-* variables are deliberately not used. */
:root {
    color-scheme: light;
    --bg: #f3f4f8;
    --card: #ffffff;
    --text: #16181d;
    --muted: #6b7280;
    --accent: #6c5ce7;
    --accent-text: #ffffff;
    --link: #6c5ce7;
    --danger: #e5484d;
    --border: color-mix(in srgb, var(--text) 12%, transparent);
    --radius: 18px;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

.shell {
    min-height: 100vh;
    min-height: var(--tg-viewport-stable-height, 100dvh);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
    max-width: 480px;
    margin: 0 auto;
}
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 28px 22px;
    box-shadow: 0 10px 30px -12px rgb(0 0 0 / .15);
}

.center { text-align: center; }

h1 { font-size: 1.6rem; font-weight: 700; margin: 0 0 10px; letter-spacing: -.02em; }
.muted { color: var(--muted); line-height: 1.55; margin: 0 0 24px; }
.hint { color: var(--muted); font-size: .85rem; line-height: 1.5; margin: 22px 0 12px; }

.thanks-logo { display: block; width: min(180px, 60%); height: auto; margin: 0 auto 18px; animation: pop .5s ease; }
.req { color: var(--danger); font-weight: 600; }

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 100%; padding: 15px 20px;
    border: 0; border-radius: 14px;
    font: inherit; font-weight: 600; font-size: 1rem;
    text-decoration: none; cursor: pointer;
    transition: transform .12s ease, opacity .2s ease, filter .2s;
}
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.loading { color: transparent; position: relative; }
.btn.loading::after {
    content: ''; position: absolute; width: 20px; height: 20px;
    border: 2px solid var(--accent-text); border-right-color: transparent;
    border-radius: 50%; animation: spin .7s linear infinite;
}

.field { margin-bottom: 14px; }
.field label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 6px; }
.field input {
    width: 100%; padding: 13px 14px;
    font: inherit; color: var(--text);
    background: var(--bg); border: 1.5px solid transparent; border-radius: 12px;
    outline: none; transition: border-color .2s, background .2s;
}
.field input:focus { border-color: var(--accent); background: var(--card); }

.field-error { display: block; color: var(--danger); font-size: .8rem; margin-top: 4px; min-height: 0; }
.field-error:empty { display: none; }

.check {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 0; font-size: .88rem; line-height: 1.45; cursor: pointer;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box {
    flex: none; width: 22px; height: 22px; margin-top: 1px;
    border: 2px solid var(--border); border-radius: 7px;
    display: grid; place-items: center; transition: all .15s;
}
.check input:checked + .box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .box::after {
    content: ''; width: 6px; height: 11px; margin-top: -2px;
    border: solid var(--accent-text); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }

.alert {
    margin: 12px 0; padding: 12px 14px; border-radius: 12px; font-size: .88rem;
    color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent);
}
form .btn { margin-top: 12px; }
.check a { color: var(--link); font-weight: 500; }

.sheet {
    width: min(480px, 100% - 32px); max-height: 85vh; overflow: auto;
    padding: 24px 22px; border: 0; border-radius: var(--radius);
    background: var(--card); color: var(--text);
}
.sheet::backdrop { background: rgb(0 0 0 / .45); }
.sheet .btn { margin-top: 8px; }
.policy h2 { font-size: 1.25rem; font-weight: 700; margin: 0 0 6px; }
.policy p { line-height: 1.55; }
.policy .muted { margin-bottom: 16px; font-size: .85rem; }

.shell > .card.center { margin-block: auto; }
.footer { text-align: center; color: var(--muted); font-size: .9rem; margin-top: auto; }
.footer a { color: var(--link); font-weight: 600; text-decoration: none; }

.fade-in { animation: fadeIn .45s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } }
@keyframes pop { 0% { transform: scale(.4); } 70% { transform: scale(1.1); } }
@keyframes spin { to { transform: rotate(360deg); } }
