:root {
  --bg: #0c1210;
  --bg-elev: #121a17;
  --surface: #16211d;
  --line: rgba(180, 220, 200, 0.12);
  --text: #e8f2ec;
  --muted: #8aa396;
  --accent: #3dffa8;
  --accent-dim: #1a9e6a;
  --warn: #ffb020;
  --danger: #ff5d5d;
  --ok: #3dffa8;
  --radius: 16px;
  --font: "Instrument Sans", system-ui, sans-serif;
  --display: "Syne", "Instrument Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body {
  padding: 0 16px 40px;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: max(40px, env(safe-area-inset-bottom));
}

input,
textarea,
[contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

img,
svg,
video {
  -webkit-user-drag: none;
  user-drag: none;
  -webkit-touch-callout: none;
}

.product-logo,
.brand-logo,
.access-gate-logo {
  pointer-events: none;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(61, 255, 168, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(61, 255, 168, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at 50% 0%, black 20%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  width: 420px;
  height: 420px;
  top: -120px;
  right: -80px;
  background: radial-gradient(circle, rgba(61, 255, 168, 0.18), transparent 65%);
  filter: blur(8px);
  pointer-events: none;
  z-index: 0;
  animation: drift 12s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translate(0, 0); }
  to { transform: translate(-40px, 50px); }
}

.topbar, .tabs, main, .toast {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 16px;
  animation: rise 0.5s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand-logo {
  height: 52px;
  width: auto;
  max-width: min(160px, 48vw);
  display: block;
  object-fit: contain;
  object-position: left center;
  border-radius: 12px;
}

.balance-chip {
  border: 1px solid var(--line);
  background: rgba(22, 33, 29, 0.85);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.balance-chip span {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.balance-chip strong {
  font-size: 0.95rem;
  color: var(--accent);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  border-radius: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  margin-bottom: 18px;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 10px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}

.panel {
  display: none;
  animation: rise 0.35s ease both;
}

.panel.active {
  display: block;
}

.panel-title {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.panel-lead {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.product-grid {
  display: grid;
  gap: 10px;
}

.product-row {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.product-card {
  text-align: left;
  width: 100%;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(22, 33, 29, 0.95), rgba(12, 18, 16, 0.9));
  color: inherit;
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}

.product-card:hover,
.product-card.selected {
  border-color: rgba(61, 255, 168, 0.45);
  transform: translateY(-1px);
}

.product-card .pc-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.product-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  min-width: 0;
}

.product-title span {
  line-height: 1.25;
}

.product-logo-wrap {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.product-logo-wrap--cryptocom {
  background: #0B1426;
  padding: 6px;
}

.product-logo-wrap--google,
.product-logo-wrap--amazon {
  background: #FFFFFF;
  padding: 8px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.product-logo-wrap--dhl {
  background: transparent;
  padding: 7px;
  box-shadow: none;
}

.product-logo-wrap--google .product-logo,
.product-logo-wrap--amazon .product-logo,
.product-logo-wrap--dhl .product-logo {
  border-radius: 4px;
}

.sheet-head .product-logo-wrap--google,
.sheet-head .product-logo-wrap--amazon {
  padding: 7px;
}

.sheet-head .product-logo-wrap--dhl {
  padding: 6px;
}

.product-logo-wrap--debouncer {
  background: #2B3148;
  padding: 6px;
}

.product-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sheet-head .product-logo-wrap {
  width: 36px;
  height: 36px;
  min-width: 36px;
}

.sheet-head .product-logo-wrap--cryptocom {
  padding: 5px;
}

.product-card .price {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #04110c;
  background: var(--accent);
  padding: 4px 8px;
  border-radius: 999px;
}

.product-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.launch-sheet {
  display: block;
  max-height: 0;
  overflow: hidden;
  margin-top: 0;
  padding: 0;
  border: none;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition:
    max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.28s ease,
    margin-top 0.35s ease;
}

.launch-sheet.open {
  max-height: 1600px;
  opacity: 1;
  margin-top: 8px;
  pointer-events: auto;
}

.launch-sheet-inner {
  overflow: hidden;
  min-height: 0;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  transform: translateY(-6px);
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.launch-sheet.open .launch-sheet-inner {
  transform: translateY(0);
}

.launch-sheet.hidden,
.hidden {
  display: none !important;
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.sheet-head .product-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.field-group {
  margin-bottom: 14px;
}

.field-group label,
.redeem-form label,
.section-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 11px;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.chip.active {
  border-color: transparent;
  background: var(--accent);
  color: #04110c;
  font-weight: 700;
}

.dropzone.disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

.format-box {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 176, 32, 0.25);
  background: rgba(255, 176, 32, 0.06);
}

.format-box-title {
  margin: 0 0 6px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--warn);
  font-weight: 700;
}

.format-box-text {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text);
}

.dropzone {
  display: block;
  border: 1.5px dashed rgba(61, 255, 168, 0.35);
  border-radius: 14px;
  padding: 22px 14px;
  text-align: center;
  cursor: pointer;
  background: rgba(61, 255, 168, 0.04);
  margin-bottom: 12px;
  transition: background 0.2s, border-color 0.2s;
}

.dropzone:hover,
.dropzone.drag {
  background: rgba(61, 255, 168, 0.09);
  border-color: var(--accent);
}

.dz-title {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
}

.dz-sub {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}

.estimate {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.estimate > div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

.estimate span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.estimate strong {
  font-size: 1.05rem;
}

.primary-btn {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: #04110c;
  background: linear-gradient(135deg, var(--accent), #7cffc8);
  transition: opacity 0.2s, transform 0.15s;
}

.primary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.primary-btn:not(:disabled):active {
  transform: scale(0.98);
}

.primary-btn.compact {
  width: auto;
  padding: 11px 14px;
  flex-shrink: 0;
}

.hint {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1.2em;
  white-space: pre-line;
}

.hint.error {
  color: var(--danger);
}

.hint.ok {
  color: var(--ok);
}

.tasks-list,
.tx-list {
  display: grid;
  gap: 10px;
}

.task-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  padding: 14px;
}

.task-card .tc-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.task-card h3 {
  margin: 0;
  font-size: 0.95rem;
}

.task-card .meta {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  white-space: nowrap;
}

.badge.queued,
.badge.submitting,
.badge.pending { color: var(--warn); background: rgba(255, 176, 32, 0.12); }
.badge.processing { color: #7ec8ff; background: rgba(126, 200, 255, 0.12); }
.badge.exported { color: var(--ok); background: rgba(61, 255, 168, 0.12); }
.badge.failed { color: var(--danger); background: rgba(255, 93, 93, 0.12); }

.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  margin: 8px 0;
}

.progress > i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  transition: width 0.4s ease;
}

.progress.indeterminate > i {
  width: 35%;
  animation: slide 1.2s ease-in-out infinite;
}

@keyframes slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
}

.task-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.task-actions a,
.task-actions button {
  flex: 1;
  text-align: center;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 9px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.empty {
  text-align: center;
  padding: 36px 12px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.account-card {
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  background:
    linear-gradient(145deg, rgba(61, 255, 168, 0.16), transparent 50%),
    var(--bg-elev);
  border: 1px solid var(--line);
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.big-balance {
  margin: 6px 0 10px;
  font-family: var(--display);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.redeem-form {
  margin-bottom: 22px;
}

.redeem-form .row {
  display: flex;
  gap: 8px;
}

.redeem-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.redeem-form input:focus {
  outline: 2px solid rgba(61, 255, 168, 0.35);
  outline-offset: 1px;
}

.tx-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
}

.tx-item .left strong {
  display: block;
  font-size: 0.88rem;
}

.tx-item .left span {
  font-size: 0.75rem;
  color: var(--muted);
}

.tx-item .amt {
  font-weight: 700;
  white-space: nowrap;
}

.tx-item .amt.pos { color: var(--ok); }
.tx-item .amt.neg { color: var(--danger); }

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: max(20px, env(safe-area-inset-bottom));
  padding: 12px 14px;
  border-radius: 12px;
  background: #1c2a24;
  border: 1px solid rgba(61, 255, 168, 0.35);
  color: var(--text);
  font-size: 0.9rem;
  z-index: 50;
  animation: rise 0.25s ease both;
}

.toast.hidden {
  display: none;
}

.toast.error {
  border-color: rgba(255, 93, 93, 0.45);
}

body.app-locked {
  overflow: hidden;
}

.app-shell[hidden] {
  display: none !important;
}

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(8, 12, 10, 0.92);
  backdrop-filter: blur(10px);
}

.access-gate.hidden {
  display: none !important;
}

.access-gate-card {
  width: min(100%, 360px);
  text-align: center;
  padding: 28px 20px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(22, 33, 29, 0.98), rgba(12, 18, 16, 0.96));
}

.access-gate-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 14px;
  margin-bottom: 14px;
}

.access-gate-title {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 800;
}

.access-gate-text {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.turnstile-host {
  display: flex;
  justify-content: center;
  min-height: 65px;
  margin-bottom: 10px;
}

.access-gate-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--danger);
  min-height: 1.2em;
}

