/* ==========================================================================
   StudyLink — 学習SNS & 学習支援アプリ
   Design tokens / layout / components
   ========================================================================== */

:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
          "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, "Courier New", monospace;

  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-ink: #ffffff;
  --accent-soft: #eef0ff;
  --ok: #0f9d58;
  --warn: #d97706;
  --danger: #dc2626;
  --like: #e0245e;

  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --surface-3: #e6e9f2;
  --text: #14161d;
  --text-2: #5b6274;
  --text-3: #8b93a7;
  --border: #e3e6f0;
  --border-strong: #ccd2e2;
  --shadow-sm: 0 1px 2px rgba(16, 20, 40, .06);
  --shadow: 0 4px 16px rgba(16, 20, 40, .08);
  --shadow-lg: 0 18px 48px rgba(16, 20, 40, .18);

  --r-xs: 8px;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  --nav-w: 258px;
  --rail-w: 320px;
  --dock-h: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  --ease: cubic-bezier(.22, .61, .36, 1);
}

html[data-theme="dark"] {
  --accent: #8b8cf9;
  --accent-2: #a78bfa;
  --accent-ink: #12131a;
  --accent-soft: #232544;
  --bg: #0e1016;
  --surface: #161922;
  --surface-2: #1d212c;
  --surface-3: #272c3a;
  --text: #eef1f8;
  --text-2: #a8b0c2;
  --text-3: #737d92;
  --border: #262b38;
  --border-strong: #333a4b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow: 0 6px 20px rgba(0, 0, 0, .45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; font-size: inherit; color: inherit; }
img { max-width: 100%; display: block; }
ul, ol { margin: 0; padding: 0; list-style: none; }
input, textarea, select { font-family: inherit; font-size: 15px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ==========================================================================
   Layout
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar { display: none; }
.rail { display: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 56px;
  padding: 0 8px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar__title {
  flex: 1;
  font-weight: 700;
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar__actions { display: flex; align-items: center; gap: 2px; }

.main {
  padding: 12px 12px calc(84px + var(--safe-b) + var(--dock-h));
  min-width: 0;
  max-width: 100%;
}
.main:focus { outline: none; }

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--dock-h);
  z-index: 45;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: stretch;
  height: calc(60px + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  transition: bottom .25s var(--ease);
}
.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0 4px;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav__item .ico { width: 22px; height: 22px; }
.bottom-nav__item[aria-current="page"] { color: var(--accent); }
.bottom-nav__item[aria-current="page"]::after {
  content: "";
  position: absolute;
  top: 2px;
  width: 26px;
  height: 3px;
  border-radius: 9px;
  background: var(--accent);
}
.bottom-nav__item--fab { color: var(--accent-ink); }
.bottom-nav__item--fab .fab-inner {
  display: grid;
  place-items: center;
  width: 42px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 45%, transparent);
  margin-bottom: -2px;
}
.bottom-nav__item--fab[aria-current="page"]::after { display: none; }

/* ==========================================================================
   Desktop layout (>= 1000px): sidebar + main + rail
   ========================================================================== */
@media (min-width: 1000px) {
  .app {
    grid-template-columns: var(--nav-w) minmax(0, 1fr);
    max-width: 1320px;
    margin: 0 auto;
  }
  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    padding: 18px 12px;
    border-right: 1px solid var(--border);
  }
  .topbar { display: none; }
  .bottom-nav { display: none; }
  .main { padding: 20px 24px 40px; }
}

@media (min-width: 1280px) {
  .app { grid-template-columns: var(--nav-w) minmax(0, 1fr) var(--rail-w); }
  .rail {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    padding: 20px 16px 40px 4px;
  }
}

/* ---------- sidebar internals ---------- */
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 12px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 40%, transparent);
}
.brand-mark svg { fill: currentColor; }
.brand-text { font-weight: 800; font-size: 19px; letter-spacing: -.02em; }

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-link:hover { background: var(--surface-2); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav-link .ico { width: 21px; height: 21px; flex: none; }
.nav-link__badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.nav-group-label {
  padding: 14px 12px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.sidebar__foot .btn { justify-content: flex-start; }
.fictional-note {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11.5px;
  line-height: 1.6;
}
.fictional-note strong { color: var(--text); }
.rail-note { margin-top: 4px; color: var(--text-3); font-size: 11.5px; line-height: 1.6; }

/* ==========================================================================
   Primitives
   ========================================================================== */
.ico { display: inline-block; width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ico--fill { fill: currentColor; stroke: none; }
.nav-ico { display: inline-flex; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--r-pill);
  background: none;
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), transform .12s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn--sm { width: 34px; height: 34px; }
.icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: filter .15s var(--ease), transform .12s var(--ease), background .15s var(--ease), color .15s var(--ease), border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn--block { width: 100%; }
.btn--ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--soft { background: var(--accent-soft); color: var(--accent); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger-soft { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.btn--sm { min-height: 34px; padding: 6px 13px; font-size: 13px; }
.btn--lg { min-height: 50px; font-size: 16px; padding: 12px 26px; }
.btn .ico { width: 18px; height: 18px; }

.input, .textarea, .select {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
  appearance: none;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.65; }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b93a7' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 17px;
  padding-right: 36px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.field__hint { font-size: 11.5px; color: var(--text-3); line-height: 1.5; }
.field-row { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s var(--ease);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip[aria-pressed="true"], .chip.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.card--pad { padding: 16px; }
.card__title { font-size: 14px; font-weight: 800; margin-bottom: 10px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card__head .card__title { margin: 0; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack--sm { gap: 8px; }
.stack--lg { gap: 18px; }
.row { display: flex; align-items: center; gap: 8px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.strong { font-weight: 700; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 2px; flex-wrap: wrap; }
.page-title { font-size: 22px; letter-spacing: -.02em; }
.page-sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }

.divider { height: 1px; background: var(--border); border: 0; margin: 0; }

/* avatars */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
  flex: none;
  border: 1px solid var(--border);
}
.avatar--xs { width: 26px; height: 26px; }
.avatar--sm { width: 36px; height: 36px; }
.avatar--md { width: 44px; height: 44px; }
.avatar--lg { width: 64px; height: 64px; }
.avatar--xl { width: 96px; height: 96px; }
.avatar-btn { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; line-height: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-2);
  white-space: nowrap;
}
.badge--ai { background: var(--accent-soft); color: var(--accent); }
.badge--you { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.badge--subject { background: var(--surface-2); color: var(--text-2); }
.badge--ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.badge--warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 20px;
  color: var(--text-3);
  text-align: center;
  font-size: 13.5px;
}
.empty .ico { width: 34px; height: 34px; opacity: .6; }

.inline-note {
  display: flex;
  gap: 9px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.6;
}
.inline-note .ico { width: 17px; height: 17px; margin-top: 2px; flex: none; }
.inline-note--warn { background: color-mix(in srgb, var(--warn) 10%, transparent); color: color-mix(in srgb, var(--warn) 82%, var(--text)); }
.inline-note--danger { background: color-mix(in srgb, var(--danger) 9%, transparent); color: color-mix(in srgb, var(--danger) 78%, var(--text)); }

/* ==========================================================================
   Timeline / Post card
   ========================================================================== */
.tl { display: flex; flex-direction: column; gap: 10px; }

.post {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 11px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
  animation: postIn .28s var(--ease) both;
}
@keyframes postIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.post:hover { border-color: var(--border-strong); }
.post--thread { border-left: 3px solid var(--accent); }
.post--question { border-left: 3px solid var(--accent-2); }

.post__head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.post__name {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text);
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.post__name:hover { color: var(--accent); text-decoration: underline; }
.post__handle { color: var(--text-3); font-size: 12.5px; }
.post__time { color: var(--text-3); font-size: 12.5px; }
.post__time::before { content: "·"; margin-right: 5px; }

.post__body {
  margin-top: 4px;
  font-size: 14.5px;
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.post__body a { color: var(--accent); }
.post__subject {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 5px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
}
.post__quote {
  margin-top: 9px;
  padding: 10px 12px;
  border-left: 3px solid var(--border-strong);
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.65;
}
.post__quote-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-weight: 700; color: var(--text); font-size: 12.5px; }

.post__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 9px -6px -4px;
  flex-wrap: wrap;
}
.act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 0;
  border-radius: var(--r-pill);
  background: none;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s var(--ease), background .15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.act .ico { width: 17px; height: 17px; }
.act:hover { background: var(--surface-2); color: var(--text); }
.act--like:hover { color: var(--like); background: color-mix(in srgb, var(--like) 9%, transparent); }
.act--like[aria-pressed="true"] { color: var(--like); }
.act--like[aria-pressed="true"] .ico { fill: currentColor; stroke: currentColor; animation: pop .32s var(--ease); }
.act--repost:hover { color: var(--ok); background: color-mix(in srgb, var(--ok) 9%, transparent); }
.act--repost[aria-pressed="true"] { color: var(--ok); }
.act--save[aria-pressed="true"] { color: var(--accent); }
.act--save[aria-pressed="true"] .ico { fill: currentColor; }
@keyframes pop { 0% { transform: scale(1); } 42% { transform: scale(1.32); } 100% { transform: scale(1); } }

.post__more { position: absolute; top: 10px; right: 8px; }
.post__more .icon-btn { width: 30px; height: 30px; }

/* reply / thread */
.reply-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.reply {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.reply__head { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; flex-wrap: wrap; }
.reply__body { font-size: 13.5px; line-height: 1.68; white-space: pre-wrap; word-break: break-word; }
.reply__meta { margin-left: auto; display: flex; gap: 2px; }
.reply .avatar { border: 0; }
.reply--user { background: color-mix(in srgb, var(--accent) 8%, var(--surface-2)); }
.reply-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 10px; align-items: end; }

/* composer inline */
.composer { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 11px; padding: 14px; }
.composer__area {
  width: 100%;
  min-height: 64px;
  border: 0;
  background: none;
  resize: none;
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.7;
  padding: 6px 0;
}
.composer__area:focus { outline: none; }
.composer__area::placeholder { color: var(--text-3); }
.composer__foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.counter { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.counter--over { color: var(--danger); font-weight: 700; }

/* segmented control */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg__btn {
  border: 0;
  background: none;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s var(--ease);
}
.seg__btn[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs__btn {
  border: 0;
  background: none;
  padding: 11px 14px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tabs__btn[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

/* ==========================================================================
   Home
   ========================================================================== */
.hero {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 92%, #000), var(--accent-2));
  color: #fff;
  box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 30%, transparent);
}
.hero::after {
  content: "";
  position: absolute;
  right: -50px;
  top: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
}
.hero__greet { font-size: 13px; opacity: .9; font-weight: 600; }
.hero__title { font-size: 23px; margin: 4px 0 6px; letter-spacing: -.02em; }
.hero__sub { font-size: 13.5px; opacity: .92; max-width: 46ch; line-height: 1.6; }
.hero__stats { display: flex; gap: 18px; margin-top: 16px; flex-wrap: wrap; }
.hero__stat b { display: block; font-size: 20px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.hero__stat span { font-size: 11.5px; opacity: .88; }
.hero__actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.hero .btn { background: rgba(255, 255, 255, .96); color: var(--accent); }
.hero .btn--ghost { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .4); }

.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px) { .quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.quick {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: transform .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.quick:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.quick__ico {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}
.quick__label { font-weight: 700; font-size: 14px; }
.quick__meta { font-size: 11.5px; color: var(--text-3); }

/* ==========================================================================
   Tools: timers
   ========================================================================== */
.tool-shell { display: flex; flex-direction: column; gap: 14px; max-width: 620px; margin: 0 auto; }

.dial {
  position: relative;
  width: min(300px, 78vw);
  aspect-ratio: 1;
  margin: 4px auto;
  display: grid;
  place-items: center;
}
.dial svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.dial__track { fill: none; stroke: var(--surface-3); stroke-width: 12; }
.dial__prog { fill: none; stroke: var(--accent); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset .35s linear, stroke .3s; }
.dial__inner { position: relative; text-align: center; }
.dial__time {
  font-size: clamp(38px, 13vw, 52px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
  line-height: 1;
}
.dial__label { margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--text-2); letter-spacing: .04em; }
.dial.is-break .dial__prog { stroke: var(--ok); }
.dial.is-break .dial__label { color: var(--ok); }
.dial.is-long .dial__prog { stroke: #0ea5e9; }
.dial.is-long .dial__label { color: #0ea5e9; }

.timer-controls { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.timer-controls .btn { min-width: 104px; }

.pomo-dots { display: flex; gap: 7px; justify-content: center; margin: 2px 0; }
.pomo-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--surface-3); transition: background .2s; }
.pomo-dot.is-done { background: var(--accent); }

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .stat-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat {
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; line-height: 1.25; }
.stat span { font-size: 11.5px; color: var(--text-2); }

.lap-list { max-height: 260px; overflow-y: auto; }
.lap-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.lap-row:last-child { border-bottom: 0; }
.lap-row__n { color: var(--text-3); font-size: 12px; font-weight: 700; }
.lap-row__diff { color: var(--text-2); font-size: 12px; }
.lap-row__t { font-weight: 700; font-size: 14px; }

/* alarm */
.alarm-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
}
.alarm-item__time { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.alarm-item.is-off { opacity: .5; }
.alarm-item__meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.alarm-item__name { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alarm-item__sub { font-size: 11.5px; color: var(--text-3); }

.switch {
  position: relative;
  width: 46px;
  height: 27px;
  border-radius: var(--r-pill);
  border: 0;
  background: var(--surface-3);
  cursor: pointer;
  flex: none;
  transition: background .2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .28);
  transition: transform .2s var(--ease);
}
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(19px); }

.sound-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.sound-row.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.sound-row__name { font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.sound-row__sub { font-size: 11px; color: var(--text-3); }

.ringing {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: color-mix(in srgb, var(--accent) 55%, #000);
  backdrop-filter: blur(6px);
  animation: fadeIn .2s var(--ease);
}
.ringing__box {
  width: min(380px, 100%);
  padding: 28px 22px;
  border-radius: var(--r-lg);
  background: var(--surface);
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: ringPop .3s var(--ease);
}
@keyframes ringPop { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.ringing__time { font-size: 46px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.ringing__name { font-size: 15px; font-weight: 700; margin-top: 8px; color: var(--text-2); }
.ringing__bell { animation: shake 1s infinite; display: inline-block; color: var(--accent); }
@keyframes shake {
  0%, 100% { transform: rotate(-12deg); }
  50% { transform: rotate(12deg); }
}
.ringing__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ==========================================================================
   YouTube dock
   ========================================================================== */
.yt-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 24px rgba(16, 20, 40, .14);
  transition: transform .25s var(--ease);
}
@media (min-width: 1000px) {
  .yt-dock { left: auto; right: 18px; bottom: 18px; width: 340px; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
  .yt-dock[data-size="mini"] { width: 260px; }
  .yt-dock[data-size="wide"] { width: 480px; }
}
.yt-dock[data-dock="top"] { bottom: auto; top: 0; border-top: 0; border-bottom: 1px solid var(--border); }
@media (min-width: 1000px) {
  .yt-dock[data-dock="top"] { top: 18px; bottom: auto; }
}
.yt-dock[hidden] { display: none; }
.yt-dock__bar { display: flex; align-items: center; gap: 4px; padding: 5px 6px 5px 4px; }
.yt-dock__meta { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.yt-dock__title { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yt-dock__sub { font-size: 10.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yt-dock__ctrls { display: flex; align-items: center; gap: 0; }
.yt-dock__ctrls .icon-btn { width: 30px; height: 30px; }
.yt-dock__ctrls .ico { width: 16px; height: 16px; }
.yt-dock__stage { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.yt-dock__stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-dock[data-collapsed="true"] .yt-dock__stage { display: none; }
.yt-dock__loading {
  position: absolute;
  inset: auto 0 0 0;
  padding: 6px;
  font-size: 11px;
  text-align: center;
  color: var(--text-3);
  background: var(--surface);
}
.yt-fab {
  position: fixed;
  right: 14px;
  bottom: calc(74px + var(--safe-b));
  z-index: 55;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #ff0033;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(255, 0, 51, .42);
  animation: fadeIn .2s var(--ease);
}
.yt-fab .ico { width: 24px; height: 24px; fill: currentColor; stroke: none; }
@media (min-width: 1000px) { .yt-fab { bottom: 24px; right: 24px; } }

.yt-wrap { display: flex; flex-direction: column; gap: 12px; max-width: 760px; margin: 0 auto; }
.yt-frame { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--r); overflow: hidden; }
.yt-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 8px;
  color: #cbd5e1;
  background: #111827;
  text-align: center;
  padding: 20px;
  font-size: 13px;
}
.yt-placeholder .ico { width: 44px; height: 44px; fill: #ff0033; stroke: none; }

.pl-item { display: grid; grid-template-columns: 30px 74px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.pl-item:last-child { border-bottom: 0; }
.pl-item.is-playing { background: var(--accent-soft); }
.pl-item__n { font-size: 12px; color: var(--text-3); font-weight: 700; text-align: center; }
.pl-item__thumb { width: 74px; height: 42px; border-radius: 6px; object-fit: cover; background: var(--surface-3); }
.pl-item__t { font-size: 13px; font-weight: 600; line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pl-item__a { font-size: 11px; color: var(--text-3); }
.pl-item__ctrls { display: flex; gap: 1px; }

/* ==========================================================================
   Plan / Calendar
   ========================================================================== */
.plan-card { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.plan-card__top { display: flex; align-items: flex-start; gap: 10px; }
.plan-card__name { font-size: 15px; font-weight: 700; line-height: 1.4; }
.plan-card__meta { font-size: 12px; color: var(--text-2); }
.progress {
  position: relative;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.progress__bar {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .4s var(--ease);
}
.progress__bar.is-done { background: var(--ok); }
.plan-figures { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.plan-figures b { color: var(--text); font-variant-numeric: tabular-nums; }

.cal-head { display: flex; align-items: center; gap: 6px; }
.cal-head__label { font-weight: 800; font-size: 16px; min-width: 118px; text-align: center; font-variant-numeric: tabular-nums; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.cal-dow {
  padding: 7px 0;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  background: var(--surface-2);
}
.cal-dow--sun { color: #e11d48; }
.cal-dow--sat { color: #2563eb; }
.cal-cell {
  position: relative;
  min-height: 74px;
  padding: 5px 5px 4px;
  background: var(--surface);
  border: 0;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
  transition: background .12s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.cal-cell:hover { background: var(--surface-2); }
.cal-cell--out { background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
.cal-cell--out .cal-cell__num { color: var(--text-3); }
.cal-cell--today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell__num { font-size: 12px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.cal-cell--today .cal-cell__num { color: var(--accent); }
.cal-cell__num--sun { color: #e11d48; }
.cal-cell__num--sat { color: #2563eb; }
.cal-ev {
  font-size: 10px;
  line-height: 1.35;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-ev--manual { background: color-mix(in srgb, var(--warn) 15%, transparent); color: color-mix(in srgb, var(--warn) 85%, var(--text)); }
.cal-ev.is-done { opacity: .55; text-decoration: line-through; }
.cal-more { font-size: 9.5px; color: var(--text-3); font-weight: 700; }
@media (min-width: 700px) { .cal-cell { min-height: 104px; } .cal-ev { font-size: 11px; } }

.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; overflow-x: auto; }
.week-col { min-width: 96px; display: flex; flex-direction: column; gap: 6px; }
.week-col__head { text-align: center; padding: 6px 0; border-radius: var(--r-xs); background: var(--surface-2); font-size: 11.5px; font-weight: 700; }
.week-col__head.is-today { background: var(--accent); color: #fff; }

.ev-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}
.ev-item--manual { border-left: 3px solid var(--warn); }
.ev-item--plan { border-left: 3px solid var(--accent); }
.ev-item__t { font-size: 13.5px; font-weight: 700; line-height: 1.45; }
.ev-item--done .ev-item__t { text-decoration: line-through; color: var(--text-3); }
.ev-item__s { font-size: 11.5px; color: var(--text-2); }
.check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border-strong);
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: transparent;
  padding: 0;
  margin-top: 2px;
  flex: none;
}
.check[aria-checked="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.check .ico { width: 14px; height: 14px; stroke-width: 3; }

/* ==========================================================================
   Profile
   ========================================================================== */
.profile-hero {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}
.profile-hero__cover {
  height: 104px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 78%, #fff), var(--accent-2));
}
.profile-hero__body { padding: 0 16px 16px; }
.profile-hero__avatar-row { display: flex; align-items: flex-end; justify-content: space-between; margin-top: -44px; gap: 10px; }
.profile-hero__avatar { width: 88px; height: 88px; border-radius: 50%; border: 4px solid var(--surface); background: var(--surface); object-fit: cover; }
.profile-hero__name { font-size: 21px; margin-top: 10px; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-hero__handle { color: var(--text-3); font-size: 13px; }
.profile-hero__bio { margin-top: 8px; font-size: 14px; line-height: 1.7; color: var(--text-2); white-space: pre-wrap; }
.profile-stats { display: flex; gap: 18px; margin-top: 14px; flex-wrap: wrap; }
.profile-stats b { font-size: 16px; font-variant-numeric: tabular-nums; }
.profile-stats span { color: var(--text-2); font-size: 12px; }

.spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.spec {
  padding: 11px 13px;
  background: var(--surface);
}
.spec__k { font-size: 10.5px; font-weight: 700; color: var(--text-3); letter-spacing: .05em; text-transform: uppercase; }
.spec__v { font-size: 13.5px; font-weight: 600; margin-top: 2px; line-height: 1.5; }

.devbar { display: flex; flex-direction: column; gap: 9px; }
.devbar__row { display: grid; grid-template-columns: 42px 1fr 44px; gap: 9px; align-items: center; font-size: 12px; }
.devbar__track { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.devbar__fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.devbar__v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.user-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.user-card__n { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card__s { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mini-user-list { display: flex; flex-direction: column; gap: 2px; }
.mini-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border: 0;
  border-radius: var(--r-xs);
  background: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.mini-user:hover { background: var(--surface-2); }
.mini-user__n { font-size: 12.5px; font-weight: 700; }
.mini-user__s { font-size: 10.5px; color: var(--text-3); }

.trend-list { display: flex; flex-direction: column; gap: 8px; }
.trend {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--r-xs);
  background: none;
  text-align: left;
  cursor: pointer;
}
.trend:hover { background: var(--surface-2); }
.trend__t { font-size: 12.5px; font-weight: 700; }
.trend__c { font-size: 10.5px; color: var(--text-3); }

/* ==========================================================================
   Modal / sheet / toast
   ========================================================================== */
.modal-root { position: fixed; inset: 0; z-index: 150; pointer-events: none; }
.modal-root:empty { display: none; }
.modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: auto;
  background: rgba(10, 12, 20, .48);
  backdrop-filter: blur(3px);
  animation: fadeIn .16s var(--ease);
  padding: 0;
}
@media (min-width: 700px) { .modal { align-items: center; padding: 24px; } }
.modal__panel {
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-lg);
  animation: sheetUp .24s var(--ease);
  overflow: hidden;
}
@media (min-width: 700px) { .modal__panel { border-radius: var(--r-lg); animation: sheetPop .2s var(--ease); } }
@keyframes sheetUp { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes sheetPop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.modal__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 12px 10px 18px;
  border-bottom: 1px solid var(--border);
}
.modal__title { font-size: 16px; font-weight: 800; flex: 1; }
.modal__body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal__foot { display: flex; gap: 9px; padding: 12px 18px calc(14px + var(--safe-b)); border-top: 1px solid var(--border); }
.modal__foot .btn { flex: 1; }

.toast-root {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-b) + var(--dock-h));
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  width: min(420px, calc(100% - 24px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 15px;
  border-radius: var(--r-pill);
  background: #1c2030;
  color: #f4f6fb;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn .22s var(--ease);
}
.toast .ico { width: 17px; height: 17px; flex: none; }
.toast--ok .ico { color: #4ade80; }
.toast--err .ico { color: #fb7185; }
.toast.is-out { animation: toastOut .2s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px) scale(.97); } }

/* mobile menu sheet */
.menu-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 160;
  max-height: 82vh;
  overflow-y: auto;
  padding: 8px 14px calc(20px + var(--safe-b));
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-lg);
  animation: sheetUp .24s var(--ease);
}
.menu-sheet__grip { width: 40px; height: 4px; border-radius: 9px; background: var(--surface-3); margin: 6px auto 12px; }
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 155;
  background: rgba(10, 12, 20, .45);
  animation: fadeIn .16s var(--ease);
}
.sheet-backdrop[hidden] { display: none; }

/* ==========================================================================
   Settings
   ========================================================================== */
.set-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
}
.set-row:last-child { border-bottom: 0; }
.set-row__t { font-size: 14px; font-weight: 700; }
.set-row__d { font-size: 11.5px; color: var(--text-3); line-height: 1.5; }
.set-row__main { min-width: 0; flex: 1; }

.subject-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

/* utilities */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mb-2 { margin-bottom: 12px; }
.gap-2 { gap: 12px; }
.scroll-x { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }

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

/* print */
@media print {
  .sidebar, .rail, .bottom-nav, .topbar, .yt-dock, .yt-fab { display: none !important; }
  .app { display: block; }
}
