/* 2026-10-01 23:24  valmonty.uk hub styles */

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains_mono_variable.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}
/* Symbol glyphs JetBrains Mono lacks: DejaVu Sans covers all but one, Unifont covers U+0FD6. */
@font-face {
  font-family: "Valmonty Symbols";
  src: url("/fonts/dejavu_sans_symbols.woff2") format("woff2");
  unicode-range: U+21B3, U+21BA, U+21BB, U+1403, U+2153, U+2154, U+207F, U+2640, U+2642, U+2300, U+2661, U+2105;
  font-display: swap;
}
@font-face {
  font-family: "Valmonty Symbols";
  src: url("/fonts/unifont_symbols.woff2") format("woff2");
  unicode-range: U+0FD6;
  font-display: swap;
}

:root {
  --bg: #1c1d20;
  --panel: #232428;
  --ink: #f7fbff;
  --muted: #c9cdd3;
  --faint: #4b4e55;
  --rule: #2e3035;
  --control: #3a3c42;
  --danger: #ff7a6e;
  --glow: 0 0 3px rgba(255, 255, 255, 0.7), 0 0 12px rgba(225, 238, 255, 0.45), 0 0 28px rgba(200, 225, 255, 0.25);
  --glow_soft: 0 0 6px rgba(255, 255, 255, 0.28);
  --font: "JetBrains Mono", "Valmonty Symbols", ui-monospace, Menlo, Consolas, monospace;
  --logo_w: 9.5rem;
  --row_pad: clamp(0.6rem, 2vh, 1.1rem);
  --gutter: clamp(1.25rem, 4vw, 3rem);
  color-scheme: dark;
  box-sizing: border-box;
}
*, *::before, *::after { box-sizing: inherit; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  text-shadow: var(--glow_soft);
  font-family: var(--font);
  font-weight: 300;
  text-transform: lowercase;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; text-transform: inherit; text-shadow: inherit; }
/* Interface text is lower case. Anything you type, dictate or copy shows its real case, so what you see
   is exactly what gets copied. */
input, textarea, .pinyin { text-transform: none; }
b { font-weight: 700; }
[hidden] { display: none !important; }

/* ---------- page layout ---------- */

.layout {
  max-width: 110rem;
  margin: 0 auto;
  min-height: 100%;
  display: grid;
  /* Left column takes --left_pct of the width (default 38%); app.js changes it when the divider is dragged. */
  grid-template-columns: minmax(0, var(--left_pct, 38%)) 2.5rem minmax(0, 1fr);
  padding: 0 var(--gutter);
}
.divider {
  position: relative;
  cursor: col-resize;
  touch-action: none;
}
.divider::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(50% - 0.5px);
  width: 1px;
  background: var(--rule);
  transition: background 0.15s, box-shadow 0.15s;
}
.divider:hover::before, .divider.dragging::before, .divider:focus-visible::before { background: var(--muted); box-shadow: var(--glow_soft); }
.divider:focus-visible { outline: none; }
.page {
  padding-top: calc(env(safe-area-inset-top, 0px) + clamp(1.25rem, 4vw, 3rem));
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(1.25rem, 4vw, 3rem));
  min-width: 0;
}
.page_projects { display: flex; flex-direction: column; }
.page_pad { display: none; }
.pager { display: none; }

/* Swipe pages below 600 px (phone, Fold7 folded). Must match NARROW in app.js. */
@media (max-width: 599px) {
  .layout {
    display: flex;
    height: 100%;
    max-width: none;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .layout::-webkit-scrollbar { display: none; }
  .divider { display: none; }
  .page {
    flex: 0 0 100%;
    height: 100%;
    overflow-y: auto;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 3.5rem);
  }
  .pager {
    display: flex;
    gap: 0.75rem;
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    background: rgba(28, 29, 32, 0.85);
  }
  .pager_dot {
    width: 0.6rem; height: 0.6rem; padding: 0;
    border-radius: 50%;
    border: 1px solid var(--muted);
    background: transparent;
    cursor: pointer;
  }
  .pager_dot[aria-current="true"] { background: var(--ink); border-color: var(--ink); box-shadow: var(--glow); }
  .page_pad { display: flex; flex-direction: column; }
  .pad_tab, .pad_drawer, .pad_backdrop { display: none !important; }
}

