/* ============================================================
   Pet Buttons — page shells: auth, theme toggle, sub, dom
   ============================================================ */

/* ---- theme toggle ---- */
.theme-toggle { border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); height: 50px; min-width: 50px;
  padding: 0 14px; border-radius: 15px; font-size: 20px; cursor: pointer; box-shadow: 0 3px 0 var(--line);
  display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-ui); font-weight: 700; transition: transform .1s, box-shadow .1s, color .15s; }
.theme-toggle:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.theme-toggle .lbl { font-size: 14px; }

/* ============================================================
   Auth gate (full screen)
   ============================================================ */
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.gate-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 28px;
  box-shadow: var(--shadow-lg); padding: 34px 30px 30px; text-align: center; animation: rise .3s cubic-bezier(.2,.9,.3,1.1); }
.gate-mark { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto 16px; display: grid; place-items: center; font-size: 38px;
  background: var(--c-coral); box-shadow: 0 6px 0 var(--rim-coral), inset 0 2px 5px oklch(1 0 0 / 0.4); }
.gate-card h1 { font-family: var(--font-display); font-weight: 600; font-size: 27px; margin: 0 0 6px; color: var(--ink); letter-spacing: -0.01em; }
.gate-card p.gate-sub { margin: 0 0 22px; color: var(--ink-faint); font-size: 14.5px; font-weight: 600; line-height: 1.45; }
.gate-card .input { text-align: center; font-size: 18px; }
.gate-card .input.phrase { font-family: var(--font-display); letter-spacing: .01em; }
.gate-err { color: oklch(0.62 0.19 25); font-weight: 700; font-size: 14px; margin: 12px 0 0; min-height: 18px; }
.gate-row { display: flex; gap: 10px; margin-top: 16px; }
.gate .reveal { background: none; border: none; cursor: pointer; color: var(--ink-faint); font-weight: 700; font-size: 13px; margin-top: 10px; }
.gate-foot { margin-top: 18px; font-size: 12.5px; color: var(--ink-faint); font-weight: 600; }
.gate-theme { position: fixed; top: 16px; right: 16px; }

/* ============================================================
   SUBMISSIVE shell (mobile-first, centred column)
   ============================================================ */
.sub { max-width: var(--maxw-sub); margin: 0 auto; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; gap: 14px; padding: 14px clamp(12px, 4vw, 20px) 22px; }
.sub-top { display: flex; align-items: center; gap: 12px; }
.sub-brand { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; }
.sub-mark { width: 44px; height: 44px; border-radius: 14px; flex: none; background: var(--c-coral);
  box-shadow: 0 4px 0 var(--rim-coral), inset 0 2px 4px oklch(1 0 0 / 0.4); display: grid; place-items: center; font-size: 23px; }
.sub-brand h1 { font-family: var(--font-display); font-weight: 600; font-size: 22px; margin: 0; color: var(--ink); letter-spacing: -0.01em; white-space: nowrap; }
.sub-version { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink-faint); border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.sub-top .sp { flex: 1; }

.sub-board { flex: 1; }
.sub-foot { text-align: center; font-size: 12px; color: var(--ink-faint); font-weight: 600; padding-top: 2px; }
.sub-foot kbd { font-family: var(--font-ui); background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 6px; padding: 1px 6px; font-size: 11px; color: var(--ink-soft); }

/* destination switch (Play here / Send to Dominant) */
.dest { display: flex; align-items: stretch; gap: 0; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 16px; padding: 5px; box-shadow: var(--shadow); }
.dest button { flex: 1; border: none; background: transparent; cursor: pointer; border-radius: 12px; padding: 11px 10px;
  font-family: var(--font-display); font-weight: 500; font-size: 16px; color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center; gap: 8px; transition: background .18s, color .18s, box-shadow .18s; }
.dest button .ic { font-size: 18px; }
.dest button.on { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.dest button.on.on-target { color: var(--ink-sage); background: var(--c-sage); box-shadow: 0 3px 0 var(--rim-sage); }
.dest button.on.send { color: var(--ink-rose); background: var(--c-rose); box-shadow: 0 3px 0 var(--rim-rose); }
.dest-status { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12.5px; font-weight: 700;
  color: var(--ink-faint); padding: 2px 0 0; min-height: 18px; text-align: center; }
.dest-status .led { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); }
.dest-status.live .led { background: oklch(0.72 0.16 145); box-shadow: 0 0 0 3px oklch(0.72 0.16 145 / 0.25); }
.dest-status.mobile .led { background: oklch(0.78 0.13 75); }

/* fly-to-dominant confirmation chip on a sent press */
.sent-burst { position: fixed; z-index: 7; pointer-events: none; font-weight: 800; font-size: 14px; color: var(--ink-rose);
  background: var(--c-rose); border-radius: 999px; padding: 6px 14px; box-shadow: 0 6px 16px oklch(0.4 0.05 70 / 0.3);
  transform: translate(-50%, -50%); animation: sent-fly .9s ease-out forwards; white-space: nowrap; }
@keyframes sent-fly { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.8); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -180%) scale(1); } }

/* ============================================================
   DOMINANT shell (desktop-oriented control surface)
   ============================================================ */
.dom { max-width: var(--maxw-dom); margin: 0 auto; min-height: 100vh; padding: 18px clamp(14px, 3vw, 30px) 40px;
  display: flex; flex-direction: column; gap: 18px; }
.dom-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.dom-brand { display: flex; align-items: center; gap: 12px; }
.dom-mark { width: 46px; height: 46px; border-radius: 14px; background: var(--c-periwinkle);
  box-shadow: 0 4px 0 var(--rim-periwinkle), inset 0 2px 4px oklch(1 0 0 / 0.4); display: grid; place-items: center; font-size: 23px; }
