/* VALENTINE 1,000,000 — 1986's idea of the future, one million years later. */
:root {
  --night: #0A0620; --violet: #2A0E4A; --plum: #3A0F5A; --pink: #FF6EC7; --magenta: #FF3EA5; --cyan: #3EF6FF;
  --gold: #FFC857; --cream: #FFF3E0; --dim: #B9A8D8; --choc: #3A1D12;
  --panel: rgba(18, 7, 38, 0.86); --panel-2: rgba(40, 14, 70, 0.7); --line: rgba(255, 110, 199, 0.35);
  --display: "Futura", "Avenir Next", "Century Gothic", "Trebuchet MS", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", Menlo, Consolas, "Courier New", monospace;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--cream); font-family: var(--body); overflow: hidden;
  -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; -webkit-user-select: text; user-select: text; }
[hidden] { display: none !important; }
#c { position: fixed; inset: 0; display: block; touch-action: none; }

/* ——— top bar ——— */
.hud { position: fixed; z-index: 6; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-t) + 8px) 12px 6px; pointer-events: none; }
.hud > * { pointer-events: auto; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: rgba(18, 7, 38, 0.6);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); display: grid; place-items: center; color: var(--cream); padding: 0; }
.icon-btn:active { transform: scale(0.94); }
.ico { width: 22px; height: 22px; }
#btnSound .ico-off { display: none; }
#btnClose .ico-back { display: none; }
#btnClose.back .ico-x { display: none; }
#btnClose.back .ico-back { display: block; }
#btnSound[aria-pressed="false"] .ico-on { display: none; }
#btnSound[aria-pressed="false"] .ico-off { display: block; }
.cassette { position: relative; width: 26px; height: 17px; border: 2px solid var(--pink); border-radius: 4px; display: flex; gap: 5px;
  align-items: center; justify-content: center; box-shadow: 0 0 8px rgba(255, 110, 199, 0.6); }
