:root {
  --bg: #020406;
  --neon: #5fb6ff;
  --glow: rgba(61, 155, 255, .9);
  --glow-deep: rgba(27, 95, 217, .75);
  --ink-title: #a8d6ff;
  --ink-label: #8cc8ff;
  --ink-text: #e3f1ff;
  --line: rgba(90, 170, 255, .6);
  --line-dim: rgba(90, 170, 255, .28);
  --grey: #8f99a4;
  --grey-hi: #d4dbe2;

  --labw: clamp(92px, 10.8vw, 176px);
  --rowh: clamp(56px, 9.6svh, 108px);

  --mincho: "Zen Old Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --sans: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  --ui: system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; background: var(--bg); color: var(--ink-text); }

body {
  font-family: var(--sans);
  min-height: 100svh;
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; }

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---------- stage ---------- */

.stage {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-block: clamp(40px, 8svh, 110px) clamp(48px, 9svh, 110px);
  padding-inline: clamp(16px, 7.5vw, 180px);
}

.title {
  margin: 0 0 clamp(8px, 1.6svh, 26px);
  padding: .3em .7em;
  font-family: var(--mincho);
  font-weight: 900;
  font-size: clamp(28px, 3.4vw, 64px);
  letter-spacing: .04em;
  line-height: 1.2;
  color: var(--ink-title);
  text-align: center;
  text-shadow:
    0 0 1px rgba(230, 244, 255, .9),
    0 0 8px var(--glow),
    0 0 22px var(--glow-deep),
    0 0 48px rgba(27, 95, 217, .45);
  -webkit-mask-image: repeating-linear-gradient(to bottom, #000 0 2px, rgba(0, 0, 0, .7) 2px 3px);
  mask-image: repeating-linear-gradient(to bottom, #000 0 2px, rgba(0, 0, 0, .7) 2px 3px);
  animation: flicker 7s infinite;
}

.meta {
  min-height: 1.4em;
  margin: calc(-1 * clamp(4px, 1svh, 16px)) 0 clamp(10px, 1.8svh, 24px);
  font: 500 12px/1.4 var(--mono);
  letter-spacing: .16em;
  color: #7f95ab;
  text-shadow: 0 0 6px rgba(61, 155, 255, .35);
  text-align: center;
}

/* ---------- frame ---------- */

.frame {
  position: relative;
  width: min(100%, 1640px);
  padding-block: clamp(12px, 1.6vw, 30px) clamp(4px, .6vw, 10px);
  padding-inline: clamp(10px, 2.6vw, 46px);
  border: 2px solid var(--neon);
  border-radius: clamp(14px, 1.4vw, 26px);
  background: radial-gradient(120% 140% at 50% 50%, rgba(8, 20, 40, .45), rgba(0, 0, 0, .9) 70%);
  box-shadow:
    0 0 0 1px rgba(95, 182, 255, .22),
    0 0 14px rgba(61, 155, 255, .6),
    0 0 42px rgba(27, 95, 217, .32),
    inset 0 0 16px rgba(61, 155, 255, .35),
    inset 0 0 70px rgba(27, 95, 217, .12);
}

.sheet { position: relative; border-left: 1px solid var(--line-dim); }

/* label-column divider; runs through the tool bar like the original screen */
.sheet::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--labw);
  width: 1px;
  background: var(--line);
  box-shadow: 0 0 6px rgba(61, 155, 255, .55);
  pointer-events: none;
}

.rows { position: relative; border-right: 1px solid var(--line-dim); }

.rows::after,
.row::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 7px;
  pointer-events: none;
  background:
    linear-gradient(var(--line) 0 0) 0 0 / 100% 1px no-repeat,
    linear-gradient(var(--line-dim) 0 0) 0 6px / 100% 1px no-repeat;
  filter: drop-shadow(0 0 3px rgba(61, 155, 255, .6));
}

.rows::after { bottom: -7px; }

.row {
  position: relative;
  display: grid;
  grid-template-columns: var(--labw) minmax(0, 1fr);
  min-height: var(--rowh);
}

.row::before { top: 0; }

.lab {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  font-family: var(--mincho);
  font-weight: 700;
  font-size: clamp(14px, 1.5vw, 28px);
  line-height: 1.25;
  text-align: center;
  color: var(--ink-label);
  text-shadow: 0 0 6px rgba(61, 155, 255, .85), 0 0 16px rgba(27, 95, 217, .6);
}

