/* sugarpackets.app — the app itself. Tokens and reset live in tokens.css. */
:root {
  --room: #0B0A10;
  --room-2: #151220;
  --panel: #1B1726;
  --panel-2: #221D31;
  --muted: #B3A8BE;
  --dim: #7C7189;
  --line: rgba(244,236,221,.14);
  --line-strong: rgba(244,236,221,.24);
  --shadow: 0 30px 90px rgba(0,0,0,.6);
  --shadow-card: 0 10px 26px rgba(0,0,0,.4);
  --radius-card: 22px;
  --radius-btn: 10px;
  --radius-pill: 999px;
  --tracking-label: .1em;
  --tracking-button: .04em;
  color-scheme: dark;
}

html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 16% 8%, rgba(255,46,136,.16), transparent 16rem),
    radial-gradient(circle at 86% 12%, rgba(43,232,255,.13), transparent 16rem),
    radial-gradient(circle at 50% 100%, rgba(255,201,60,.08), transparent 22rem),
    var(--room);
  color: var(--cream);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

@keyframes flicker {
  0%, 19%, 21%, 80%, 100% { opacity: 1; }
  20%, 79% { opacity: .55; }
}

.device {
  width: min(100%, 440px);
  min-height: min(880px, calc(100vh - 36px));
  border-radius: 40px;
  background: #08070C;
  padding: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line-strong);
}

.screen {
  min-height: min(856px, calc(100vh - 60px));
  border-radius: 30px;
  padding: 18px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 8%, rgba(255,46,136,.14), transparent 10rem),
    radial-gradient(circle at 86% 12%, rgba(43,232,255,.12), transparent 10rem),
    var(--room-2);
  border: 1px solid var(--line);
}

.screen::before {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -132px;
  top: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,201,60,.1), transparent 62%);
  pointer-events: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: relative;
  z-index: 2;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-family: var(--font-script);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1;
  color: var(--pink);
  text-shadow: 0 0 6px var(--pink), 0 0 16px rgba(255,46,136,.6);
  font-size: 1.1rem;
}

.brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mark {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 3px 3px 7px 7px;
  border: 2px solid var(--pink);
  box-shadow: 0 0 8px var(--pink), 0 0 18px rgba(255,46,136,.5);
  position: relative;
  transform: rotate(-6deg);
  clip-path: polygon(0 18%, 16% 0, 32% 16%, 48% 0, 64% 16%, 80% 0, 100% 18%, 100% 100%, 0 100%);
}
.mark::before,
.mark::after {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  height: 2px;
  background: var(--pink);
  box-shadow: 0 0 4px var(--pink);
  border-radius: 999px;
}
.mark::before { top: 13px; }
.mark::after { top: 20px; }

.top-pill {
  flex: 0 0 auto;
  padding: 8px 11px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--amber);
  color: var(--amber);
  font-size: .66rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  box-shadow: 0 0 8px rgba(255,201,60,.35);
}

.progress {
  display: flex;
  gap: 7px;
  margin-bottom: 18px;
  position: relative;
  z-index: 2;
}
.progress span {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}
.progress span::after {
  content: "";
  display: block;
  width: var(--fill, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--fill-color, var(--cyan));
  box-shadow: 0 0 10px currentColor;
  transition: width .22s ease;
}
.progress .done { --fill: 100%; --fill-color: var(--amber); color: var(--amber); }
.progress .active { --fill: 70%; --fill-color: var(--cyan); color: var(--cyan); }

.view {
  display: none;
  position: relative;
  z-index: 2;
  animation: viewIn .2s ease both;
}
.view.active { display: block; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: .02em;
  line-height: 1.02;
  font-weight: 800;
  color: var(--cream);
}
h1 { font-size: clamp(2.2rem, 11vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 7.5vw, 2.5rem); }
h3 { font-size: 1.1rem; }

