:root {
  --bg: #000000;
  --card: #121418;
  --ink: #f2f3f5;
  --soft: rgba(242, 243, 245, 0.54);
  --line: rgba(242, 243, 245, 0.1);
  --accent: #c8f55a;
  --g1: #ffb454;
  --g2: #5ad4e6;
  --g3: #b79cff;
  --bad: #ff6b5e;
  --pop: 1;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 10px 12px;
}

.rx { width: min(352px, 100%); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 16px; border-radius: 24px; background: var(--card); box-shadow: 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 30px 50px -30px rgba(0, 0, 0, 0.9); }
.rx__roll { display: block; overflow: hidden; }
.rx__roll > * { display: block; white-space: nowrap; }

.rx__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 24px; }
.rx__name { font-size: 13px; font-weight: 700; font-stretch: 104%; }
.rx__status { --tone: var(--accent); height: 24px; line-height: 24px; padding: 0 10px; border-radius: 12px; background: color-mix(in srgb, var(--tone) 13%, transparent); color: var(--tone); font-size: 12px; font-weight: 720; transition: color 0.3s, background-color 0.3s; }
.rx.is-none .rx__status { --tone: var(--soft); }
.rx.is-bad .rx__status { --tone: var(--bad); }

.rx__field { display: flex; align-items: center; gap: 2px; height: 46px; padding: 0 14px; border-radius: 14px; background: rgba(242, 243, 245, 0.05); box-shadow: inset 0 0 0 1px var(--line); font-family: var(--mono); font-size: 15px; line-height: 22px; cursor: text; transition: box-shadow 0.25s, background-color 0.25s; }
.rx__field:focus-within, .rx__field.is-typing { box-shadow: inset 0 0 0 1.500px color-mix(in srgb, var(--accent) 70%, transparent); background: rgba(242, 243, 245, 0.07); }
.rx.is-bad .rx__field { box-shadow: inset 0 0 0 1.500px color-mix(in srgb, var(--bad) 70%, transparent); }
.rx__slash { flex: none; color: var(--soft); }
.rx__box { position: relative; flex: 1; min-width: 0; height: 22px; overflow: hidden; }
.rx__mirror { position: absolute; left: 0; top: 0; height: 22px; white-space: pre; pointer-events: none; will-change: transform; }
.rx__mirror span { transition: color 0.2s, opacity 0.2s, text-shadow 0.2s; }
.rx__mirror .g1 { color: var(--g1); }
.rx__mirror .g2 { color: var(--g2); }
.rx__mirror .g3 { color: var(--g3); }
.rx__caret { position: relative; display: inline-block; width: 0; height: 22px; vertical-align: top; }
.rx__caret::after { content: ""; position: absolute; left: -1px; top: 2px; width: 2px; height: 18px; border-radius: 1px; background: var(--accent); }
.rx__input { position: absolute; inset: 0; width: 100%; height: 22px; border: 0; outline: none; background: transparent; color: transparent; caret-color: var(--accent); font: inherit; letter-spacing: 0; }
.rx__input::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

.rx__text { padding: 10px 14px; border-radius: 14px; background: rgba(0, 0, 0, 0.32); box-shadow: inset 0 0 0 1px rgba(242, 243, 245, 0.05); font-family: var(--mono); font-size: 12.500px; line-height: 24px; white-space: pre-wrap; overflow-wrap: anywhere; color: rgba(242, 243, 245, 0.62); min-height: 116px; }
.rx__text mark { padding: 3px 0; border-radius: 5px; color: var(--ink); background: linear-gradient(rgba(242, 243, 245, 0.13), rgba(242, 243, 245, 0.13)) no-repeat left center / 100% 100%; box-shadow: 0 0 0 0 transparent; animation: rx-in 0.36s cubic-bezier(0.25, 0.9, 0.3, 1) backwards; cursor: default; transition: box-shadow 0.2s, opacity 0.2s; }
.rx__text mark.is-old { animation: none; }
.rx__text mark.is-on { box-shadow: 0 0 0 1.500px color-mix(in srgb, var(--accent) 80%, transparent); }
.rx__text .g { transition: opacity 0.2s, text-shadow 0.2s; }
.rx__text .g1 { color: var(--g1); }
.rx__text .g2 { color: var(--g2); }
.rx__text .g3 { color: var(--g3); }
@keyframes rx-in {
  0% { background-size: 0% 100%; color: rgba(242, 243, 245, 0.62); }
  70% { background-size: 100% calc(100% + var(--pop) * 5px); }
  100% { background-size: 100% 100%; }
}
/* a chip is being read: its group stays bright everywhere, the rest steps back */
.rx.has-pick .rx__text mark .g:not(.is-lit), .rx.has-pick .rx__mirror span:not(.is-lit) { opacity: 0.38; }
.rx.has-pick .is-lit { text-shadow: 0 0 12px currentColor; }
.rx.is-bad .rx__text mark { opacity: 0.45; }

.rx__groups { display: flex; align-items: center; gap: 6px; height: 30px; min-width: 0; }
.rx__empty { font-size: 12px; font-weight: 600; color: var(--soft); }
.rx__chip { display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px 0 9px; border: 0; border-radius: 10px; background: rgba(242, 243, 245, 0.06); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); font-family: var(--mono); font-size: 12.500px; cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; transition: background-color 0.2s, box-shadow 0.2s, transform 0.25s cubic-bezier(0.3, 1.5, 0.5, 1); }
.rx__chip i { font-style: normal; font-weight: 700; color: var(--c); }
.rx__chip .rx__roll { height: 18px; line-height: 18px; }
.rx__chip.is-on, .rx__chip:focus-visible { background: color-mix(in srgb, var(--c) 14%, transparent); box-shadow: inset 0 0 0 1.500px color-mix(in srgb, var(--c) 70%, transparent); transform: translateY(-1px); }
.rx__chip.g1 { --c: var(--g1); }
.rx__chip.g2 { --c: var(--g2); }
.rx__chip.g3 { --c: var(--g3); }

.ghost { position: absolute; left: 0; top: 0; width: 24px; height: 24px; margin: -3px 0 0 -5px; pointer-events: none; opacity: 0; fill: #ffffff; stroke: #000000; stroke-width: 1.300; stroke-linejoin: round; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); z-index: 5; }

@media (max-width: 350px) {
  .rx { padding: 14px; gap: 10px; }
  .rx__field { font-size: 13.500px; padding: 0 12px; }
  .rx__text { font-size: 12px; padding: 8px 12px; }
}
@media (max-height: 330px) {
  .rx { gap: 8px; padding: 12px; }
  .rx__field { height: 40px; }
  .rx__text { line-height: 21px; min-height: 100px; }
}

@media (prefers-reduced-motion: reduce) {
  .rx__text mark { animation: none; }
  .rx__status, .rx__field, .rx__chip, .rx__mirror span, .rx__text .g, .rx__text mark { transition: none; }
}
