/* Feya's Soft Game palette, Golos type and two-step edges from the Memory
   screen. The protected page serves its font and pixel sprite locally. */
@font-face {
  font-family: "Golos Text";
  src: url("./GolosText.ttf") format("truetype");
  font-weight: 400 900;
  font-display: swap;
}
:root {
  color-scheme: light;
  --bg: #fff4fa;
  --sky: #fce7f5;
  --surface: #fff;
  --surface-tint: #fde8f5;
  --ink: #490751;
  --ink2: #6a3a70;
  --accent: #a12f96;
  --pk: #fc70e5;
  --pk-hi: #fca4e5;
  --pk-lo: #d94bc3;
  --on-pk: #490751;
  --edge: #efcbe4;
  --shadow: #f0cde6;
  --line: #b77aa8;
  --soft-line: #f5dcee;
  --danger: #a62155;
  --font: "Golos Text", system-ui, sans-serif;
  --icon-fill: var(--pk-hi);
  --steps: polygon(8px 0, calc(100% - 8px) 0, calc(100% - 8px) 4px,
    calc(100% - 4px) 4px, calc(100% - 4px) 8px, 100% 8px,
    100% calc(100% - 8px), calc(100% - 4px) calc(100% - 8px),
    calc(100% - 4px) calc(100% - 4px), calc(100% - 8px) calc(100% - 4px),
    calc(100% - 8px) 100%, 8px 100%, 8px calc(100% - 4px), 4px calc(100% - 4px),
    4px calc(100% - 8px), 0 calc(100% - 8px), 0 8px, 4px 8px, 4px 4px, 8px 4px);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #170c1f; --sky: #271231; --surface: #26132f; --surface-tint: #361a42;
    --ink: #ffe6f7; --ink2: #ecc8e6; --accent: #ff9dec; --pk: #ff8de9;
    --pk-hi: #ffb8f0; --pk-lo: #d95bc2; --on-pk: #2a0632; --edge: #673d6d;
    --shadow: #100817; --line: #b78bb6; --soft-line: #4a2a58; --danger: #ff96ba;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-height: 100vh; margin: 0; color: var(--ink);
  background: linear-gradient(var(--sky), var(--bg)) fixed;
  font: 400 15px/1.45 var(--font);
  overflow-wrap: anywhere;
}
button, input, textarea, select { font: inherit; }
.top, main { width: min(100%, 688px); margin: 0 auto; }
.top {
  display: flex; align-items: center; gap: 8px; min-height: 68px;
  padding: max(8px, env(safe-area-inset-top)) 16px 8px;
}
.back, .x, .text-btn {
  display: inline-grid; place-items: center; flex: none; min-width: 44px; min-height: 44px;
  border: none; background: none; color: var(--accent); cursor: pointer;
}
.back { --icon-fill: none; }
.title { flex: 1; min-width: 0; margin: 0; font-size: 26px; line-height: 1.12; font-weight: 800; }
.lock {
  --icon-fill: var(--surface-tint);
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
  border: 2px solid var(--edge); background: var(--surface); color: var(--ink2);
  box-shadow: inset 0 -2px var(--surface-tint); font-size: 13px; font-weight: 600;
}
.lock .glyph { width: 16px; height: 16px; }
main { padding: 0 16px max(24px, env(safe-area-inset-bottom)); }
.gc, .status {
  isolation: isolate; position: relative; padding: 18px; margin: 0 2px 20px 0;
  filter: drop-shadow(2px 2px 0 var(--shadow));
}
.gc::before, .gc::after, .status::before, .status::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--edge); clip-path: var(--steps); pointer-events: none;
}
.gc::after, .status::after { inset: 2px; background: var(--surface); }
.h2, .dt { display: block; margin: 0; font-size: 18px; line-height: 1.25; font-weight: 800; }
.p { margin: 6px 0 12px; color: var(--ink2); font-size: 14px; }
.p:last-child { margin-bottom: 0; }
.status { margin-top: 0; color: var(--ink); }
a { color: var(--accent); }
.glyph { width: 24px; height: 24px; flex: none; display: block; }
.ic {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px;
  background: var(--surface-tint); color: var(--accent);
}
.head, .notes-head, .add-note, .askrow { display: flex; align-items: center; gap: 10px; }
.notes-head { margin-bottom: 14px; }
.notes-head > div { min-width: 0; }
small, .count { color: var(--ink2); font-size: 12px; line-height: 1.4; }
.notes-head small { display: block; margin-top: 3px; }
.count { margin-left: auto; flex: none; }
.add-note { gap: 8px; }
.btn, .in {
  min-height: 44px; max-width: 100%; border: 2px solid var(--line);
  border-radius: 2px; color: var(--ink); background: var(--surface);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; text-align: center; font-weight: 700; line-height: 1.25; cursor: pointer;
  box-shadow: inset 2px 2px var(--surface), inset -2px -2px var(--soft-line);
}
.btn.pk {
  border-color: var(--pk-lo); background: var(--pk); color: var(--on-pk);
  box-shadow: inset 2px 2px var(--pk-hi), inset -2px -2px var(--pk-lo), 2px 2px 0 var(--shadow);
}
.btn.pk .glyph { --icon-fill: none; }
.btn.sm { min-height: 36px; padding: 6px 10px; font-size: 13px; }
.btn.danger { border-color: currentColor; color: var(--danger); }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn:disabled, .sw:disabled { opacity: .5; cursor: default; }
.btn:hover:enabled, .text-btn:hover, .back:hover, .x:hover { color: var(--accent); }
.btn.pk:hover:enabled { color: var(--on-pk); background: var(--pk-hi); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.in {
  width: 100%; min-width: 0; padding: 9px 10px; font-size: 16px;
  box-shadow: inset 2px 2px var(--soft-line);
}
.in::placeholder { color: var(--ink2); opacity: .9; }
.add-note .btn, .add-note .in { min-height: 52px; }
.add-note .btn { flex: none; }
.mem, .row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.mem + .mem, .row + .row { border-top: 2px solid var(--soft-line); }
.row:last-child, .mem:last-child { padding-bottom: 2px; }
.mem { align-items: flex-start; }
.mem .ic { width: 36px; height: 36px; }
.g, .note-body { flex: 1; min-width: 0; }
.note-body p { margin: 0; }
.g b, .g small, .note-body small { display: block; }
.history-toggle, .retry-sync {
  background: transparent; color: var(--ink); border: 0; padding: 8px 0;
  text-align: left; cursor: pointer; line-height: 1.4;
}
.history-toggle { width: 100%; min-height: 44px; font-weight: 650; }
.history-toggle small { font-weight: 400; }
.history-toggle::after { content: "+"; float: right; color: var(--accent); }
.history-toggle[aria-expanded="true"]::after { content: "−"; }
.saved-chat { padding: 0 6px; border-top: 2px solid var(--soft-line); }
.saved-chat .turn { margin: 0; }
.retry-sync { color: var(--accent); font-size: 12px; text-decoration: underline; }
.g small, .note-body small { margin-top: 3px; }
.when { text-transform: uppercase; font-weight: 500; letter-spacing: .035em; font-size: 11px; }
.note-actions { display: flex; align-items: center; flex: none; }
.text-btn { min-width: 34px; font-size: 12px; text-decoration: underline; }
.x { min-width: 40px; }
.x .glyph { width: 20px; height: 20px; }
.empty-note { margin: 12px 0 0; color: var(--ink2); font-size: 14px; }
.preferences .ic { border: 2px solid var(--line); width: 44px; height: 44px; color: var(--ink); }
.preferences .row:first-child { padding-top: 2px; }
.sw {
  position: relative; flex: none; width: 48px; height: 28px;
  padding: 0; border: 2px solid var(--line); border-radius: 0; background: var(--surface-tint); cursor: pointer;
}
.sw::before { content: ""; position: absolute; inset: -8px 0; }
.sw::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border: 2px solid var(--line); background: var(--surface);
}
.sw[aria-checked="true"] { background: var(--pk); border-color: var(--pk-lo); }
.sw[aria-checked="true"]::after { left: 22px; border-color: var(--pk-lo); }
.askrow { align-items: stretch; gap: 8px; margin-top: 8px; }
.askrow select { flex: 1; }
.ask textarea { resize: vertical; }
.turn { padding: 10px 0; margin-top: 10px; border-top: 2px solid var(--soft-line); white-space: pre-wrap; }
.turn .who, .turn .meta { display: block; color: var(--ink2); font-size: 12px; }
.turn .who { font-weight: 700; }
.turn .meta { margin-top: 4px; }
.toast {
  position: fixed; right: 16px; left: 16px; bottom: max(16px, env(safe-area-inset-bottom));
  width: fit-content; max-width: calc(100% - 32px); margin: 0 auto; z-index: 5;
  border: 2px solid #fca4e5; background: #3a0a44; color: #fff7fc; padding: 10px 14px;
}
.dlg {
  width: min(30rem, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 18px; box-shadow: 4px 4px 0 var(--shadow);
}
.dlg::backdrop { background: rgb(39 9 44 / 48%); }
.dlg .dx { margin: 8px 0 14px; white-space: pre-wrap; color: var(--ink2); font-size: 14px; }
.dlg .db { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
@media (max-width: 359px) {
  .top { gap: 4px; }
  .title { font-size: 22px; }
  .lock { gap: 5px; padding: 7px; }
  .gc { padding: 16px; }
  .add-note .btn { gap: 4px; padding-inline: 8px; }
  .add-note .glyph { width: 20px; height: 20px; }
  .mem, .row { gap: 7px; }
  .note-actions { flex-direction: column; }
  .preferences .ic { width: 32px; height: 32px; }
  .row:has([data-vmain]) { flex-wrap: wrap; }
  .row:has([data-vmain]) .g { flex-basis: calc(100% - 48px); }
}
@media (min-width: 720px) {
  .top { min-height: 84px; }
  .gc, .status { margin-bottom: 22px; }
}