.cell {
  display: flex;
  align-items: center;
  padding: 14px clamp(12px, 1.6vw, 30px) 10px;
  transition: background .25s;
}

.row:focus-within .cell,
.row.on .cell {
  background: linear-gradient(90deg, rgba(61, 155, 255, .09), transparent 75%);
}

/* ---------- typed text ---------- */

.field { position: relative; width: 100%; }

.field textarea,
.ink {
  display: block;
  width: 100%;
  min-height: 1.75em;
  margin: 0;
  padding: 0;
  font: 500 clamp(15px, 1.15vw, 20px) / 1.75 var(--sans);
  letter-spacing: .02em;
  font-kerning: none;
  font-variant-ligatures: none;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  line-break: auto;
}

.field textarea {
  position: relative;
  z-index: 1;
  border: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: transparent;
  caret-color: #9fd6ff;
}

.field textarea::placeholder { color: transparent; }
.field textarea:focus::placeholder { color: rgba(140, 190, 240, .3); }
.field textarea::selection { background: rgba(61, 155, 255, .32); color: transparent; }

.ink {
  color: var(--ink-text);
  text-shadow: 0 0 8px rgba(61, 155, 255, .45);
}

.field .ink { position: absolute; inset: 0; pointer-events: none; }

/* keeps a trailing newline as tall as the textarea's */
.ink::after { content: "\200b"; }

.ink .n { animation: type-in .6s cubic-bezier(.2, .7, .2, 1) both; }

.caret {
  display: inline-block;
  width: .5em;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -.14em;
  background: #9fd6ff;
  box-shadow: 0 0 10px var(--glow);
  animation: blink .9s steps(1) infinite;
}

/* ---------- list ---------- */

a.row { color: inherit; text-decoration: none; }

[data-view="list"] .row { min-height: clamp(62px, 8.4svh, 92px); }

.item { animation: rise .5s ease-out both; }

.item .lab { flex-direction: column; gap: 5px; }
.item .no { font-size: clamp(14px, 1.2vw, 22px); }
.item .date {
  font: 400 11px/1.2 var(--mono);
  letter-spacing: .04em;
  color: #6f88a0;
  text-shadow: none;
}

.sum { width: 100%; min-width: 0; }

