/* Patchling panel: soft lilac + peach + mint, rounded everything. */

:root {
  color-scheme: dark;
  --bg: #14131c;
  --bg-2: #1a1925;
  --card: #211f2e;
  --card-2: #2a2739;
  --line: #34304a;
  --text: #f2effc;
  --muted: #a7a3c0;
  --faint: #716d8a;
  --primary: #b79cff;
  --primary-ink: #1c1330;
  --primary-soft: rgba(183, 156, 255, 0.14);
  --ring: rgba(183, 156, 255, 0.35);
  --peach: #ffb59e;
  --mint: #84e0b8;
  --sky: #8ec5ff;
  --amber: #ffd479;
  --rose: #ff8fa3;
  --shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.6);
  --radius: 20px;
  --font: 'Nunito', ui-rounded, 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', Consolas, monospace;
}

[data-theme='light'] {
  color-scheme: light;
  --bg: #f7f4fe;
  --bg-2: #efeafb;
  --card: #ffffff;
  --card-2: #f6f2ff;
  --line: #e4dcf6;
  --text: #2a2240;
  --muted: #6f6988;
  --faint: #9a95b0;
  --primary: #7a58ee;
  --primary-ink: #ffffff;
  --primary-soft: rgba(122, 88, 238, 0.1);
  --ring: rgba(122, 88, 238, 0.28);
  --peach: #f47f5e;
  --mint: #25a876;
  --sky: #3c8ee6;
  --amber: #d89a0b;
  --rose: #e5486a;
  --shadow: 0 10px 30px -16px rgba(80, 50, 160, 0.3);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 85% -10%, var(--primary-soft), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, rgba(255, 181, 158, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 600 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: 28px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--primary); }
:where(svg:not([class])) { width: 20px; height: 20px; flex: none; }
code, .mono { font-family: var(--mono); font-size: 0.88em; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--ring); }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 10px; }

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

.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px;
  background: color-mix(in srgb, var(--bg-2) 88%, transparent);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 20px; }
.brand b { display: block; font-size: 19px; font-weight: 900; letter-spacing: -0.02em; }
.brand small { color: var(--faint); font-weight: 700; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px;
  color: var(--muted); font-weight: 800; text-decoration: none; transition: background 0.15s, color 0.15s, transform 0.15s;
}
.nav a:hover { background: var(--card); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav a:active { transform: scale(0.98); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }

main { padding: 30px clamp(16px, 4vw, 44px) 140px; max-width: 1280px; width: 100%; animation: fadeUp 0.35s ease both; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { color: var(--muted); margin-top: 4px; }

.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.right { text-align: right; }
.hidden { display: none !important; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card > h2, .card-head { margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card.flat { box-shadow: none; background: var(--card-2); }

/* ------------------------------------------------------------ stat tiles */

.stat { display: flex; align-items: center; gap: 14px; transition: transform 0.2s; }
.stat:hover { transform: translateY(-2px); }
.blob {
  width: 52px; height: 52px; border-radius: 18px; flex: none; display: grid; place-items: center;
  color: var(--tint, var(--primary));
  background: color-mix(in srgb, var(--tint, var(--primary)) 16%, transparent);
}
.blob svg { width: 24px; height: 24px; }
.stat b { display: block; font-size: 28px; line-height: 1.1; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }

/* ----------------------------------------------------------------- forms */

.input, select, textarea {
  width: 100%; background: var(--bg-2); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 9px 12px; transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a7a3c0' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.input.num { width: 96px; text-align: center; font-variant-numeric: tabular-nums; }
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: 13px; color: var(--muted); }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px dashed var(--line); }
.field-row:first-of-type { border-top: 0; }
.field-row .info b { display: block; font-weight: 800; }
.field-row .info span { color: var(--muted); font-size: 13px; font-weight: 600; }
.unit { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 700; }

.switch { position: relative; width: 46px; height: 27px; flex: none; display: inline-block; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--card-2); border: 1.5px solid var(--line); transition: 0.2s; }
.switch i::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--faint); transition: 0.25s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.switch input:checked + i { background: var(--primary); border-color: var(--primary); }
.switch input:checked + i::after { transform: translateX(19px); background: var(--primary-ink); }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px var(--ring); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  padding: 9px 18px; border-radius: 99px; border: 1.5px solid transparent; font-weight: 800;
  background: var(--primary); color: var(--primary-ink); transition: transform 0.12s, filter 0.15s, background 0.15s;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--card-2); }
