:root {
  color-scheme: light;
  --bg: #fff7f3;
  --bg-elevated: rgba(255, 255, 255, 0.88);
  --surface: #ffffff;
  --surface-soft: #fff1ec;
  --surface-muted: #f8f3f1;
  --ink: #282329;
  --ink-soft: #71686f;
  --ink-faint: #a39aa0;
  --line: rgba(74, 50, 62, 0.11);
  --primary: #f85f78;
  --primary-deep: #d94362;
  --primary-soft: #ffe2e7;
  --orange: #ff8d5c;
  --purple: #8b72e8;
  --green: #36a67e;
  --yellow: #f1b84c;
  --shadow: 0 22px 64px rgba(105, 58, 74, 0.14), 0 3px 12px rgba(105, 58, 74, 0.06);
  --shadow-soft: 0 10px 30px rgba(105, 58, 74, 0.1);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 15px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171417;
  --bg-elevated: rgba(30, 26, 31, 0.9);
  --surface: #242026;
  --surface-soft: #31242b;
  --surface-muted: #2d292e;
  --ink: #f8f0f3;
  --ink-soft: #bdb2b9;
  --ink-faint: #8c8289;
  --line: rgba(255, 236, 244, 0.1);
  --primary: #ff7088;
  --primary-deep: #ff8da1;
  --primary-soft: #482a33;
  --orange: #ffa06f;
  --purple: #aa91ff;
  --green: #58c79e;
  --yellow: #ffd06a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.4), 0 3px 14px rgba(0, 0, 0, 0.25);
  --shadow-soft: 0 12px 34px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
.feed:focus-visible,
summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 62%, transparent);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  z-index: 0;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(30px);
  opacity: 0.18;
  pointer-events: none;
}

.ambient-one {
  top: -230px;
  left: -160px;
  background: #ff9d76;
}

.ambient-two {
  right: -230px;
  bottom: -220px;
  background: #9a7aff;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  max-width: 980px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + var(--safe-top)) clamp(14px, 3.5vw, 28px) 8px;
}

.brand-button {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--orange), var(--primary) 62%, var(--purple));
  color: white;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -1px;
  box-shadow: 0 10px 25px rgba(248, 95, 120, 0.25);
}

.brand-mark span {
  margin-left: 1px;
  font-size: 9px;
  letter-spacing: -0.4px;
  vertical-align: super;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.brand-copy strong {
  overflow: hidden;
  font-size: 16px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy small {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elevated);
  box-shadow: 0 6px 18px rgba(100, 65, 76, 0.06);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(18px);
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  background: var(--surface);
}

.icon-button:active {
  transform: scale(0.94);
}

.icon-button.quiet {
  border-color: transparent;
  background: var(--surface-muted);
  box-shadow: none;
}

.category-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px clamp(14px, 3.5vw, 28px) 9px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.category-strip::-webkit-scrollbar,
.feed::-webkit-scrollbar,
.detail-content::-webkit-scrollbar,
.explore-panel::-webkit-scrollbar {
  display: none;
}

.category-chip,
.filter-chip {
  flex: 0 0 auto;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  scroll-snap-align: start;
  transition: all 160ms ease;
}

.category-chip[aria-pressed="true"],
.filter-chip[aria-pressed="true"] {
  border-color: transparent;
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow-soft);
}

.feed {
  position: relative;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2px clamp(12px, 3vw, 28px) calc(24px + var(--safe-bottom));
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  overscroll-behavior-y: contain;
}

.problem-card {
  --card-accent: var(--primary);
  --card-accent-soft: var(--primary-soft);
  position: relative;
  display: flex;
  width: min(100%, 720px);
  height: calc(100dvh - 126px - var(--safe-top) - var(--safe-bottom));
  min-height: 520px;
  max-height: 790px;
  margin: 4px auto 16px;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid color-mix(in srgb, var(--card-accent) 12%, var(--line));
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--card-accent) 12%, transparent), transparent 38%),
    var(--surface);
  box-shadow: var(--shadow);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  transform: translateZ(0);
}

.problem-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--card-accent), color-mix(in srgb, var(--card-accent) 45%, var(--orange)));
  content: "";
}

