/* Pack a Neta — cozy late-night sushi-ya theme.
   Palette: charcoal wood, paper cream, vermilion, nori green, gold. */

:root {
  color-scheme: dark;
  --bg: #171310;
  --bg-deep: #120e0b;
  --panel: #201a14;
  --panel-edge: #392e23;
  --paper: #f7efdf;
  --paper-edge: #e0d0ae;
  --ink: #2a211a;
  --cream: #f5ead6;
  --muted: #b8a68f;
  --faint: #93805f;
  --vermilion: #e4572e;
  --vermilion-dark: #a83a1c;
  --nori: #2f5d50;
  --nori-light: #3d7a68;
  --gold: #f3a712;
  --gold-soft: #ffd982;
}

*, *::before, *::after { box-sizing: border-box; }

html { scrollbar-color: #3a2f24 #171310; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--cream);
  font-family: "M PLUS Rounded 1c", ui-rounded, "Hiragino Maru Gothic ProN",
    "Segoe UI Rounded", system-ui, sans-serif;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.4;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* warm wood-grain texture + lantern glow, pure CSS */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 460px at 50% -120px, rgba(243, 167, 18, 0.08), transparent 62%),
    radial-gradient(900px 500px at 50% 110%, rgba(228, 87, 46, 0.05), transparent 60%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.014) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.05) 0 3px, transparent 3px 15px),
    linear-gradient(180deg, #1c1611, var(--bg) 42%, var(--bg-deep));
}

::selection { background: var(--gold); color: var(--bg); }

h1, h2, h3, h4, p { margin: 0; }

[hidden] { display: none !important; }

/* app.js hides #btn-next via attribute + inline style; never fight it */
#btn-next[hidden] { display: none !important; }

button { font-family: inherit; }

/* ---------- layout shell ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  padding: 14px
    max(14px, env(safe-area-inset-right))
    calc(30px + env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
}

.screen {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.screen.active {
  display: flex;
  flex: 1;
  animation: screen-in 0.3s ease both;
}

@keyframes screen-in {
  from { opacity: 0; translate: 0 12px; }
  to { opacity: 1; translate: 0 0; }
}

#screen-setup, #screen-order, #screen-pass { justify-content: center; }

.screen-title {
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  color: var(--cream);
}

.screen-kicker {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---------- scorebar ---------- */

#scorebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: calc(8px + env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    9px
    max(14px, env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(23, 19, 16, 0.97), rgba(23, 19, 16, 0.9));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 2px solid rgba(243, 167, 18, 0.22);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

@media (min-width: 620px) {
  #scorebar {
    padding-left: max(14px, calc((100% - 532px) / 2));
    padding-right: max(14px, calc((100% - 532px) / 2));
  }
}

body[data-screen="setup"] #scorebar,
body[data-screen="rules"] #scorebar,
body[data-screen="final"] #scorebar { display: none; }

#round-label {
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

#round-label:empty { display: none; }

#scorebar-items { display: flex; gap: 6px; }

.score-chip {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  background: #241d17;
  border: 1px solid #40331f;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12.5px;
  font-weight: 700;
  color: #e9dcc3;
}

.score-chip b { font-weight: 800; }

.score-chip i {
  font-style: normal;
  font-weight: 800;
  color: var(--gold);
}

/* ---------- buttons ---------- */

.btn {
  appearance: none;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 15px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s ease, filter 0.15s ease, box-shadow 0.08s ease;
}

.btn-big { width: 100%; min-height: 54px; font-size: 18px; }

