@font-face {
  font-family: "DotGothic16";
  src: url("font/DotGothic16-latin.woff2") format("woff2");
  font-display: block;
}

:root {
  --ink: #0d0a2b;
  --deep: #17124a;
  --panel: #221a66;
  --line: #5446c4;
  --cream: #f4ecd8;
  --dim: #b9b0e6;
  --pink: #ff3d9a;
  --pink-ink: #2e021a;
  --pink-deep: #9c0f55;
  --yellow: #ffd93b;
  --yellow-ink: #3a2c00;
  --cyan: #49e0e8;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s6: 24px; --s8: 32px;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: #06051a;
  color: var(--cream);
  font: 400 16px/1.4 "DotGothic16", ui-monospace, monospace;
  -webkit-font-smoothing: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  caret-color: var(--pink);
}
::selection { background: var(--pink); color: var(--pink-ink); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
[hidden] { display: none !important; }

#tv {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  max-height: 932px;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  overflow: hidden;
  animation: power 520ms steps(8) both;
}
@media (min-width: 480px) {
  #tv { height: min(100dvh - 48px, 932px); border-radius: 28px; box-shadow: 0 0 0 12px #1b1838, 0 0 0 14px #2c2857, 0 24px 28px -8px rgb(0 0 0 / .16); }
}
@keyframes power {
  0% { clip-path: inset(49.5% 0); filter: brightness(4); }
  40% { clip-path: inset(49.5% 0); filter: brightness(4); }
  100% { clip-path: inset(0); filter: brightness(1); }
}

/* top bar */
.bar {
  display: flex; align-items: center; gap: var(--s3);
  height: 48px; padding: 0 var(--s4);
  background:
    repeating-conic-gradient(var(--deep) 0 25%, var(--panel) 0 50%) 0 0 / 4px 4px;
  border-bottom: 2px solid var(--line);
  flex: none;
}
.logo { font-size: 24px; font-weight: 400; line-height: .95; color: var(--yellow); letter-spacing: .04em; }
.today { margin-left: auto; font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.ico { width: 44px; height: 44px; margin-right: -12px; display: grid; place-items: center; color: var(--cream); }
.ico[aria-pressed="false"] { color: var(--dim); }
svg.px { display: block; shape-rendering: crispEdges; fill: currentColor; }

/* scene */
.scene { position: relative; flex: none; aspect-ratio: 4 / 3; background: var(--deep); overflow: hidden; border-bottom: 2px solid var(--cream); }
.scene img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.scene.dance img { animation: hop 300ms steps(2) infinite; }
@keyframes hop { 0% { transform: translateY(0); } 50% { transform: translateY(-4px); } 100% { transform: translateY(0); } }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.scene.flashing .flash { animation: flash 360ms steps(1) both; }
@keyframes flash { 0% { opacity: .9; } 25% { opacity: 0; } 50% { opacity: .6; } 75%, 100% { opacity: 0; } }
.yatta {
  position: absolute; left: 0; right: 0; bottom: var(--s4);
  text-align: center; font-size: 48px; line-height: .95; letter-spacing: .04em;
  color: var(--yellow); text-shadow: 4px 4px 0 var(--pink-deep), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink);
  opacity: 0; pointer-events: none;
}
.scene.dance .yatta { opacity: 1; animation: slam 240ms steps(3) both, blink 300ms steps(1) 240ms infinite; }
@keyframes slam { 0% { transform: scale(3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes blink { 0% { color: var(--yellow); } 50% { color: var(--cream); } }
.stars { position: absolute; inset: 0; pointer-events: none; }
.stars i { position: absolute; top: -8px; width: 8px; height: 8px; animation: fall var(--d, 1200ms) steps(12) both; }
@keyframes fall { to { transform: translateY(340px); } }

/* dialogue box */
.talk {
  position: relative; flex: none;
  margin: var(--s4) var(--s4) 0; padding: var(--s4) var(--s4) var(--s3);
  min-height: 80px;
  background: var(--deep); border: 2px solid var(--cream); box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 4px var(--line);
}
.plate {
  position: absolute; top: -12px; left: var(--s3);
  padding: 0 var(--s2); height: 20px; line-height: 20px; font-size: 12px; letter-spacing: .08em;
  background: var(--pink); color: var(--pink-ink);
}
#line { min-height: 44px; overflow-wrap: anywhere; }
.talk.hearing #line { color: var(--cyan); }
.more { position: absolute; right: var(--s3); bottom: var(--s2); width: 8px; height: 8px; background: var(--yellow); clip-path: polygon(0 0, 100% 0, 50% 100%); animation: bob 800ms steps(2) infinite; }
@keyframes bob { 50% { transform: translateY(2px); } }

/* panes */
.pane { flex: 1; min-height: 0; overflow-y: auto; padding: var(--s2) var(--s4) var(--s4); scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.list { list-style: none; }
.list li { display: grid; grid-template-columns: 44px 1fr auto 44px; align-items: center; min-height: 48px; border-bottom: 2px dotted var(--line); }
.box { width: 44px; height: 44px; margin-left: -10px; display: grid; place-items: center; }
.box span { width: 24px; height: 24px; display: grid; place-items: center; border: 2px solid var(--cream); background: var(--ink); color: transparent; }
.box:hover span { border-color: var(--yellow); }
.done .box span { background: var(--yellow); border-color: var(--yellow); color: var(--yellow-ink); }
.title { padding: var(--s2) var(--s2) var(--s2) 0; overflow-wrap: anywhere; }
.done .title { color: var(--dim); text-decoration: line-through; text-decoration-thickness: 2px; }
.due { font-size: 12px; color: var(--cyan); font-variant-numeric: tabular-nums; white-space: nowrap; display: flex; align-items: center; gap: var(--s1); }
.due.late { color: var(--pink); }
.del { width: 44px; height: 44px; margin-right: -14px; display: grid; place-items: center; color: var(--line); }
.del:hover { color: var(--cream); }
.group { margin: var(--s6) 0 var(--s2); font-size: 12px; font-weight: 400; line-height: .98; letter-spacing: .08em; color: var(--dim); }

.empty { padding: var(--s8) 0 var(--s4); text-align: center; }
.empty h2 { font-size: 24px; font-weight: 400; line-height: .95; }
.empty p { margin: var(--s2) 0 var(--s4); color: var(--dim); }

.btn {
  height: 40px; padding: var(--s2) var(--s4); line-height: 1.4;
  background: var(--pink); color: var(--pink-ink);
  box-shadow: inset -2px -2px 0 var(--pink-deep), inset 2px 2px 0 #ff8cc4;
}
.btn:hover { background: #ff5caa; }
.btn:active { box-shadow: inset 2px 2px 0 var(--pink-deep); transform: translateY(1px); }
.btn.small { height: 32px; padding: var(--s1) var(--s3); font-size: 12px; line-height: 24px; }

/* stats */
.nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); margin-top: var(--s2); }
.nums div { display: flex; flex-direction: column-reverse; gap: var(--s3); padding: var(--s3) var(--s3); border: 2px solid var(--line); background: var(--deep); }
.nums dt { font-size: 12px; line-height: 1; color: var(--dim); }
.nums dd { font-size: 32px; line-height: .95; color: var(--yellow); font-variant-numeric: tabular-nums; }
.chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s2); align-items: end; height: 136px; padding: var(--s3) var(--s3) var(--s2); border: 2px solid var(--line); background: var(--deep); }
.chart div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: var(--s1); height: 100%; font-size: 12px; line-height: 1; color: var(--dim); font-variant-numeric: tabular-nums; }
.chart b { font-weight: 400; color: var(--cream); }
.chart i { width: 100%; min-height: 2px; background: repeating-linear-gradient(to top, var(--line) 0 6px, transparent 6px 8px); }
.chart .now i { background: repeating-linear-gradient(to top, var(--yellow) 0 6px, transparent 6px 8px); }
.chart .now span { color: var(--yellow); }
.row.set { display: flex; align-items: center; justify-content: space-between; min-height: 48px; border-bottom: 2px dotted var(--line); }