.btn.soft { background: var(--primary-soft); color: var(--primary); }
.btn.danger { background: color-mix(in srgb, var(--rose) 16%, transparent); color: var(--rose); border-color: color-mix(in srgb, var(--rose) 30%, transparent); }
.btn.danger.solid { background: var(--rose); color: #fff; }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn.icon { padding: 7px; border-radius: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; background: var(--bg-2); border: 1.5px solid var(--line); border-radius: 14px; min-height: 46px; align-items: center; }
.chips:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 11px; border-radius: 99px; max-width: 100%;
  background: var(--primary-soft); color: var(--text); font-weight: 700; font-size: 13.5px; animation: pop 0.2s ease;
}
.chip.role { background: color-mix(in srgb, var(--chip, var(--primary)) 18%, transparent); }
.chip button { all: unset; cursor: pointer; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.chip button:hover { background: var(--ring); color: var(--text); }
.chip button svg { width: 12px; height: 12px; }
.chips input, .chips select { flex: 1 1 140px; min-width: 120px; border: 0; background: transparent; padding: 4px 6px; box-shadow: none; }
.chips input:focus, .chips select:focus { box-shadow: none; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 800; white-space: nowrap;
  color: var(--tone, var(--muted)); background: color-mix(in srgb, var(--tone, var(--muted)) 15%, transparent);
}
.badge.ok { --tone: var(--mint); } .badge.warn { --tone: var(--amber); } .badge.bad { --tone: var(--rose); }
.badge.info { --tone: var(--sky); } .badge.violet { --tone: var(--primary); } .badge.peach { --tone: var(--peach); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tone, var(--mint)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tone, var(--mint)) 25%, transparent); }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 800; padding: 8px 10px; white-space: nowrap; }
td { padding: 11px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--card-2); }
tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.trunc { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; object-fit: cover; background: var(--card-2); display: grid; place-items: center; font-weight: 900; font-size: 14px; color: var(--primary-ink); }
.avatar.lg { width: 76px; height: 76px; font-size: 28px; border: 3px solid var(--primary-soft); }

/* ----------------------------------------------------------- feed + bars */

.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 11px 4px; border-top: 1px dashed var(--line); animation: fadeUp 0.35s ease both; align-items: flex-start; }
.feed-item:first-child { border-top: 0; }
.feed-item .ico { width: 34px; height: 34px; border-radius: 12px; flex: none; display: grid; place-items: center; color: var(--tint, var(--primary)); background: color-mix(in srgb, var(--tint, var(--primary)) 15%, transparent); }
.feed-item .ico svg { width: 17px; height: 17px; }
.feed-item .txt { min-width: 0; flex: 1; }
.feed-item .txt b { font-weight: 800; }
.feed-item .txt p { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.feed-item time { color: var(--faint); font-size: 12.5px; white-space: nowrap; }

.hbar { display: grid; grid-template-columns: 130px 1fr 36px; gap: 10px; align-items: center; padding: 6px 0; }
.hbar .track { height: 12px; background: var(--card-2); border-radius: 99px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--peach)); transform-origin: left; animation: grow 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }

.chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart .bars { display: flex; align-items: flex-end; gap: 4px; flex: 1; width: 100%; justify-content: center; }
.chart .bar { width: min(22px, 40%); border-radius: 8px 8px 4px 4px; min-height: 4px; transform-origin: bottom; animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; position: relative; }
.chart .bar.a { background: linear-gradient(180deg, var(--primary), color-mix(in srgb, var(--primary) 50%, transparent)); }
.chart .bar.b { background: linear-gradient(180deg, var(--peach), color-mix(in srgb, var(--peach) 50%, transparent)); }
.chart small { color: var(--faint); font-weight: 700; font-size: 12px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 13px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 4px; margin-right: 6px; }

.health { display: flex; flex-direction: column; gap: 8px; }
.health-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: var(--card-2); }
.health-item svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--tone); }
.health-item.ok { --tone: var(--mint); } .health-item.warn { --tone: var(--amber); } .health-item.bad { --tone: var(--rose); }
.health-item p { color: var(--muted); font-size: 13px; }

/* -------------------------------------------------------------- rule UI */

