/* Phone-first, dark, high contrast: this gets read in a dim room with a phone
   being passed around a table. Tap targets are >= 44px everywhere. */

:root {
  --bg: #0a0a0f;
  --bg-2: #13131c;
  --card: #191926;
  --line: #2a2a3d;
  --ink: #f2f2f7;
  --dim: #9a9ab0;
  --yes: #5ce6a4;
  --no: #ff6b81;
  --gold: #ffd166;
  --accent: #a78bfa;
  --r: 14px;
}

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

/* Any class selector setting `display` outranks the UA's [hidden]{display:none},
   which silently turns closed panels into invisible full-screen tap traps.
   Settle it once, here. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.35;
  overscroll-behavior-y: none;
}

body {
  background-image:
    radial-gradient(120% 60% at 50% 0%, #1b1430 0%, rgba(10, 10, 15, 0) 60%),
    radial-gradient(80% 40% at 80% 100%, #0f2028 0%, rgba(10, 10, 15, 0) 70%);
  background-attachment: fixed;
  min-height: 100dvh;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 14px calc(120px + env(safe-area-inset-bottom));
}

/* ---------------------------------------------------------------- boot */
.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
}
.boot-mark {
  font-size: 42px;
  color: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}
.boot-text {
  color: var(--dim);
  font-size: 15px;
}
.boot-bar {
  width: 190px;
  height: 4px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
}
.boot-bar i {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: 4px;
  background: var(--accent);
  animation: slide 1.1s ease-in-out infinite;
}
@keyframes slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(320%); }
}
@keyframes pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.94); }
  50% { opacity: 1; transform: scale(1.06); }
}

/* ---------------------------------------------------------------- header */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 0 14px;
}
h1 {
  margin: 0;
  font-size: 21px;
  letter-spacing: 0.22em;
  font-weight: 800;
  background: linear-gradient(92deg, var(--accent), #67e8f9 60%, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 14px;
  font: inherit;
  font-size: 15px;
  min-height: 44px;
  cursor: pointer;
}

/* ---------------------------------------------------------------- recipe */
.recipe {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px;
  margin-bottom: 12px;
}
.recipe-line {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 9px;
}
.lead {
  flex: none;
  font-size: 12.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--yes);
  padding-top: 8px;
  font-weight: 700;
}
.lead-no {
  color: var(--no);
}
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  flex: 1;
}
.pill {
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid;
  background: rgba(92, 230, 164, 0.11);
  border-color: rgba(92, 230, 164, 0.45);
  color: var(--yes);
}
.pill.no {
  background: rgba(255, 107, 129, 0.11);
  border-color: rgba(255, 107, 129, 0.45);
  color: var(--no);
}
.pill.empty {
  background: transparent;
  border-color: var(--line);
  border-style: dashed;
  color: var(--dim);
  font-weight: 500;
}
.pick {
  width: 100%;
  min-height: 46px;
  border-radius: 11px;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  font-size: 15.5px;
  cursor: pointer;
}
.pick:active {
  background: rgba(167, 139, 250, 0.12);
}

/* ---------------------------------------------------------------- dials */
.dials {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}
.dial-label {
  font-size: 12.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 6px;
  font-weight: 700;
}
.seg {
  display: flex;
  gap: 6px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 5px;
}
.seg button {
  flex: 1;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
}
.seg button.on {
  background: var(--accent);
  color: #14101f;
  font-weight: 800;
}

/* ---------------------------------------------------------------- status */
.status {
  margin: 0 0 12px;
  font-size: 13.5px;
  color: var(--dim);
  min-height: 19px;
}
.status.warn {
  color: var(--gold);
}
.status b {
  color: var(--ink);
}

/* ---------------------------------------------------------------- results */
.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 9px;
}
.name {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px 34px 15px 13px;
  text-align: left;
  font: inherit;
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
  cursor: pointer;
  overflow-wrap: anywhere;
  min-height: 58px;
  transition: transform 0.09s ease, border-color 0.15s ease;
  animation: rise 0.26s ease both;
}
.name:active {
  transform: scale(0.97);
}
.name.copied {
  border-color: var(--yes);
  color: var(--yes);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}
.star {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 100%;
  border: 0;
  background: transparent;
  color: #4a4a63;
  font-size: 17px;
  cursor: pointer;
  border-radius: 0 12px 12px 0;
}
.star.on {
  color: var(--gold);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 26px 16px;
  color: var(--dim);
  border: 1px dashed var(--line);
  border-radius: var(--r);
}
.empty-state button {
  margin-top: 12px;
}

.foot {
  margin: 20px 0 0;
  text-align: center;
  font-size: 12.5px;
  color: #6a6a85;
  line-height: 1.7;
}

/* ---------------------------------------------------------------- roll bar */
.rollbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 62%, rgba(10, 10, 15, 0));
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.roll {
  pointer-events: auto;
  width: 100%;
  max-width: 692px;
  min-height: 58px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(96deg, var(--accent), #7dd3fc);
  color: #140f24;
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.13em;
  cursor: pointer;
  box-shadow: 0 8px 26px rgba(103, 232, 249, 0.2);
}
.roll:active {
  transform: scale(0.985);
}

/* ---------------------------------------------------------------- sheet */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
}
.sheet-body {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  padding: 14px 14px calc(22px + env(safe-area-inset-bottom));
  animation: up 0.2s ease both;
}
@keyframes up {
  from { transform: translateY(14px); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: -14px;
  background: var(--bg-2);
  padding: 6px 0 10px;
  margin-top: -6px;
  font-size: 18px;
}
.sheet-hint {
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--dim);
}
.sheet-hint .yes { color: var(--yes); }
.sheet-hint .no { color: var(--no); }

.chip-groups {
  display: grid;
  gap: 16px;
}
.chip-group h3 {
  margin: 0 0 8px;
  font-size: 12.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 700;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 15px;
  min-height: 44px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip[data-state='inc'] {
  background: rgba(92, 230, 164, 0.15);
  border-color: var(--yes);
  color: var(--yes);
}
.chip[data-state='exc'] {
  background: rgba(255, 107, 129, 0.15);
  border-color: var(--no);
  color: var(--no);
}
.chip:active {
  transform: scale(0.97);
}

/* ---------------------------------------------------------------- kept */
.kept-list {
  display: grid;
  gap: 8px;
}
.kept-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px;
}
.kept-row b {
  font-size: 18px;
  overflow-wrap: anywhere;
}
.kept-row small {
  display: block;
  color: var(--dim);
  font-size: 11.5px;
  font-weight: 500;
  margin-top: 2px;
}
.kept-row button {
  flex: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--dim);
  border-radius: 9px;
  min-width: 44px;
  min-height: 44px;
  font: inherit;
  cursor: pointer;
}
.kept-empty {
  color: var(--dim);
  text-align: center;
  padding: 22px;
}

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  background: var(--ink);
  color: #10101a;
  font-weight: 800;
  font-size: 14.5px;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 60;
  max-width: 88vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 560px) {
  h1 { font-size: 25px; }
  .name { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