.btn-primary {
  background: linear-gradient(180deg, #ef6a3d, var(--vermilion));
  color: #fff;
  box-shadow: 0 4px 0 var(--vermilion-dark), 0 12px 22px rgba(0, 0, 0, 0.35);
}

.btn-primary:active {
  transform: translateY(3px) scale(0.985);
  box-shadow: 0 1px 0 var(--vermilion-dark), 0 6px 12px rgba(0, 0, 0, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--gold);
  border: 2px solid rgba(243, 167, 18, 0.45);
  box-shadow: none;
}

.btn-ghost:active { transform: scale(0.97); background: rgba(243, 167, 18, 0.08); }

.btn:disabled, .btn[disabled] {
  opacity: 0.45;
  filter: grayscale(0.5);
  cursor: not-allowed;
  transform: none;
}

.btn:focus-visible, .card:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- setup screen ---------- */

.noren {
  position: relative;
  margin-top: 10px;
  padding: 30px 18px 34px;
  border-radius: 16px 16px 4px 4px;
  text-align: center;
  background-image:
    repeating-linear-gradient(90deg, transparent 0 52px, var(--bg) 52px 60px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.05) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, var(--nori-light), var(--nori) 68%, #29554a);
  background-size: 100% 26px, 100% 100%, 100% 100%;
  background-position: left bottom, 0 0, 0 0;
  background-repeat: repeat-x, repeat, no-repeat;
  box-shadow: inset 0 5px 0 rgba(0, 0, 0, 0.22), 0 16px 32px rgba(0, 0, 0, 0.45);
}

/* wooden rod the noren hangs from */
.noren::before {
  content: "";
  position: absolute;
  top: -9px;
  left: -7px;
  right: -7px;
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(180deg, #6a5238, #45351f);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}

.wordmark {
  font-size: clamp(30px, 9vw, 42px);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #fdf6e7;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.3), 0 0 26px rgba(243, 167, 18, 0.25);
}

.wm-emoji { filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.3)); }

.jp-sub {
  margin-top: 8px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: #f3d9a5;
}

.tagline {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
}

.setup-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

.name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.name-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.seat {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  padding-left: 3px;
}

input, select {
  width: 100%;
  min-height: 48px;
  background: #221b15;
  border: 2px solid #3d3126;
  border-radius: 12px;
  padding: 10px 13px;
  color: var(--cream);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
}

input::placeholder { color: #7d6c56; }

input:focus, select:focus {
  border-color: var(--gold);
  outline: none;
  box-shadow: 0 0 0 3px rgba(243, 167, 18, 0.22);
}

.round-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

select {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 1 170px;
  cursor: pointer;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23f3a712' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
}

option { background: #221b15; color: var(--cream); }

.setup-note {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--faint);
}

/* ---------- rules screen ---------- */

.rules-list { display: flex; flex-direction: column; gap: 10px; }

.rule {
  display: flex;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 16px;
  padding: 13px 15px;
}

.rule-icon { font-size: 26px; line-height: 1.3; }

.rule h3 { font-size: 15px; font-weight: 800; color: var(--gold); margin-bottom: 3px; }

.rule p { font-size: 13.5px; font-weight: 700; line-height: 1.55; color: #d8c9ae; }

/* ---------- order screen ---------- */

.order-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  background: linear-gradient(180deg, #fbf5e8, var(--paper) 55%, #efe3ca);
  color: var(--ink);
  border: 2px solid var(--paper-edge);
  border-radius: 20px;
  padding: 26px 20px 22px;
  box-shadow: 0 5px 0 #cdbb95, 0 18px 36px rgba(0, 0, 0, 0.5);
}

/* little "order slip" stamp */
.order-card::before {
  content: "ご注文";
  position: absolute;
  top: 10px;
  left: 14px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.3em;
  color: rgba(42, 33, 26, 0.32);
}

#order-emoji {
  font-size: clamp(56px, 17vw, 68px);
  line-height: 1.15;
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.2));
  animation: pop-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

#order-customer {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8a6a3d;
}

#order-text {
  font-size: clamp(19px, 5.4vw, 23px);
  font-weight: 800;
  line-height: 1.35;
  max-width: 24ch;
}

#order-bonus {
  margin-top: 2px;
  background: rgba(228, 87, 46, 0.1);
  border: 2px dashed rgba(228, 87, 46, 0.55);
  color: #c2391a;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 800;
  transform: rotate(-2deg);
}

/* ---------- pass screen ---------- */

.pass-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 22px;
  padding: 30px 20px 26px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

#pass-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 148px;
  height: 148px;
  font-size: 82px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, var(--paper), #e9d7b3);
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 7px rgba(243, 167, 18, 0.14), 0 16px 30px rgba(0, 0, 0, 0.45);
  animation: float 3.2s ease-in-out infinite;
}

