/* GiftBuy — quiet, collectible-marketplace interface */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* Primitive palette */
  --ink-950: oklch(0.15 0.012 155);
  --ink-900: oklch(0.19 0.014 155);
  --ink-850: oklch(0.23 0.015 155);
  --ink-800: oklch(0.28 0.016 155);
  --paper-100: oklch(0.96 0.012 105);
  --paper-300: oklch(0.78 0.015 130);
  --paper-400: oklch(0.69 0.015 130);
  --lime-400: oklch(0.9 0.19 125);
  --lime-900: oklch(0.3 0.06 125);
  --gold-400: oklch(0.84 0.15 88);
  --green-400: oklch(0.79 0.16 150);
  --red-400: oklch(0.72 0.16 25);
  --blue-400: oklch(0.75 0.12 240);
  --purple-400: oklch(0.75 0.14 310);

  /* Semantic tokens */
  --color-bg: var(--ink-950);
  --color-surface: var(--ink-900);
  --color-surface-raised: var(--ink-850);
  --color-border: oklch(0.34 0.018 155 / 0.72);
  --color-border-soft: oklch(0.31 0.015 155 / 0.48);
  --color-text: var(--paper-100);
  --color-text-dim: var(--paper-300);
  --color-text-muted: var(--paper-400);
  --color-accent: var(--lime-400);
  --color-on-accent: var(--ink-950);
  --color-gold: var(--gold-400);
  --color-success: var(--green-400);
  --color-danger: var(--red-400);

  /* Backward-compatible aliases for dynamic inline content */
  --text-dim: var(--color-text-dim);
  --gold: var(--color-gold);

  /* Component tokens */
  --surface-card: oklch(0.2 0.014 155 / 0.94);
  --surface-control: oklch(0.25 0.015 155 / 0.86);
  --surface-nav: oklch(0.18 0.014 155 / 0.92);
  --shadow-card: 0 16px 44px oklch(0.08 0.01 155 / 0.2);
  --radius: 24px;
  --radius-sm: 16px;
  --radius-pill: 999px;
  --header-h: 68px;
  --nav-h: 82px;
  --content-w: 680px;
  --ease: cubic-bezier(0.2, 0.75, 0.25, 1);
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  display: inline-block;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% -8%, oklch(0.9 0.19 125 / 0.08), transparent 34%),
    linear-gradient(180deg, oklch(0.17 0.014 155), var(--color-bg) 44%);
}

.ambient::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image:
    linear-gradient(oklch(0.8 0.02 130 / 0.1) 1px, transparent 1px),
    linear-gradient(90deg, oklch(0.8 0.02 130 / 0.1) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 62%);
}

.ambient span {
  position: absolute;
  border: 1px solid oklch(0.9 0.19 125 / 0.07);
  border-radius: 50%;
}

.ambient span:first-child {
  width: 280px;
  height: 280px;
  top: -150px;
  right: -90px;
}

.ambient span:last-child {
  width: 180px;
  height: 180px;
  top: -95px;
  right: -40px;
}

/* Header */
.app-header {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid var(--color-border-soft);
  border-radius: 20px;
  background: oklch(0.17 0.014 155 / 0.84);
  backdrop-filter: blur(20px) saturate(130%);
  -webkit-backdrop-filter: blur(20px) saturate(130%);
  box-shadow: 0 10px 34px oklch(0.08 0.01 155 / 0.18);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  min-width: 0;
}

.header-left {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  gap: 11px;
  pointer-events: none;
}

.header-right { margin-left: auto; }

.logo {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.logo-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.12);
}

.logo .icon {
  width: 23px;
  height: 23px;
  stroke-width: 1.9;
}

.brand { min-width: 0; }

.brand-title {
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.4px;
}

.brand-sub {
  margin-top: 2px;
  color: var(--color-text-dim);
  font-size: 12px;
  line-height: 1.3;
}

.balance-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid oklch(0.84 0.15 88 / 0.2);
  border-radius: 14px;
  background: oklch(0.84 0.15 88 / 0.08);
  color: var(--color-gold);
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.balance-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  stroke-width: 1.4;
}