/* ---------- projects column ---------- */

.site {
  display: flex;
  align-items: center;
  min-height: 2rem;
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0 0 clamp(0.5rem, 4vh, 2.5rem);
}
.projects { list-style: none; margin: 0; padding: 0; flex: 1; container-type: inline-size; }
.project + .project { border-top: 1px solid var(--rule); }
.row {
  position: relative;
  display: grid;
  grid-template-columns: var(--logo_w) minmax(0, 1fr);
  align-items: center;
  column-gap: 1.5rem;
  padding: var(--row_pad) 0 var(--row_pad) 1.1rem;
  color: inherit;
  text-decoration: none;
  border-radius: 2px;
}
.row::before {
  content: "";
  position: absolute;
  left: 0; top: 18%; bottom: 18%;
  width: 4px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform 160ms ease-out;
}
a.row:hover::before, a.row:focus-visible::before { transform: scaleY(1); }
a.row:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
/* Logos are squares as tall as the rows. app.js sets --logo_w on the list to the tallest row's text height. */
.logo_cell { position: relative; width: var(--logo_w); height: var(--logo_w); }
.logo_cell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 16%; }
.text {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 1.5rem;
  align-items: baseline;
}
.name {
  grid-column: 1;
  font-size: clamp(1rem, calc((100cqi - var(--logo_w) - 17.6rem) / 11.6), 4rem);
  text-shadow: var(--glow);
  font-weight: 100;
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
}
.about {
  grid-column: 1;
  margin: 0.45rem 0 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 44ch;
}
.meta {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  text-align: right;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--muted);
}
.host { display: block; color: var(--ink); }
.state { display: inline-flex; align-items: center; gap: 0.45rem; }
.dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; border: 2px solid var(--faint); background: transparent; }
.state[data-state="online"] .dot { background: var(--accent); border-color: var(--accent); }
.state[data-state="error"] .dot { border-color: var(--danger); }
.state[data-state="offline"] .dot { border-color: var(--muted); }
.key {
  display: inline-block;
  min-width: 1.6em;
  padding: 0.05em 0.35em;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 4px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
  text-shadow: none;
  margin-left: 0.8rem;
  vertical-align: middle;
}
.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: clamp(2rem, 6vh, 4rem);
  font-size: 0.8rem;
  color: var(--muted);
}
/* When the projects column is narrow (phone, or the divider dragged left), the address and status
   move under the description. Based on the column's own width, not the screen's. */
@container (max-width: 40rem) {
  .row { column-gap: 1rem; }
  .text { grid-template-columns: minmax(0, 1fr); }
  .name { font-size: clamp(0.8rem, calc((100cqi - var(--logo_w) - 2.4rem) / 11.6), 2.5rem); }
  .about {
    font-size: 0.85rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
  }
  .meta { grid-column: 1; grid-row: auto; text-align: left; margin-top: 0.4rem; font-size: 0.8rem; }
}
/* Hotkey hints only where there is a keyboard and pointer (not touch screens). */
@media (hover: none) {
  .key, .hint { display: none; }
}

/* ---------- utilities column ---------- */

.tools { display: flex; flex-direction: column; gap: 1rem; }
/* Widgets fill as many columns as fit, so a wide utilities column is used side by side. */
.tools_grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr));
  gap: 1rem;
  align-items: start;
}
.widget { position: relative; min-width: 0; }
.widget[data-widget="links"] { grid-column: 1 / -1; }