#pass-name {
  margin-top: 6px;
  font-size: 30px;
  font-weight: 800;
  color: var(--cream);
  overflow-wrap: anywhere;
}

.pass-warning {
  font-size: 14.5px;
  font-weight: 800;
  color: #ffb59b;
  background: rgba(228, 87, 46, 0.14);
  border: 1px solid rgba(228, 87, 46, 0.4);
  padding: 8px 16px;
  border-radius: 999px;
}

@keyframes float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -8px; }
}

/* ---------- cards (shared) ---------- */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 10px 7px;
  text-align: center;
  background: linear-gradient(180deg, #fbf5e8, var(--paper) 55%, #eee1c8);
  color: var(--ink);
  border: 2px solid var(--paper-edge);
  border-radius: 15px;
  box-shadow: 0 3px 0 #d6c5a1, 0 8px 16px rgba(0, 0, 0, 0.3);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.card-emoji {
  font-size: clamp(28px, 9vw, 40px);
  line-height: 1.15;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.18));
}

.card-name {
  font-size: clamp(12px, 3.4vw, 14.5px);
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.card-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }

.tag {
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  color: var(--nori);
  background: rgba(47, 93, 80, 0.12);
  border: 1px solid rgba(47, 93, 80, 0.35);
  border-radius: 999px;
  padding: 1px 7px;
}

.card-stats { display: flex; gap: 9px; font-size: 13px; font-weight: 800; }

.card-stats .price { color: var(--nori); }

.card-stats .points { color: #c2391a; }

/* face-down: nori sheet */
.card.back {
  justify-content: center;
  border-color: #20453b;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.035) 0 6px, transparent 6px 12px),
    linear-gradient(180deg, var(--nori-light), var(--nori) 60%, #274e43);
  box-shadow: 0 3px 0 #1c3a31, 0 8px 16px rgba(0, 0, 0, 0.35);
}

.card-back-art {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(24px, 7.5vw, 36px);
  opacity: 0.85;
}

/* selected hand card */
.card.selected {
  border-color: var(--vermilion);
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 0 0 3px rgba(228, 87, 46, 0.5), 0 12px 20px rgba(0, 0, 0, 0.45);
}

.card.selected::after {
  content: "✓";
  position: absolute;
  top: -8px;
  right: -7px;
  width: 23px;
  height: 23px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: var(--vermilion);
  border: 2px solid #ffd9c9;
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

/* 3D flip wrapper (reveal) */
.card-flip {
  position: relative;
  width: 100%;
  height: 100%;
  perspective: 900px;
}

.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.35, 1.15, 0.4, 1);
}

.card-flip.flipped .flip-inner { transform: rotateY(180deg); }

.card-flip .card { backface-visibility: hidden; -webkit-backface-visibility: hidden; }

.card-flip .card.back { width: 100%; height: 100%; }

.card-flip .card.face {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
}

/* ---------- pack screen ---------- */

#screen-pack { gap: 12px; justify-content: flex-start; }

#pack-who {
  text-align: center;
  font-size: 17px;
  font-weight: 800;
  color: var(--cream);
  overflow-wrap: anywhere;
}

#pack-order {
  background: linear-gradient(180deg, #fbf5e8, #f1e5cb);
  color: #3a2d20;
  border: 2px solid #dccda6;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 3px 0 #c9b78f, 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* lacquer bento tray, 2x2 */
#bento, #reveal-bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 430px;
  margin-inline: auto;
  background: linear-gradient(180deg, #43301f, #2c2015);
  border: 2px solid #58422c;
  border-radius: 20px;
  padding: 12px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.55), 0 12px 26px rgba(0, 0, 0, 0.4);
}

.bento-slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.slot-label {
  align-self: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 800;
  color: #f0e2c4;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(243, 167, 18, 0.28);
  padding: 3px 11px;
  border-radius: 999px;
}

.slot-card { position: relative; aspect-ratio: 1 / 1; }

.slot-card > .card, .slot-card > .card-flip { height: 100%; }

