:root {
  --ink: #f4f1e8;
  --muted: #99a1aa;
  --page: #10151c;
  --panel: #171e27;
  --panel-light: #202a35;
  --line: rgba(255, 255, 255, 0.11);
  --lime: #d9ff66;
  --pink: #ff6f91;
  --blue: #74c7ec;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--page);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.noise {
  position: fixed;
  z-index: -1;
  inset: 0;
  opacity: 0.035;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
}

.orb {
  position: fixed;
  z-index: -2;
  width: 480px;
  height: 480px;
  border-radius: 999px;
  filter: blur(100px);
  opacity: 0.09;
  pointer-events: none;
}

.orb-one {
  top: -160px;
  left: -180px;
  background: var(--pink);
}

.orb-two {
  right: -220px;
  bottom: 10%;
  background: var(--blue);
}

.site-header {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.96rem;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  gap: 3px;
  padding: 7px;
  border-radius: 10px;
  color: var(--page);
  background: var(--lime);
  transform: rotate(-4deg);
}

.brand-mark i {
  display: block;
  width: 100%;
  border-radius: 4px;
  background: currentColor;
}

.brand-mark i:nth-child(1) { height: 9px; }
.brand-mark i:nth-child(2) { height: 18px; }
.brand-mark i:nth-child(3) { height: 13px; }

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.05em;
}

.status-dot,
.machine-ready i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 12px var(--lime);
}

main {
  width: min(960px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  padding: 88px 0 58px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 20px;
  color: var(--lime);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow span {
  margin-right: 8px;
}

.eyebrow.small {
  margin-bottom: 8px;
  font-size: 0.65rem;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 8.2vw, 6.65rem);
  line-height: 0.91;
  letter-spacing: -0.065em;
}

h1 em {
  color: var(--pink);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}

.intro {
  margin: 30px 0 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 2vw, 1.08rem);
  line-height: 1.7;
}

.machine {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 35%), var(--panel);
  box-shadow: var(--shadow);
}

.machine-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
}

.machine-ready {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #b6c0a1;
}

.display-wrap {
  position: relative;
  padding: clamp(36px, 7vw, 74px) 24px 30px;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.018), transparent),
    radial-gradient(circle at 50% 0%, rgba(217, 255, 102, 0.05), transparent 50%);
}

.display-lights {
  position: absolute;
  top: 22px;
  left: 22px;
  display: flex;
  gap: 6px;
}

.display-lights span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3c4651;
}

.display-lights span:first-child {
  background: var(--pink);
  box-shadow: 0 0 10px rgba(255, 111, 145, 0.6);
}

.display {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(120px, 0.55fr);
  gap: 12px;
  align-items: center;
}

.reel {
  min-width: 0;
  overflow: hidden;
  padding: 19px 12px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 14px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.45)),
    #0a0e13;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5), inset 0 12px 25px rgba(0, 0, 0, 0.2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(1.2rem, 3.5vw, 2.25rem);
  font-weight: 850;
  letter-spacing: -0.04em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reel-number {
  color: var(--lime);
  letter-spacing: 0.03em;
}

.reel.spinning {
  color: rgba(244, 241, 232, 0.65);
  text-shadow: 0 6px 0 rgba(244, 241, 232, 0.1), 0 -6px 0 rgba(244, 241, 232, 0.1);
  filter: blur(0.6px);
}

.reel.landed {
  animation: land 420ms cubic-bezier(0.2, 1.7, 0.45, 1);
}

.joiner {
  color: #59636e;
  font-size: 1rem;
  font-weight: 900;
}

.display-hint {
  margin: 20px 0 0;
  color: #69737e;
  font-size: 0.76rem;
  text-align: center;
}

.controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 24px;
  padding: 22px 26px 27px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.12);
}

.quantity-picker {
  margin: 0;
  padding: 0;
  border: 0;
}

.quantity-picker legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.05em;
}