/* arrange mode */
.arrange_bar { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.arrange_bar .error_text { margin: 0; }
.tools_grid.arranging .widget > :not(.arrange_overlay) { opacity: 0.25; pointer-events: none; }
.tools_grid.arranging .widget { min-height: 5.5rem; }
.arrange_overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 4.5rem;
  border: 1px dashed var(--muted);
  border-radius: 14px;
}
.arrange_label { font-size: 0.95rem; text-shadow: var(--glow); }
.arrange_overlay .btn { min-width: 2.75rem; font-size: 1rem; }
.tools_head { display: flex; justify-content: space-between; align-items: center; min-height: 2rem; margin-bottom: clamp(0.5rem, 4vh, 2.5rem); }
.tools_title { font-size: 0.95rem; color: var(--muted); margin: 0; }
.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 1rem;
}
.panel_title { margin: 0 0 0.75rem; font-size: 0.8rem; font-weight: 400; color: var(--muted); }
.btn {
  display: inline-block;
  color: inherit;
  text-decoration: none;
  background: transparent;
  border: 1px solid var(--control);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn:focus-visible, .field:focus-visible, .symbol:focus-visible, .link_tile:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn_small { padding: 0.2rem 0.55rem; font-size: 0.8rem; }
.btn_danger { border-color: var(--danger); color: var(--danger); }
.btn_row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.field {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--control);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
}
.field::placeholder { color: var(--faint); text-shadow: none; }
.field_row { display: flex; gap: 0.5rem; align-items: center; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.error_text { color: var(--danger); font-size: 0.8rem; min-height: 1.2em; margin: 0.5rem 0 0; }

/* change pin */
.pin_form { display: grid; gap: 0.5rem; }
.pin_form .field { letter-spacing: 0.3em; }

/* locked state */
.lock_panel { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 2.5rem 1rem; text-align: center; }
.lock_open { width: 100%; padding: 2.5rem 1rem; font-size: 1.1rem; }
.pin_input {
  width: 11ch;
  text-align: center;
  font-size: 1.6rem;
  letter-spacing: 0.4em;
  padding-left: 0.4em;
}

/* links */
.links { display: grid; grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr)); gap: 0.5rem; }
.link_tile {
  display: block;
  text-align: center;
  padding: 0.75rem 0.25rem;
  border: 1px solid var(--control);
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  font-size: 0.85rem;
}
.link_tile:hover { border-color: var(--muted); }

