/* =====================================================
   steam.css — Steam top-up page (redesign)
   ===================================================== */

:root {
  --bg: #08090c;
  --bg-gradient-top: #142042;
  --bg-elevated: rgba(255, 255, 255, 0.03);
  --bg-elevated-hover: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #f5f6f8;
  --text-muted: #8a92a8;
  --text-dim: #4f6080;
  --gold: #d4af6a;
  --gold-bright: #e8c47e;
  --blue: #4a7cff;
  --blue-bright: #6b94ff;
  --blue-dim: rgba(74, 124, 255, 0.15);
  --red-bright: #ff7878;
  --green: #34c759;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;

  /* Safe area tokens — overridden by Telegram JS SDK */
  --tg-safe-area-inset-top: 0px;
  --tg-content-safe-area-inset-top: 0px;
  --tg-safe-area-inset-bottom: 0px;
  --tg-content-safe-area-inset-bottom: 0px;
  --app-safe-area-top: max(
    env(safe-area-inset-top, 0px),
    var(--tg-safe-area-inset-top, 0px),
    var(--tg-content-safe-area-inset-top, 0px)
  );
  --app-safe-area-bottom: max(
    env(safe-area-inset-bottom, 0px),
    var(--tg-safe-area-inset-bottom, 0px),
    var(--tg-content-safe-area-inset-bottom, 0px)
  );
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Geist', sans-serif;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "ss02";
}
body { min-height: 100vh; display: flex; justify-content: center; }

/* ── PHONE SHELL ── */
.phone {
  width: 100%; max-width: 420px; min-height: 100vh;
  background: radial-gradient(ellipse at top, var(--bg-gradient-top) 0%, var(--bg) 60%);
  position: relative; overflow: hidden; display: flex; flex-direction: column;
  padding-bottom: 95px;
}
.phone::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  opacity: 0.3; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  z-index: 1;
}

.content { flex: 1; position: relative; z-index: 2; padding: 0 0 100px; }