.slot-card .card { gap: 3px; padding: 8px 6px; }

.slot-card .card-emoji { font-size: clamp(24px, 7.5vw, 36px); }

.slot-card .card-name { font-size: clamp(11px, 3.1vw, 13.5px); }

.slot-card .card-stats { font-size: 12px; }

.slot-card .tag { font-size: 9px; padding: 1px 6px; }

/* empty compartment: dashed plate */
.slot-card:empty {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(240, 226, 196, 0.2);
  border-radius: 15px;
  background: rgba(0, 0, 0, 0.16);
}

.slot-card:empty::after { content: "🍽️"; font-size: 26px; opacity: 0.25; }

.slot-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(240, 226, 196, 0.2);
  border-radius: 15px;
  background: rgba(0, 0, 0, 0.16);
  font-size: 26px;
  opacity: 0.5;
}

/* hand: 3x2 on phones */
#hand {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  width: 100%;
}

#hand .card {
  aspect-ratio: 3 / 4;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  animation: pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

#hand .card:nth-child(1) { animation-delay: 0.02s; }
#hand .card:nth-child(2) { animation-delay: 0.06s; }
#hand .card:nth-child(3) { animation-delay: 0.10s; }
#hand .card:nth-child(4) { animation-delay: 0.14s; }
#hand .card:nth-child(5) { animation-delay: 0.18s; }
#hand .card:nth-child(6) { animation-delay: 0.22s; }

#hand .card:active { transform: scale(0.96); }

#hand .card.selected:active { transform: translateY(-6px) scale(0.99); }

@keyframes pop-in {
  from { opacity: 0; scale: 0.86; translate: 0 14px; }
  to { opacity: 1; scale: 1; translate: 0 0; }
}

/* ---------- reveal screen ---------- */

#screen-reveal { gap: 13px; justify-content: flex-start; }

#reveal-banner { display: none; }

#reveal-banner.show {
  display: block;
  text-align: center;
  font-size: clamp(16px, 4.6vw, 20px);
  font-weight: 800;
  line-height: 1.35;
  border-radius: 15px;
  padding: 13px 16px;
  animation: banner-drop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

#reveal-banner.reveal-banner-ok {
  background: linear-gradient(180deg, var(--nori-light), var(--nori));
  color: #ffedc7;
  border: 2px solid var(--gold);
  box-shadow: 0 0 26px rgba(243, 167, 18, 0.25), 0 8px 18px rgba(0, 0, 0, 0.4);
}

#reveal-banner.reveal-banner-fail {
  background: linear-gradient(180deg, #4c2c22, #37211a);
  color: #ffcdb8;
  border: 2px solid var(--vermilion);
  box-shadow: 0 0 26px rgba(228, 87, 46, 0.22), 0 8px 18px rgba(0, 0, 0, 0.4);
}

@keyframes banner-drop {
  from { opacity: 0; translate: 0 -28px; scale: 0.9; }
  60% { opacity: 1; }
  to { opacity: 1; translate: 0 0; scale: 1; }
}

#reveal-scores { display: flex; flex-direction: column; gap: 8px; }

.score-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 3px 10px;
  align-items: center;
  background: #221b15;
  border: 1px solid #3b2f24;
  border-radius: 14px;
  padding: 10px 14px;
  animation: row-in 0.34s ease both;
}

@keyframes row-in {
  from { opacity: 0; translate: -16px 0; }
  to { opacity: 1; translate: 0 0; }
}

.row-avatar { grid-column: 1; font-size: 24px; }

.row-name {
  grid-column: 2;
  font-size: 15px;
  font-weight: 800;
  color: var(--cream);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-gain { grid-column: 3; font-size: 19px; font-weight: 800; color: var(--gold); }

.row-detail {
  grid-column: 1 / -1;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
}

.craving-hit {
  grid-column: 1 / -1;
  margin-top: 3px;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.4;
  color: var(--gold-soft);
  background: rgba(243, 167, 18, 0.12);
  border: 1px solid rgba(243, 167, 18, 0.32);
  border-radius: 9px;
  padding: 4px 9px;
}

/* ---------- final screen ---------- */

#screen-final { gap: 12px; justify-content: flex-start; }

#final-winner {
  position: relative;
  text-align: center;
  font-size: clamp(24px, 7vw, 34px);
  font-weight: 800;
  line-height: 1.3;
  color: var(--gold);
  padding: 20px 10px 12px;
  text-shadow: 0 0 26px rgba(243, 167, 18, 0.45);
  animation: glow-pulse 2s ease-in-out infinite alternate;
  overflow-wrap: anywhere;
}