/* Content */
.app-content {
  position: fixed;
  top: calc(var(--header-h) + 26px + env(safe-area-inset-top));
  bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 18px 28px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.app-content::-webkit-scrollbar { display: none; }

.screen-enter {
  width: 100%;
  animation: screen-in 240ms var(--ease) both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.loading-screen {
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--color-text-dim);
  text-align: center;
}

.spinner {
  width: 38px;
  height: 38px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Typography */
.section-title {
  margin: 4px 0 8px;
  color: var(--color-text);
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.8px;
}

.section-lead,
.screen-description {
  max-width: 62ch;
  margin-bottom: 20px;
  color: var(--color-text-dim);
  font-size: 14px;
  line-height: 1.65;
}

.card-title {
  margin-bottom: 14px;
  color: var(--color-text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: -0.25px;
}

.text-dim { color: var(--color-text-dim); }
.text-gold { color: var(--color-gold); }
.text-green { color: var(--color-success); }
.text-red { color: var(--color-danger); }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }

/* Cards */
.glass-card {
  position: relative;
  margin-bottom: 14px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius);
  background: var(--surface-card);
  box-shadow: var(--shadow-card);
  transition: border-color 180ms ease-out, transform 180ms ease-out;
}

.glass-card.clickable { cursor: pointer; }
.glass-card.clickable:hover { border-color: var(--color-border); }
.glass-card.clickable:active { transform: scale(0.985); }

.glass-card > p {
  max-width: 70ch;
  line-height: 1.65;
}

.welcome-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 2px 0 18px;
}

.welcome-title {
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: clamp(21px, 5.8vw, 27px);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.8px;
}

.welcome-sub {
  margin-top: 4px;
  color: var(--color-text-dim);
  font-size: 14px;
}

.secure-mark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding-bottom: 4px;
  color: var(--color-text-dim);
  font-size: 12px;
}

.secure-mark::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 0 4px oklch(0.9 0.19 125 / 0.08);
}

.balance-card {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 26px 24px;
  border-color: oklch(0.9 0.19 125 / 0.22);
  background:
    radial-gradient(circle at 90% 10%, oklch(0.9 0.19 125 / 0.14), transparent 40%),
    var(--surface-card);
  text-align: left;
}

.balance-card::before,
.balance-card::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border: 1px solid oklch(0.9 0.19 125 / 0.12);
  border-radius: 50%;
}

.balance-card::before {
  width: 170px;
  height: 170px;
  top: -86px;
  right: -40px;
}

.balance-card::after {
  width: 112px;
  height: 112px;
  top: -55px;
  right: -10px;
}

.balance-label {
  position: relative;
  z-index: 1;
  margin-bottom: auto;
  color: var(--color-text-dim);
  font-size: 13px;
  font-weight: 600;
}

.balance-big {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-text);
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: clamp(38px, 11vw, 52px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
}

.balance-big .star {
  display: inline-flex;
  color: var(--color-gold);
  font-size: 32px;
}

.balance-big .star .icon {
  width: 32px;
  height: 32px;
  fill: currentColor;
  stroke-width: 1.4;
}

.balance-sub {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  color: var(--color-text-dim);
  font-size: 13px;
}

/* Buttons */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 52px;
  padding: 14px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  transition: transform 160ms ease-out, background-color 160ms ease-out, border-color 160ms ease-out, opacity 160ms ease-out;
}

.btn .icon { width: 19px; height: 19px; }
.btn:active:not(:disabled) { transform: scale(0.975); }

.btn-primary {
  background: var(--color-accent);
  color: var(--color-on-accent);
  box-shadow: 0 8px 24px oklch(0.9 0.19 125 / 0.09);
}

.btn-primary:hover:not(:disabled) { background: oklch(0.94 0.18 125); }

.btn-ghost {
  border-color: var(--color-border);
  background: var(--surface-control);
  color: var(--color-text);
}

.btn-ghost:hover:not(:disabled) {
  border-color: oklch(0.48 0.025 155);
  background: var(--ink-800);
}