/* ── STEAM HERO ── */
.steam-hero {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
}
.steam-logo {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(255,255,255,0.065) 0%, rgba(255,255,255,0.02) 50%, rgba(255,255,255,0.005) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.steam-logo img { width: 100%; height: 100%; object-fit: cover; }
.steam-title { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.steam-title span { color: var(--blue-bright); }
.steam-subtitle { font-size: 11px; font-weight: 500; color: var(--text-muted); line-height: 1.3; margin-top: 2px; }

/* ── FORM ── */
.form-section { padding: 0 20px; }
.form-group { margin-bottom: 16px; }

/* Unified section heading — overrides .form-label and .payment-methods-title to large bold white */
.form-label,
.payment-methods-title {
  color: var(--text) !important;
  font-weight: 800 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 14px !important;
}

.form-label {
  font-size: 10px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.12em;
  margin-bottom: 8px; display: block;
}

.form-input {
  width: 100%; padding: 14px 16px;
  background: linear-gradient(160deg, rgba(255,255,255,0.055) 0%, rgba(255,255,255,0.015) 50%, rgba(255,255,255,0.005) 100%);
  border: 1px solid rgba(255,255,255,0.06);
  border-top: 1px solid rgba(255,255,255,0.14);
  border-bottom: 1px solid rgba(0,0,0,0.12);
  border-radius: var(--radius-md);
  font-family: 'Geist', sans-serif; font-size: 14px; font-weight: 500;
  color: var(--text); outline: none; transition: border-color .2s;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25), 0 1px 0 rgba(255,255,255,0.06) inset, 0 -1px 0 rgba(0,0,0,0.12) inset;
}
.form-input::placeholder { color: var(--text-dim); }
.form-input:focus { border-color: rgba(74, 124, 255, 0.4); }

/* Unified pill: input + button as one glass control */
.form-field-unified {
  display: flex; align-items: stretch; gap: 0; margin-bottom: 0;
  background: linear-gradient(160deg, rgba(255,255,255,0.055) 0%, rgba(255,255,255,0.015) 50%, rgba(255,255,255,0.005) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transition: border-color .2s, box-shadow .2s;
  position: relative; isolation: isolate;
}
.form-field-unified:focus-within { border-color: rgba(74, 124, 255, 0.4); }

/* Gold variant for login + amount */
.form-field-unified.highlight {
  background: linear-gradient(160deg, rgba(212,175,106,0.08) 0%, rgba(212,175,106,0.02) 60%, rgba(255,255,255,0.005) 100%);
  border: 1px solid rgba(212,175,106,0.35);
  box-shadow: 0 8px 24px rgba(212,175,106,0.12);
}
.form-field-unified.highlight:focus-within {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 3px rgba(212,175,106,0.18), 0 10px 30px rgba(212,175,106,0.2);
}
.form-field-unified.highlight .link-btn { border-left-color: rgba(212,175,106,0.25); }

.form-field-unified .form-input {
  flex: 1; background: transparent; border: none; box-shadow: none;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  padding: 14px 16px; min-width: 0;
}
.form-field-unified .link-btn {
  padding: 0 16px; display: flex; align-items: center;
  border-left: 1px solid rgba(255,255,255,0.06); background: transparent;
}
.form-field-unified .currency-suffix {
  display: flex; align-items: center; padding: 0 16px;
  font-size: 15px; font-weight: 700; color: var(--gold-bright);
  border-left: 1px solid rgba(212,175,106,0.25); pointer-events: none;
}

/* Error / active states (set by steam.js) */
.form-field-unified.is-error { border-color: rgba(255, 120, 120, 0.5) !important; box-shadow: 0 0 0 2px rgba(255, 120, 120, 0.15) !important; }
.form-field-unified.is-active { border-color: rgba(212,175,106,0.55); }

.link-btn {
  font-size: 11px; font-weight: 600; color: var(--blue-bright);
  background: none; border: none; cursor: pointer; padding: 0; white-space: nowrap;
}
.link-btn:hover { color: var(--blue); }

.form-error {
  font-size: 11px; font-weight: 500; color: var(--red-bright);
  margin-top: 6px; min-height: 0;
}
.form-error:empty { display: none; }
.form-success {
  font-size: 11px; font-weight: 500; color: var(--green);
  margin-top: 6px;
}
.form-success:empty { display: none; }
.form-status { text-align: center; margin-top: 8px; }

/* Amount preset chips */
.amount-presets {
  display: flex; border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md); overflow: hidden; margin-top: 10px;
}
.amount-chip {
  flex: 1; padding: 13px 4px;
  background: rgba(255,255,255,0.02); border: none;
  border-right: 1px solid rgba(255,255,255,0.05);
  font-family: 'Geist', sans-serif; font-size: 13px; font-weight: 700;
  color: var(--text-muted); text-align: center; cursor: pointer; transition: all .15s;
}
.amount-chip:last-child { border-right: none; }
.amount-chip:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.amount-chip.active { background: rgba(74,124,255,0.18); color: var(--blue-bright); }

/* ── TRUST ROW ── */
.trust-row { display: flex; gap: 6px; margin-bottom: 20px; font-size: 11px; }
.trust-pill {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 9px 4px; border-radius: 10px; color: var(--text);
  background: rgba(255,255,255,0.025); border: 1px solid rgba(255,255,255,0.05); font-weight: 600;
}
.trust-pill svg { width: 12px; height: 12px; color: var(--green); flex-shrink: 0; }

/* ── PAYMENT METHODS ── */
.payment-methods-title {
  font-size: 10px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.12em;
  margin-bottom: 12px; display: block;
}
.payment-methods-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.payment-method-card {
  padding: 14px 12px;
  background: linear-gradient(160deg, rgba(255,255,255,0.055) 0%, rgba(255,255,255,0.015) 50%, rgba(255,255,255,0.005) 100%);
  border: 1px solid rgba(255,255,255,0.06);
  border-top: 1px solid rgba(255,255,255,0.14);
  border-bottom: 1px solid rgba(0,0,0,0.12);
  border-radius: var(--radius-md);
  cursor: pointer; transition: all .2s; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 60px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25), 0 1px 0 rgba(255,255,255,0.06) inset, 0 -1px 0 rgba(0,0,0,0.12) inset;
  font-size: 13px; font-weight: 700; color: var(--text-muted);
  font-family: 'Geist', sans-serif;
}
.payment-method-card:hover {
  background: linear-gradient(160deg, rgba(255,255,255,0.065) 0%, rgba(255,255,255,0.025) 100%);
  color: var(--text);
}
.payment-method-card.active,
.payment-method-card.is-selected {
  border-color: rgba(74, 124, 255, 0.35);
  background: linear-gradient(160deg, rgba(74,124,255,0.15) 0%, rgba(74,124,255,0.05) 100%);
  color: var(--blue-bright);
}
.payment-method-card .pm-icon {
  width: 28px; height: 28px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.payment-method-card .pm-icon img,
.payment-method-card .pm-icon svg { width: 100%; height: 100%; object-fit: contain; }

/* ── SUMMARY ── */
.summary {
  padding: 16px;
  background: linear-gradient(160deg, rgba(255,255,255,0.065) 0%, rgba(255,255,255,0.02) 50%, rgba(255,255,255,0.005) 100%);
  border: 1px solid rgba(255,255,255,0.06);
  border-top: 1px solid rgba(255,255,255,0.18);
  border-bottom: 1px solid rgba(0,0,0,0.3);
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.2), 0 1px 0 rgba(255,255,255,0.08) inset, 0 -1px 0 rgba(0,0,0,0.15) inset;
  margin-bottom: 6px;
}
.summary h2 {
  font-size: 12px; font-weight: 800; color: var(--gold-bright);
  text-transform: uppercase; letter-spacing: 0.16em; margin-bottom: 14px;
}
.summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; font-size: 12px; color: var(--text-dim);
}
.summary-row + .summary-row { border-top: 1px solid rgba(255,255,255,0.04); }
.summary-row.total {
  margin-top: 4px; padding-top: 12px;
  border-top: 1px solid rgba(212,175,106,0.2);
  font-size: 13px; color: var(--text);
}
.summary-row strong { color: var(--text); font-weight: 700; font-size: 14px; }
.summary-row.total strong {
  color: var(--gold-bright); font-size: 18px; font-weight: 800;
  letter-spacing: -0.01em; text-shadow: 0 0 12px rgba(212,175,106,0.35);
}
.currency { font-size: 0.9em; }