/* type a task */
.type { flex: none; padding: var(--s3) var(--s4); background: var(--deep); border-top: 2px solid var(--line); }
.type label { display: block; margin-bottom: var(--s2); font-size: 12px; line-height: 1; letter-spacing: .08em; color: var(--dim); }
.typeRow { display: flex; gap: var(--s2); }
.type input { flex: 1; min-width: 0; height: 40px; padding: var(--s2) var(--s3); background: var(--ink); border: 2px solid var(--cream); border-radius: 0; }
.type input::placeholder { color: #8f86c9; }
.type input:focus { outline: 2px solid var(--yellow); outline-offset: 0; }

/* dock */
.dock {
  flex: none; display: grid; grid-template-columns: 1fr 1fr 80px 1fr 1fr; align-items: center; justify-items: center;
  height: calc(88px + env(safe-area-inset-bottom)); padding: 0 var(--s2) env(safe-area-inset-bottom);
  background: repeating-conic-gradient(var(--deep) 0 25%, var(--panel) 0 50%) 0 0 / 4px 4px;
  border-top: 2px solid var(--line);
}
.tab, .count { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s1); width: 100%; height: 56px; font-size: 12px; line-height: 1; color: var(--dim); }
.tab[aria-pressed="true"] { color: var(--cream); }
.tab[aria-pressed="true"] span { box-shadow: 0 4px 0 -2px var(--yellow); padding-bottom: 2px; }
.tab:hover { color: var(--cream); }
.count b { font-weight: 400; font-size: 24px; line-height: 16px; height: 16px; color: var(--cream); font-variant-numeric: tabular-nums; }
.mic {
  width: 72px; height: 72px; margin-top: -24px; display: grid; place-items: center;
  background: var(--pink); color: #fff; border: 2px solid var(--cream);
  box-shadow: inset -4px -4px 0 var(--pink-deep), inset 4px 4px 0 #ff8cc4, 0 0 0 2px var(--ink);
}
.mic:hover { background: #ff5caa; }
.mic:active { box-shadow: inset 4px 4px 0 var(--pink-deep), 0 0 0 2px var(--ink); transform: translateY(2px); }
.mic.on { background: var(--cyan); color: var(--ink); box-shadow: inset -4px -4px 0 #1f97a0, inset 4px 4px 0 #b5f6f9, 0 0 0 2px var(--ink); animation: listen 600ms steps(2) infinite; }
@keyframes listen { 50% { box-shadow: inset -4px -4px 0 #1f97a0, inset 4px 4px 0 #b5f6f9, 0 0 0 2px var(--ink), 0 0 0 6px var(--cyan); } }

/* the tube */
.crt { position: absolute; inset: 0; pointer-events: none; z-index: 9;
  background:
    repeating-linear-gradient(to bottom, rgb(0 0 0 / 0) 0 2px, rgb(4 2 24 / .26) 2px 3px),
    radial-gradient(120% 90% at 50% 50%, rgb(0 0 0 / 0) 62%, rgb(4 2 24 / .5) 100%);
  animation: hum 4s steps(3) infinite;
}
@keyframes hum { 0%, 100% { opacity: 1; } 50% { opacity: .9; } }

@media (prefers-reduced-motion: reduce) {
  #tv, .crt, .more, .mic.on, .scene.dance img, .scene.dance .yatta, .scene.flashing .flash { animation: none; }
  .stars { display: none; }
}