/* clocks, stopwatch, timer */
.clock_grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.mini { background: var(--bg); border: 1px solid var(--rule); border-radius: 10px; padding: 0.75rem; min-width: 0; }
.mini_label { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); margin-bottom: 0.35rem; }
.big_time { font-size: 1.45rem; font-weight: 200; text-shadow: var(--glow); line-height: 1.2; white-space: nowrap; }
.mini_sub { font-size: 0.75rem; color: var(--muted); margin-top: 0.2rem; min-height: 1.1em; }
.mini .btn_row { margin-top: 0.5rem; gap: 0.35rem; }
.laps { list-style: none; margin: 0.4rem 0 0; padding: 0; font-size: 0.75rem; color: var(--muted); }
.timer_fields { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 0.2rem; align-items: center; }
.timer_fields .field { min-width: 0; padding: 0.3rem 0.1rem; text-align: center; font-size: 1rem; }
.timer_done .big_time { color: var(--danger); animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

/* weeks + days */
.wd { font-size: 1.6rem; font-weight: 200; text-shadow: var(--glow); }
.wd b { font-weight: 700; }
[hidden] { display: none !important; }
.wd_label { font-size: 0.8rem; color: var(--muted); margin-left: 0.5rem; text-shadow: none; }
.calc_result { margin-top: 0.75rem; min-height: 2.2rem; }

/* countdowns */
.countdowns { list-style: none; margin: 0; padding: 0; }
.countdown { border-top: 1px solid var(--rule); }
.countdown:first-child { border-top: 0; }
.countdown_view {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
}
.countdown_title { display: block; font-size: 0.95rem; overflow-wrap: anywhere; }
.countdown_date { display: block; font-size: 0.75rem; color: var(--muted); }
.countdown_view .wd { font-size: 1.3rem; white-space: nowrap; }
.countdown.passed .countdown_title { color: var(--muted); }
.countdown_form { display: grid; gap: 0.5rem; padding: 0.6rem 0; }
.empty_text { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.5rem; }
.panel_foot { margin-top: 0.75rem; }

/* translate */
.translate_result {
  margin-top: 0.75rem;
  min-height: 2.2rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
}
.pinyin { font-size: 1.15rem; line-height: 1.5; text-shadow: var(--glow); overflow-wrap: anywhere; }
.counter { font-size: 0.75rem; color: var(--muted); text-align: right; margin-top: 0.3rem; }

/* speech to text: the box is three lines tall and scrolls inside instead of growing */
.stt_text {
  display: block;
  height: calc(3 * 1.5em + 1.1rem);
  line-height: 1.5;
  resize: none;
  overflow-y: auto;
}
.stt_bar { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.status_line { font-size: 0.75rem; color: var(--muted); margin-top: 0.4rem; min-height: 1.1em; }
.btn_record[aria-pressed="true"] { border-color: var(--danger); color: var(--danger); }

/* shared */
.panel_head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.panel_head .panel_title { margin: 0; }
.danger_text { color: var(--danger); }
.visually_hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
select.field { appearance: none; width: auto; padding-right: 0.75rem; }

/* weather */
.weather_grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem; }
.forecast { list-style: none; margin: 0.6rem 0 0; padding: 0; font-size: 0.75rem; }
.forecast li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 2.6rem;
  grid-template-areas: "day temp rain" "text text text";
  column-gap: 0.4rem;
  padding: 0.25rem 0;
  border-top: 1px solid var(--rule);
}
.forecast_day { grid-area: day; }
.forecast_temp { grid-area: temp; white-space: nowrap; }
.forecast_rain { grid-area: rain; color: var(--muted); text-align: right; }
.forecast_text { grid-area: text; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weather_foot { margin-top: 0.6rem; }

/* vps health */
.health { display: grid; gap: 0.45rem; font-size: 0.85rem; }
.health_row { display: flex; justify-content: space-between; gap: 0.75rem; }
.meter { display: grid; gap: 0.25rem; margin-top: 0.2rem; }
.meter_label { display: flex; justify-content: space-between; gap: 0.75rem; }
.meter_label span:first-child { color: var(--muted); }
.meter_track { display: block; height: 4px; border-radius: 2px; background: var(--rule); overflow: hidden; }
.meter_bar { display: block; height: 100%; width: var(--pct, 0%); background: var(--ink); box-shadow: var(--glow_soft); }
.meter_bar.meter_high { background: var(--danger); }
.services { list-style: none; margin: 0.3rem 0 0; padding: 0; display: grid; gap: 0.3rem; }
.service { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.5rem; }
.service[data-state="active"] .dot { background: var(--ink); border-color: var(--ink); }
.service[data-state="failed"] .dot { border-color: var(--danger); background: var(--danger); }

/* n8n */
.n8n_grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.6rem; }
.n8n_item { display: grid; gap: 0.3rem; min-width: 0; }
.n8n_run { width: 100%; padding: 0.7rem 0.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.n8n_result { font-size: 0.7rem; color: var(--muted); overflow-wrap: anywhere; }
.n8n_result.danger_text { color: var(--danger); }
.n8n_edit_row { display: grid; gap: 0.4rem; padding: 0.6rem 0; border-bottom: 1px solid var(--rule); }
.n8n_edit_row .btn { justify-self: start; }
.n8n_method { flex: 0 0 auto; }

/* device drop */
.drop_text { display: block; resize: vertical; min-height: calc(2 * 1.5em + 1.1rem); line-height: 1.5; }
.drop_list { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.drop_item { display: grid; gap: 0.3rem; padding: 0.6rem 0; border-top: 1px solid var(--rule); }
.drop_body {
  font-size: 0.85rem;
  text-transform: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}
.drop_link { color: inherit; }
.drop_name { font-size: 0.85rem; text-transform: none; overflow-wrap: anywhere; }
.drop_meta { font-size: 0.7rem; color: var(--muted); }
.panel.drag_over { border-color: var(--ink); box-shadow: var(--glow_soft); }

/* checklist */
.checklist { display: grid; gap: 0.9rem; }
.check_head { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.85rem; margin-bottom: 0.3rem; }
.check_list { list-style: none; margin: 0; padding: 0; border: 1px solid transparent; border-radius: 8px; }
.check_section.check_full .check_list { border-color: var(--danger); }
.check_item, .check_new { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.5rem; padding: 0.15rem 0; }
.check_new { grid-template-columns: auto minmax(0, 1fr); }
.check_box { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--ink); cursor: pointer; }
.check_box_blank { width: 1.05rem; height: 1.05rem; border: 1px dashed var(--faint); border-radius: 3px; }
.check_text {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.3rem 0.4rem;
  font-size: 0.9rem;
}
.check_text:focus { border-color: var(--control); background: var(--bg); outline: none; }
/* The ready-to-type item: highlighted placeholder that disappears as soon as it is clicked. */
.check_new .check_text { background: var(--bg); border: 1px dashed var(--control); }
.check_new .check_text::placeholder { color: var(--muted); text-shadow: var(--glow_soft); }
.check_new .check_text:focus::placeholder { color: transparent; text-shadow: none; }
.check_handle {
  background: none;
  border: 0;
  color: var(--faint);
  cursor: grab;
  padding: 0.3rem 0.35rem;
  touch-action: none;
  letter-spacing: -0.2em;
  font-size: 0.9rem;
}
.check_handle:hover { color: var(--muted); }
.check_item.dragging { background: var(--bg); border-radius: 6px; box-shadow: 0 0 0 1px var(--muted); }
.check_item.dragging .check_handle { cursor: grabbing; color: var(--ink); }

/* read later */
.read_add { margin-top: 0.5rem; }
.read_item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.6rem; align-items: start; padding: 0.55rem 0; border-top: 1px solid var(--rule); }
.read_item .check_box { margin-top: 0.15rem; }
.read_main { display: grid; gap: 0.15rem; min-width: 0; }
.read_link { color: inherit; font-size: 0.85rem; text-transform: none; overflow-wrap: anywhere; }