/* ── BUY SECTION ── */
.buy-section { padding: 0 0 20px; }

.buy-btn {
  width: 100%; padding: 16px;
  background: linear-gradient(180deg, #6be893 0%, #34c759 50%, #1a9e3c 100%);
  border: none; border-radius: 14px;
  font-family: 'Geist', sans-serif; font-size: 15px; font-weight: 700;
  color: #fff; cursor: pointer;
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 -1px 0 rgba(0,0,0,0.25) inset, 0 6px 18px rgba(52,199,89,0.4);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-bottom: 12px; transition: all .25s;
  transform: translateZ(0); will-change: transform;
}
.buy-btn:hover { filter: brightness(1.08); }
.buy-btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
.buy-btn svg { width: 18px; height: 18px; stroke-width: 2; }

.pay-note {
  font-size: 11px; font-weight: 500; color: var(--text-dim);
  text-align: center; margin-bottom: 16px;
}

/* ── SUMMARY WRAPPER ── */
.summary-wrapper { margin-bottom: 16px; }

/* ── INSTRUCTION / FAQ ── */
.instruction { padding: 0 20px 16px; }
.faq { padding: 0 20px 20px; }

.faq-root {
  background: linear-gradient(160deg, rgba(255,255,255,0.065) 0%, rgba(255,255,255,0.02) 50%, rgba(255,255,255,0.005) 100%);
  border: 1px solid rgba(255,255,255,0.06);
  border-top: 1px solid rgba(255,255,255,0.18);
  border-bottom: 1px solid rgba(0,0,0,0.3);
  border-radius: var(--radius-md); overflow: hidden;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.2), 0 1px 0 rgba(255,255,255,0.08) inset, 0 -1px 0 rgba(0,0,0,0.15) inset;
}
.faq-root > summary {
  list-style: none; padding: 16px 18px; cursor: pointer;
  display: flex; align-items: center; gap: 12px; user-select: none;
}
.faq-root > summary::-webkit-details-marker { display: none; }
.faq-root > summary::marker { content: ''; }
.faq-root > summary .faq-root-title {
  flex: 1; font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: 0.01em;
}
.faq-root > summary .chev {
  width: 18px; height: 18px; color: var(--blue-bright); transition: transform .25s; flex-shrink: 0;
}
.faq-root[open] > summary .chev { transform: rotate(180deg); }
.faq-root[open] > summary { border-bottom: 1px solid rgba(255,255,255,0.06); }