.btn-danger {
  border-color: oklch(0.72 0.16 25 / 0.35);
  background: oklch(0.72 0.16 25 / 0.1);
  color: var(--color-danger);
}

.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row .btn { flex: 1; }

/* Quick actions */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.quick-card {
  position: relative;
  min-width: 0;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--color-border-soft);
  border-radius: 20px;
  background: var(--surface-card);
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-card);
  transition: transform 180ms var(--ease), border-color 180ms ease-out, background-color 180ms ease-out;
}

.quick-card:hover {
  border-color: oklch(0.9 0.19 125 / 0.32);
  background: var(--color-surface-raised);
  transform: translateY(-2px);
}

.quick-card:active { transform: scale(0.975); }

.quick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--color-accent);
}

.quick-head .icon:first-child { width: 25px; height: 25px; }
.quick-head .icon:last-child { width: 17px; height: 17px; color: var(--color-text-muted); }
.quick-label { font-size: 15px; font-weight: 800; line-height: 1.35; }
.quick-meta { margin-top: 3px; color: var(--color-text-dim); font-size: 12px; line-height: 1.45; }

/* Lists */
.list-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 74px;
  margin-bottom: 10px;
  padding: 13px 14px;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--color-text);
  text-align: left;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, transform 160ms ease-out;
}

.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { border-color: var(--color-border); background: var(--color-surface-raised); }
.list-item.clickable:active { transform: scale(0.985); }

.glass-card .list-item {
  min-height: 70px;
  margin: 0;
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid var(--color-border-soft);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.glass-card .list-item:last-child { border-bottom: 0; padding-bottom: 2px; }
.glass-card .list-item:first-of-type { padding-top: 2px; }
.glass-card .list-item.clickable:hover { background: transparent; }

.list-emoji {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border-soft);
  border-radius: 14px;
  background: var(--surface-control);
  font-size: 24px;
  line-height: 1;
}

.list-emoji .icon { color: var(--color-accent); }
.list-main { flex: 1; min-width: 0; }
.list-title { font-size: 15px; font-weight: 800; line-height: 1.4; }
.list-sub { margin-top: 3px; color: var(--color-text-dim); font-size: 12px; line-height: 1.5; }
.list-right { flex: 0 0 auto; max-width: 42%; text-align: right; }
.list-price { color: var(--color-gold); font-size: 14px; font-weight: 800; white-space: nowrap; }
.list-price-sub { margin-top: 3px; color: var(--color-text-dim); font-size: 12px; }

.step-index {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border: 1px solid oklch(0.9 0.19 125 / 0.2);
  border-radius: 50%;
  color: var(--color-accent);
  font-size: 13px;
  font-weight: 800;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.badge-pending { background: oklch(0.84 0.15 88 / 0.1); color: var(--color-gold); border-color: oklch(0.84 0.15 88 / 0.22); }
.badge-accepted { background: oklch(0.79 0.16 150 / 0.1); color: var(--color-success); border-color: oklch(0.79 0.16 150 / 0.22); }
.badge-rejected { background: oklch(0.72 0.16 25 / 0.1); color: var(--color-danger); border-color: oklch(0.72 0.16 25 / 0.22); }
.badge-sent { background: oklch(0.75 0.12 240 / 0.1); color: var(--blue-400); border-color: oklch(0.75 0.12 240 / 0.22); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 8px; color: var(--color-text-dim); font-size: 13px; font-weight: 700; }
.form-input {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface-control);
  color: var(--color-text);
  caret-color: var(--color-accent);
  font-size: 16px;
  transition: border-color 160ms ease-out, box-shadow 160ms ease-out;
  user-select: text;
}

.form-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px oklch(0.9 0.19 125 / 0.1);
}

.form-input::placeholder { color: var(--color-text-muted); }

.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.choice-btn {
  min-height: 52px;
  padding: 13px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--surface-control);
  color: var(--color-text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, transform 160ms ease-out;
}