.problem-card[data-category="哈希"],
.problem-card[data-category="图"] {
  --card-accent: #5b8def;
  --card-accent-soft: #e5eeff;
}

.problem-card[data-category="双指针"],
.problem-card[data-category="滑动窗口"] {
  --card-accent: #2eb58b;
  --card-accent-soft: #def8ee;
}

.problem-card[data-category="链表"],
.problem-card[data-category="栈"],
.problem-card[data-category="堆"] {
  --card-accent: #9a72ea;
  --card-accent-soft: #eee5ff;
}

.problem-card[data-category="二叉树"],
.problem-card[data-category="回溯"] {
  --card-accent: #ed7c48;
  --card-accent-soft: #ffebdf;
}

.problem-card[data-category="动态规划"],
.problem-card[data-category="多维动态规划"] {
  --card-accent: #ee5778;
  --card-accent-soft: #ffe4ea;
}

.problem-card[data-category="二分查找"],
.problem-card[data-category="技巧"] {
  --card-accent: #d99b26;
  --card-accent-soft: #fff1cc;
}

:root[data-theme="dark"] .problem-card {
  --card-accent-soft: color-mix(in srgb, var(--card-accent) 20%, var(--surface));
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: clamp(20px, 4vh, 30px) clamp(19px, 5vw, 34px) 8px;
}

.badge-row {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 7px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--card-accent-soft);
  color: color-mix(in srgb, var(--card-accent) 78%, var(--ink));
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.badge.difficulty {
  background: var(--surface-muted);
  color: var(--ink-soft);
}

.bookmark-button {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 13px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 22px;
  cursor: pointer;
}

.bookmark-button.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.card-main {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  padding: 8px clamp(19px, 5vw, 34px) 14px;
}

.problem-index {
  margin-bottom: 3px;
  color: var(--card-accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.problem-card h2 {
  margin: 0;
  font-size: clamp(25px, 6.6vw, 40px);
  line-height: 1.18;
  letter-spacing: -0.04em;
}

.card-hook {
  display: -webkit-box;
  margin: 9px 0 13px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: clamp(14px, 3.8vw, 17px);
  font-weight: 620;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.signal-row {
  display: flex;
  gap: 7px;
  overflow: hidden;
  margin-bottom: 13px;
}

.signal-pill {
  flex: 0 1 auto;
  overflow: hidden;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insight-box {
  position: relative;
  margin-bottom: 12px;
  padding: 14px 15px 14px 41px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--card-accent-soft) 70%, var(--surface));
  font-size: clamp(12px, 3.2vw, 14px);
  line-height: 1.62;
}

.insight-box::before {
  position: absolute;
  top: 14px;
  left: 14px;
  content: "✦";
  color: var(--card-accent);
  font-size: 17px;
}

.insight-box strong {
  display: block;
  margin-bottom: 3px;
  color: var(--card-accent);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.insight-box p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.visual-card {
  position: relative;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.visual-label {
  position: absolute;
  z-index: 1;
  top: 10px;
  right: 11px;
  padding: 3px 7px;
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.visual-card pre {
  height: 100%;
  max-height: 160px;
  margin: 0;
  overflow: hidden;
  padding: 16px 14px 13px;
  color: var(--ink-soft);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(9px, 2.5vw, 12px);
  line-height: 1.45;
  white-space: pre-wrap;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 700;
}

.complexity-preview {
  display: flex;
  gap: 10px;
}

.card-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
  gap: 9px;
  padding: 0 clamp(19px, 5vw, 34px) clamp(17px, 3.5vh, 25px);
}

.primary-button,
.secondary-button,
.status-button {
  min-height: 46px;
  padding: 11px 16px;
  border: 0;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, filter 150ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, var(--orange)));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 25%, transparent);
  color: white;
}

.primary-button:hover,
.status-button:hover,
.secondary-button:hover {
  filter: brightness(1.035);
  transform: translateY(-1px);
}

.primary-button:active,
.status-button:active,
.secondary-button:active {
  transform: scale(0.98);
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--ink-soft);
}

.status-button {
  background: var(--ink);
  color: var(--surface);
}

.status-button[data-status="learning"] {
  background: var(--yellow);
  color: #3a2b0e;
}

.status-button[data-status="mastered"] {
  background: var(--green);
  color: white;
}