.rule { padding: 0; overflow: hidden; }
.rule > .head { display: flex; align-items: center; gap: 14px; padding: 14px 20px; }
.rule .toggle-area { all: unset; box-sizing: border-box; flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; cursor: pointer; border-radius: 14px; }
.rule .toggle-area:focus-visible { outline: 3px solid var(--ring); outline-offset: 4px; }
.rule .info { flex: 1; min-width: 0; }
.rule .info h3 { font-size: 16px; }
.rule .info span { display: block; font-size: 13.5px; font-weight: 600; }
.rule .caret { color: var(--faint); transition: transform 0.2s; display: grid; }
.rule .caret svg { width: 20px; height: 20px; }
.rule.open .caret { transform: rotate(180deg); }
.rule .body { display: none; padding: 4px 20px 20px; border-top: 1px dashed var(--line); }
.rule.open .body { display: block; animation: fadeUp 0.25s ease both; }
.rule.off .blob { filter: grayscale(1); opacity: 0.5; }
.field-row.col { flex-direction: column; align-items: stretch; gap: 8px; }
.subcard { background: var(--card-2); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.hint { color: var(--muted); font-size: 13px; background: var(--primary-soft); padding: 10px 14px; border-radius: 12px; }

.ladder-row { display: grid; grid-template-columns: 90px 1fr 140px auto; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: var(--card-2); }
.ladder-preview { color: var(--muted); font-size: 13.5px; }

.savebar {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 140%); z-index: 30;
  display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 20px; border-radius: 99px;
  background: var(--card); border: 1.5px solid var(--primary); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.55);
  transition: transform 0.35s cubic-bezier(0.3, 1.4, 0.5, 1); max-width: calc(100vw - 24px);
}
.savebar.show { transform: translate(-50%, 0); }

/* ------------------------------------------------------------- overlays */

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 16px; background: var(--card);
  border: 1.5px solid var(--tone, var(--line)); box-shadow: var(--shadow); font-weight: 800; animation: pop 0.25s ease; max-width: 360px;
}
.toast svg { width: 18px; height: 18px; color: var(--tone); flex: none; }
.toast.ok { --tone: var(--mint); } .toast.bad { --tone: var(--rose); }

dialog.modal {
  border: 1px solid var(--line); border-radius: 24px; padding: 0; background: var(--card); color: var(--text);
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
}
dialog.modal[open] { animation: pop 0.22s ease; }
dialog.modal::backdrop { background: rgba(10, 8, 20, 0.55); backdrop-filter: blur(5px); }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; max-height: calc(100vh - 40px); }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); }

.skeleton { border-radius: 14px; background: linear-gradient(90deg, var(--card-2), var(--card), var(--card-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; height: 90px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(400px, 100%); text-align: center; display: flex; flex-direction: column; gap: 16px; padding: 32px; }

.verdict { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; background: color-mix(in srgb, var(--tone) 14%, transparent); border: 1.5px solid color-mix(in srgb, var(--tone) 35%, transparent); }
.verdict.ok { --tone: var(--mint); } .verdict.bad { --tone: var(--rose); } .verdict.warn { --tone: var(--amber); }
.verdict svg { width: 28px; height: 28px; color: var(--tone); }
pre.norm { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); font-family: var(--mono); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }

.progress { height: 10px; border-radius: 99px; background: var(--card-2); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--mint), var(--amber), var(--rose)); }

.linkbox { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; background: var(--primary-soft); border: 1.5px dashed var(--primary); font-weight: 800; word-break: break-all; }

/* ------------------------------------------------------------- animation */

