:root {
  --bg: #0c1f28;
  --ice: #9fe8e0;
  --ice-dim: #5a9e97;
  --cream: #f6f1e6;
  --muted: #8aa6ad;
  --fate: #ff5c4a;
  --wish: #f0c95a;
  --ok: #6fd4a0;
  --glass: rgba(255, 255, 255, 0.06);
  --line: rgba(159, 232, 224, 0.18);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--cream);
  font-family: "Noto Sans SC", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(159, 232, 224, 0.16), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(255, 92, 74, 0.08), transparent 50%),
    linear-gradient(180deg, #0c1f28 0%, #0a1820 100%);
  min-height: 100dvh;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.04;
  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='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 440px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 20px 20px calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--ice-dim);
  font-weight: 500;
}

.brand {
  font-family: "ZCOOL KuaiLe", cursive;
  font-size: 34px;
  line-height: 1.05;
  margin-top: 6px;
}

.brand em {
  font-style: normal;
  color: var(--fate);
}

.stock-pill {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: right;
  min-width: 88px;
}

.stock-pill .n {
  font-family: "ZCOOL KuaiLe", cursive;
  font-size: 28px;
  line-height: 1;
  color: var(--ice);
}

.stock-pill .l {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.tagline,
.hint {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.hint {
  font-size: 12px;
}

.hint strong {
  color: var(--wish);
  font-weight: 500;
}

code {
  font-size: 11px;
  color: var(--ice);
  word-break: break-all;
}

.roster-luck-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.roster-luck-row {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--line);
}

.rl-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.rl-main strong {
  font-size: 14px;
}

.rl-meta {
  font-size: 12px;
  color: var(--ice);
}

.rl-reasons,
.rl-draw {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.rl-draw {
  color: var(--cream);
  opacity: 0.85;
}

.rl-select {
  width: 88px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--cream);
  font-family: inherit;
  font-size: 13px;
}

.fridge {
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #1a4452, #122f39 55%, #0f2832);
  padding: 16px;
  overflow: hidden;
}

.fridge-title {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--ice-dim);
  letter-spacing: 0.12em;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.drink-card {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 118px;
}

.drink-card.selectable {
  cursor: pointer;
}

.drink-card.selected {
  border-color: var(--wish);
  background: rgba(240, 201, 90, 0.1);
  box-shadow: inset 0 0 0 1px rgba(240, 201, 90, 0.35);
}

.picked-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 500;
  font-family: "Noto Sans SC", sans-serif;
  color: var(--wish);
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.cta-hint {
  text-align: center;
  font-size: 13px;
  color: var(--cream);
  opacity: 0.85;
  line-height: 1.4;
  margin-top: -2px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.btn-fate:disabled {
  background: #3a4a50;
  color: #9aadb3;
  filter: none;
}

.drink-card.soldout {
  opacity: 0.35;
  filter: grayscale(0.6);
  pointer-events: none;
}

.drink-swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: "ZCOOL KuaiLe", cursive;
  font-size: 16px;
  color: #0c1f28;
}

.drink-name {
  font-size: 15px;
  font-weight: 700;
}

.drink-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  margin-top: auto;
}

.bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar>i {
  display: block;
  height: 100%;
  width: 0%;
  transition: width 0.45s ease;
}

.input-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-wrap label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.input-wrap input,
select.roster,
.input-wrap textarea {
  width: 100%;
  height: 48px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--cream);
  padding: 0 14px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 8px;
}

