:root {
  --bg0: #071018;
  --bg1: #0c1a24;
  --card: rgba(14, 28, 38, 0.78);
  --card-solid: #102230;
  --line: rgba(120, 200, 210, 0.16);
  --text: #e8f4f6;
  --muted: #8aa3ad;
  --accent: #2ee6c5;
  --accent-2: #4fd1ff;
  --warn: #ffb454;
  --danger: #ff6b7a;
  --ok: #5dffb0;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --nav-h: 64px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Syne", "DM Sans", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg0);
}
html.app-lock,
body.app-shell {
  overflow: hidden;
  overscroll-behavior: none;
  height: 100%;
  height: 100dvh;
}
a { color: var(--accent-2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { color-scheme: dark; }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.6rem !important;
  background-image:
    linear-gradient(45deg, transparent 50%, #8fb1b6 50%),
    linear-gradient(135deg, #8fb1b6 50%, transparent 50%) !important;
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px) !important;
  background-size: 6px 6px, 6px 6px !important;
  background-repeat: no-repeat !important;
}
select option {
  color: #e8f7f5;
  background: #07141c;
}
input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(46, 230, 197, 0.18), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, rgba(79, 209, 255, 0.14), transparent 55%),
    radial-gradient(600px 400px at 50% 110%, rgba(20, 90, 110, 0.35), transparent 50%),
    linear-gradient(165deg, #071018, #0a1822 45%, #071018);
}

.page {
  width: min(460px, 100%);
  margin: 0 auto;
  padding: 1.25rem 1.1rem calc(var(--nav-h) + 3.6rem + env(safe-area-inset-bottom));
  animation: pageIn 0.45s ease both;
}
.page.auth-page,
.page.welcome-page {
  width: min(460px, 100%);
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 auto;
  padding: 1rem 1.1rem calc(5.8rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
}
.auth-body, .welcome-body {
  height: 100dvh;
  overflow: hidden;
}
.auth-card {
  max-height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}
.auth-card-reg {
  padding: 1.1rem 1.05rem;
}
.auth-brand.compact h1 { font-size: 1.35rem; }
.auth-brand.compact { margin-bottom: 0.65rem; }
.auth-btn-stack {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.15rem;
}
.auth-actions .btn-after-fields,
.stack-form.auth-actions > .btn {
  margin-top: 1.15rem;
}
.stack-form.auth-actions {
  gap: 0.65rem;
}
.stack-form.auth-actions label {
  gap: 0.28rem;
}
.stack-form.auth-actions input {
  padding: 0.7rem 0.9rem;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.enter-up { animation: enterUp 0.55s cubic-bezier(.2,.8,.2,1) both; }
.enter-fade { animation: enterFade 0.4s ease both; }
@keyframes enterUp {
  from { opacity: 0; transform: translateY(28px); }
  to { opacity: 1; transform: none; }
}
@keyframes enterFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* WiFi pulse */
.wifi-mark { color: var(--accent); display: grid; place-items: center; }
.wifi-mark.sm { margin-bottom: 0.4rem; }
.wifi-svg { overflow: visible; }
.wifi-arcs .arc {
  opacity: 0.25;
  animation: wifiPulse 2.4s ease-in-out infinite;
}
.wifi-arcs .a1 { animation-delay: 0s; }
.wifi-arcs .a2 { animation-delay: 0.25s; }
.wifi-arcs .a3 { animation-delay: 0.5s; }
.wifi-dot { animation: wifiDot 2.4s ease-in-out infinite; }
@keyframes wifiPulse {
  0%, 100% { opacity: 0.2; }
  40% { opacity: 1; filter: drop-shadow(0 0 8px rgba(46,230,197,.55)); }
}
@keyframes wifiDot {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  40% { transform: scale(1.15); opacity: 1; }
}

/* Welcome */
.welcome-page,
.auth-page {
  /* layout handled via .page.auth-page / .page.welcome-page */
}
.auth-body .page.auth-page { padding-bottom: 2rem; }
.page.otp-page {
  justify-content: flex-start;
  padding-top: max(0.75rem, env(safe-area-inset-top));
  padding-bottom: 1rem;
}
.page.otp-page .auth-card {
  margin-top: 0.35rem;
}
.otp-body .page.otp-page {
  height: 100dvh;
  max-height: 100dvh;
}
.auth-secondary { margin-top: 0.75rem; text-align: center; }
.hero-welcome { text-align: center; padding: 2rem 0.5rem; }
.brand-eyebrow {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--muted);
  margin: 1.2rem 0 0.4rem;
}
.brand-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.6rem, 10vw, 3.6rem);
  letter-spacing: -0.03em;
  margin: 0;
  background: linear-gradient(120deg, #fff 20%, var(--accent) 55%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub {
  color: var(--muted);
  max-width: 28rem;
  margin: 0.9rem auto 1.6rem;
  line-height: 1.5;
}
.cta-row { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.welcome-links { margin-top: 1.6rem; color: var(--muted); display: flex; gap: 0.6rem; justify-content: center; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  border: 1px solid transparent; border-radius: 999px;
  padding: 0.75rem 1.25rem; cursor: pointer; font-weight: 700;
  transition: transform .15s ease, background .2s, border-color .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #1ac4b0 40%, var(--accent-2));
  color: #042018; box-shadow: 0 10px 30px rgba(46, 230, 197, 0.25);
}
.btn-ghost {
  background: transparent; border-color: var(--line); color: var(--text);
}
.btn-soft {
  background: rgba(46, 230, 197, 0.1); border-color: var(--line); color: var(--text);
}
.btn-block { width: 100%; }
.btn-lg { padding: 0.95rem 1.5rem; font-size: 1.02rem; }
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.85rem; }

/* Auth / cards */
.auth-card, .balance-card, .stat-tile, .tariff-card, .info-list, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.auth-card { padding: 1.5rem 1.25rem; }
.auth-brand { text-align: center; margin-bottom: 1rem; }
.auth-brand h1 { font-family: var(--display); margin: 0.2rem 0; font-size: 1.7rem; }
.auth-brand p { margin: 0; color: var(--muted); }
.hint-box {
  background: rgba(255, 180, 84, 0.1);
  border: 1px solid rgba(255, 180, 84, 0.25);
  color: #ffd9a3;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  font-size: 0.88rem;
  margin-bottom: 1rem;
}
.pay-offline-steps {
  margin: 0 0 1.1rem;
  padding-left: 1.15rem;
  color: var(--muted);
  display: grid;
  gap: 0.45rem;
}
.pay-link-label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 0.8rem;
}
.pay-offline-actions { display: grid; gap: 0.65rem; }
.pay-offline-actions .btn.copied { background: rgba(46, 230, 197, 0.16); }
.pay-qr {
  margin: 1.2rem 0 0.4rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}