@keyframes fadeUp { from { opacity: 0.55; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes rise { from { transform: scaleY(0); } }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* --------------------------------------------------------------- mobile */

@media (max-width: 900px) {
  .app { display: block; }
  .side {
    position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; gap: 6px;
    padding: 8px 10px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: none;
  }
  .brand { padding: 0 6px 0 0; } .brand small, .brand b { display: none; } .brand .face { width: 36px; height: 36px; }
  .nav { flex-direction: row; } .nav a { padding: 8px 12px; white-space: nowrap; }
  .nav a span { display: none; } .nav a.active span { display: inline; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; }
  .side-foot .label { display: none; }
  main { padding-top: 22px; }
  h1 { font-size: 24px; }
  .ladder-row { grid-template-columns: 1fr 1fr; }
  .hbar { grid-template-columns: 96px 1fr 30px; }
}

/* ------------------------------------------------------------- additions */

.split { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }
a.subcard:hover { border-color: var(--primary); }
.subcard.row { align-items: center; }

/* ------------------------------------------------------------ role panels */

dialog.modal.wide { width: min(900px, calc(100vw - 24px)); }
.panel-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.item-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 99px; background: var(--card-2); border: 1px solid var(--line); font-weight: 800; font-size: 13.5px; }
.item-chip.bad { border-color: var(--rose); color: var(--rose); }
.item-chip .em { font-size: 17px; line-height: 1; }
.item-row { display: grid; grid-template-columns: 70px minmax(150px, 1fr) minmax(150px, 1.2fr) auto; gap: 8px; align-items: center; }
.item-row .emoji-in { text-align: center; font-size: 18px; padding: 7px 4px; }
.picker { position: relative; }
.emoji-pop { position: absolute; z-index: 10; top: 100%; left: 0; margin-top: 6px; width: 290px; padding: 10px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 240px; overflow-y: auto; }
.emoji-pop button { all: unset; cursor: pointer; text-align: center; font-size: 20px; padding: 4px; border-radius: 8px; }
.emoji-pop button:hover { background: var(--primary-soft); }
.emoji-pop .sep { grid-column: 1 / -1; font-size: 11px; color: var(--faint); font-weight: 800; padding: 4px 2px 0; }
.dc-preview { display: flex; border-radius: 8px; background: var(--bg-2); overflow: hidden; border: 1px solid var(--line); }
.dc-preview .bar { width: 5px; flex: none; background: var(--c, var(--primary)); }
.dc-preview .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.dc-preview .t { font-weight: 800; font-size: 15px; }
.dc-preview .d { color: var(--muted); font-size: 14px; white-space: pre-wrap; }
.dc-preview .role { color: var(--primary); font-weight: 800; background: var(--primary-soft); padding: 0 4px; border-radius: 4px; }
.dc-preview .f { color: var(--faint); font-size: 12px; }
@media (max-width: 700px) { .item-row { grid-template-columns: 64px 1fr; } .item-row > :nth-child(n+3) { grid-column: 1 / -1; } }

/* ------------------------------------------------------------ friendly DMs */

.dm-bubble { display: flex; flex-direction: column; gap: 6px; max-width: 520px; }
.dm-bubble .who { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.dm-bubble .tag { background: var(--primary); color: var(--primary-ink); font-size: 10px; font-weight: 900; border-radius: 4px; padding: 1px 4px; }
.fake-btn { padding: 4px 12px; border-radius: 6px; background: var(--card-2); border: 1px solid var(--line); font-size: 13px; font-weight: 800; }

/* ------------------------------------------------------------ mascot life */

.waking { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 800; padding: 4px 2px; }
.hero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.bubble { position: relative; background: var(--card); border: 1.5px solid var(--line); border-radius: 18px; padding: 10px 16px; font-weight: 700; max-width: 520px; animation: pop 0.3s ease; }
.bubble::before { content: ''; position: absolute; left: -9px; top: 50%; width: 16px; height: 16px; background: var(--card); border-left: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line); transform: translateY(-50%) rotate(45deg); }
.palette-row { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { all: unset; cursor: pointer; width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; box-shadow: 0 0 0 1.5px var(--line); transition: transform 0.15s; }
.swatch:hover { transform: scale(1.1); }
.swatch.on { border-color: var(--text); }
.avatar-preview { width: 150px; height: 150px; border-radius: 50%; overflow: hidden; border: 3px solid var(--primary-soft); flex: none; background: var(--card-2); }
.avatar-preview img, .avatar-preview svg { width: 100%; height: 100%; display: block; object-fit: cover; }
.nav .group { margin: 14px 14px 4px; font-size: 11px; letter-spacing: 0.08em; color: var(--faint); font-weight: 900; text-transform: uppercase; }
@media (max-width: 900px) { .nav .group { display: none; } .hero .patchling { width: 84px; } }


/* ------------------------------------------------------------ setup checklist */

.check-list { display: flex; flex-direction: column; gap: 6px; }
.check-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 16px; background: var(--card-2); color: inherit; text-decoration: none; transition: transform 0.15s, background 0.15s; }
.check-row:hover { transform: translateX(3px); background: var(--primary-soft); }
.tick { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; color: var(--primary-ink); }
.tick.on { background: var(--mint); border-color: var(--mint); animation: pop 0.3s ease; }
.tick svg { width: 15px; height: 15px; }
.preset-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.preset { text-align: left; cursor: pointer; background: var(--card-2); border: 1.5px solid var(--line); border-radius: 16px; padding: 14px; color: inherit; transition: border-color 0.15s, transform 0.15s; }
.preset:hover { border-color: var(--primary); transform: translateY(-2px); }
.preset b { display: block; font-size: 16px; margin-bottom: 4px; }
.preset span { color: var(--muted); font-size: 13px; font-weight: 600; }

.progress.ok i { background: linear-gradient(90deg, var(--mint), var(--sky)); }

/* ------------------------------------------------------------ Patchling (the Cadeft plush) */

:root { --ease-out: cubic-bezier(0.22, 1, 0.36, 1); }
.patchling { position: relative; display: block; width: 100%; user-select: none; }
.pl-body, .pl-arm, .pl-look, .pl-blink { position: absolute; inset: 0; }
.pl-body { transform-origin: var(--base-x) var(--base-y); animation: pl-breathe 4.2s ease-in-out infinite; }
.pose-perch .pl-body { animation: pl-sway 5.5s ease-in-out infinite; }
.patchling img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.pl-arm { transform-origin: var(--sh-x) var(--sh-y); animation: pl-wave 2.4s ease-in-out infinite; }
.pl-look { transition: transform 0.5s var(--ease-out), opacity 0.1s; }
.pl-blink { transform-origin: var(--eye-x) var(--eye-y); animation: pl-blink 5.6s infinite; }
.pl-happy { position: absolute; inset: 0; opacity: 0; transition: opacity 0.1s; }
.patchling.is-happy .pl-happy { opacity: 1; }
.patchling.is-happy .pl-look { opacity: 0; }
.patchling.is-sleepy .pl-body { animation-duration: 6s; }
.patchling.is-patted .pl-body { animation: pl-pat 0.56s var(--ease-out); }
.patchling.is-overjoyed .pl-body { animation: pl-overjoyed 1.05s var(--ease-out); }
.pl-hit { position: absolute; inset: 4% 12% 8% 10%; border: 0; border-radius: 45%; background: transparent; cursor: grab; -webkit-tap-highlight-color: transparent; }
.pl-bit { position: absolute; width: calc(13% * var(--s, 1)); height: auto !important; inset: auto; object-fit: contain; z-index: 3; transform: translate(-50%, -50%); animation: pl-float 1.15s var(--ease-out) forwards; }
.pl-cheer { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); white-space: nowrap; font-weight: 800; font-size: 13px; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 4px 12px; pointer-events: none; z-index: 4; }
.pl-cheer:empty { display: none; }