@keyframes glow-pulse {
  from { text-shadow: 0 0 14px rgba(243, 167, 18, 0.3); }
  to { text-shadow: 0 0 34px rgba(243, 167, 18, 0.65); }
}

/* CSS confetti */
#final-winner::before, #final-winner::after {
  position: absolute;
  top: 0;
  font-size: 26px;
  pointer-events: none;
  animation: confetti-fall 2.8s linear infinite;
}

#final-winner::before { content: "🎉"; left: 7%; }
#final-winner::after { content: "🍣"; right: 7%; animation-delay: 1.4s; }

@keyframes confetti-fall {
  0% { translate: 0 -22px; rotate: 0deg; opacity: 0; }
  12% { opacity: 1; }
  100% { translate: 0 96px; rotate: 340deg; opacity: 0; }
}

#final-standings { display: flex; flex-direction: column; gap: 8px; }

.stand-row {
  display: grid;
  grid-template-columns: 48px 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  background: #221b15;
  border: 1px solid #3b2f24;
  border-radius: 15px;
  padding: 11px 14px;
  animation: row-in 0.35s ease both;
}

.stand-pos { font-size: 15px; font-weight: 800; color: #c8b78f; }

.stand-avatar { font-size: 24px; }

.stand-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--cream);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stand-score { font-size: 21px; font-weight: 800; color: var(--gold); }

.stand-row[data-rank="1"] {
  border-color: var(--gold);
  background: linear-gradient(180deg, #37291a, #2a2015);
  animation: row-in 0.35s ease both, winner-glow 2.4s ease-in-out 0.8s infinite;
}

.stand-row[data-rank="1"] .stand-pos { color: var(--gold); }

.stand-row[data-rank="1"] .stand-pos::before { content: "👑 "; }

@keyframes winner-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(243, 167, 18, 0.18); }
  50% { box-shadow: 0 0 26px rgba(243, 167, 18, 0.42); }
}

.craving-reveal {
  margin-top: 8px;
  background: #1d1712;
  border: 1px dashed #4c3c2b;
  border-radius: 15px;
  padding: 12px 14px;
}

.craving-reveal h4 {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 5px;
}

.craving-line {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.5;
  color: #c9b99c;
  padding: 5px 0 2px;
}

.craving-line + .craving-line { border-top: 1px solid rgba(255, 255, 255, 0.06); }

/* ---------- toast ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  translate: -50% 14px;
  z-index: 60;
  width: max-content;
  max-width: min(92vw, 460px);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, translate 0.25s ease;
}

#toast.show { opacity: 1; translate: -50% 0; }

/* ---------- responsive ---------- */

/* single row of 6 on desktop widths */
@media (min-width: 600px) {
  #hand { grid-template-columns: repeat(6, 1fr); }
  #hand .card { aspect-ratio: 5 / 7; }
  #hand .card-emoji { font-size: 30px; }
  #hand .card-name { font-size: 12px; }
}

/* short screens (phones in hand): compact bento + hand */
@media (max-height: 820px) and (max-width: 599px) {
  #screen-pack { gap: 9px; }
  .slot-card { aspect-ratio: 7 / 6; }
  #bento, #reveal-bento { padding: 10px; gap: 8px; }
  #hand { gap: 7px; }
  #hand .card { aspect-ratio: 1 / 1; gap: 2px; padding: 6px 4px; }
  #hand .card-emoji { font-size: 26px; }
  #hand .card-name { font-size: 11px; }
  #hand .card-stats { font-size: 11.5px; }
  #hand .tag { font-size: 8.5px; padding: 0 5px; }
  .btn-big { min-height: 50px; font-size: 17px; }
}

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