.choice-btn.active {
  border-color: var(--color-accent);
  background: oklch(0.9 0.19 125 / 0.1);
  color: var(--color-accent);
}

.choice-btn:active { transform: scale(0.975); }

/* Bottom navigation */
.bottom-nav {
  position: fixed;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 12px;
  right: 12px;
  z-index: 20;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.bottom-nav-inner {
  display: flex;
  align-items: stretch;
  gap: 3px;
  width: 100%;
  max-width: 620px;
  height: 72px;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: 22px;
  background: var(--surface-nav);
  backdrop-filter: blur(24px) saturate(130%);
  -webkit-backdrop-filter: blur(24px) saturate(130%);
  box-shadow: 0 18px 48px oklch(0.06 0.01 155 / 0.44);
  pointer-events: auto;
}

.nav-item {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color 180ms ease-out, background-color 180ms ease-out, transform 160ms ease-out;
}

.nav-item:hover { color: var(--color-text); background: oklch(0.96 0.012 105 / 0.035); }
.nav-item:active { transform: scale(0.94); }
.nav-item.active { background: oklch(0.9 0.19 125 / 0.1); color: var(--color-accent); }
.nav-icon { width: 21px; height: 21px; stroke-width: 1.8; }
.nav-item.active .nav-icon { stroke-width: 2.1; }
.nav-label { overflow: hidden; max-width: 100%; font-size: 12px; font-weight: 700; line-height: 1.2; text-overflow: ellipsis; }

/* Toasts */
.toast-container {
  position: fixed;
  top: calc(var(--header-h) + 26px + env(safe-area-inset-top));
  left: 50%;
  z-index: 40;
  width: calc(100% - 32px);
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: oklch(0.22 0.015 155 / 0.98);
  box-shadow: 0 16px 40px oklch(0.06 0.01 155 / 0.4);
  font-size: 14px;
  font-weight: 600;
  animation: toast-in 220ms var(--ease) both;
}

.toast.success { border-color: oklch(0.79 0.16 150 / 0.35); }
.toast.error { border-color: oklch(0.72 0.16 25 / 0.4); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Empty states */
.empty-state { padding: 48px 20px; color: var(--color-text-dim); text-align: center; }
.empty-emoji { margin-bottom: 16px; font-size: 48px; line-height: 1; }
.empty-state p { max-width: 46ch; margin-left: auto; margin-right: auto; }
.divider { height: 1px; margin: 16px 0; background: var(--color-border-soft); }

/* Cases */
.case-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 132px;
  margin-bottom: 12px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius);
  background: var(--surface-card);
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-card);
  transition: transform 180ms var(--ease), border-color 180ms ease-out;
}

.case-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--case-gradient);
  opacity: 0.11;
  pointer-events: none;
}

.case-card > * { position: relative; z-index: 1; }
.case-card:hover:not(:disabled) { border-color: oklch(0.9 0.19 125 / 0.3); transform: translateY(-2px); }
.case-card:active:not(:disabled) { transform: scale(0.985); }
.case-card.locked { cursor: not-allowed; opacity: 0.56; }
.case-glow { display: none; }
.case-emoji { flex: 0 0 auto; font-size: 44px; line-height: 1; }
.case-info { flex: 1; min-width: 0; }
.case-name { margin-bottom: 3px; font-size: 17px; font-weight: 800; line-height: 1.4; }
.case-desc { margin-bottom: 10px; color: var(--color-text-dim); font-size: 12px; line-height: 1.5; }
.case-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.case-price { padding: 4px 9px; border: 1px solid oklch(0.84 0.15 88 / 0.2); border-radius: 9px; background: oklch(0.84 0.15 88 / 0.08); color: var(--color-gold); font-size: 12px; font-weight: 800; }
.case-arrow { flex: 0 0 auto; color: var(--color-text-dim); }
.case-arrow .icon { width: 20px; height: 20px; }

/* Roulette */
.roulette-container {
  position: relative;
  height: 140px;
  margin: 20px 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: inset 0 2px 20px oklch(0.06 0.01 155 / 0.28);
}

