:root {
  --bg: #0e0f11;
  --surface: #18191c;
  --surface-hi: #202124;
  --edge: rgba(255, 255, 255, 0.06);
  --ink: #f3f3f4;
  --muted: #a3a4a8;
  --faint: #6c6d72;
  --orange: #ff8c1a;
  --orange-soft: #ffb36b;
  --ok: #8be0a4;
  --r: 18px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  scrollbar-width: none;
  overscroll-behavior: none;
}

html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; }

body { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }

.hero img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 509;
  object-fit: cover;
}

main { padding: 16px 16px 4px; }

.muted { color: var(--muted); }
.loading { margin: 24px 4px; }

.ticket {
  --notch: 13px;
  --cut: 62%;
  position: relative;
  background: linear-gradient(180deg, var(--surface-hi), var(--surface));
  box-shadow: inset 0 1px 0 var(--edge);
  border-radius: var(--r);
  -webkit-mask:
    radial-gradient(circle var(--notch) at 0 var(--cut), #0000 97%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% var(--cut), #0000 97%, #000) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle var(--notch) at 0 var(--cut), #0000 97%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% var(--cut), #0000 97%, #000) right / 51% 100% no-repeat;
}

.ticket-top { padding: 18px 24px 14px; }
.ticket-stub { padding: 14px 24px 18px; position: relative; }
.ticket-stub::before {
  content: "";
  position: absolute;
  left: calc(var(--notch) + 10px);
  right: calc(var(--notch) + 10px);
  top: 0;
  height: 4px;
  background: radial-gradient(circle, var(--faint) 1.5px, transparent 2px) 0 50% / 12px 4px repeat-x;
}

.channel {
  margin: 0 0 6px;
  color: var(--orange-soft);
  font-size: 14px;
  font-weight: 600;
}

.prize {
  margin: 0;
  font-size: clamp(18px, 5.4vw, 21px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.when { margin: 8px 0 0; color: var(--muted); font-size: 15px; }

.facts {
  margin: 14px 0 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 2px 0 0; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

.stub-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.stub-label { color: var(--muted); font-size: 14px; }
.stub-no {
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.stub-no.empty { font-size: 18px; font-weight: 600; color: var(--muted); letter-spacing: 0; }

.stamp {
  display: inline-block;
  color: var(--ok);
  font-weight: 800;
  font-size: 15px;
  white-space: nowrap;
  transform: rotate(-4deg);
}
.stamp.fresh { animation: stamp 420ms cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes stamp { from { transform: rotate(-4deg) scale(1.6); } to { transform: rotate(-4deg) scale(1); } }

.block { margin: 18px 4px 0; }
.block > .link:first-child { margin-top: 0; }
.block h2 { margin: 0 0 6px; font-size: 18px; font-weight: 800; }
.block p { margin: 0; color: var(--muted); }

.progress { margin: 14px 0 6px; height: 10px; border-radius: 5px; background: var(--surface-hi); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 5px; background: var(--orange); transition: width 500ms ease; }
.progress-label { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }

.link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 10px 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(255, 179, 107, 0.6);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
  cursor: pointer;
}
.link svg { width: 14px; height: 14px; color: var(--orange-soft); transition: transform 160ms ease; }
.link:active svg { transform: translate(2px, -2px); }

.winners { margin: 10px 0 0; padding: 0; list-style: none; }
.winners li { padding: 8px 0; display: flex; gap: 10px; font-weight: 600; }
.winners li span { color: var(--faint); font-variant-numeric: tabular-nums; min-width: 1.5em; }
.winners li.me { color: var(--orange-soft); }

.list { display: grid; gap: 12px; }
.list .ticket { --cut: 50%; display: block; width: 100%; text-align: left; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 18px 26px; }
.list .ticket .prize { font-size: 19px; }
.list .ticket .muted { margin: 6px 0 0; font-size: 14px; }

.note { padding: 14px 20px 0; }
.note p { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
body.compact .note { display: none; }

#sprinkles { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#sprinkles i {
  position: absolute;
  top: -20px;
  width: 6px;
  height: 16px;
  border-radius: 3px;
  animation: fall var(--t) cubic-bezier(.25, .6, .4, 1) forwards;
}
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); } }

@media (prefers-reduced-motion: reduce) {
  .stamp.fresh, #sprinkles i { animation: none; }
  .progress > i { transition: none; }
}

.shop-head {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: -16px -16px 0;
  padding: 2px 16px 4px;
  background: var(--bg);
}

.tabs { position: relative; display: flex; gap: 18px; overflow-x: auto; scrollbar-width: none; margin: 0 4px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: color 200ms ease;
}
.tab.on { color: var(--ink); }
.ink {
  position: absolute;
  left: 0;
  bottom: 4px;
  width: 0;
  height: 3px;
  border-radius: 2px;
  background: var(--orange);
  pointer-events: none;
  transition: opacity 200ms ease;
}
.tabs.games .tab { font-size: 19px; }
.tabs.cats { gap: 16px; margin-right: -16px; padding-right: 28px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
.tabs.cats .tab { font-size: 15px; }
.tabs.cats.scrolled { -webkit-mask-image: linear-gradient(to right, transparent 20px, #000 52px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, transparent 20px, #000 52px, #000 calc(100% - 36px), transparent); }
.tabs.dim .tab { color: var(--faint); }
.tabs.dim .ink { opacity: 0; }

.list-hint { margin: 10px 4px 0; color: var(--muted); font-size: 13px; }
.group-label { margin: 18px 4px 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.search {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-hi);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  outline: 2px solid transparent;
  transition: outline-color 160ms ease;
}
.search::placeholder { color: var(--faint); }
.search:focus { outline-color: var(--orange-soft); }
.search::-webkit-search-cancel-button { -webkit-appearance: none; }

.rows { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 14px;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 200ms ease, transform 140ms ease;
}
.row:active { transform: scale(.985); }
.row:first-child { border-radius: 14px 14px 0 0; }
.row:last-child { border-radius: 0 0 14px 14px; }
.row:only-child { border-radius: 14px; }
.row:active, .row.in { background: var(--surface-hi); }
.row img.pin { -webkit-mask-image: none; mask-image: none; object-fit: contain; }
.row img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: cover;
  -webkit-mask-image: radial-gradient(circle at 50% 48%, #000 52%, transparent 72%);
  mask-image: radial-gradient(circle at 50% 48%, #000 52%, transparent 72%);
}
.row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-title { font-size: 15px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.row-sub { color: var(--muted); font-size: 13px; line-height: 1.3; }
.row-sub b { color: var(--orange-soft); }
.row-price { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row.in .row-price { color: var(--orange-soft); font-size: 13px; }
.empty { margin: 16px 4px 0; color: var(--muted); }
.more { margin: 6px 4px 0; font-size: 15px; }

body.compact .hero { display: none; }

.page-title { margin: 4px 4px 12px; font-size: 24px; font-weight: 800; }
.small { font-size: 13px; }
.hint { margin: 10px 4px 0; }

.panel {
  padding: 18px 22px;
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--surface-hi), var(--surface));
  box-shadow: inset 0 1px 0 var(--edge);
}

.cart-line { margin-top: 10px; padding: 14px 16px; border-radius: 14px; background: var(--surface); box-shadow: inset 0 1px 0 var(--edge); }
.cart-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 2px 12px; }
.cart-title { font-weight: 700; line-height: 1.25; }
.cart-price { justify-self: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.remove { justify-self: end; padding: 12px 0 12px 20px; margin: -12px 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }

.field { display: block; margin-top: 12px; }
.account .field:first-child { margin-top: 0; }
.field span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.field input {
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-hi);
  color: var(--ink);
  font: inherit;
  outline: 2px solid transparent;
  transition: outline-color 160ms ease;
}
.field input::placeholder { color: var(--faint); }
.field input:focus { outline-color: var(--orange-soft); }

.toggle { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 12px 4px 0; font-weight: 600; }
.toggle input { width: 20px; height: 20px; accent-color: var(--orange); }

.total { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 4px 6px; font-size: 18px; }
.total b { font-size: 22px; font-variant-numeric: tabular-nums; }

.orders { margin: 8px 0 0; padding: 0; list-style: none; }
.orders li { padding: 10px 0; }
.order-head { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.field.need span { color: var(--orange-soft); font-weight: 700; }
.field.need input { outline-color: var(--orange-soft); }
.status-wait { color: var(--orange-soft); }
.order-action { margin-top: 4px; padding: 8px 0; font-size: 14px; }
.links { display: flex; flex-wrap: wrap; gap: 0 22px; }

@media (prefers-reduced-motion: no-preference) {
  .row.just .row-price { animation: pop 380ms cubic-bezier(.3, 1.6, .5, 1); }
  .field.need input { animation: nudge 320ms ease; }
}
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes nudge { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
@media (prefers-reduced-motion: reduce) {
  .row, .tab, .ink { transition: none; }
  .row:active { transform: none; }
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  display: flex;
  padding: 0 8px env(safe-area-inset-bottom);
  background: var(--surface);
  box-shadow: inset 0 1px 0 var(--edge);
}
.tabbar[hidden], body.typing .tabbar { display: none; }
.tabbar button {
  flex: 1;
  min-height: 54px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: color 200ms ease;
}
.tabbar button.on { color: var(--ink); }
.tabbar .ink { bottom: calc(9px + env(safe-area-inset-bottom)); }
body.with-tabbar { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.joined { margin: 8px 0 0; color: var(--ok); font-size: 14px; font-weight: 700; }
.row.plain { grid-template-columns: minmax(0, 1fr) auto; }
.row-price.won { color: var(--orange-soft); font-size: 14px; }

.field select {
  width: 100%;
  padding: 12px 40px 12px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-hi) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23ffb36b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center / 12px 8px;
  color: var(--ink);
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
  outline: 2px solid transparent;
}
.field select:focus { outline-color: var(--orange-soft); }
.field > .tabs { margin: 0; }
.row.off .row-title, .row.off img { opacity: .5; }
.row-price.status { font-size: 13px; font-weight: 700; white-space: normal; text-align: right; max-width: 120px; }