.feed-position {
  position: fixed;
  z-index: 3;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(8px + var(--safe-bottom));
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
  pointer-events: none;
  backdrop-filter: blur(14px);
}

.empty-state {
  position: absolute;
  z-index: 4;
  inset: 110px 16px 16px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-illustration {
  display: grid;
  width: 84px;
  height: 84px;
  place-items: center;
  border-radius: 28px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 42px;
}

.empty-state h2 {
  margin: 18px 0 6px;
}

.empty-state p {
  margin: 0 0 18px;
  color: var(--ink-soft);
}

dialog {
  padding: 0;
  border: 0;
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(25, 18, 23, 0.52);
  backdrop-filter: blur(7px);
}

.detail-dialog {
  width: min(100%, 920px);
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0 auto;
  background: transparent;
}

.detail-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  background: var(--bg);
}

.detail-header {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  padding: calc(10px + var(--safe-top)) clamp(14px, 4vw, 28px) 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elevated);
  backdrop-filter: blur(20px);
}

.detail-heading {
  min-width: 0;
  text-align: center;
}

.detail-heading strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-heading small {
  color: var(--ink-soft);
  font-size: 10px;
}

.detail-content {
  overflow-y: auto;
  padding: 22px clamp(16px, 5vw, 52px) 120px;
  scrollbar-width: none;
}

.detail-hero {
  max-width: 760px;
  margin: 0 auto 20px;
  padding: clamp(22px, 5vw, 36px);
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--primary-soft) 52%, var(--surface)));
  box-shadow: var(--shadow-soft);
}

.detail-hero .detail-number {
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.detail-hero h1 {
  margin: 7px 0 10px;
  font-size: clamp(28px, 7vw, 46px);
  line-height: 1.17;
  letter-spacing: -0.045em;
}

.detail-hero blockquote {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.7;
}

.detail-hero .badge-row {
  margin-top: 17px;
}

.lesson-section {
  max-width: 760px;
  margin: 12px auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 6px 20px rgba(80, 48, 62, 0.05);
}

.lesson-section > summary {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 17px 18px;
  list-style: none;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
}

.lesson-section > summary::-webkit-details-marker {
  display: none;
}

.lesson-section > summary::after {
  margin-left: auto;
  content: "+";
  color: var(--ink-faint);
  font-size: 21px;
  font-weight: 400;
}

.lesson-section[open] > summary::after {
  content: "−";
}

.section-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 14px;
}

.section-body {
  padding: 0 19px 20px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.8;
}

.section-body p {
  margin: 0 0 12px;
}

.section-body ul,
.section-body ol {
  margin: 0;
  padding-left: 1.35em;
}

.section-body li + li {
  margin-top: 8px;
}

.section-body code:not(pre code) {
  padding: 2px 5px;
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--primary-deep);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.9em;
}

.detail-visual {
  overflow-x: auto;
  margin: 0;
  padding: 18px;
  border-radius: var(--radius-md);
  background: #24202a;
  color: #f7eefa;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(11px, 3vw, 13px);
  line-height: 1.6;
  white-space: pre-wrap;
}

.code-wrap {
  position: relative;
}

.code-wrap pre {
  max-height: 62vh;
  overflow: auto;
  margin: 0;
  padding: 20px 16px 18px;
  border-radius: var(--radius-md);
  background: #19171d;
  color: #f7edf5;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.62;
  tab-size: 4;
}

.copy-code-button {
  position: absolute;
  z-index: 1;
  top: 9px;
  right: 9px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.complexity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.complexity-item {
  padding: 13px;
  border-radius: 13px;
  background: var(--surface-muted);
}

.complexity-item strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 11px;
}

.quiz-card {
  padding: 17px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--purple) 12%, var(--surface)));
}

.quiz-card strong {
  color: var(--ink);
}