.roulette-container::before,
.roulette-container::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 3;
  width: 52px;
  pointer-events: none;
}

.roulette-container::before { left: 0; background: linear-gradient(90deg, var(--color-surface), transparent); }
.roulette-container::after { right: 0; background: linear-gradient(270deg, var(--color-surface), transparent); }

.roulette-pointer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 4;
  width: 2px;
  background: var(--color-accent);
  box-shadow: 0 0 14px oklch(0.9 0.19 125 / 0.4);
  transform: translateX(-50%);
}

.roulette-pointer::before,
.roulette-pointer::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  transform: translateX(-50%);
}

.roulette-pointer::before { top: 0; border-top: 9px solid var(--color-accent); }
.roulette-pointer::after { bottom: 0; border-bottom: 9px solid var(--color-accent); }

.roulette-reel {
  display: flex;
  align-items: center;
  gap: 0;
  height: 100%;
  padding: 12px;
  backface-visibility: hidden;
  transform: translateZ(0);
  will-change: transform;
}

.reel-item {
  position: relative;
  flex: 0 0 112px;
  width: 112px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
  box-sizing: border-box;
  border: 1px solid var(--color-border-soft);
  border-radius: 14px;
  background: var(--surface-control);
}

.reel-emoji { font-size: 32px; }
.reel-name { max-width: 100%; padding: 0 4px; overflow: hidden; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.reel-rarity { font-size: 12px; font-weight: 800; letter-spacing: 0.3px; text-transform: uppercase; }
.rarity-common { border-color: oklch(0.69 0.015 130 / 0.45); }
.rarity-common .reel-rarity { color: var(--paper-300); }
.rarity-rare { border-color: oklch(0.75 0.12 240 / 0.55); }
.rarity-rare .reel-rarity { color: var(--blue-400); }
.rarity-epic { border-color: oklch(0.75 0.14 310 / 0.6); }
.rarity-epic .reel-rarity { color: var(--purple-400); }
.rarity-legendary { border-color: oklch(0.84 0.15 88 / 0.7); }
.rarity-legendary .reel-rarity { color: var(--color-gold); }

/* Win state */
.win-card {
  position: relative;
  padding: 28px 20px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--surface-card);
  text-align: center;
  box-shadow: var(--shadow-card);
  animation: win-pop 280ms var(--ease) both;
}

@keyframes win-pop {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

.win-card.rarity-legendary { border-color: oklch(0.84 0.15 88 / 0.7); }
.win-card.rarity-epic { border-color: oklch(0.75 0.14 310 / 0.6); }
.win-card.rarity-rare { border-color: oklch(0.75 0.12 240 / 0.55); }
.win-glow { position: absolute; inset: 0; background: radial-gradient(circle at 50% 20%, oklch(0.9 0.19 125 / 0.09), transparent 48%); pointer-events: none; }
.win-title { position: relative; margin-bottom: 12px; color: var(--color-text-dim); font-size: 14px; font-weight: 700; }
.win-emoji { position: relative; font-size: 64px; line-height: 1.2; }
.win-name { position: relative; margin: 10px 0; font-family: "Unbounded", "Manrope", sans-serif; font-size: 20px; font-weight: 600; }
.win-rarity { position: relative; display: inline-block; padding: 4px 10px; border: 1px solid transparent; border-radius: 9px; font-size: 12px; font-weight: 800; }
.rarity-label-common { background: oklch(0.69 0.015 130 / 0.1); color: var(--paper-300); border-color: oklch(0.69 0.015 130 / 0.25); }
.rarity-label-rare { background: oklch(0.75 0.12 240 / 0.1); color: var(--blue-400); border-color: oklch(0.75 0.12 240 / 0.25); }
.rarity-label-epic { background: oklch(0.75 0.14 310 / 0.1); color: var(--purple-400); border-color: oklch(0.75 0.14 310 / 0.25); }
.rarity-label-legendary { background: oklch(0.84 0.15 88 / 0.1); color: var(--color-gold); border-color: oklch(0.84 0.15 88 / 0.25); }

/* Dynamic screen components */
.quick-label,
.quick-meta,
.list-title,
.list-sub,
.list-price,
.list-price-sub,
.case-name,
.case-desc {
  display: block;
}

.summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--color-border-soft);
  font-size: 14px;
}