.pay-qr svg {
  display: block;
  width: 148px;
  height: 148px;
  margin: 0 auto 0.45rem;
  background: #fff;
  border-radius: 12px;
  padding: 8px;
}
.stack-form { display: grid; gap: 0.75rem; }
.stack-form label { display: grid; gap: 0.35rem; font-size: 0.86rem; color: var(--muted); }
.stack-form input, .stack-form select, .stack-form textarea,
.search-form input, .action-block input, .action-block select, .action-block textarea,
#notesArea, #pushMsg, #pushTitle, #macInput {
  width: 100%;
  background: rgba(5, 14, 20, 0.65);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem 0.95rem;
  outline: none;
}
.stack-form input:focus, .action-block input:focus, .action-block select:focus, textarea:focus {
  border-color: rgba(46, 230, 197, 0.55);
  box-shadow: 0 0 0 3px rgba(46, 230, 197, 0.12);
}
.text-link { display: block; text-align: center; margin-top: 0.9rem; font-weight: 600; }
.text-link.muted, .muted { color: var(--muted); }
.auth-extra { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-top: 1.2rem; }
.field-hint { font-size: 0.8rem; min-height: 1.1em; }
.field-hint.ok { color: var(--ok); }
.field-hint.bad { color: var(--danger); }

.flash-stack { margin-bottom: 0.8rem; }
.flash {
  padding: 0.75rem 1rem; border-radius: 14px; margin-bottom: 0.6rem; font-size: 0.92rem;
}
.flash-ok, .flash-success { background: rgba(93,255,176,.12); border: 1px solid rgba(93,255,176,.3); }
.flash-err, .flash-danger, .flash-error { background: rgba(255,107,122,.12); border: 1px solid rgba(255,107,122,.3); }
.flash-err { /* alias */ }