.sum-main,
.sum-sub {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sum-main {
  font: 500 clamp(15px, 1.1vw, 19px) / 1.6 var(--sans);
  text-shadow: 0 0 8px rgba(61, 155, 255, .45);
}

.sum-sub { margin-top: 2px; font-size: 13px; color: #7890a6; }
.sum-sub b { font-weight: 400; color: #5d7690; margin-right: .6em; }

.item:active .cell,
.item:focus-visible .cell {
  background: linear-gradient(90deg, rgba(61, 155, 255, .16), transparent 80%);
}

@media (hover: hover) {
  .item:hover .cell { background: linear-gradient(90deg, rgba(61, 155, 255, .16), transparent 80%); }
  .item:hover .lab { color: #d2ebff; }
}

.item:focus-visible { outline: none; }

.item.sample .date { letter-spacing: .24em; }

/* ---------- bottom bar ---------- */

.bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-block: clamp(12px, 1.2vw, 20px) 2px;
}

.bar-l, .bar-r { display: flex; align-items: center; gap: clamp(2px, .5vw, 10px); }
.bar-r { margin-right: clamp(-18px, -1vw, -4px); }

.tb {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  padding: .35em .45em;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--grey);
  font: 400 clamp(15px, 1.3vw, 24px) / 1 var(--ui);
  cursor: pointer;
  transition: color .15s, background .15s;
}

.tb:hover,
.tb[aria-expanded="true"] { color: var(--grey-hi); background: rgba(255, 255, 255, .05); }

.tb svg {
  width: 1.05em;
  height: 1.05em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.tb .chev { width: .8em; height: .8em; stroke-width: 2; }
.ib svg { width: 1.2em; height: 1.2em; }

#btn-mic.on {
  color: #bfe3ff;
  background: rgba(61, 155, 255, .14);
  box-shadow: 0 0 0 1px rgba(95, 182, 255, .5), 0 0 14px var(--glow);
  animation: pulse 1.2s ease-in-out infinite;
}

.send {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(36px, 2.7vw, 48px);
  aspect-ratio: 1;
  margin-left: 6px;
  padding: 0;
  border: 1px solid rgba(95, 182, 255, .55);
  border-radius: 50%;
  background: rgba(2, 8, 16, .85);
  color: #a9d4f5;
  box-shadow: 0 0 8px rgba(61, 155, 255, .22), inset 0 0 8px rgba(61, 155, 255, .12);
  cursor: pointer;
  transition: border-color .4s, box-shadow .4s, color .4s, transform .1s;
}

/* a faint second ring, echoing the table's double rules */
.send::before {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(95, 182, 255, .18);
  border-radius: 50%;
  pointer-events: none;
}

.send svg {
  width: 58%;
  height: 58%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.send .facet { fill: currentColor; fill-opacity: .16; stroke: none; }

@media (hover: hover) {
  .send:hover {
    border-color: rgba(143, 208, 255, .85);
    color: #d6ecff;
    box-shadow: 0 0 14px rgba(61, 155, 255, .4), inset 0 0 10px rgba(61, 155, 255, .2);
  }
}
.send:active { transform: scale(.96); }

body:not([data-view="compose"]) #btn-mic,
body:not([data-view="compose"]) #btn-send,
body:not([data-view="view"]) #btn-share,
body:not([data-view="compose"]) [data-only="compose"],
body:not([data-view="view"]) [data-only="view"] { display: none; }

:focus-visible { outline: 2px solid var(--neon); outline-offset: 2px; }

/* ---------- menus ---------- */

.menu-wrap { position: relative; }

.menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 20;
  min-width: 200px;
  padding: 6px;
  background: rgba(3, 9, 18, .95);
  border: 1px solid rgba(95, 182, 255, .55);
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(61, 155, 255, .35), inset 0 0 12px rgba(61, 155, 255, .12);
  backdrop-filter: blur(6px);
}

.menu.right { left: auto; right: 0; }

.menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: #cfe6ff;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.menu button:hover { background: rgba(61, 155, 255, .15); }

.menu [aria-checked]::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid rgba(143, 208, 255, .5);
}

.menu [aria-checked="true"]::before { background: #8fd0ff; border-color: #8fd0ff; box-shadow: 0 0 6px var(--glow); }

/* ---------- share dialog ---------- */

.dlg {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100svh - 24px);
  padding: 0;
  border: 2px solid var(--neon);
  border-radius: 18px;
  background: rgba(2, 6, 12, .97);
  color: var(--ink-text);
  box-shadow: 0 0 18px rgba(61, 155, 255, .6), inset 0 0 18px rgba(61, 155, 255, .25);
}

.dlg::backdrop { background: rgba(0, 3, 8, .72); backdrop-filter: blur(2px); }

.dlg-body { display: grid; gap: 14px; padding: clamp(16px, 4vw, 26px); }

.dlg-title {
  margin: 0;
  font-family: var(--mincho);
  font-weight: 900;
  font-size: 24px;
  color: var(--ink-title);
  text-shadow: 0 0 8px var(--glow), 0 0 20px var(--glow-deep);
}

.dlg-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.dlg-link {
  padding: 4px 0;
  border: 0;
  background: none;
  color: #7f95ab;
  font-size: 12px;
  letter-spacing: .08em;
  text-decoration: underline;
  text-decoration-color: rgba(127, 149, 171, .4);
  text-underline-offset: 3px;
  cursor: pointer;
}

.share-main,
.intro { display: grid; gap: 14px; }

.dlg[data-pane="intro"] .dlg-link,
.dlg[data-pane="intro"] .share-main,
.dlg:not([data-pane="intro"]) .intro { display: none; }

/* ---------- posting intro ---------- */

.intro-lead { margin: 0; font-size: 13px; line-height: 1.8; color: #a9bccd; }

.steps { position: relative; margin: 0 0 7px; padding: 0; list-style: none; }

.steps::after,
.step::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 7px;
  pointer-events: none;
  background:
    linear-gradient(var(--line) 0 0) 0 0 / 100% 1px no-repeat,
    linear-gradient(var(--line-dim) 0 0) 0 6px / 100% 1px no-repeat;
}

.steps::after { bottom: -7px; }

.step {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  animation: rise .6s ease-out both;
}

.step::before { top: 0; }

.step-no {
  display: grid;
  place-items: center;
  padding-top: 6px;
  border-right: 1px solid var(--line-dim);
  font-family: var(--mincho);
  font-weight: 700;
  font-size: 22px;
  color: var(--ink-label);
  text-shadow: 0 0 6px rgba(61, 155, 255, .7), 0 0 14px rgba(27, 95, 217, .5);
}

.step-text { display: grid; gap: 3px; padding: 16px 14px 12px; }
.step-text b { font-size: 15px; font-weight: 500; color: var(--ink-text); }
.step-text span { font-size: 12px; line-height: 1.7; color: #8aa0b5; }

.share-preview {
  display: grid;
  place-items: center;
  min-height: 160px;
  max-height: 42svh;
  overflow: auto;
  border: 1px solid var(--line-dim);
  border-radius: 10px;
  background: #000;
}

.share-preview img { display: block; width: 100%; height: auto; }
.share-preview img:not([src]) { display: none; }
.dlg.loading .share-preview::after { content: "画像を生成中…"; font-size: 13px; letter-spacing: .1em; color: var(--grey); }

.link-row { display: flex; gap: 8px; }

.link-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line-dim);
  border-radius: 10px;
  background: rgba(0, 0, 0, .5);
  color: #cfe6ff;
  font: 12px/1.4 var(--mono);
}

