/* CW-7C-32F2 — Cloud Wi-Fi captive portal. Layout/flow mirrors the familiar Dr Internet portal (sticky top bar, REDEEM ACCESS card,
   Select Package list, payment section, large buttons) with Cloud Wi-Fi styling. All sizes are fluid: no fixed widths, no horizontal scroll. */
:root {
  --accent: #14b8a6; --accent2: #0d9488; --accent-glow: rgba(20, 184, 166, 0.14);
  --bg: #0b1220; --bg2: #0f1829; --card: #131c2e; --border: #223049;
  --fg: #ffffff; --grey: #a3b1c6; --dim: #7a8aa5; --ok: #10b981; --err: #ef4444; --warn: #f59e0b;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: var(--bg); color: var(--fg); min-height: 100vh; max-width: 100%; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif; }
body { display: flex; flex-direction: column; }
@supports (overflow-x: clip) { body { overflow-x: clip; } } /* clip, not hidden: no extra scroll container for touch hit-testing in captive WebViews */
button, input, .pkg-item, .pay-opt { touch-action: manipulation; }
.diag { margin: 0 12px 12px; padding: 8px 10px; font: 11px/1.4 monospace; color: var(--grey); background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
img, svg { max-width: 100%; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; background: var(--bg2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-icon { width: 38px; height: 38px; flex-shrink: 0; background: var(--accent-glow); color: var(--accent); border-radius: 11px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.brand-icon img { width: 100%; height: 100%; object-fit: contain; }
.brand-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-name { color: var(--accent); font-size: 15px; font-weight: 700; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-sub { color: var(--dim); font-size: 11px; }
.brand-support { color: var(--grey); font-size: 12px; text-decoration: none; margin-top: 2px; }
.brand-mark { flex-shrink: 0; text-align: right; }
.brand-mark-title { color: var(--dim); font-size: 10px; font-weight: 800; letter-spacing: 0.2em; }

.welcome-banner { background: var(--accent-glow); color: var(--grey); font-size: 14px; line-height: 1.5; padding: 12px 16px; text-align: center; overflow-wrap: anywhere; }
.error-banner { background: rgba(239, 68, 68, 0.1); border-bottom: 1px solid var(--err); color: #fca5a5; padding: 12px 16px; font-size: 13px; overflow-wrap: anywhere; }

.container { width: 100%; max-width: 480px; margin: 0 auto; padding: 20px 16px 24px; flex: 1; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 18px; margin-bottom: 18px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25); }
.card.center { text-align: center; }
.card-label { color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: 0.18em; margin-bottom: 14px; }
.input-row { display: flex; gap: 10px; align-items: stretch; }
.voucher-wrap { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); border-radius: 14px; padding: 4px 4px 4px 12px; transition: border-color 0.2s; }
.voucher-wrap:focus-within { border-color: var(--accent); }
.voucher-icon { display: flex; flex-shrink: 0; color: var(--accent); opacity: 0.9; }
.voucher-input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; padding: 14px 8px 14px 0; font-size: 16px; letter-spacing: 0.06em; }
.voucher-input::placeholder { color: var(--dim); letter-spacing: 0; }
.connect-btn { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #04211e; border: none; border-radius: 14px; padding: 0 20px; min-height: 52px; font-size: 15px; font-weight: 800; cursor: pointer; white-space: nowrap; box-shadow: 0 4px 16px var(--accent-glow); }
.connect-btn:active, .pay-btn:active { transform: scale(0.98); }
.connect-btn:disabled, .pay-btn:disabled { opacity: 0.5; cursor: default; }
.form-msg { margin-top: 12px; font-size: 13px; line-height: 1.45; color: #fca5a5; overflow-wrap: anywhere; }
.form-msg.info { color: var(--grey); }

.section-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 22px 0 12px; }
.section-title { font-size: 20px; font-weight: 800; letter-spacing: -0.03em; }
.badge { color: var(--dim); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; white-space: nowrap; }
.section-label { color: var(--dim); font-size: 10px; font-weight: 700; letter-spacing: 0.16em; margin: 22px 0 12px; }

.packages-list { display: flex; flex-direction: column; gap: 10px; }
.pkg-item { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; transition: border-color 0.2s, background 0.2s; }
.pkg-item.selectable { cursor: pointer; }
.pkg-item.selected { border-color: var(--accent); background: var(--accent-glow); }
.pkg-icon { width: 46px; height: 46px; flex-shrink: 0; border-radius: 14px; background: var(--accent); color: #04211e; display: flex; align-items: center; justify-content: center; }
.pkg-info { flex: 1; min-width: 0; }
.pkg-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; overflow-wrap: anywhere; }
.pkg-dur { color: var(--grey); font-size: 13px; }
.pkg-meta { color: var(--dim); font-size: 12px; margin-top: 2px; }
.pkg-price { text-align: right; flex-shrink: 0; }
.price-amt { color: var(--accent); font-size: 19px; font-weight: 800; }
.pkg-item.selected .price-amt { color: var(--fg); }
.price-cur { color: var(--dim); font-size: 11px; font-weight: 600; }

.note { color: var(--grey); font-size: 13px; line-height: 1.5; text-align: center; margin: 16px 4px 4px; overflow-wrap: anywhere; }
.empty { text-align: center; padding: 36px 16px; color: var(--dim); }
.empty-icon { font-size: 44px; margin-bottom: 14px; }
.empty-title { font-size: 15px; font-weight: 700; color: var(--grey); margin-bottom: 8px; }
.empty-text { font-size: 13px; line-height: 1.6; }

.payment-methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.pay-opt { appearance: none; -webkit-appearance: none; min-height: 58px; background: var(--bg2); border: 2px solid var(--border); border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px; cursor: pointer; font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.pay-opt img { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; }
.pay-opt.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-glow); }
.pay-btn { width: 100%; min-height: 54px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #04211e; border: none; border-radius: 16px; padding: 16px 20px; font-size: 16px; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; box-shadow: 0 8px 28px var(--accent-glow); }

.loading, .fullstate { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 40px 16px; color: var(--dim); font-size: 14px; text-align: center; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
.spinner.big { width: 56px; height: 56px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
.state-icon { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 800; margin: 4px auto 10px; }
.state-icon.ok { background: rgba(16, 185, 129, 0.15); border: 3px solid var(--ok); color: var(--ok); }
.state-icon.warn { background: rgba(245, 158, 11, 0.12); border: 3px solid var(--warn); color: var(--warn); }
.state-title { color: var(--fg); font-size: 20px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.state-text { color: var(--grey); font-size: 14px; line-height: 1.6; margin-bottom: 18px; overflow-wrap: anywhere; }
.powered { text-align: center; font-size: 10px; color: var(--dim); letter-spacing: 0.04em; padding: 8px 0 calc(14px + env(safe-area-inset-bottom, 0)); }

@media (max-width: 360px) {
  .container { padding: 16px 12px 20px; }
  .connect-btn { padding: 0 14px; }
  .pkg-item { padding: 14px 12px; gap: 10px; }
  .price-amt { font-size: 17px; }
  .payment-methods { grid-template-columns: minmax(0, 1fr); }
}