.dom-brand h1 { font-family: var(--font-display); font-weight: 600; font-size: 22px; margin: 0; color: var(--ink); letter-spacing: -0.01em; white-space: nowrap; }
.dom-brand p { margin: 1px 0 0; font-size: 12.5px; color: var(--ink-faint); font-weight: 700; }
.dom-top .sp { flex: 1; }

/* relay control panel */
.relay { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 16px 20px; box-shadow: var(--shadow); }
.relay-info { flex: 1; min-width: 220px; }
.relay-info h3 { font-family: var(--font-display); font-weight: 600; font-size: 18px; margin: 0 0 3px; color: var(--ink); display: flex; align-items: center; gap: 9px; }
.relay-info p { margin: 0; font-size: 13px; color: var(--ink-faint); font-weight: 600; line-height: 1.4; }
.relay.on { border-color: transparent; box-shadow: 0 0 0 2px oklch(0.72 0.16 145 / 0.5), var(--shadow); }

/* big switch */
.switch { --w: 88px; --h: 46px; position: relative; width: var(--w); height: var(--h); border-radius: 999px; border: none; cursor: pointer;
  background: var(--line); transition: background .25s; flex: none; box-shadow: inset 0 2px 5px oklch(0.3 0.02 280 / 0.25); }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: calc(var(--h) - 8px); height: calc(var(--h) - 8px);
  border-radius: 50%; background: var(--surface); box-shadow: 0 2px 6px oklch(0.3 0.04 70 / 0.35); transition: transform .25s cubic-bezier(.3,.9,.4,1.2); }
.switch.on { background: oklch(0.72 0.16 145); }
.switch.on::after { transform: translateX(calc(var(--w) - var(--h))); }

/* "now relaying" flash when a press arrives */
.relay-flash { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13px; color: var(--ink-sage);
  background: var(--c-sage); border-radius: 999px; padding: 7px 14px; box-shadow: 0 3px 0 var(--rim-sage); animation: pop-chip .3s cubic-bezier(.2,.9,.3,1.3); }
@keyframes pop-chip { from { transform: scale(.7); opacity: 0; } }

/* management area */
.dom-manage { display: grid; grid-template-columns: 230px 1fr; gap: 20px; align-items: start; }
.cat-rail { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 14px; box-shadow: var(--shadow); }
.cat-rail h4 { font-family: var(--font-ui); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); margin: 4px 6px 10px; }
.cat-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 13px; cursor: pointer; font-family: var(--font-display);
  font-weight: 500; font-size: 16px; color: var(--ink-soft); transition: background .15s, color .15s; border: none; background: none; width: 100%; text-align: left; }
.cat-item .dot { width: 13px; height: 13px; border-radius: 50%; flex: none; }
.cat-item .ct { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--ink-faint); background: var(--bg-2); border-radius: 999px; padding: 1px 8px; }
.cat-item:hover { background: var(--bg-2); color: var(--ink); }
.cat-item.active { background: var(--bg-2); color: var(--ink); }
.cat-item .edit { opacity: 0; font-size: 13px; }
.cat-item:hover .edit { opacity: .6; }
.cat-rail .add-cat { margin-top: 8px; width: 100%; border: 1.5px dashed var(--line); background: none; color: var(--ink-faint);
  font-family: var(--font-ui); font-weight: 700; font-size: 13.5px; padding: 11px; border-radius: 13px; cursor: pointer; transition: border-color .15s, color .15s; }
.cat-rail .add-cat:hover { border-color: var(--c-sky); color: var(--ink); }

.dom-grid-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.dom-grid-head h2 { font-family: var(--font-display); font-weight: 600; font-size: 22px; margin: 0; color: var(--ink); }
.dom-grid-head .sp { flex: 1; }
.dom-add { border: none; cursor: pointer; font-family: var(--font-display); font-weight: 500; font-size: 16px; padding: 11px 20px; border-radius: 13px; white-space: nowrap;
  background: var(--c-sage); color: var(--ink-sage); box-shadow: 0 4px 0 var(--rim-sage); transition: transform .1s, box-shadow .1s; }
.dom-add:active { transform: translateY(4px); box-shadow: 0 0 0 var(--rim-sage); }

.dom-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
/* management tiles grow to fit two-line labels instead of clipping */
.dom-board .talk { aspect-ratio: auto; min-height: 152px; padding-bottom: 18px; }
.tile-wrap { position: relative; }
.tile-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; z-index: 3; }
.tile-tool { width: 34px; height: 34px; border-radius: 10px; border: none; cursor: pointer; font-size: 15px;
  background: oklch(1 0 0 / 0.88); color: oklch(0.34 0.03 70); box-shadow: 0 2px 6px oklch(0.4 0.05 70 / 0.3); display: grid; place-items: center; transition: transform .1s, background .12s; }
.tile-tool:hover { transform: scale(1.1); background: white; }
.tile-wrap.dragging { opacity: .4; }
.tile-wrap.drag-over .talk { outline: 3px dashed var(--c-sky); outline-offset: 3px; }
.tile-wrap .talk { cursor: grab; }

/* preload meter */
.preload { display: inline-flex; align-items: center; gap: 9px; font-size: 12.5px; font-weight: 700; color: var(--ink-faint); }
.preload .bar { width: 90px; height: 7px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.preload .bar i { display: block; height: 100%; background: var(--c-sky); border-radius: 99px; transition: width .25s; }

@media (max-width: 760px) {
  .dom-manage { grid-template-columns: 1fr; }
  .cat-rail { display: flex; flex-wrap: wrap; gap: 8px; }
  .cat-rail h4 { width: 100%; }
  .cat-item { width: auto; }
  .cat-item .ct { margin-left: 6px; }
}