.share-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.share-actions .primary,
.share-actions .ghost { grid-column: 1 / -1; }

.dlg-note { margin: 0; font-size: 12px; line-height: 1.7; color: #8aa0b5; white-space: pre-line; }

.btn {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid rgba(95, 182, 255, .6);
  border-radius: 10px;
  background: rgba(61, 155, 255, .1);
  color: #d7ecff;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}

.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { border-color: var(--neon); background: rgba(61, 155, 255, .3); color: #fff; box-shadow: 0 0 12px rgba(61, 155, 255, .35); }
.btn.ghost { border-color: var(--line-dim); background: none; color: var(--grey); }

@media (hover: hover) {
  .btn:not(:disabled):hover { background: rgba(61, 155, 255, .22); box-shadow: 0 0 12px rgba(61, 155, 255, .45); }
}

/* ---------- overlay / toast / footer ---------- */

.ov {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(0, 4, 10, .66);
  backdrop-filter: blur(3px);
}

.ov-box { display: grid; justify-items: center; gap: 10px; padding-inline: 16px; }

.ov-ring {
  width: 92px;
  height: 92px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(143, 208, 255, .85) 0 2deg, transparent 2deg 9deg);
  -webkit-mask: radial-gradient(circle, transparent 38px, #000 39px 46px, transparent 47px);
  mask: radial-gradient(circle, transparent 38px, #000 39px 46px, transparent 47px);
  filter: drop-shadow(0 0 6px var(--glow));
  animation: spin 3s linear infinite;
}

.ov-en { padding-left: .4em; font: 500 13px/1 var(--ui); letter-spacing: .4em; color: var(--grey); }

.ov-ja {
  font-family: var(--mincho);
  font-weight: 900;
  font-size: clamp(22px, 3vw, 34px);
  color: var(--ink-title);
  text-shadow: 0 0 8px var(--glow), 0 0 22px var(--glow-deep);
}

.ov-bar { width: min(320px, 70vw); height: 2px; margin-top: 8px; background: var(--line-dim); overflow: hidden; }
.ov-bar i { display: block; width: 0; height: 100%; background: var(--neon); box-shadow: 0 0 8px var(--glow); }
.ov:not([hidden]) .ov-bar i { animation: fill 1.4s cubic-bezier(.6, .1, .3, 1) forwards; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border: 1px solid rgba(95, 182, 255, .55);
  border-radius: 999px;
  background: rgba(3, 9, 18, .92);
  color: #cfe6ff;
  font-size: 13px;
  box-shadow: 0 0 14px rgba(61, 155, 255, .35);
  opacity: 0;
  translate: -50% 10px;
  pointer-events: none;
  transition: opacity .2s, translate .2s;
}

.toast.on { opacity: 1; translate: -50% 0; }

/* crawlable intro below the terminal, kept quiet */
.about {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding-inline: 16px;
  padding-block: 8px 44px;
  font-size: 13px;
  line-height: 1.9;
  color: #8ea3b7;
}

.about h2 {
  margin: 36px 0 10px;
  font-family: var(--mincho);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .06em;
  color: var(--ink-label);
  text-shadow: 0 0 6px rgba(61, 155, 255, .5);
}

.about h2:first-child { margin-top: 0; }
.about p { margin: 0; }
.about ol { margin: 0; padding-left: 1.4em; }
.about dl { margin: 0; }
.about dt { margin-top: 12px; color: #c2d8ea; }
.about dd { margin: 2px 0 0; }

.foot {
  position: relative;
  z-index: 1;
  padding-inline: 16px;
  padding-block: 0 24px;
  text-align: center;
  font-size: 11px;
  line-height: 1.8;
  color: #4d5864;
}

.foot p { margin: 0; }
.foot a { color: #7f95ab; text-underline-offset: 3px; }

@keyframes type-in {
  0% { opacity: 0; filter: blur(5px); color: #fff; text-shadow: 0 0 14px #bfe3ff, 0 0 28px var(--glow); }
  35% { opacity: 1; filter: blur(0); color: #fff; text-shadow: 0 0 10px #bfe3ff, 0 0 20px var(--glow); }
  100% { opacity: 1; filter: blur(0); }
}
@keyframes rise { from { opacity: 0; translate: 0 6px; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes spin { to { rotate: 360deg; } }@keyframes fill { to { width: 100%; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 1px rgba(95, 182, 255, .3), 0 0 4px var(--glow); } }
@keyframes flicker {
  0%, 91%, 93%, 100% { opacity: 1; }
  92% { opacity: .82; }
  92.5% { opacity: .95; }
}

/* ---------- phone ---------- */

@media (max-width: 640px) {
  :root { --labw: 44px; --rowh: 92px; }

  .stage {
    justify-content: flex-start;
    padding-block: calc(18px + env(safe-area-inset-top)) 16px;
    padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
  }

  .title { margin-bottom: 6px; font-size: 25px; }
  .meta { margin: 0 0 12px; font-size: 11px; letter-spacing: .12em; }

  .frame {
    display: flex;
    flex-direction: column;
    padding-block: 10px 0;
    padding-inline: 8px;
    border-radius: 16px;
  }

  /* the table fills the screen while writing / reading */
  [data-view="compose"] .frame,
  [data-view="view"] .frame { flex: 1 0 auto; }
  .sheet, .rows { flex: 1 0 auto; display: flex; flex-direction: column; }
  [data-view="compose"] .row,
  [data-view="view"] .row { flex: 1 0 auto; }

  /* vertical labels keep the two-column table but give the text the width */
  .lab {
    padding: 12px 0;
    font-size: 15px;
    letter-spacing: .14em;
    writing-mode: vertical-rl;
  }

  .cell { padding: 14px 12px 12px; }
  .field textarea, .ink { font-size: 16px; line-height: 1.8; }

  /* list: single-column cards */
  [data-view="list"] .sheet::before { display: none; }
  [data-view="list"] .row { min-height: 0; }
  .item { grid-template-columns: minmax(0, 1fr); }
  .item .lab {
    flex-direction: row;
    justify-content: flex-start;
    align-items: baseline;
    gap: 10px;
    padding: 16px 12px 0;
    letter-spacing: 0;
    writing-mode: horizontal-tb;
  }
  .item .no { font-size: 15px; }
  .item .cell { padding: 6px 12px 16px; }
  .sum-main {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
    font-size: 15px;
    line-height: 1.65;
  }
  .sum-sub { font-size: 12px; }

  /* tool bar stays reachable while scrolling */
  .bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin-inline: -8px;
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    border-radius: 0 0 14px 14px;
    background: linear-gradient(to top, rgba(2, 6, 12, .97) 75%, rgba(2, 6, 12, 0));
  }
  .bar-l, .bar-r { gap: 2px; }
  .bar-r { margin-right: 0; }
  .tb { min-width: 44px; min-height: 44px; justify-content: center; font-size: 15px; }
  .send { width: 44px; margin-left: 2px; }

  /* menus open as a sheet anchored to the (sticky) bar, whatever its position */
  .menu-wrap { position: static; }
  .menu,
  .menu.right {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: calc(100% + 4px);
    min-width: 0;
    padding: 8px;
    border-radius: 16px;
  }
  .menu button { padding: 14px 16px; font-size: 16px; }

  /* Tool and Mode offer the same screens, so phones get a single Tool menu */
  .mode-wrap { display: none; }
  .menu [data-mode]::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1px solid rgba(143, 208, 255, .5);
  }
  .menu [aria-current="page"] { color: #fff; background: rgba(61, 155, 255, .12); }
  .menu [aria-current="page"]::before { background: #8fd0ff; border-color: #8fd0ff; box-shadow: 0 0 6px var(--glow); }

  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .foot { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
