/* Yoshi's Desk: tidy exercise-book look */
:root {
  --paper: #fbf8f1;
  --paper-2: #fffdf8;
  --dot: #e2dccd;
  --ink: #2b2d42;
  --ink-soft: #5d6079;
  --line: #cfd9ea;
  --mint: #c9efdc;
  --mint-d: #2f9e74;
  --sky: #d3e8ff;
  --sky-d: #2f6fc0;
  --butter: #fff0b3;
  --butter-d: #b98a00;
  --coral: #ffd3c7;
  --coral-d: #d4553a;
  --lavender: #e4dbfb;
  --lavender-d: #6a4fc2;
  --red-margin: #f0a3a3;
  --radius: 18px;
  --shadow: 3px 3px 0 var(--ink);
  --shadow-sm: 2px 2px 0 var(--ink);
  --font-head: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, sans-serif;
  --top: 64px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 1.1px, transparent 1.3px);
  background-size: 22px 22px;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; margin: 0; letter-spacing: .01em; }
h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.1; }
.h2 { font-family: var(--font-head); font-weight: 600; font-size: 20px; margin: 0 0 12px; display: block; }
p { margin: 0; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--sky-d); outline-offset: 3px; border-radius: 10px; }

.skip { position: absolute; left: 12px; top: -60px; background: var(--butter); border: 2px solid var(--ink); padding: 10px 14px; border-radius: 12px; z-index: 100; }
.skip:focus { top: 10px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--top);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 16px;
  background: var(--paper-2);
  border-bottom: 2px solid var(--ink);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-height: 48px; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--butter); border: 2px solid var(--ink); box-shadow: var(--shadow-sm); display: grid; place-items: center; transform: rotate(-4deg); }