/* Dashboard */
.dash-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.1rem;
}
.dash-head h2, .dash-name {
  font-family: var(--display); margin: 0.15rem 0 0; font-size: 1.55rem; letter-spacing: -0.02em;
}
.balance-card {
  padding: 1.35rem 1.25rem 1.2rem;
  position: relative;
  overflow: hidden;
  margin-bottom: 0.9rem;
}
.balance-card::before {
  content: "";
  position: absolute; inset: auto -20% -40% 30%;
  height: 140px;
  background: radial-gradient(circle, rgba(46,230,197,.28), transparent 70%);
  pointer-events: none;
}
.balance-label { color: var(--muted); font-size: 0.9rem; }
.balance-value {
  font-family: var(--font);
  font-size: 2.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0.2rem 0 1rem;
  font-variant-numeric: tabular-nums;
}
.balance-value span { font-size: 1rem; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.balance-cta .plus {
  display: inline-grid; place-items: center;
  width: 1.4rem; height: 1.4rem; border-radius: 50%;
  background: rgba(4, 32, 24, 0.2); font-size: 1.1rem; line-height: 1;
}
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}
.stat-tile { padding: 1rem; }
.stat-tile.wide { grid-column: 1 / -1; }
.stat-tile.warn { border-color: rgba(255,180,84,.35); }
.stat-label { display: block; color: var(--muted); font-size: 0.8rem; margin-bottom: 0.35rem; line-height: 1.35; }
.stat-tile strong { font-size: 1.35rem; font-family: var(--font); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.stat-tile strong.sm { font-size: 1.05rem; }

/* Payment */
.tariff-list { display: grid; gap: 0.7rem; margin-bottom: 1rem; }
.tariff-card {
  display: block; cursor: pointer; padding: 0;
  transition: transform .15s, border-color .2s, box-shadow .2s;
}
.tariff-card input { display: none; }
.tariff-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
}
.tariff-left { min-width: 0; display: grid; gap: 0.2rem; }
.tariff-name {
  font-weight: 700;
  font-size: 1.02rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tariff-meta { color: var(--muted); font-size: 0.85rem; }
.tariff-price {
  flex-shrink: 0;
  font-family: var(--font);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  text-align: right;
}
.tariff-price small { color: var(--muted); font-weight: 600; font-size: 0.75rem; }
.tariff-card:has(input:checked) {
  border-color: rgba(46,230,197,.55);
  box-shadow: 0 0 0 1px rgba(46,230,197,.25), var(--shadow);
  transform: translateY(-1px);
}
.promo-row { display: grid; grid-template-columns: 1fr auto; gap: 0.55rem; margin: 0.8rem 0 0.35rem; }
.promo-input,
#promoInput {
  width: 100%;
  background: rgba(5, 14, 20, 0.65) !important;
  border: 1px solid var(--line) !important;
  border-radius: 14px !important;
  padding: 0.8rem 0.95rem !important;
  color: var(--text) !important;
  outline: none;
}
.promo-input:focus,
#promoInput:focus {
  border-color: rgba(46,230,197,.55) !important;
  box-shadow: 0 0 0 3px rgba(46,230,197,.12);
}
.method-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; margin: 1rem 0; }
.method-card {
  border: 1px solid var(--line); border-radius: 16px; padding: 0.9rem;
  text-align: center; cursor: pointer; background: rgba(5,14,20,.4);
  font-weight: 600;
}
.method-card:has(input:checked) { border-color: var(--accent); color: var(--accent); background: rgba(46,230,197,.08); }
.method-card input { display: none; }

.cta-col {
  display: grid;
  gap: 0.85rem;
  width: min(320px, 100%);
  margin: 0 auto;
}
.admin-pass-label { opacity: 0.85; }
.admin-pass-label input { font-size: 0.95rem; }