/* text tools */
.text_in, .text_out { display: block; resize: vertical; line-height: 1.5; font-size: 0.85rem; }
.text_out { margin-top: 0.5rem; color: var(--ink); }
.text_options { margin-top: 0.5rem; flex-wrap: wrap; }
.text_options .field { flex: 1 1 10rem; }
.text_out + .stt_bar .btn_row { flex-wrap: nowrap; }

/* footer */
.footer_right { display: inline-flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* qr code */
.qr_actions { margin-top: 0.5rem; }
.qr_out { display: flex; justify-content: center; }
.qr_svg { width: min(100%, 15rem); height: auto; margin-top: 0.5rem; border-radius: 6px; }

/* symbols */
.symbols { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.6rem, 1fr)); gap: 0.35rem; text-transform: none; }
.symbol {
  height: 2.6rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  font-size: 1.15rem;
  font-weight: 400;
  cursor: pointer;
  text-transform: none;
}
.symbol:hover { border-color: var(--muted); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 4.5rem);
  transform: translate(-50%, 1rem);
  background: var(--ink);
  color: var(--bg);
  text-shadow: none;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms, transform 150ms;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .sym { text-transform: none; }

/* pad: drawer from the right on wide screens, third swipe page on narrow screens */
.pad_tab {
  position: fixed;
  z-index: 15;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  padding: 0.9rem 0.4rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  letter-spacing: 0.15em;
  font-size: 0.85rem;
  cursor: pointer;
}
.pad_tab:hover { border-color: var(--muted); }
.pad_backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(10, 11, 13, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.pad_backdrop.open { opacity: 1; pointer-events: auto; }
.pad_drawer {
  position: fixed;
  z-index: 25;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--pad_w, 50vw);
  max-width: 95vw;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0px) + 1.25rem) 1.25rem calc(env(safe-area-inset-bottom, 0px) + 1.25rem) 1.5rem;
  background: var(--panel);
  border-left: 1px solid var(--rule);
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.35);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s linear 0.28s;
}
.pad_drawer.open { transform: translateX(0); visibility: visible; transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1); }
.pad_handle {
  position: absolute;
  left: -4px;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  touch-action: none;
}
.pad_handle::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: transparent;
  transition: background 0.15s;
}
.pad_handle:hover::after, .pad_handle.dragging::after { background: var(--muted); }
body.resizing { cursor: col-resize; user-select: none; }
.pad { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.pad_head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; min-height: 2rem; margin-bottom: 0.75rem; }
.pad_head_right { display: flex; align-items: center; gap: 0.75rem; }
.pad_status { font-size: 0.75rem; color: var(--muted); }
.pad_text {
  flex: 1;
  min-height: 12rem;
  width: 100%;
  resize: none;
  background: var(--bg);
  border: 1px solid var(--control);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  font-size: 0.95rem;
  line-height: 1.6;
}
.pad_text:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.page_pad .pad_close { display: none; }

@media (prefers-reduced-motion: reduce) {
  .pad_drawer, .pad_drawer.open, .pad_backdrop { transition: none; }
  .row::before, .toast { transition: none; }
  .timer_done .big_time { animation: none; }
}