.brand-mark svg { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.brand-word { font-family: var(--font-head); font-size: 24px; font-weight: 600; }
.brand-word b { font-weight: 700; color: var(--coral-d); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.me { display: flex; align-items: center; gap: 8px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: contain; object-position: center top; background: var(--sky); border: 2px solid var(--ink); padding: 3px 6px 0; }
.initials { font-family: var(--font-head); font-weight: 700; font-size: 14px; letter-spacing: .08em; padding: 6px 10px; border-radius: 999px; background: var(--mint); border: 2px solid var(--ink); }
.role-pill { font-size: 13px; font-weight: 800; padding: 6px 10px; border-radius: 999px; background: var(--lavender); border: 2px dashed var(--lavender-d); color: var(--lavender-d); }
.icon-btn { width: 48px; height: 48px; border-radius: 14px; border: 2px solid var(--ink); background: #fff; box-shadow: var(--shadow-sm); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.icon-btn:active { transform: translate(2px, 2px); box-shadow: none; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 184px minmax(0, 1fr) 330px; min-height: calc(100vh - var(--top)); }
.sidenav {
  position: sticky; top: var(--top); align-self: start;
  height: calc(100vh - var(--top)); overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 12px;
  border-right: 2px solid var(--ink);
  background: var(--paper-2);
}
.sidenav a {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 8px 12px;
  border-radius: 14px; border: 2px solid transparent;
  text-decoration: none; font-weight: 800; color: var(--ink-soft);
}
.sidenav svg { width: 26px; height: 26px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sidenav a[aria-current="page"] { color: var(--ink); border-color: var(--ink); box-shadow: var(--shadow-sm); }
.sidenav a[data-route="desk"][aria-current="page"] { background: var(--butter); }
.sidenav a[data-route="arcade"][aria-current="page"] { background: var(--mint); }
.sidenav a[data-route="ideas"][aria-current="page"] { background: var(--coral); }
.sidenav a[data-route="sketchbook"][aria-current="page"] { background: var(--sky); }
.sidenav a[data-route="log"][aria-current="page"] { background: var(--lavender); }
.sidenav a[data-route="trophies"][aria-current="page"] { background: var(--butter); }
.sidenav a[data-route="rules"][aria-current="page"] { background: var(--mint); }

main { padding: 28px 28px 20px; min-width: 0; outline: none; }
.page { animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { margin-bottom: 22px; }
.page-head.row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sub { color: var(--ink-soft); margin-top: 6px; font-size: 17px; }
.foot { text-align: center; font-size: 12px; color: var(--ink-soft); padding: 36px 0 8px; font-weight: 700; }

/* ---------- Cards, chips, buttons ---------- */
.card {
  position: relative;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card.mint { background: var(--mint); }
.card.sky { background: var(--sky); }
.card.butter { background: var(--butter); }
.card.coral { background: var(--coral); }
.card.lavender { background: var(--lavender); }
.tape::before {
  content: ""; position: absolute; top: -12px; left: 50%; width: 86px; height: 22px;
  transform: translateX(-50%) rotate(-3deg);
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.55) 0 6px, rgba(255,255,255,0) 6px 12px), rgba(240, 163, 163, .75);
  border-left: 2px dashed rgba(0,0,0,.08); border-right: 2px dashed rgba(0,0,0,.08);
  pointer-events: none;
}
.tape.mint::before { background-color: rgba(122, 199, 230, .7); }
.tape.lavender::before { background-color: rgba(255, 214, 102, .8); }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: #fff; border: 2px solid var(--ink); white-space: nowrap; }
.chip.soft { border-style: dashed; color: var(--ink-soft); }
.chip.on { background: var(--mint); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px;
  border-radius: 14px; border: 2px solid var(--ink);
  background: #fff; box-shadow: var(--shadow-sm);
  font-weight: 800; font-size: 16px; text-decoration: none; cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
.btn.primary { background: var(--mint); }
.btn.play { background: #ff9e86; }
.btn.test { background: var(--sky); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--coral); }
.btn.approve { background: var(--lavender); }
.btn.icon { width: 48px; padding: 0; flex: none; }
.btn.icon svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.small { min-height: 48px; font-size: 14px; padding: 8px 12px; }

/* ---------- Desk ---------- */
.hello { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 30px; }
.hello h1 { font-size: clamp(36px, 5vw, 54px); }
.date { font-weight: 800; color: var(--coral-d); text-transform: uppercase; letter-spacing: .08em; font-size: 13px; margin-bottom: 6px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--mint); border: 2px solid var(--ink); font-weight: 800; font-size: 14px; }
.status-pill .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--mint-d); box-shadow: 0 0 0 3px rgba(47,158,116,.25); }
.status-pill.off { background: var(--lavender); }
.status-pill.off .dot { background: var(--lavender-d); box-shadow: 0 0 0 3px rgba(106,79,194,.2); }

.quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 26px; }
.quick-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-decoration: none; min-height: 210px; padding-top: 22px; transition: transform .12s ease; }
.quick-card:active { transform: translate(2px, 2px); box-shadow: var(--shadow-sm); }
.quick-card .chip { margin-top: auto; }
.quick-img { width: 100%; height: 88px; object-fit: cover; border-radius: 12px; border: 2px solid var(--ink); margin-bottom: 4px; }
.quick-icon { font-size: 44px; line-height: 1; height: 92px; display: grid; align-items: center; }
.quick-k { font-family: var(--font-head); font-size: 22px; font-weight: 600; }
.quick-t { color: var(--ink-soft); }