/* Telegram OTP */
.code-form { display: grid; gap: 1rem; position: relative; }
.code-native {
  position: absolute;
  inset: 0 0 auto;
  width: 100%;
  height: 58px;
  opacity: .01;
  z-index: 2;
  cursor: text;
}
.code-boxes {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.45rem;
}
.code-boxes span {
  height: 52px; border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(5,14,20,.55);
  display: grid; place-items: center;
  font-size: 1.4rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.code-boxes span.filled {
  border-color: rgba(46,230,197,.5);
  color: var(--accent);
}
.code-boxes span.current {
  border-color: var(--accent);
  background: rgba(46, 230, 197, 0.08);
  box-shadow: 0 0 0 3px rgba(46, 230, 197, 0.16);
}
.code-boxes.is-focused span.current:not(.filled)::after {
  content: "";
  width: 2px;
  height: 1.2em;
  border-radius: 1px;
  background: var(--accent);
  animation: codeCaret 1.05s steps(1) infinite;
}
@keyframes codeCaret {
  50% { opacity: 0; }
}

.choice-sheet { position: fixed; inset: 0; z-index: 120; }
.choice-sheet[hidden] { display: none; }
.choice-backdrop {
  position: absolute; inset: 0; border: 0;
  background: rgba(0, 7, 12, .3);
  backdrop-filter: blur(0);
  transition: backdrop-filter .24s ease, background .24s ease;
}
.choice-card {
  position: absolute; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom));
  width: min(420px, calc(100% - 1.2rem));
  padding: 1rem; border: 1px solid rgba(46,230,197,.22); border-radius: 24px;
  background: rgba(8, 21, 29, .96); box-shadow: 0 24px 70px rgba(0,0,0,.55);
  transform: translate(-50%, 120%); transition: transform .28s cubic-bezier(.2,.8,.2,1);
}
.choice-sheet.open .choice-backdrop { background: rgba(0, 7, 12, .62); backdrop-filter: blur(12px); }
.choice-sheet.open .choice-card { transform: translate(-50%, 0); }
.choice-card h2 { margin: .45rem 0 1rem; text-align: center; }
.choice-card .btn + .btn { margin-top: .65rem; }
.choice-grip { display: block; width: 42px; height: 4px; margin: 0 auto; border-radius: 9px; background: var(--line); }

.page { transition: filter .35s ease, opacity .35s ease, transform .35s ease; }
.page.is-blurred { filter: blur(12px); opacity: .2; transform: scale(.985); }
.page-transition {
  position: fixed; inset: 0; z-index: 200; pointer-events: none;
  display: grid; place-content: center; justify-items: center; gap: .8rem;
  opacity: 0; visibility: hidden; background: rgba(3, 12, 18, .3);
  backdrop-filter: blur(0); transition: opacity .35s ease, backdrop-filter .6s ease, visibility .35s;
}
.page-transition, .page-transition * { pointer-events: none !important; }
.page-transition.active { opacity: 1; visibility: visible; backdrop-filter: blur(18px); }
.transition-orb {
  width: 54px; height: 54px; border-radius: 50%;
  border: 3px solid rgba(46,230,197,.15); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
.page-transition span { font-family: var(--display); letter-spacing: .16em; color: var(--accent); }

.telegram-prompt {
  position: fixed; z-index: 90; left: 50%; top: max(.7rem, env(safe-area-inset-top));
  transform: translateX(-50%); width: min(440px, calc(100% - 1.2rem));
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  padding: .75rem; border: 1px solid rgba(46,230,197,.25); border-radius: 18px;
  background: rgba(7, 19, 27, .94); backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0,0,0,.42); animation: installIn .45s both;
}
.telegram-prompt div { display: grid; gap: .1rem; min-width: 0; }
.telegram-prompt strong { font-size: .88rem; }
.telegram-prompt span { color: var(--muted); font-size: .7rem; }