.summary-row:last-child { border-bottom: 0; padding-bottom: 0; }
.summary-row:first-of-type { padding-top: 0; }
.summary-row b { text-align: right; }
.summary-total { margin-top: 6px; padding-top: 14px; font-size: 16px; }
.summary-card { border-color: oklch(0.9 0.19 125 / 0.2); }
.summary-card .card-title { color: var(--color-accent); }

.rate-card { border-color: oklch(0.84 0.15 88 / 0.2); }
.rate-value { display: flex; align-items: baseline; gap: 10px; color: var(--color-text-dim); font-size: 18px; }
.rate-value b { color: var(--color-gold); font-family: "Unbounded", "Manrope", sans-serif; font-size: 26px; font-weight: 600; }

.payout-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 0 16px;
  font-size: 14px;
}

.payout-row b { text-align: right; }
.form-note { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--color-border-soft); color: var(--color-text-dim); font-size: 12px; line-height: 1.6; }

.ref-link {
  padding: 14px;
  border: 1px solid var(--color-border-soft);
  border-radius: 13px;
  background: var(--ink-950);
  color: var(--color-text-dim);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  user-select: text;
}

.referral-link-card { border-color: oklch(0.9 0.19 125 / 0.2); }
.gift-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--color-accent); font-size: 14px; font-weight: 700; text-decoration: none; }
.gift-link:hover { text-decoration: underline; }
.gift-link .icon { width: 18px; height: 18px; }
.alert-card { border-color: oklch(0.72 0.16 25 / 0.35); background: oklch(0.72 0.16 25 / 0.07); }
.title-count { display: inline-grid; place-items: center; min-width: 25px; height: 25px; margin-left: 5px; padding: 0 7px; border-radius: 8px; background: oklch(0.9 0.19 125 / 0.1); color: var(--color-accent); font-size: 12px; }
.choice-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.choice-btn .icon { width: 19px; height: 19px; }

@media (min-width: 600px) {
  .app-header {
    left: 50%;
    right: auto;
    width: calc(100% - 32px);
    max-width: var(--content-w);
    transform: translateX(-50%);
  }

  .app-content {
    left: 50%;
    right: auto;
    width: 100%;
    max-width: calc(var(--content-w) + 36px);
    padding-left: 18px;
    padding-right: 18px;
    transform: translateX(-50%);
  }

  .bottom-nav {
    left: 50%;
    right: auto;
    width: calc(100% - 32px);
    max-width: 644px;
    transform: translateX(-50%);
  }

  .glass-card { padding: 24px; }
}

@media (min-width: 720px) {
  .quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .quick-card { min-height: 142px; padding: 16px; }
  .quick-label { font-size: 14px; }
}

@media (max-width: 380px) {
  .app-header { left: 8px; right: 8px; padding: 0 10px; }
  .header-left { gap: 8px; }
  .brand-sub { display: none; }
  .logo { width: 36px; height: 36px; flex-basis: 36px; }
  .app-content { padding-left: 12px; padding-right: 12px; }
  .bottom-nav { left: 8px; right: 8px; }
  .bottom-nav-inner { gap: 1px; padding: 5px; }
  .nav-label { font-size: 12px; }
  .glass-card { padding: 18px; }
  .balance-card { padding: 22px 20px; }
  .quick-card { padding: 15px; }
  .secure-mark { display: none; }
  .list-item { gap: 10px; }
  .list-emoji { width: 42px; height: 42px; flex-basis: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }

  .roulette-reel { transition-duration: 1ms !important; }
}