.sub {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.small { color: var(--dim); font-size: .86rem; line-height: 1.45; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.chip {
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .74rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.card {
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.card.tight { padding: 14px; }

.meter {
  width: 190px;
  height: 190px;
  margin: 8px auto 18px;
  border-radius: 50%;
  background:
    radial-gradient(circle at var(--bubble-x, 58%) var(--bubble-y, 42%), var(--pink) 0 15px, transparent 16px),
    radial-gradient(circle, transparent 0 49px, rgba(255,201,60,.85) 50px 54px, transparent 55px),
    var(--room-2);
  border: 4px solid rgba(43,232,255,.35);
  box-shadow:
    inset 0 0 0 2px rgba(0,0,0,.4),
    0 0 24px rgba(43,232,255,.18),
    0 0 18px rgba(255,46,136,.16);
  transition: filter .2s ease, transform .2s ease;
}

.meter.live { filter: brightness(1.1); }
.meter.recording { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { transform: scale(1) rotate(-1deg); }
  50% { transform: scale(1.02) rotate(1deg); }
}

.meter-wrap { position: relative; width: 190px; margin: 8px auto 0; }
.meter-wrap .meter { margin: 0; }
.hold-ring {
  position: absolute;
  inset: -12px;
  width: calc(100% + 24px);
  height: calc(100% + 24px);
  transform: rotate(-90deg);
  pointer-events: none;
}
.hold-ring circle { fill: none; stroke-width: 5; }
.hold-ring-bg { stroke: rgba(244,236,221,.12); }
.hold-ring-fill {
  stroke: var(--cyan);
  stroke-linecap: round;
  stroke-dasharray: 339.29;
  stroke-dashoffset: 339.29;
  filter: drop-shadow(0 0 6px var(--cyan));
  transition: stroke-dashoffset .08s linear, stroke .2s ease, filter .2s ease;
}
.hold-ring-fill.unsettled { stroke: var(--pink); filter: drop-shadow(0 0 8px var(--pink)); }
.hold-ring-fill.settled { stroke: var(--amber); filter: drop-shadow(0 0 10px var(--amber)); }

.hold-caption {
  text-align: center;
  margin-top: 14px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  font-size: .78rem;
  font-weight: 700;
  color: var(--cyan);
  transition: color .2s ease;
}
.hold-caption.unsettled { color: var(--pink); }
.hold-caption.settled { color: var(--amber); }

.meter-label { text-align: center; }
.meter-label strong { display: block; font-size: 1.05rem; color: var(--cream); }
.meter-label span { display: block; color: var(--muted); margin-top: 4px; }

.btn-row { display: grid; gap: 10px; margin-top: 18px; }
.btn-row.two { grid-template-columns: 1fr 1fr; }
button, .button-like {
  width: 100%;
  min-height: 56px;
  border: 2px solid transparent;
  border-radius: var(--radius-btn);
  padding: 15px 16px;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  font-family: var(--font-head);
  letter-spacing: var(--tracking-button);
  font-weight: 700;
  font-size: 1.02rem;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease;
}
button:active, .button-like:active { transform: translateY(1px) scale(.99); }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--pink); color: #1a0410; box-shadow: 0 0 14px rgba(255,46,136,.5); }
.secondary { background: transparent; color: var(--cyan); border-color: var(--cyan); box-shadow: inset 0 0 12px rgba(43,232,255,.08); }
.amber { background: transparent; color: var(--amber); border-color: var(--amber); box-shadow: inset 0 0 12px rgba(255,201,60,.08); }
.ghost { background: var(--panel); color: var(--cream); border-color: var(--line); }

.status-line {
  margin-top: 12px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: .82rem;
  line-height: 1.45;
  text-align: center;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.option-grid.three { grid-template-columns: repeat(3, 1fr); }
.option { flex-direction: column; gap: 3px; }
.option .mm {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .06em;
  text-transform: none;
  color: var(--muted);
}
.option.active .mm { color: inherit; opacity: .75; }
.option {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--cream);
  font-weight: 700;
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: .02em;
  cursor: pointer;
  transition: border .16s ease, box-shadow .16s ease, color .16s ease;
  user-select: none;
}
.option.active {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(43,232,255,.3), 0 0 16px rgba(43,232,255,.18);
}

.corner-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}
.corner {
  min-height: 92px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  font-weight: 700;
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--cream);
  position: relative;
  overflow: hidden;
}
.corner::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 12px;
  border: 1px dashed rgba(244,236,221,.1);
  pointer-events: none;
}
.corner.active {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(43,232,255,.3), 0 0 18px rgba(43,232,255,.14);
}
.corner.done {
  border-color: var(--amber);
  color: var(--amber);
  box-shadow: inset 0 0 0 1px rgba(255,201,60,.24), 0 0 14px rgba(255,201,60,.1);
}
.corner.suspect {
  border-color: var(--pink);
  color: var(--cream);
  background: rgba(255,46,136,.16);
  box-shadow: inset 0 0 0 1px rgba(255,46,136,.3), 0 0 20px rgba(255,46,136,.18);
}

.sample-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .82rem;
}
.sample-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 9px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.result-card {
  margin-top: 18px;
  background: rgba(43,232,255,.06);
  border: 1px solid rgba(43,232,255,.3);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow-card);
}
.result-kicker {
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 700;
}
.result-main {
  margin-top: 6px;
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: .02em;
  font-size: 2.1rem;
  line-height: 1;
  color: var(--cream);
  font-weight: 800;
}
.result-badge {
  display: inline-flex;
  margin-top: 12px;
  padding: 9px 13px;
  border-radius: 999px;
  background: transparent;
  color: var(--amber);
  font-weight: 700;
  font-family: var(--font-mono);
  border: 1px solid var(--amber);
  box-shadow: 0 0 10px rgba(255,201,60,.35);
}
.meta { margin-top: 12px; color: var(--muted); font-size: .92rem; line-height: 1.45; }

.table-mini {
  margin-top: 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--room-2);
  padding: 16px;
}

.diag {
  position: relative;
  width: 176px;
  height: 126px;
  border-radius: 44px;
  border: 2px dashed rgba(244,236,221,.16);
  margin: 0 auto;
  background: radial-gradient(circle at center, rgba(255,46,136,.05), transparent 70%);
}
.leg-dot {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--panel);
}
.leg-dot[data-leg="front-left"] { left: 16px; bottom: 16px; }
.leg-dot[data-leg="front-right"] { right: 16px; bottom: 16px; }
.leg-dot[data-leg="back-left"] { left: 16px; top: 16px; }
.leg-dot[data-leg="back-right"] { right: 16px; top: 16px; }
.leg-dot.active { background: var(--pink); box-shadow: 0 0 16px rgba(255,46,136,.6); border-color: var(--pink); }

.toast {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  transform: translateY(120%);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--panel);
  color: var(--amber);
  border: 1px solid var(--amber);
  font-weight: 700;
  font-family: var(--font-mono);
  box-shadow: 0 0 20px rgba(255,201,60,.3);
}
.toast.show { transform: translateY(0); opacity: 1; }

.footer-note {
  position: relative;
  z-index: 2;
  margin-top: 16px;
  text-align: center;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: .78rem;
}

@media (max-width: 420px) {
  body { padding: 0; align-items: stretch; }
  .device { width: 100%; min-height: 100svh; border-radius: 0; padding: 0; }
  .screen { min-height: 100svh; border-radius: 0; border: 0; padding: 18px; }
  .meter { width: 180px; height: 180px; }
  .btn-row.two { grid-template-columns: 1fr; }
}