.desk-lower { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
.mini-log { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.mini-log li { background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 8px 12px; display: flex; gap: 10px; align-items: baseline; }
.mini-log .when { font-size: 12px; font-weight: 800; color: var(--sky-d); white-space: nowrap; }
.sticker-sheet { background: var(--paper-2); }
.crew { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.crew figure { margin: 0; text-align: center; font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.crew img { height: 86px; margin: 0 auto 4px; object-fit: contain; filter: drop-shadow(2px 2px 0 rgba(43,45,66,.25)); }

/* ---------- Arcade ---------- */
.cabinets { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.cab { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.cab.live { background: var(--paper-2); }
.cab .num { position: absolute; top: -12px; left: 16px; font-family: var(--font-head); font-weight: 700; font-size: 13px; background: var(--butter); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 10px; }
.cab-cover { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 12px; border: 2px solid var(--ink); }
.cab-cover.starter { display: grid; place-items: center; font-size: 56px; background: var(--sky); }
.cab h3 { font-size: 21px; line-height: 1.15; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cab-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cab-actions .wide { grid-column: 1 / -1; }
.progress { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.progress li { text-align: center; font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.progress li::before { content: ""; display: block; height: 10px; border-radius: 999px; border: 2px solid var(--ink); background: #fff; margin-bottom: 4px; }
.progress li.done::before { background: var(--mint-d); }
.progress li.done { color: var(--ink); }
.cab.empty { background: rgba(255,255,255,.6); border-style: dashed; box-shadow: none; align-items: center; justify-content: center; text-align: center; min-height: 260px; color: var(--ink-soft); }
.cab.empty .big { font-size: 40px; }
.coming { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.addr { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.ship-note { font-size: 13px; font-weight: 800; color: var(--lavender-d); }
.cab.flash { animation: flash 1.2s ease; }
@keyframes flash { 30% { box-shadow: 0 0 0 6px var(--butter), var(--shadow); } }

/* ---------- Ideas ---------- */
.add-note { margin-bottom: 26px; background: var(--paper-2); }
.add-row { display: flex; gap: 10px; align-items: stretch; }
.add-row textarea { flex: 1; min-width: 0; min-height: 52px; resize: vertical; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--ink); background: #fff; font-weight: 700; }
.hint { font-size: 14px; color: var(--ink-soft); margin-top: 8px; min-height: 1em; }
.mic.listening { background: var(--coral); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.wall { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 22px; align-items: start; }
.board { background: #f3e3c6; border: 2px solid var(--ink); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  background-image: radial-gradient(rgba(140, 100, 50, .18) 1.4px, transparent 1.6px), radial-gradient(rgba(140, 100, 50, .12) 1px, transparent 1.2px);
  background-size: 14px 14px, 9px 9px; background-position: 0 0, 5px 7px; }
.notes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.note { position: relative; padding: 22px 14px 12px; border: 2px solid var(--ink); border-radius: 6px 6px 16px 6px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px; min-height: 170px; }
.note:nth-child(3n+1) { transform: rotate(-1.2deg); }
.note:nth-child(3n+2) { transform: rotate(.8deg); }
.note::before { content: ""; position: absolute; top: -9px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--coral-d); border: 2px solid var(--ink); }
.note p { font-size: 17px; font-weight: 800; flex: 1; word-break: break-word; }
.note .when { font-size: 12px; color: var(--ink-soft); }
.note .note-actions { display: flex; gap: 6px; }
.note .note-actions .btn { flex: 1; font-size: 14px; padding: 8px 10px; }
.note .x { position: absolute; top: 2px; right: 2px; width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; font-size: 18px; color: var(--ink-soft); border-radius: 10px; }
.c-butter { background: var(--butter); } .c-mint { background: var(--mint); } .c-sky { background: var(--sky); } .c-coral { background: var(--coral); } .c-lavender { background: var(--lavender); }
.sent { background: var(--paper-2); border: 2px dashed var(--ink); border-radius: var(--radius); padding: 18px; }
.sent-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sent-list li { background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 10px 12px; font-weight: 700; font-size: 15px; }
.sent-list .when { display: block; font-size: 12px; color: var(--mint-d); font-weight: 800; margin-top: 2px; }
.empty-msg { color: var(--ink-soft); font-size: 15px; }

/* ---------- Sketchbook ---------- */
.file-btn { position: relative; }
.file-btn:focus-within { outline: 3px solid var(--sky-d); outline-offset: 3px; }
.sketch-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 20px; }
.sketch { background: #fff; border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.sketch .thumb { padding: 0; border: 2px solid var(--ink); border-radius: 12px; overflow: hidden; cursor: zoom-in; background: var(--paper); display: block; width: 100%; }
.sketch .thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.sketch .cap { font-size: 14px; font-weight: 800; }
.sketch .tag { font-size: 12px; color: var(--ink-soft); }
.sketch-actions { display: flex; gap: 6px; }
.sketch-actions .btn { flex: 1; font-size: 14px; padding: 8px 10px; }

.lightbox { padding: 0; border: 0; background: transparent; max-width: 96vw; max-height: 96vh; overflow: visible; }
.lightbox::backdrop { background: rgba(43, 45, 66, .55); }
.lightbox figure { margin: 0; background: #fff; border: 2px solid var(--ink); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.lightbox img { max-width: min(90vw, 900px); max-height: 80vh; border-radius: 10px; margin: 0 auto; }
.lightbox figcaption { text-align: center; font-family: var(--font-head); font-size: 20px; padding-top: 10px; }
.lightbox .close { position: absolute; top: -16px; right: -16px; background: var(--butter); font-size: 20px; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 28px; position: relative; max-width: 760px; }
.timeline::before { content: ""; position: absolute; left: 10px; top: 6px; bottom: 6px; border-left: 3px dashed var(--ink-soft); }
.timeline li { position: relative; margin-bottom: 20px; }
.timeline li::before { content: ""; position: absolute; left: -26px; top: 18px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink); background: var(--butter); }
.timeline li.new::before { background: var(--mint); }
.tl-card { display: flex; gap: 14px; align-items: flex-start; padding: 14px; }
.tl-card img { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; border: 2px solid var(--ink); flex: none; background: var(--paper); }
.tl-card .when { font-size: 13px; font-weight: 800; color: var(--sky-d); text-transform: uppercase; letter-spacing: .05em; }
.tl-card h3 { font-size: 19px; margin: 2px 0 4px; }
.tl-card p { color: var(--ink-soft); font-size: 15px; }
.tl-card .chip { margin-top: 8px; }

/* ---------- Trophies ---------- */
.shelves { display: grid; gap: 34px; margin-bottom: 26px; }
.shelf { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; padding: 0 12px 18px; }
.shelf::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 18px; background: #e8c48f; border: 2px solid var(--ink); border-radius: 6px; box-shadow: var(--shadow-sm); }
.trophy { position: relative; z-index: 1; width: 132px; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; padding: 8px; background: transparent; border: 2px solid transparent; border-radius: 16px; cursor: pointer; font-weight: 800; font-size: 14px; text-align: center; line-height: 1.2; }
.trophy .art { font-size: 64px; line-height: 1; filter: drop-shadow(2px 3px 0 rgba(43,45,66,.3)); }
.trophy[aria-pressed="true"] { background: rgba(255,255,255,.75); border-color: var(--ink); }
.trophy.locked .art { filter: grayscale(1) opacity(.35); }
.trophy.locked { color: var(--ink-soft); }
.trophy .lock { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.trophy-story { font-size: 18px; text-align: center; max-width: 620px; margin: 0 auto; }

/* ---------- Rules: exercise book ---------- */
.exercise-book {
  max-width: 760px; margin: 0 auto; position: relative;
  background: #fff;
  border: 2px solid var(--ink); border-radius: 8px 18px 18px 8px;
  box-shadow: var(--shadow);
  padding: 24px 28px 30px 76px;
}
.exercise-book::before { content: ""; position: absolute; left: 56px; top: 0; bottom: 0; border-left: 2px solid var(--red-margin); }
.book-label { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--ink-soft); margin-bottom: 10px; background: var(--butter); border: 2px solid var(--ink); border-radius: 10px; padding: 6px 12px; width: fit-content; }
.exercise-book h1 { margin-bottom: 10px; color: var(--sky-d); }
.rules { margin: 0; padding-left: 22px; font-size: 17px; line-height: 39px; background-image: linear-gradient(transparent 0 37px, var(--line) 37px 39px); background-size: 100% 39px; }
.rules li { margin: 0; }
.rules li::marker { font-family: var(--font-head); font-weight: 700; color: var(--coral-d); }
.signoff { margin-top: 12px; line-height: 39px; color: var(--ink-soft); }
.sig { font-family: var(--font-head); color: var(--ink); font-size: 22px; transform: rotate(-3deg); display: inline-block; }

/* ---------- Chat ---------- */
.chat {
  position: sticky; top: var(--top); align-self: start;
  height: calc(100vh - var(--top));
  display: flex; flex-direction: column;
  background: var(--paper-2);
  border-left: 2px solid var(--ink);
}
.chat-head { padding: 16px 16px 12px; border-bottom: 2px solid var(--ink); background: var(--lavender); }
.chat-title { display: flex; align-items: center; gap: 10px; }
.chat-title h2 { font-size: 22px; }
.badge { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: #fff; border: 2px solid var(--ink); }
.demo-banner { margin-top: 10px; font-size: 13px; font-weight: 800; background: var(--butter); border: 2px dashed var(--butter-d); color: #7a5b00; padding: 6px 10px; border-radius: 10px; }
.seen { margin-top: 8px; font-size: 13px; color: var(--ink-soft); }
.sheet-grip { display: none; }
.msgs { list-style: none; margin: 0; padding: 14px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--ink); font-size: 15px; }
.msg.ai { background: #fff; border-bottom-left-radius: 4px; align-self: flex-start; }
.msg.me { background: var(--mint); border-bottom-right-radius: 4px; align-self: flex-end; }
.msg .who { display: block; font-size: 11px; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.msg.typing { color: var(--ink-soft); font-style: italic; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 2px solid var(--ink); }
.chat-form input { flex: 1; min-width: 0; min-height: 48px; border-radius: 14px; border: 2px solid var(--ink); padding: 0 14px; background: #fff; font-weight: 700; }
.chat-form input:disabled { background: #eee; }
.quiet-note { margin: 0 12px 12px; padding: 10px 12px; border-radius: 12px; background: var(--lavender); border: 2px solid var(--ink); font-size: 14px; font-weight: 800; }
.chat-fab { display: none; }
.scrim { display: none; }

/* ---------- Dialogs ---------- */
dialog { border: 2px solid var(--ink); border-radius: 20px; box-shadow: 4px 4px 0 var(--ink); padding: 0; background: var(--paper-2); color: var(--ink); width: min(460px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(43, 45, 66, .4); }
.dlg { padding: 22px; display: grid; gap: 14px; }
.dlg h2 { font-size: 24px; }
.dlg fieldset { border: 0; padding: 0; margin: 0; }
.dlg legend, .lbl { font-weight: 800; margin-bottom: 8px; padding: 0; }
.dlg input[type="text"] { min-height: 48px; border: 2px solid var(--ink); border-radius: 14px; padding: 0 14px; background: #fff; font-weight: 700; width: 100%; }
.starters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.starters label { position: relative; }
.starters input { position: absolute; opacity: 0; inset: 0; }
.starters span { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 84px; justify-content: center; border: 2px solid var(--ink); border-radius: 14px; background: #fff; font-weight: 800; cursor: pointer; }
.starters b { font-size: 28px; }
.starters input:checked + span { background: var(--mint); box-shadow: var(--shadow-sm); }
.starters input:focus-visible + span { outline: 3px solid var(--sky-d); outline-offset: 2px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 12px 14px; cursor: pointer; }
.switch-row small { color: var(--ink-soft); }
.switch-row input { appearance: none; -webkit-appearance: none; width: 56px; height: 32px; border-radius: 999px; border: 2px solid var(--ink); background: #e6e2d8; position: relative; cursor: pointer; flex: none; transition: background .15s; }
.switch-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); transition: transform .15s; }
.switch-row input:checked { background: var(--lavender-d); }
.switch-row input:checked::after { transform: translateX(24px); }
.role { display: flex; gap: 10px; flex-wrap: wrap; }
.role legend { width: 100%; }
.role label { flex: 1; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; font-weight: 800; cursor: pointer; }
.role input { width: 20px; height: 20px; accent-color: var(--mint-d); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 14px; font-weight: 800; box-shadow: 3px 3px 0 rgba(43,45,66,.25); animation: toastIn .2s ease-out; }
.toast button { min-height: 40px; padding: 0 12px; border-radius: 10px; border: 2px solid #fff; background: transparent; color: #fff; font-weight: 800; cursor: pointer; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Responsive ---------- */
@media (max-width: 1279px) {
  .shell { grid-template-columns: 96px minmax(0, 1fr) 310px; }
  .sidenav { padding: 14px 8px; }
  .sidenav a { flex-direction: column; gap: 2px; font-size: 12px; padding: 8px 4px; text-align: center; min-height: 62px; justify-content: center; }
  main { padding: 24px 22px 18px; }
  .quick { gap: 16px; }
  .wall { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .desk-lower { grid-template-columns: 1fr; }
}
@media (max-width: 999px) {
  :root { --top: 60px; }
  .shell { display: block; }
  .sidenav {
    position: sticky; top: var(--top); z-index: 20; height: auto;
    flex-direction: row; overflow-x: auto; gap: 6px;
    padding: 8px 12px; border-right: 0; border-bottom: 2px solid var(--ink);
    scrollbar-width: none;
  }
  .sidenav::-webkit-scrollbar { display: none; }
  .sidenav a { flex-direction: row; flex: none; font-size: 14px; min-height: 48px; padding: 6px 12px; gap: 6px; }
  .sidenav svg { width: 22px; height: 22px; }
  main { padding: 22px 16px 96px; }
  .chat {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 60;
    height: min(78vh, 640px);
    border-left: 0; border-top: 2px solid var(--ink);
    border-radius: 22px 22px 0 0; overflow: hidden;
    box-shadow: 0 -4px 0 rgba(43,45,66,.12);
    transform: translateY(105%); transition: transform .25s ease; visibility: hidden;
  }
  .chat.open { transform: none; visibility: visible; }
  .sheet-grip { display: flex; justify-content: center; width: 100%; min-height: 28px; margin: -8px 0 4px; border: 0; background: transparent; cursor: pointer; }
  .sheet-grip span { width: 52px; height: 6px; border-radius: 999px; background: var(--ink); opacity: .5; margin-top: 6px; }
  .chat-fab {
    display: inline-flex; align-items: center; gap: 8px;
    position: fixed; right: 16px; bottom: 16px; z-index: 50;
    min-height: 56px; padding: 0 20px; border-radius: 999px;
    border: 2px solid var(--ink); background: var(--lavender); box-shadow: var(--shadow);
    font-family: var(--font-head); font-weight: 600; font-size: 18px; cursor: pointer;
  }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(43,45,66,.35); }
  .scrim[hidden] { display: none !important; }
  .toasts { bottom: 88px; }
}
@media (max-width: 760px) {
  .quick { grid-template-columns: 1fr; }
  .quick-card { min-height: 0; }
  .quick-img { height: 120px; }
  .quick-icon { height: auto; font-size: 36px; }
  .crew img { height: 64px; }
}
@media (max-width: 560px) {
  .brand-word { font-size: 20px; }
  .initials { display: none; }
  .role-pill { display: none; }
  .add-row { flex-wrap: wrap; }
  .add-row textarea { flex-basis: 100%; }
  .add-row .primary { flex: 1; }
  .notes { grid-template-columns: 1fr 1fr; gap: 14px; }
  .note p { font-size: 15px; }
  .note .note-actions .btn { font-size: 13px; padding: 6px 8px; }
  .sketch-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .sketch-actions { flex-direction: column; }
  .exercise-book { padding: 18px 16px 24px 44px; }
  .exercise-book::before { left: 30px; }
  .rules { font-size: 16px; line-height: 34px; background-size: 100% 34px; background-image: linear-gradient(transparent 0 32px, var(--line) 32px 34px); }
  .shelves { gap: 18px; }
  .shelf { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 12px; padding: 0; }
  .shelf::after { display: none; }
  .trophy { width: auto; padding-bottom: 22px; }
  .trophy::after { content: ""; position: absolute; left: 4px; right: 4px; bottom: 0; height: 14px; background: #e8c48f; border: 2px solid var(--ink); border-radius: 6px; z-index: -1; }
  .trophy .art { font-size: 48px; }
  .tl-card img { width: 64px; height: 64px; }
  .cabinets { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .notes { grid-template-columns: 1fr; }
}

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

/* ---------- Yoshi Labs additions: lock, edit mode, install card, admin, chat links ---------- */
.lockscreen { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 16px; background-color: var(--paper); background-image: radial-gradient(var(--dot) 1.1px, transparent 1.3px); background-size: 22px 22px; }
.lock-card { width: min(380px, 100%); display: grid; gap: 10px; padding: 26px 22px; }
.lock-brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 6px; }
.brand-mark.big { width: 56px; height: 56px; border-radius: 16px; }
.brand-mark.big svg { width: 34px; height: 34px; }
.lock-card .sub { text-align: center; margin: 0 0 6px; }
.lock-card input { min-height: 50px; border: 2px solid var(--ink); border-radius: 14px; padding: 0 14px; background: #fff; font-weight: 700; width: 100%; font-size: 17px; }
.lock-card .lbl { margin: 4px 0 -4px; font-weight: 800; }
.lock-card .btn { margin-top: 8px; }
.hint.err { color: var(--coral-d); font-weight: 800; }

.save-pill { font-size: 13px; font-weight: 800; padding: 6px 10px; border-radius: 999px; background: var(--mint); border: 2px solid var(--ink); white-space: nowrap; }
.edit-btn { background: #fff; font-size: 20px; }
.edit-btn[aria-pressed="true"] { background: var(--butter); box-shadow: none; transform: translate(2px, 2px); }
.me { border: 0; background: transparent; padding: 0; cursor: pointer; }
.avatar-wrap { position: relative; display: inline-block; }
.edit-banner { margin: -8px 0 18px; padding: 10px 14px; border-radius: 12px; background: var(--butter); border: 2px dashed var(--butter-d); font-size: 14px; font-weight: 800; color: #7a5b00; }

/* editable text */
body.editing [contenteditable="plaintext-only"] { outline: 2px dashed var(--sky-d); outline-offset: 3px; border-radius: 6px; cursor: text; background: rgba(211, 232, 255, .35); min-width: 1.5em; display: inline-block; }
body.editing h1[contenteditable], body.editing h2[contenteditable], body.editing h3[contenteditable], body.editing p[contenteditable], body.editing .sub[contenteditable], body.editing .foot[contenteditable], body.editing figcaption[contenteditable] { display: block; }
body.editing [contenteditable="plaintext-only"]:focus { outline-style: solid; background: #fff; }
body.editing .no-edit { opacity: .9; }
/* picture change buttons */
[data-img] { position: relative; display: block; }
.cover-wrap { display: block; }
.change-img { position: absolute; right: 6px; bottom: 6px; z-index: 2; min-height: 36px; padding: 4px 12px; border-radius: 10px; border: 2px solid var(--ink); background: var(--butter); font-weight: 800; font-size: 13px; cursor: pointer; box-shadow: var(--shadow-sm); }
.avatar-wrap .change-img { right: -8px; bottom: -10px; min-height: 28px; padding: 2px 8px; font-size: 11px; }
.crew figure .change-img { right: 50%; transform: translateX(50%); bottom: 26px; }
body.editing .trophy-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.trophy-wrap { display: contents; }
.trophy .lock { display: block; }
.tog { font-size: 12px; min-height: 36px; padding: 4px 10px; }
body.editing .cab h3 { display: block; }

/* install card */
.install-card { display: flex; gap: 16px; align-items: center; margin-bottom: 26px; flex-wrap: wrap; }
.install-card .quick-icon { height: auto; font-size: 40px; }
.install-card > div { flex: 1; min-width: 220px; }
.install-steps { margin: 0; padding-left: 20px; font-size: 15px; display: grid; gap: 4px; }
.share-ico { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 2px solid var(--ink); border-radius: 6px; font-size: 13px; background: #fff; vertical-align: middle; }

/* chat extras */
.msg.spook { background: var(--lavender); border-bottom-left-radius: 4px; align-self: flex-start; }
.msg-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msg-links .btn { font-size: 13px; min-height: 40px; padding: 6px 10px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* admin dialog */
.approval-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.approval-list li { background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 10px 12px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.approval-list .btn.small { min-height: 36px; font-size: 13px; }

@media (max-width: 560px) { .save-pill { display: none; } .edit-banner { font-size: 13px; } }

/* ---------- screen time ---------- */
.time-chip { font-size: 13px; font-weight: 800; padding: 6px 10px; border-radius: 999px; background: var(--sky); border: 2px solid var(--ink); white-space: nowrap; }
.time-chip.low { background: var(--coral); }
.timeup { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 16px; background: rgba(251, 248, 241, .92); }
.timeup-card { width: min(520px, 100%); text-align: center; display: grid; gap: 12px; justify-items: center; padding: 28px 22px; }
.timeup-card h2 { font-family: var(--font-head); font-size: 28px; }
.timeup-games { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
body.timeup .chat-form, body.timeup .edit-btn, body.timeup .add-note, body.timeup [data-action="build"], body.timeup [data-action="start"], body.timeup [data-action="build-note"], body.timeup [data-action="remix"], body.timeup [data-action="sprite"], body.timeup .file-btn { opacity: .5; pointer-events: none; }
.time-days { width: 100%; border-collapse: collapse; font-size: 14px; }
.time-days td { padding: 4px 2px; }
.time-days td:first-child { font-weight: 800; width: 3.2em; }
.time-days input[type="time"] { min-height: 36px; border: 2px solid var(--ink); border-radius: 10px; padding: 0 6px; background: #fff; font-weight: 700; font-size: 14px; width: 100%; }
.time-days input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--mint-d); }
@media (max-width: 560px) { .time-chip { font-size: 12px; padding: 5px 8px; } .time-actions { grid-template-columns: 1fr; } .timeup-card h2 { font-size: 24px; } }

/* ---------- voice first ---------- */
.btn.mic.big { width: 56px; min-height: 52px; font-size: 26px; background: var(--butter); }
.btn.mic.big.listening { background: var(--coral); animation: pulse 1s infinite; box-shadow: 0 0 0 6px rgba(212, 85, 58, .25); }
.mic-hint { margin: 0 12px 8px; padding: 10px 12px; border-radius: 12px; background: var(--butter); border: 2px dashed var(--butter-d); font-size: 14px; color: #7a5b00; }
#ideaMicHint { margin: 8px 0 0; }
.linkish { border: 0; background: transparent; padding: 0; font: inherit; font-weight: 800; color: var(--sky-d); text-decoration: underline; cursor: pointer; }
.talk-card { display: flex; align-items: center; gap: 16px; text-align: left; width: 100%; margin-bottom: 26px; cursor: pointer; }
.talk-card .quick-icon { height: auto; font-size: 40px; }
.talk-card > span:last-child { display: grid; gap: 2px; }
.talk-card .h2 { margin: 0; }
.dlg.talk { gap: 12px; }
.talk-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: step; }
.talk-steps li { display: grid; grid-template-columns: 44px 56px 1fr; gap: 10px; align-items: center; background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 10px 12px; }
.talk-steps li::before { counter-increment: step; content: counter(step); font-family: var(--font-head); font-weight: 700; font-size: 22px; width: 40px; height: 40px; border-radius: 50%; background: var(--butter); border: 2px solid var(--ink); display: grid; place-items: center; }
.talk-steps .ico { font-size: 28px; text-align: center; }
.talk .grownup { font-size: 13px; color: var(--ink-soft); background: var(--paper); border: 2px dashed var(--line); border-radius: 12px; padding: 8px 10px; }
dialog:has(.talk) { width: min(560px, calc(100vw - 32px)); }
@media (max-width: 560px) { .talk-steps li { grid-template-columns: 36px 44px 1fr; } .talk-card { gap: 12px; } }

/* ---------- readability pass (9 Nov): dialogs, admin controls ---------- */
dialog { max-height: calc(100dvh - 24px); overflow: auto; overscroll-behavior: contain; }
.dlg { font-size: 16px; }
.dlg .hint { font-size: 15px; }
dialog:has(.admin) { width: min(600px, calc(100vw - 24px)); }
.dlg.admin { padding: 0; gap: 0; }
.dlg.admin > h2 { padding: 20px 20px 8px; }
.ctl-group { display: grid; gap: 10px; padding: 12px 20px 16px; border-top: 2px dashed var(--line); }
.ctl-group .h2 { margin: 0; font-size: 19px; }
.switch-row { gap: 14px; padding: 12px 14px; }
.switch-row > span { display: grid; gap: 2px; min-width: 0; }
.switch-row small { font-size: 15px; line-height: 1.3; }
.switch-row input[type="checkbox"] { flex: none; }
.field-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 16px; }
.field-row > b { min-width: 7em; }
.field-row label { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.field-row .time, .field-row .num { min-height: 48px; border: 2px solid var(--ink); border-radius: 12px; padding: 0 10px; background: #fff; font-weight: 700; font-size: 16px; width: 130px; }
.field-row .num { width: 90px; }
.time-days { font-size: 16px; }
.time-days td { padding: 6px 4px; }
.time-days input[type="time"] { min-height: 48px; font-size: 16px; border-radius: 12px; padding: 0 8px; }
.time-days input[type="checkbox"] { width: 26px; height: 26px; }
.approval-list li { font-size: 15px; }
.dlg-actions.sticky { position: sticky; bottom: 0; margin: 0; padding: 12px 20px; background: var(--paper-2); border-top: 2px solid var(--ink); justify-content: space-between; }
.dlg-actions.sticky .btn { flex: 1; }
.dlg-actions.sticky .primary { flex: 2; }
@media (max-width: 560px) {
  .field-row > b { flex-basis: 100%; min-width: 0; }
  .field-row .time { width: 124px; }
  .time-days td:first-child { width: 2.8em; }
}
/* fluid admin content: nothing may be wider than the dialog */
.dlg.admin, .ctl-group, .ctl-group > * { min-width: 0; max-width: 100%; }
.time-days { table-layout: fixed; width: 100%; }
.time-days td:nth-child(2) { width: 34px; }
.time-days td:nth-child(4) { width: 2em; text-align: center; }
.time-days input[type="time"] { width: 100%; min-width: 0; padding: 0 4px; }
.field-row .time { width: 124px; max-width: 42vw; }
.switch-row { width: 100%; }

/* header fits a phone: wordmark never wraps, time chip shrinks */
.brand-word { white-space: nowrap; }
@media (max-width: 560px) {
  .topbar { padding: 0 10px; gap: 8px; }
  .brand { gap: 6px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-word { font-size: 18px; }
  .time-chip { display: inline-block; font-size: 12px; padding: 4px 7px; }
  .icon-btn { width: 44px; height: 44px; }
  .avatar { width: 40px; height: 40px; }
}
/* short landscape phones: the chat sheet uses nearly the whole height, hint hidden */
@media (max-width: 999px) and (max-height: 520px) {
  .chat { height: calc(100dvh - 44px); }
  .chat .mic-hint, .chat .seen { display: none; }
  .chat-head { padding: 6px 16px 6px; }
  .toasts { bottom: 12px; }
}
.avatar-wrap .change-img { right: -6px; bottom: -4px; min-height: 24px; padding: 1px 7px; font-size: 11px; }