/* Live catalog, case inventory and server-driven opening */
.gift-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.empty-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  color: var(--color-accent);
  background: var(--surface-card);
}
.empty-icon .icon { width: 30px; height: 30px; }
.empty-copy { margin-top: 8px; font-size: 14px; }
.section-note { font-size: 14px; line-height: 1.65; }
.section-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-heading-row .card-title { margin: 0; }
.text-button { min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--color-accent); cursor: pointer; font-size: 13px; font-weight: 800; }
.text-button:hover { text-decoration: underline; }
.text-button:active { opacity: 0.7; }

.case-card.locked { opacity: 0.84; }
.case-collage {
  position: relative;
  width: 102px;
  height: 82px;
  flex: 0 0 102px;
}
.case-collage .gift-image {
  position: absolute;
  top: 7px;
  left: 25px;
  width: 62px;
  height: 68px;
  padding: 4px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface-raised);
  filter: drop-shadow(0 8px 12px oklch(0.06 0.01 155 / 0.28));
}
.case-collage .gift-image:first-child { transform: translateX(-23px) rotate(-9deg); }
.case-collage .gift-image:nth-child(2) { z-index: 2; transform: translateY(-5px); }
.case-collage .gift-image:nth-child(3) { transform: translateX(23px) rotate(9deg); }
.case-count { color: var(--color-text-dim); font-size: 12px; font-weight: 700; }