.instruction-card { padding: 6px; font-size: 12px; line-height: 1.5; color: var(--text-muted); }
.instruction-step {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 12px; border-radius: calc(var(--radius-md) - 4px); transition: background .2s;
}
.instruction-step + .instruction-step { border-top: 1px solid rgba(255,255,255,0.05); }
.instruction-step .step-num {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(74,124,255,0.22), rgba(74,124,255,0.08));
  border: 1px solid rgba(74,124,255,0.35); color: var(--blue-bright);
  font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.instruction-step-body { flex: 1; min-width: 0; }
.instruction-step-body p { margin: 0; }
.instruction-step-body p + p { margin-top: 6px; font-size: 10.5px; color: var(--text-dim); }
.instruction-card a { color: var(--blue-bright); text-decoration: none; }
.instruction-card a:hover { text-decoration: underline; }

.faq-list { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.faq-item {
  background: linear-gradient(160deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px; overflow: hidden; transition: border-color .2s, background .2s;
}
.faq-item:hover { border-color: rgba(74,124,255,0.25); background: linear-gradient(160deg, rgba(74,124,255,0.06) 0%, rgba(74,124,255,0.015) 100%); }
.faq-item[open] { border-color: rgba(74,124,255,0.35); background: linear-gradient(160deg, rgba(74,124,255,0.08) 0%, rgba(74,124,255,0.02) 100%); }
.faq-item summary {
  list-style: none; padding: 11px 12px; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--text);
  user-select: none; display: flex; align-items: center; gap: 10px; transition: color .2s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::marker { content: ''; }
.faq-item summary > span:first-of-type { flex: 1; }
.faq-item summary .chev-sm {
  width: 14px; height: 14px; color: var(--blue-bright); opacity: .7;
  transition: transform .2s, opacity .2s; flex-shrink: 0;
}
.faq-item:hover summary .chev-sm,
.faq-item[open] summary .chev-sm { opacity: 1; }
.faq-item[open] summary .chev-sm { transform: rotate(180deg); }
.faq-item[open] summary { color: var(--blue-bright); }
.faq-item p { padding: 0 12px 12px; font-size: 12px; line-height: 1.5; color: var(--text-muted); }
.faq-item a { color: var(--blue-bright); text-decoration: none; }
.faq-item a:hover { text-decoration: underline; }

/* ── FOOTER ── */
.steam-footer { padding: 16px 20px; text-align: center; }
.steam-footer p { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.steam-footer a { font-size: 12px; color: var(--blue-bright); text-decoration: none; font-weight: 600; }
.steam-footer a:hover { text-decoration: underline; }

/* ── GUIDE MODAL (hidden by default) ── */
.steam-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(4px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px;
}
.steam-modal.hidden { display: none; }
.steam-modal img { max-width: 100%; border-radius: 12px; }
.steam-modal-close {
  margin-bottom: 12px; padding: 10px 24px;
  background: var(--blue); border: none; border-radius: 10px;
  color: #fff; font-family: 'Geist', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer;
}