.btn {
  height: 52px;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.btn-primary {
  background: linear-gradient(180deg, #ffe07a, var(--wish));
  color: #2a2108;
  box-shadow: 0 10px 24px rgba(240, 201, 90, 0.22);
}

.btn-fate {
  background: linear-gradient(180deg, #ff7a6c, var(--fate));
  color: #fff8f6;
  font-family: "ZCOOL KuaiLe", cursive;
  font-size: 22px;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  height: 44px;
  font-size: 14px;
  font-weight: 500;
}

.btn-ok {
  background: linear-gradient(180deg, #8be0b0, var(--ok));
  color: #0b2a1a;
}

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  text-align: center;
}

.orb {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.35), transparent 35%),
    radial-gradient(circle at 50% 55%, #2a6b72, #12343c 70%);
  border: 2px solid rgba(159, 232, 224, 0.35);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.orb.spinning {
  animation: wobble 0.35s ease-in-out infinite;
}

.orb .glyph {
  font-family: "ZCOOL KuaiLe", cursive;
  font-size: 42px;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.orb.spinning .glyph {
  animation: flash 0.18s steps(1) infinite;
}

@keyframes wobble {

  0%,
  100% {
    transform: rotate(-4deg) scale(1);
  }

  50% {
    transform: rotate(4deg) scale(1.03);
  }
}

@keyframes flash {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.35;
  }
}

.stage-copy h2 {
  font-family: "ZCOOL KuaiLe", cursive;
  font-size: 28px;
  font-weight: 400;
}

.stage-copy p {
  color: var(--muted);
  font-size: 14px;
}

.reveal-card {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  position: relative;
}

.reveal-card.miss {
  border-color: rgba(255, 92, 74, 0.45);
}

.reveal-card.hit {
  border-color: rgba(111, 212, 160, 0.45);
}

.stamp {
  position: absolute;
  top: 16px;
  right: 14px;
  transform: rotate(12deg);
  border: 2px solid currentColor;
  border-radius: 6px;
  padding: 4px 8px;
  font-family: "ZCOOL KuaiLe", cursive;
  font-size: 18px;
  opacity: 0.85;
}

.stamp.miss {
  color: var(--fate);
}

.stamp.hit {
  color: var(--ok);
}

.result-swatch {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-family: "ZCOOL KuaiLe", cursive;
  font-size: 28px;
  color: #0c1f28;
  animation: pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes pop {
  0% {
    transform: scale(0.4) rotate(-12deg);
    opacity: 0;
  }

  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

.result-name {
  font-family: "ZCOOL KuaiLe", cursive;
  font-size: 32px;
}

.result-msg {
  font-size: 15px;
  line-height: 1.55;
  max-width: 18em;
}

.wish-line {
  font-size: 13px;
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--fate);
}

.wish-line.kept {
  text-decoration: none;
  color: var(--ok);
}

.onboard {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
}

.onboard-hero {
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 28px 20px;
  background: linear-gradient(160deg, rgba(159, 232, 224, 0.12), rgba(255, 92, 74, 0.08));
  text-align: center;
}

.onboard-hero h1 {
  font-family: "ZCOOL KuaiLe", cursive;
  font-size: 40px;
  line-height: 1.1;
}

.onboard-hero p {
  margin-top: 10px;
  color: var(--muted);
}

.rule-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rule {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
}

.rule .n {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(159, 232, 224, 0.15);
  color: var(--ice);
  font-family: "ZCOOL KuaiLe", cursive;
  font-size: 20px;
}

.rule h3 {
  font-size: 15px;
  margin-bottom: 4px;
}

.rule p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.music-fab {
  position: fixed;
  right: 16px;
  bottom: calc(16px + var(--safe-bottom));
  z-index: 20;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(12, 31, 40, 0.9);
  color: var(--ice);
  font-size: 20px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.music-fab.muted {
  color: var(--muted);
  opacity: 0.7;
}

.admin-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-card h2 {
  font-size: 14px;
  letter-spacing: 0.1em;
  color: var(--ice-dim);
  font-weight: 500;
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.admin-row input {
  width: 72px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--cream);
  text-align: center;
  font-family: inherit;
}

.luck-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.luck-chip {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: left;
  color: var(--cream);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.luck-chip.selected {
  border-color: var(--wish);
  background: rgba(240, 201, 90, 0.12);
}

.luck-chip.star.selected {
  border-color: var(--ok);
  background: rgba(111, 212, 160, 0.12);
}

.luck-chip.low.selected {
  border-color: var(--fate);
  background: rgba(255, 92, 74, 0.1);
}

.luck-chip strong {
  font-size: 15px;
}

.luck-chip span {
  font-size: 12px;
  color: var(--muted);
}

.log-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.log-list li {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 8px;
}

.log-list .who {
  color: var(--cream);
}

.log-list .got {
  color: var(--ice);
}

.file-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-row .meta {
  font-size: 12px;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: var(--cream);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 30;
}

.screen {
  display: none;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.screen.active {
  display: flex;
}

@media (prefers-reduced-motion: reduce) {

  .orb.spinning,
  .orb.spinning .glyph,
  .result-swatch {
    animation: none;
  }
}