.case-detail-head { display: grid; grid-template-columns: 152px minmax(0, 1fr); align-items: center; gap: 20px; }
.case-detail-head .section-title { margin-top: 0; }
.case-detail-collage { display: grid; grid-template-columns: repeat(2, 66px); gap: 6px; }
.case-detail-collage .gift-image { width: 66px; height: 66px; padding: 5px; border-radius: 14px; background: var(--surface-control); }
.case-detail-price { margin-top: 12px; color: var(--color-gold); font-size: 17px; font-weight: 800; }
.prizes-section { margin-top: 28px; }
.prize-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.prize-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--color-border-soft);
  border-radius: 16px;
  background: var(--surface-card);
  text-align: center;
}
.prize-card > .gift-image { height: 104px; margin-bottom: 8px; }
.prize-name { overflow: hidden; font-size: 13px; font-weight: 800; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.prize-number { color: var(--color-text-dim); font-size: 12px; }
.prize-meta { display: flex; justify-content: space-between; gap: 6px; margin-top: 8px; color: var(--color-text-dim); font-size: 10px; font-weight: 700; }

.opening-head { padding: 16px 4px 4px; text-align: center; }
.opening-head .section-lead, .opening-head p { margin: 0; font-size: 14px; }
.opening-kicker { margin-bottom: 8px; color: var(--color-accent); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.8px; }
.roulette-container { height: 158px; }
.reel-item { flex-basis: 116px; width: 116px; padding: 6px; gap: 2px; }
.reel-item .gift-image { width: 76px; height: 82px; flex: 0 0 82px; }
.reel-rarity { max-width: 100%; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.winner-marker { position: absolute; inset: 4px; border: 1px solid oklch(0.9 0.19 125 / 0.16); border-radius: 11px; pointer-events: none; }
.win-image { position: relative; width: 180px; height: 180px; margin: 0 auto; }
.win-note { position: relative; max-width: 44ch; margin: 16px auto 0; font-size: 13px; }

.product-card { text-align: center; }
.product-card h1 { font-family: "Unbounded", "Manrope", sans-serif; font-size: 22px; line-height: 1.4; }
.product-visual { display: grid; place-items: center; width: 150px; height: 150px; margin: 0 auto 16px; font-size: 72px; }
.product-visual.has-image { padding: 8px; border-radius: 28px; background: var(--surface-control); }
.product-price { margin: 8px 0; color: var(--color-gold); font-size: 26px; font-weight: 800; }
.product-balance { display: flex; align-items: center; gap: 8px; color: var(--color-gold); font-size: 22px; font-weight: 800; }
.product-balance .icon { fill: currentColor; }
.list-emoji.has-image { padding: 3px; overflow: hidden; }
.success-card { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid oklch(0.79 0.16 150 / 0.28); border-radius: 16px; background: oklch(0.79 0.16 150 / 0.08); color: var(--color-success); }
.success-card p { color: var(--color-text); font-size: 14px; }

.gift-choice.selected { border-color: var(--color-accent); background: oklch(0.9 0.19 125 / 0.07); }
.selection-mark { display: grid; place-items: center; min-width: 24px; min-height: 24px; margin-top: 4px; color: var(--color-accent); }
.selection-mark .icon { width: 20px; height: 20px; }
.collection-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.collection-card { min-width: 0; padding: 10px; border: 1px solid var(--color-border-soft); border-radius: 16px; background: var(--surface-control); text-align: center; }
.collection-card > .gift-image { height: 112px; margin-bottom: 8px; }
.collection-name { overflow: hidden; font-size: 12px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.collection-meta { margin: 4px 0 8px; color: var(--color-text-dim); font-size: 10px; }
.mini-gift-row { display: flex; gap: 8px; margin-bottom: 14px; }
.mini-gift-row .gift-image { width: 64px; height: 64px; padding: 4px; border: 1px solid var(--color-border-soft); border-radius: 14px; background: var(--surface-control); }
.history-grid { display: grid; gap: 8px; }
.history-item { display: flex; align-items: center; gap: 12px; min-width: 0; }
.history-item > .gift-image { width: 48px; height: 48px; flex: 0 0 48px; padding: 3px; border-radius: 12px; background: var(--surface-control); }
.toast { transition: opacity 200ms ease-out, transform 200ms ease-out; }

@media (min-width: 540px) {
  .prize-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .collection-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
  .case-card { gap: 10px; padding: 16px 14px; }
  .case-collage { width: 82px; flex-basis: 82px; transform: scale(0.88); transform-origin: left center; }
  .case-detail-head { grid-template-columns: 112px minmax(0, 1fr); gap: 12px; }
  .case-detail-collage { grid-template-columns: repeat(2, 50px); }
  .case-detail-collage .gift-image { width: 50px; height: 50px; }
  .case-detail-head .section-title { font-size: 19px; }
  .prize-card > .gift-image { height: 90px; }
}


/* Balance top-up and compact Stars checkout */
.balance-pill {
  min-height: 44px;
  padding: 8px 9px 8px 12px;
  cursor: pointer;
  font-family: inherit;
  touch-action: manipulation;
  transition: border-color 160ms ease-out, background-color 160ms ease-out, transform 160ms ease-out;
}
.balance-pill:hover { border-color: oklch(0.84 0.15 88 / 0.45); background: oklch(0.84 0.15 88 / 0.13); }
.balance-pill:active { transform: scale(0.97); }
.balance-pill:focus-visible { outline: 3px solid oklch(0.9 0.19 125 / 0.5); outline-offset: 3px; }
.balance-plus {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-left: 2px;
  border-radius: 7px;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.stars-lead { margin-bottom: 16px; }
.stars-layout { display: grid; gap: 12px; }
.stars-main-card { padding: 16px; }
.stars-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.stars-card-head .card-title { margin: 0; }
.stars-rate { flex: 0 0 auto; color: var(--color-gold); font-size: 13px; font-weight: 800; }
.stars-main-card .form-group { margin-bottom: 10px; }
.stars-main-card .form-label { margin-bottom: 6px; }
.stars-main-card .form-input { min-height: 48px; padding: 12px 14px; }
.stars-main-card .payout-row { margin-bottom: 12px; }
.stars-main-card .form-note { margin-top: 10px; padding-top: 10px; }
.stars-partner-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; }
.stars-partner-card .card-title { margin-bottom: 5px; font-size: 15px; }
.stars-partner-card .section-note { margin: 0; font-size: 12px; }
.stars-partner-card > div { min-width: 0; }
.stars-partner-card .btn { flex: 0 0 auto; width: auto; min-height: 44px; padding: 10px 12px; font-size: 13px; white-space: nowrap; }

@media (max-width: 380px) {
  .stars-partner-card { gap: 10px; padding: 14px; }
  .stars-partner-card .card-title { font-size: 14px; }
  .stars-partner-card .btn { padding-inline: 10px; }
}