.segments {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.quantity {
  width: 38px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
}

.quantity:hover {
  color: var(--ink);
}

.quantity.active {
  color: var(--page);
  background: var(--ink);
}

.roll-button {
  position: relative;
  isolation: isolate;
  min-width: 230px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 17px 28px;
  border: 0;
  border-radius: 13px;
  color: #161b12;
  background: var(--lime);
  box-shadow: 0 10px 30px rgba(217, 255, 102, 0.14);
  cursor: pointer;
  font-weight: 900;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.roll-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 14px 38px rgba(217, 255, 102, 0.23);
}

.roll-button:active:not(:disabled) {
  transform: translateY(1px) scale(0.985);
}

.roll-button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.button-icon {
  display: inline-block;
  font-size: 1.25rem;
  line-height: 1;
}

.roll-button.rolling .button-icon {
  animation: rotate 600ms linear infinite;
}

.button-shine {
  position: absolute;
  z-index: -1;
  inset: 0;
  transform: translateX(-120%) skewX(-22deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
}

.roll-button:hover .button-shine {
  animation: shine 750ms ease;
}

.keyboard-tip {
  align-self: center;
  justify-self: end;
  margin: 0;
  color: #6f7882;
  font-size: 0.68rem;
}

kbd {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-bottom-color: rgba(255, 255, 255, 0.23);
  border-radius: 5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-family: inherit;
  font-size: 0.64rem;
}

.results-section,
.history-section {
  margin-top: 72px;
  animation: reveal 500ms ease both;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-heading.compact {
  align-items: center;
}

h2 {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2.5rem);
  letter-spacing: -0.04em;
}

.history-section h2 {
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.text-button {
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid rgba(217, 255, 102, 0.4);
  color: var(--lime);
  background: transparent;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 800;
}

.text-button.muted {
  border-color: var(--line);
  color: #707a84;
}

.results-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: result;
}

.result-card {
  counter-increment: result;
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  animation: resultIn 480ms cubic-bezier(0.2, 0.9, 0.25, 1) both;
  animation-delay: calc(var(--index) * 75ms);
}

.result-card::before {
  content: counter(result, decimal-leading-zero);
  color: #55606b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
}

.result-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(1rem, 3vw, 1.35rem);
  font-weight: 800;
  letter-spacing: -0.035em;
}

.copy-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.copy-button:hover {
  color: var(--lime);
  border-color: rgba(217, 255, 102, 0.35);
  transform: translateY(-1px);
}

.copy-button svg {
  width: 16px;
}

.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-chip {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #7f8994;
  background: transparent;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.7rem;
  transition: color 160ms ease, background 160ms ease;
}

.history-chip:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}

footer {
  width: min(960px, calc(100% - 40px));
  margin: 100px auto 0;
  padding: 30px 0 40px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  color: #626c76;
  font-size: 0.7rem;
}

.toast {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 28px;
  padding: 11px 16px;
  border: 1px solid rgba(217, 255, 102, 0.24);
  border-radius: 10px;
  color: var(--ink);
  background: #222b26;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
  font-size: 0.75rem;
  font-weight: 750;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid rgba(116, 199, 236, 0.8);
  outline-offset: 3px;
}

@keyframes land {
  0% { transform: translateY(-12px); opacity: 0.4; }
  65% { transform: translateY(3px); }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes rotate {
  to { transform: rotate(360deg); }
}

@keyframes shine {
  to { transform: translateX(120%) skewX(-22deg); }
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(12px); }
}

@keyframes resultIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
}

@media (max-width: 720px) {
  .site-header {
    padding-top: 20px;
  }

  .status-pill {
    font-size: 0;
  }

  .status-pill::after {
    content: "ONLINE";
    font-size: 0.66rem;
  }

  .hero {
    padding: 64px 0 42px;
  }

  h1 {
    font-size: clamp(3rem, 15vw, 5.5rem);
  }

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

  .joiner {
    display: none;
  }

  .reel {
    padding: 14px 12px;
  }

  .display-wrap {
    padding-top: 46px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .quantity-picker,
  .keyboard-tip {
    justify-self: center;
    text-align: center;
  }

  .roll-button {
    width: 100%;
    grid-row: 1;
  }

  .keyboard-tip {
    display: none;
  }

  .quantity-picker {
    grid-row: 2;
  }

  footer {
    flex-direction: column;
    text-align: center;
  }
}

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