.quiz-answer {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.quiz-card.revealed .quiz-answer {
  display: block;
}

.reveal-answer-button {
  margin-top: 12px;
  padding: 8px 11px;
  border: 0;
  border-radius: 9px;
  background: var(--ink);
  color: var(--surface);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.detail-footer {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: 0.8fr 1.25fr 0.8fr;
  gap: 8px;
  padding: 10px clamp(12px, 4vw, 28px) calc(10px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg-elevated);
  backdrop-filter: blur(20px);
}

.explore-dialog {
  width: min(100%, 720px);
  height: min(92dvh, 900px);
  max-width: none;
  max-height: none;
  margin: auto auto 0;
  overflow: hidden;
  border-radius: 30px 30px 0 0;
  background: var(--bg);
  box-shadow: var(--shadow);
}

.explore-panel {
  height: 100%;
  overflow-y: auto;
  padding: 0 clamp(16px, 5vw, 30px) calc(100px + var(--safe-bottom));
  scrollbar-width: none;
}

.sheet-header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 21px 0 14px;
  background: linear-gradient(var(--bg) 80%, transparent);
}

.sheet-header h2 {
  margin: 3px 0 0;
  font-size: 25px;
  letter-spacing: -0.035em;
}

.eyebrow {
  color: var(--primary);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.progress-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 17px;
  margin-bottom: 18px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #252028, #48343f);
  color: #fff;
  box-shadow: var(--shadow-soft);
}

.progress-ring {
  --progress: 0deg;
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#ff8c71 var(--progress), rgba(255, 255, 255, 0.14) 0);
}

.progress-ring::before {
  grid-area: 1 / 1;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #2d252c;
  content: "";
}

.progress-ring strong {
  z-index: 1;
  font-size: 15px;
}

.progress-summary {
  align-self: center;
}

.progress-summary strong {
  display: block;
  margin-bottom: 7px;
  font-size: 17px;
}

.progress-summary p {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  line-height: 1.5;
}

.progress-mini-stats {
  display: flex;
  gap: 12px;
  margin-top: 9px;
  font-size: 10px;
  font-weight: 700;
}

.search-field {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 5px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: var(--ink-faint);
}

.search-field > span {
  text-align: center;
  font-size: 21px;
}

.search-field input {
  width: 100%;
  padding: 5px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.search-field button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 9px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  cursor: pointer;
}

.filter-section {
  margin-top: 22px;
}

.filter-title {
  margin-bottom: 9px;
  font-size: 12px;
  font-weight: 850;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.category-tile {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.category-tile[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.category-tile strong {
  font-size: 12px;
}

.category-tile span {
  color: var(--ink-faint);
  font-size: 10px;
}

.category-tile .tile-progress {
  grid-column: 1 / -1;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.category-tile .tile-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.sheet-footer {
  position: fixed;
  z-index: 3;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 11px clamp(16px, 5vw, 30px) calc(11px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg-elevated);
  backdrop-filter: blur(20px);
}

.text-button {
  padding: 10px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.wide {
  width: 100%;
}

.toast {
  position: fixed;
  z-index: 20;
  bottom: calc(28px + var(--safe-bottom));
  left: 50%;
  max-width: calc(100% - 32px);
  padding: 10px 15px;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: var(--shadow);
  color: var(--surface);
  font-size: 12px;
  font-weight: 750;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 760px) {
  .problem-card {
    height: min(740px, calc(100dvh - 136px));
  }

  .visual-card pre {
    max-height: 190px;
  }

  .explore-dialog {
    margin: auto;
    border-radius: 30px;
  }

  .sheet-footer {
    position: sticky;
    margin: 20px calc(-1 * clamp(16px, 5vw, 30px)) calc(-100px - var(--safe-bottom));
  }

  .category-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-height: 700px) {
  .problem-card {
    min-height: 490px;
  }

  .card-hook {
    margin-bottom: 8px;
    -webkit-line-clamp: 1;
  }

  .signal-row {
    margin-bottom: 8px;
  }

  .insight-box {
    margin-bottom: 8px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .insight-box::before {
    top: 10px;
  }

  .visual-card pre {
    max-height: 116px;
  }
}

@media (max-width: 390px) {
  .brand-copy strong {
    font-size: 14px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .top-actions {
    gap: 5px;
  }

  .top-actions .icon-button {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  .signal-row .signal-pill:nth-child(n + 3) {
    display: none;
  }

  .complexity-grid {
    grid-template-columns: 1fr;
  }

  .detail-footer {
    grid-template-columns: 0.65fr 1.35fr 0.65fr;
  }

  .detail-footer button {
    padding-right: 8px;
    padding-left: 8px;
    font-size: 12px;
  }
}

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