.cassette .reel { width: 6px; height: 6px; border-radius: 50%; border: 2px solid var(--cyan); }
.hearts { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: rgba(18, 7, 38, 0.6);
  border: 1px solid var(--line); font: 700 17px/1 var(--mono); color: #5BFFD2; text-shadow: 0 0 8px rgba(91, 255, 210, 0.7);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.heart-ico { width: 14px; height: 13px; position: relative; display: inline-block; }
.heart-ico::before, .heart-ico::after { content: ""; position: absolute; top: 0; width: 8px; height: 12px; background: var(--pink);
  border-radius: 8px 8px 0 0; box-shadow: 0 0 6px var(--pink); }
.heart-ico::before { left: 7px; transform: rotate(-45deg); transform-origin: 0 100%; }
.heart-ico::after { left: -1px; transform: rotate(45deg); transform-origin: 100% 100%; }
.hearts.bump { animation: bump 0.5s ease; }
@keyframes bump { 30% { transform: scale(1.18); } }

/* ——— panels ——— */
.ui { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.panel { pointer-events: auto; }
.dock { position: fixed; left: 50%; bottom: 0; width: min(100%, 560px); transform: translate(-50%, 110%);
  padding: 14px 16px calc(var(--safe-b) + 14px); background: var(--panel); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 24px 24px 0 0; box-shadow: 0 -10px 50px rgba(255, 62, 165, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
  transition: transform 0.45s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; gap: 10px; }
.dock.in { transform: translate(-50%, 0); }
.dock::before { content: ""; position: absolute; left: 24px; right: 24px; top: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--pink), var(--cyan), transparent); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.dock h3, .sheet h3 { margin: 2px 0 0; font: italic 800 13px/1.2 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan); }
.muted { color: var(--dim); }
.small { font-size: 12.5px; line-height: 1.4; }
.center { text-align: center; }

.btn { min-height: 52px; border-radius: 16px; border: 0; padding: 0 16px; font: italic 900 17px/1 var(--display); letter-spacing: 0.04em;
  text-transform: uppercase; color: #1B0626; background: linear-gradient(180deg, #FFE08A 0%, #FF9A5C 45%, #FF4FA0 100%);
  box-shadow: 0 6px 22px rgba(255, 79, 160, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6); transition: transform 0.12s, filter 0.2s; }
.btn:active { transform: translateY(1px) scale(0.985); }
.btn:disabled { filter: grayscale(0.8) brightness(0.6); cursor: default; }
.btn-ghost { background: rgba(255, 255, 255, 0.06); color: var(--cream); border: 1px solid var(--line); box-shadow: none; font-size: 14px; }
.btn-cyan { background: linear-gradient(180deg, #CFFFFF 0%, #3EF6FF 50%, #1A9FC8 100%); box-shadow: 0 6px 22px rgba(62, 246, 255, 0.3); }
.btn-small { min-height: 40px; font-size: 13px; border-radius: 12px; }
.btn-gold { background: linear-gradient(180deg, #FFF6C8, #FFC857 50%, #C8901A); }
a.btn { display: grid; place-items: center; text-decoration: none; }

.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; border-radius: 14px; border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04); font: 700 11px/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); }
.tab:active { background: rgba(255, 110, 199, 0.14); }
.tab img { width: 30px; height: 30px; image-rendering: pixelated; }

/* ——— dialogue ——— */
.talk { --who: #FF6EC7; position: fixed; z-index: 7; left: 50%; bottom: calc(var(--safe-b) + 14px); transform: translateX(-50%);
  width: min(calc(100% - 24px), 540px); padding: 16px 18px 18px; border-radius: 20px; background: rgba(14, 5, 30, 0.92);
  border: 1.5px solid var(--who); box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.25), 0 0 30px color-mix(in srgb, var(--who) 40%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); animation: talkin 0.3s ease; cursor: pointer; }
@keyframes talkin { from { opacity: 0; transform: translate(-50%, 12px); } }
.talk.ray { border-color: #5BFFD2; --who: #5BFFD2; }
.talk-tag { position: absolute; top: -14px; left: 16px; display: flex; gap: 8px; align-items: baseline; padding: 5px 12px; border-radius: 10px;
  background: var(--who); color: #12041F; box-shadow: 0 0 16px color-mix(in srgb, var(--who) 60%, transparent); }
.talk-name { font: italic 900 14px/1 var(--display); letter-spacing: 0.08em; }
.talk-role { font: 700 10.5px/1 var(--display); opacity: 0.8; letter-spacing: 0.03em; }
.talk.ray .talk-name { font-family: var(--mono); font-style: normal; }
.talk-text { margin: 6px 0 0; font: 600 17px/1.42 var(--body); color: var(--cream); min-height: 2.8em; text-wrap: pretty; }
.talk.ray .talk-text { font-family: var(--mono); font-size: 15.5px; color: #CFFFF0; }
.talk-next { position: absolute; right: 16px; bottom: 8px; color: var(--who); font-size: 12px; opacity: 0; }
.talk.ready .talk-next { opacity: 1; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ——— order ticket (dot-matrix receipt) ——— */
.ticket { position: relative; background: #FFF7E8; color: #2A1A30; border-radius: 6px; padding: 14px 16px 12px; font: 600 13px/1.45 var(--mono);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45); }
.ticket::before, .ticket::after { content: ""; position: absolute; left: 0; right: 0; height: 8px;
  background: radial-gradient(circle at 6px -2px, transparent 6px, #FFF7E8 6.5px) repeat-x; background-size: 12px 8px; }
.ticket::before { top: -7px; transform: scaleY(-1); }
.ticket::after { bottom: -7px; }
.ticket h4 { margin: 0 0 6px; font: 800 13px/1.2 var(--mono); letter-spacing: 0.18em; text-align: center; }
.ticket .line { display: grid; grid-template-columns: 74px 1fr; gap: 8px; padding: 4px 0; border-top: 1px dashed rgba(42, 26, 48, 0.25); }
.ticket .line b { font-weight: 800; letter-spacing: 0.08em; }
.ticket .clue { font-style: italic; }
.ticket .to { text-align: center; margin-top: 6px; font-weight: 800; letter-spacing: 0.12em; }

/* ——— choices ——— */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.choice { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px 7px; border-radius: 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04); font: 700 10.5px/1.15 var(--display); color: var(--cream);
  text-align: center; min-height: 82px; }
.choice img { width: 46px; height: 46px; }
.choice.on { border-color: var(--pink); background: rgba(255, 110, 199, 0.14); box-shadow: 0 0 16px rgba(255, 110, 199, 0.35); }
.choice.locked { opacity: 0.55; }
.choice .price { position: absolute; top: 4px; right: 5px; font: 800 9.5px/1 var(--mono); color: #5BFFD2; }
.choice .want { position: absolute; top: 3px; left: 5px; font-size: 11px; color: var(--gold); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg .choice { min-height: 0; flex-direction: row; justify-content: center; padding: 10px 4px; font-size: 13px; }
.scroller { overflow-y: auto; max-height: 34vh; padding-right: 2px; }

/* ——— temper controls ——— */
.temper-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; }
.heat { min-height: 76px; border-radius: 20px; border: 0; font: italic 900 20px/1 var(--display); letter-spacing: 0.06em; color: #2A0606;
  background: radial-gradient(120% 120% at 50% 100%, #FFE66B 0%, #FF8A3D 45%, #E0244F 100%); box-shadow: 0 6px 26px rgba(255, 90, 60, 0.4);
  touch-action: none; -webkit-user-select: none; user-select: none; }
.heat.on { transform: scale(0.97); box-shadow: 0 0 40px rgba(255, 140, 60, 0.9), inset 0 0 20px rgba(255, 255, 255, 0.5); }
.heat small { display: block; font: 700 11px/1.2 var(--display); letter-spacing: 0.08em; margin-top: 4px; opacity: 0.8; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 0; padding: 0; list-style: none; }
.steps li { padding: 7px 4px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); text-align: center; font: 800 10.5px/1.15 var(--display);
  letter-spacing: 0.04em; color: var(--dim); border: 1px solid transparent; }
.steps li b { display: block; font-size: 12px; color: var(--cream); }
.steps li.now { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 12px rgba(62, 246, 255, 0.3); }
.steps li.done { background: rgba(91, 255, 210, 0.12); color: #5BFFD2; }
.steps li.done b::after { content: " \2713"; }
.hint { font: 600 13px/1.35 var(--body); color: var(--dim); min-height: 2.7em; text-align: center; margin: 0; }

/* ——— reply tally ——— */
.tally { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font: 600 13.5px/1.3 var(--mono); }
.tally li { display: flex; justify-content: space-between; gap: 10px; opacity: 0; animation: up 0.35s ease forwards; }
.tally li span:last-child { color: #5BFFD2; }
.tally li.total { border-top: 1px dashed var(--line); padding-top: 6px; font-weight: 800; color: var(--gold); }
@keyframes up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ——— toast, sheet ——— */
.toast { position: fixed; z-index: 9; left: 50%; top: calc(var(--safe-t) + 64px); transform: translateX(-50%); max-width: calc(100% - 32px);
  padding: 10px 16px; border-radius: 999px; background: rgba(14, 5, 30, 0.94); border: 1px solid var(--cyan); text-align: center;
  font: 800 13px/1.3 var(--display); box-shadow: 0 0 24px rgba(62, 246, 255, 0.35); }
.toast.show { animation: talkin 0.3s ease; }
.scrim { position: fixed; inset: 0; z-index: 10; background: rgba(4, 1, 12, 0.6); }
.sheet { position: fixed; z-index: 11; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 600px); max-height: min(90vh, 90dvh);
  display: flex; flex-direction: column; background: rgba(16, 6, 34, 0.97); border: 1px solid var(--line); border-bottom: 0; border-radius: 24px 24px 0 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6); animation: sheetin 0.35s cubic-bezier(.2, .8, .2, 1); }
@keyframes sheetin { from { transform: translate(-50%, 40px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px; }
.sheet-head h2 { margin: 0; font: italic 900 22px/1.1 var(--display); letter-spacing: 0.02em;
  background: linear-gradient(180deg, #E9F6FF 0%, #7FB2FF 45%, #FFFFFF 50%, #FF6EC7 62%, #FFE2A8 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sheet-body { overflow-y: auto; padding: 4px 16px calc(var(--safe-b) + 22px); display: flex; flex-direction: column; gap: 12px; -webkit-user-select: text; user-select: text; }
.sheet-body p { margin: 0; line-height: 1.5; }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 16px;
  background: var(--panel-2); border: 1px solid rgba(255, 255, 255, 0.07); }
.item img { width: 52px; height: 52px; }
.item b { display: block; font: italic 800 15px/1.2 var(--display); }
.item span { font-size: 12.5px; color: var(--dim); line-height: 1.35; }
.item.on { border-color: var(--pink); }
.mini { min-height: 36px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06);
  font: 800 12px/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.mini.buy { background: linear-gradient(180deg, #FFE08A, #FF4FA0); color: #1B0626; border: 0; }
.mini.on { background: var(--cyan); color: #04202A; border: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font: 800 11px/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.field input, .field textarea { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: rgba(6, 2, 18, 0.7);
  font-size: 16px; outline: none; resize: none; }
.field input:focus, .field textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(62, 246, 255, 0.15); }
.linkbox { padding: 10px 12px; border-radius: 12px; background: #06021A; border: 1px dashed var(--line); font: 600 12.5px/1.45 var(--mono); overflow-wrap: anywhere; }
.toggle { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 14px; background: var(--panel-2); }
.toggle input { width: 22px; height: 22px; accent-color: var(--pink); }
.box-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.box-cell { padding: 6px; border-radius: 14px; background: var(--panel-2); text-align: center; font: 700 10.5px/1.25 var(--display); color: var(--dim); }
.box-cell img { width: 100%; height: auto; aspect-ratio: 1; }
.fact { padding: 12px 14px; border-radius: 14px; border-left: 3px solid var(--cyan); background: rgba(62, 246, 255, 0.06); font-size: 14px; line-height: 1.45; }

/* ——— title ——— */
.title-card { position: fixed; z-index: 6; left: 50%; bottom: calc(var(--safe-b) + 24px); transform: translateX(-50%); width: min(calc(100% - 32px), 440px);
  display: flex; flex-direction: column; gap: 10px; text-align: center; pointer-events: auto; }
.title-card .tag { margin: 0; font: italic 700 15px/1.4 var(--display); color: var(--dim); text-shadow: 0 2px 12px #000; }

@media (orientation: landscape) and (max-height: 559px) {
  .dock { left: auto; right: 0; top: 0; bottom: 0; width: min(46vw, 400px); transform: translateX(110%); border-radius: 22px 0 0 22px;
    border: 1px solid var(--line); border-right: 0; padding: calc(var(--safe-t) + 58px) calc(env(safe-area-inset-right, 0px) + 14px) calc(var(--safe-b) + 12px) 14px;
    overflow-y: auto; justify-content: center; gap: 8px; }
  .dock.in { transform: translateX(0); }
  .dock::before { left: -1px; right: auto; top: 24px; bottom: 24px; width: 2px; height: auto; background: linear-gradient(180deg, transparent, var(--pink), var(--cyan), transparent); }
  .talk { left: calc(env(safe-area-inset-left, 0px) + 12px); transform: none; width: calc(54vw - 24px); bottom: calc(var(--safe-b) + 10px); animation: talkinL 0.3s ease; }
  @keyframes talkinL { from { opacity: 0; transform: translateY(12px); } }
  .btn { min-height: 44px; font-size: 15px; }
  .heat { min-height: 56px; }
  .talk-text { font-size: 15px; min-height: 0; }
  .talk { padding: 12px 16px 12px; }
  .scroller { max-height: none; }
  .choices { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
  .choice { min-height: 64px; }
  .choice img { width: 34px; height: 34px; }
  .tabs .tab img { width: 22px; height: 22px; }
  .steps li { padding: 4px 2px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ——— the love note ——— */
.notecard { position: relative; margin: 2px 4px 6px; padding: 16px 18px 14px 34px; border-radius: 4px; color: #3A1830; transform: rotate(-1.2deg);
  background: repeating-linear-gradient(#FFF8F0 0 23px, #BFD8FF 23px 24px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.notecard::before { content: ""; position: absolute; left: 22px; top: 0; bottom: 0; width: 2px; background: #FF8FB8; }
.notecard p { margin: 0; }
.note-to, .note-from { font: 800 12px/24px var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: #7A3A6A; }
.note-from { text-align: right; }
.note-text { font: 600 16px/24px "Bradley Hand", "Segoe Print", "Chalkboard SE", "Comic Sans MS", cursive; }
.notecard::after { content: "\2665"; position: absolute; right: 12px; bottom: -14px; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  font-size: 22px; color: #FFE0EA; background: radial-gradient(circle at 35% 35%, #FF5A86, #B0103A); box-shadow: 0 4px 12px rgba(120, 0, 40, 0.5);
  transform: scale(0); transition: transform 0.35s cubic-bezier(.3, 1.6, .5, 1); }
.notecard.sealed::after { transform: scale(1) rotate(-12deg); }