.profile-section-head { display: flex; justify-content: space-between; align-items: end; margin-top: 1.2rem; }
.profile-section-head .section-title, .profile-section-head p { margin: 0; }
.device-slots { padding: .35rem .65rem; border-radius: 999px; color: var(--accent); background: rgba(46,230,197,.1); }
.device-policy-copy { margin: .45rem 0 .8rem; font-size: .78rem; }
.profile-devices { display: grid; gap: .6rem; }
.profile-device {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .75rem;
  padding: .8rem; border: 1px solid var(--line); border-radius: 16px; background: rgba(5,14,20,.48);
}
.device-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; color: var(--accent); background: rgba(46,230,197,.1); }
.remove-card h2 { margin-bottom: .4rem; }
.remove-copy { color: var(--muted); margin: 0 0 .8rem; line-height: 1.45; }
.device-main { min-width: 0; display: grid; gap: .12rem; }
.device-main span, .device-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-main span { color: var(--muted); font-size: .72rem; }
.device-main small { color: var(--muted); font-size: .68rem; }
.recovery-result { margin-bottom: 1rem; padding: 1rem; border: 1px solid rgba(46,230,197,.2); border-radius: 16px; background: rgba(46,230,197,.07); }
.recovery-result p { color: var(--muted); margin: .35rem 0 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Bottom nav */
.bottom-nav {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(460px, 100%);
  z-index: 50;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(8, 18, 26, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.nav-bar {
  position: relative;
  height: 64px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: stretch;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  transition: color .25s ease;
  position: relative;
  z-index: 2;
  text-decoration: none;
}
.nav-item.active { color: var(--accent); }
.nav-ico { display: grid; place-items: center; line-height: 0; }
.nav-indicator {
  position: absolute;
  top: 6px; bottom: 6px;
  width: 33.333%;
  border-radius: 14px;
  background: rgba(46, 230, 197, 0.1);
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1);
  z-index: 1;
  pointer-events: none;
}

.info-list { padding: 0.4rem 1rem; margin-bottom: 1rem; }
.info-list > div {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 0; border-bottom: 1px solid var(--line); font-size: 0.95rem;
}
.info-list > div:last-child { border-bottom: 0; }
.info-list span { color: var(--muted); }
.section-title { font-family: var(--display); margin: 1.2rem 0 0.7rem; }
.history-list { display: grid; gap: 0.55rem; margin-bottom: 1.8rem; padding-bottom: 0.4rem; }
.history-more { display: inline-block; margin-bottom: 2.2rem; }
.history-item {
  background: rgba(5,14,20,.45); border: 1px solid var(--line);
  border-radius: 14px; padding: 0.75rem 0.9rem;
}
.history-item time { color: var(--muted); font-size: 0.78rem; }
.history-item p { margin: 0.25rem 0 0; font-size: 0.92rem; }
.history-list.compact { max-height: 360px; overflow: auto; }

.center-text { text-align: center; }
.loader-ring {
  width: 54px; height: 54px; margin: 0.5rem auto 1rem;
  border-radius: 50%;
  border: 3px solid rgba(46,230,197,.2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.success-mark {
  width: 64px; height: 64px; margin: 0 auto 1rem;
  border-radius: 50%; display: grid; place-items: center;
  background: rgba(93,255,176,.15); color: var(--ok);
  font-size: 1.8rem; font-weight: 800;
  animation: pop 0.5s cubic-bezier(.2,.9,.2,1);
}
@keyframes pop {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@media (min-width: 900px) {
  .page { width: min(520px, 100%); padding-top: 2rem; }
  .page.auth-page, .page.welcome-page { padding-top: 1rem; }
}

/* PWA install banner */
.install-banner {
  position: fixed;
  left: 50%;
  bottom: calc(0.75rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(440px, calc(100% - 1.2rem));
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.75rem;
  border-radius: 18px;
  background: rgba(10, 22, 30, 0.92);
  border: 1px solid rgba(46, 230, 197, 0.28);
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
  backdrop-filter: blur(16px);
  z-index: 80;
  animation: installIn .45s cubic-bezier(.2,.8,.2,1) both;
}
.install-banner[hidden] { display: none !important; }
.install-ico {
  width: 44px; height: 44px; border-radius: 12px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(46,230,197,.2), 0 8px 20px rgba(46,230,197,.15);
}
.install-ico img { display: block; width: 100%; height: 100%; }
.install-text { display: grid; gap: 0.1rem; min-width: 0; }
.install-text strong {
  font-size: 0.86rem; font-weight: 700; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.install-text span {
  font-size: 0.72rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#installBtn { white-space: nowrap; padding: 0.55rem 0.9rem; }
.install-close {
  width: 28px; height: 28px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); font-size: 1.2rem; line-height: 1;
  cursor: pointer;
}
.install-steps {
  margin: 0.6rem 0 0; padding-left: 1.2rem;
  display: grid; gap: 0.35rem; color: var(--muted); font-size: 0.92rem;
}
@keyframes installIn {
  from { opacity: 0; transform: translateX(-50%) translateY(18px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.stack-form input[readonly] {
  opacity: 0.92;
  cursor: default;
  color: var(--accent);
  font-weight: 700;
}

.extras-entry { margin: 1.1rem 0 0.4rem; }
.extras-hint,
.extras-path-note {
  margin: 0.35rem 0 0.85rem;
  font-size: 0.9rem;
  line-height: 1.4;
}
.photo-howto {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(8, 22, 30, 0.45);
}
.photo-howto .install-steps { margin-bottom: 0; }
.extra-card {
  display: block;
  margin: 1rem 0;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
}
.extra-card strong { display: block; margin-bottom: 0.35rem; }
.store-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin: 1.1rem 0;
}
.store-badge {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 0.9rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(14, 28, 38, 0.9);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: rgba(46, 230, 197, .18);
}
.store-badge.play { border-color: rgba(0, 200, 83, .35); }
.store-badge.apple { border-color: rgba(232, 244, 246, .2); }
.photo-warn {
  margin: 1rem 0 0;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 107, 122, .35);
  background: rgba(255, 107, 122, .08);
  color: #ffd0d5;
  font-size: 0.92rem;
  line-height: 1.45;
}
.photo-access { margin-top: 1.2rem; position: relative; z-index: 2; }
.ad-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 1.1rem;
  background: rgba(4, 10, 14, .78);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.ad-overlay[hidden] { display: none !important; pointer-events: none !important; }
.ad-overlay.open {
  display: grid;
  opacity: 1;
  pointer-events: auto;
}
.ad-overlay:not(.open),
.ad-overlay:not(.open) * { pointer-events: none !important; }
.ad-card {
  width: min(420px, 100%);
  background: #102230;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.1rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.ad-card img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 0.8rem;
}
.ad-card h2 { margin: 0 0 .4rem; font-family: var(--display); }
.ad-card p { margin: 0; color: var(--muted); }
.ad-timer {
  margin-top: 1rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: .04em;
}

.support-choice { display: grid; gap: 0.75rem; margin: 0.4rem 0 0.2rem; }
.page.support-chat-page {
  height: 100dvh;
  max-height: 100dvh;
  padding: 0.85rem 0.9rem calc(var(--nav-h) + 0.4rem + env(safe-area-inset-bottom));
  display: flex;
  overflow: hidden;
}
body.guest-chat .page.support-chat-page {
  padding-bottom: calc(0.9rem + env(safe-area-inset-bottom));
}
.chat-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.chat-head .muted { margin: 0; font-size: 0.75rem; }
.chat-head strong { display: block; }
.chat-back {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 1.1rem;
}
.chat-log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.2rem 0.1rem 0.6rem;
}
.chat-empty { text-align: center; margin: auto; }
.bubble {
  max-width: 86%;
  padding: 0.65rem 0.8rem;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  align-self: flex-start;
}
.bubble p { margin: 0.15rem 0; white-space: pre-wrap; word-break: break-word; }
.bubble-media {
  display: block;
  margin: 0.35rem 0;
  border-radius: 12px;
  overflow: hidden;
  max-width: min(240px, 70vw);
}
.bubble-media img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}
.bubble.admin .bubble-media { max-width: min(220px, 65vw); }
.bubble time { display: block; color: var(--muted); font-size: 0.68rem; margin-top: 0.25rem; }
.bubble-who { display: block; font-size: 0.68rem; color: var(--accent); font-weight: 700; }
.bubble.client {
  align-self: flex-end;
  background: rgba(46, 230, 197, .14);
  border-color: rgba(46, 230, 197, .28);
}
.bubble.client .bubble-who { text-align: right; }
.bubble.system {
  align-self: center;
  max-width: 92%;
  background: transparent;
  border: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}
.bubble.system .bubble-who, .bubble.system time { display: none; }
.chat-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
  align-items: end;
  padding-top: 0.2rem;
}
.chat-composer textarea {
  width: 100%;
  min-height: 46px;
  max-height: 120px;
  resize: none;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 0.7rem 0.85rem;
}
.chat-composer.is-locked {
  opacity: 0.72;
}
.chat-wait-hint {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
}
