:root {
  --ink: #0b0f14;
  --lime: #c8f542;
  --coral: #ff5c3a;
  --paper: #e4e6e1;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Space Grotesk", system-ui, sans-serif;
  --glass: rgba(11, 15, 20, 0.86);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#paper {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

/* plate numeral, printed top-centre like the originals */
.numeral {
  position: fixed;
  top: max(20px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.3em;
  opacity: 0.45;
  pointer-events: none;
}

/* title */
.title {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: max(20px, env(safe-area-inset-left));
  max-width: min(78vw, 360px);
  pointer-events: none;
  transition: opacity 1.2s ease;
}
.title__kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 8px;
  opacity: 0.6;
}
.title__name {
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin: 0;
}
.title__how {
  font-size: 14px;
  line-height: 1.55;
  margin: 12px 0 0;
  opacity: 0.72;
  transition: opacity 1.2s ease;
}
.title.is-quiet { opacity: 0.55; }
.title.is-quiet .title__how { opacity: 0; }

/* top-right tools */
.tools {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  display: flex;
  gap: 8px;
}
.tool {
  border: 1px solid rgba(11, 15, 20, 0.28);
  background: rgba(228, 230, 225, 0.72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  border-radius: 999px;
  padding: 7px 14px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.tool:hover { border-color: var(--ink); }
a.tool { display: inline-flex; align-items: center; text-decoration: none; }
.tool--solid { background: var(--lime); border-color: var(--lime); color: var(--ink); font-weight: 600; }
.tool--solid:hover { border-color: var(--ink); }

/* bottom dock: prompt above the ink wells */
.dock {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(94vw, 460px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
.dock > * { pointer-events: auto; }

.wells {
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: var(--glass);
  color: #e8ebe6;
}
.well {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  padding: 7px 14px 7px 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  opacity: 0.7;
}
.well.is-on { background: rgba(200, 245, 66, 0.14); box-shadow: inset 0 0 0 1px var(--lime); opacity: 1; }
.well__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(232, 235, 230, 0.8);
}
.well__dot--black { background: #05070a; }
.well__dot--red { background: var(--coral); }

/* the question */
.ask {
  width: 100%;
  padding: 14px 16px 14px;
  border-radius: 16px;
  background: var(--glass);
  color: #e8ebe6;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.9s ease, transform 0.9s ease;
}
.ask.is-on { opacity: 1; transform: none; pointer-events: auto; }
.ask__label {
  display: block;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}
.ask__row { display: flex; gap: 8px; align-items: center; }
.ask__input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(232, 235, 230, 0.25);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  padding: 10px 12px;
  font: 16px var(--sans);
  -webkit-user-select: text;
  user-select: text;
}
.ask__input::placeholder { color: rgba(232, 235, 230, 0.4); }
.ask__keep {
  border: 0;
  border-radius: 10px;
  background: var(--lime);
  color: var(--ink);
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
}
.ask__skip {
  border: 1px solid rgba(232, 235, 230, 0.3);
  border-radius: 10px;
  background: transparent;
  padding: 9px 12px;
  font-family: var(--mono);
  font-size: 12px;
  opacity: 0.75;
}
.ask__done { display: none; }
.ask__answer.ask__answer--theirs span { color: var(--coral); }
.ask__link { margin-top: 10px; }
.ask__url {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(232, 235, 230, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #e8ebe6;
  padding: 7px 12px;
  font: 12px var(--mono);
  -webkit-user-select: all;
  user-select: all;
}
.ask.is-done .ask__form { display: none; }
.ask.is-done .ask__done { display: block; }
.ask__answer {
  margin: 0 0 12px;
  font-size: 19px;
  line-height: 1.35;
}
.ask__answer span {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--lime);
  margin-bottom: 4px;
}
.ask__done .tool { background: transparent; color: #e8ebe6; border-color: rgba(232, 235, 230, 0.35); }
.ask__done .tool--solid { background: var(--lime); color: var(--ink); border-color: var(--lime); }
.ask__fine { margin: 12px 0 0; font-size: 12px; opacity: 0.55; }

/* about */
.about {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 15, 20, 0.35);
}
.about[hidden] { display: none; }
.about__card {
  width: min(94vw, 540px);
  max-height: 88vh;
  overflow: auto;
  padding: 26px 28px 24px;
  border-radius: 18px;
  background: var(--glass);
  color: #e8ebe6;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.about__title { margin: 0 0 18px; font-size: 24px; font-weight: 400; letter-spacing: -0.02em; }
.about__list { margin: 0; display: grid; grid-template-columns: 60px 1fr; gap: 12px 14px; }
.about__list dt { font-family: var(--mono); font-size: 12px; color: var(--lime); padding-top: 3px; }
.about__list dd { margin: 0; font-size: 15px; line-height: 1.55; opacity: 0.9; }
.about__note { margin: 20px 0 6px; font-size: 15px; line-height: 1.55; }
.about__note b { color: var(--coral); font-family: var(--mono); font-weight: 600; letter-spacing: 0.08em; }
.about__credit { margin: 0 0 20px; font-size: 13px; opacity: 0.6; }

/* a shared plate: the sheet lies on a dark table, and there is no ink to pour */
.is-shared { background: var(--ink); }
.is-shared .wells { display: none; }
.is-shared .title { color: #e8ebe6; max-width: min(60vw, 520px); }
.is-shared .title__name { font-size: clamp(26px, 3.4vw, 34px); }
.is-shared .title__how { margin-top: 6px; font-size: 13px; }
.is-shared .numeral { color: #e8ebe6; }
.is-shared .tools .tool { background: rgba(11, 15, 20, 0.6); color: #e8ebe6; border-color: rgba(232, 235, 230, 0.35); }
.is-shared #paper { cursor: default; }
.is-still #paper { visibility: hidden; }
.still {
  position: fixed;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 260px);
  border-radius: 4px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.fallback {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font-size: 17px;
}
.fallback[hidden] { display: none; }

@media (max-width: 640px) {
  .numeral { display: none; }
  .title, .is-shared .title { max-width: calc(100vw - 150px); }
  .title__kicker { letter-spacing: 0.1em; }
  .title__how { font-size: 13px; }
  .tools { flex-direction: column; align-items: flex-end; }
  .ask__label { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .title, .title__how, .ask { transition: none; }
}