/* sizes per place */
.brand .face { width: 44px; height: 44px; flex: none; border-radius: 50%; background: #f6ede4; object-fit: cover; animation: pl-breathe 4.2s ease-in-out infinite; }
.dm-bubble .who .face { width: 28px; height: 28px; border-radius: 50%; background: #f6ede4; }
.empty .patchling { width: 78px; margin: 0 auto 8px; }
.login .patchling { width: 96px; margin: 0 auto; }
.waking .patchling { width: 34px; flex: none; }
.hero .patchling { width: 108px; flex: none; cursor: pointer; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.28)); }
.hero { align-items: flex-end; }
.hero .bubble { margin-bottom: 14px; }
.hero .bubble::before { top: auto; bottom: 14px; transform: rotate(45deg); }

@keyframes pl-breathe { 50% { transform: scale(1.012, 1.022); } }
@keyframes pl-sway { 0%, 100% { transform: rotate(-1.4deg); } 50% { transform: rotate(1.4deg) scaleY(1.01); } }
@keyframes pl-blink { 0%, 91%, 95%, 100% { transform: scaleY(1); } 93% { transform: scaleY(0.08); } }
@keyframes pl-wave { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-16deg); } 50% { transform: rotate(4deg); } 75% { transform: rotate(-12deg); } }
@keyframes pl-pat { 22% { transform: scale(1.09, 0.88); } 48% { transform: translateY(-4%) scale(0.95, 1.07); } 74% { transform: translateY(0) scale(1.03, 0.97); } }
@keyframes pl-overjoyed { 12% { transform: scale(1.1, 0.86); } 32% { transform: translateY(-16%) rotate(-10deg) scale(0.94, 1.08); } 50% { transform: translateY(0) scale(1.08, 0.9); } 66% { transform: translateY(-9%) rotate(9deg) scale(0.97, 1.04); } 82% { transform: translateY(0) scale(1.04, 0.96); } }
@keyframes pl-float { 0% { opacity: 0; transform: translate(-50%, -30%) scale(0.5) rotate(0); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0%)), -420%) scale(1) rotate(var(--rot, 0deg)); } }
