:root {
  --bg: #f4efe6;
  --panel: #fffaf2;
  --ink: #1f2933;
  --muted: #5f6c7b;
  --line: #d8cdbf;
  --accent: #b24a2a;
  --accent-2: #1f6f78;
  --shadow: 0 18px 50px rgba(43, 38, 31, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(178, 74, 42, 0.14), transparent 28%),
    radial-gradient(circle at right 10% top 20%, rgba(31, 111, 120, 0.16), transparent 25%),
    linear-gradient(180deg, #f8f1e5 0%, var(--bg) 100%);
  font-family: "Noto Sans TC", "PingFang TC", sans-serif;
}

body.home-page {
  background:
    linear-gradient(90deg, rgba(31, 111, 120, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, #f7f8f2 0%, #eef5f2 48%, var(--bg) 100%);
  background-size: 72px 100%, auto;
}

a {
  color: inherit;
}

img,
svg,
video,
canvas,
table {
  max-width: 100%;
}

.home-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 72px;
}

.home-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.home-brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  font-size: 1.08rem;
}

.home-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.home-badges span,
.home-hero-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 11px;
  color: #26434a;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(49, 93, 100, 0.18);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 800;
}

.home-hero {
  position: relative;
  min-height: calc(100vh - 250px);
  display: grid;
  grid-template-columns: minmax(0, 0.96fr) minmax(340px, 0.86fr);
  gap: 42px;
  align-items: center;
  padding: 42px 0 34px;
  color: var(--ink);
  border-bottom: 1px solid rgba(49, 93, 100, 0.18);
  isolation: isolate;
}

.home-hero::after {
  display: none;
}

.home-copy {
  position: relative;
  z-index: 2;
  max-width: 650px;
}

.home-copy h1 {
  margin: 10px 0 16px;
  max-width: 640px;
  font-size: 4.05rem;
  line-height: 1.08;
}

.home-copy .eyebrow {
  color: var(--accent);
  letter-spacing: 0;
}

.home-copy .lede {
  max-width: 620px;
  color: #4d5d66;
  font-size: 1.13rem;
  line-height: 1.85;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
}

.button-link.primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.button-link.secondary {
  color: #fff;
  background: var(--accent-2);
  border-color: var(--accent-2);
}

.button-link.ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(49, 93, 100, 0.2);
}

.home-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
}

.home-hero-meta span {
  color: #26434a;
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(49, 93, 100, 0.16);
  backdrop-filter: blur(10px);
}

.home-hero-meta strong {
  margin-right: 6px;
  color: var(--accent);
}

.home-preview {
  position: relative;
  z-index: 1;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(49, 93, 100, 0.16);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(31, 45, 48, 0.18);
}

.home-preview-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: #496066;
  background: #eef5f2;
  border-bottom: 1px solid rgba(49, 93, 100, 0.13);
  font-size: 0.9rem;
  font-weight: 800;
}

.home-preview-body {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.home-preview-kicker {
  margin: 0;
  color: var(--accent-2);
  font-size: 0.9rem;
  font-weight: 900;
}

.home-preview h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1.5;
}

.home-preview img {
  display: block;
  width: 100%;
  background: #fff;
  border: 1px solid rgba(93, 81, 66, 0.14);
  border-radius: 8px;
}

.home-preview-answer {
  padding: 14px;
  background: #fff8ee;
  border: 1px solid rgba(178, 74, 42, 0.16);
  border-radius: 8px;
}

.home-preview-answer span {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 900;
}

.home-preview-answer p {
  margin: 6px 0 0;
  color: #485963;
  line-height: 1.7;
}

.home-figure {
  margin: 0;
  background: var(--panel);
  border: 1px solid rgba(93, 81, 66, 0.14);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.home-figure img {
  display: block;
  width: 100%;
  max-height: 440px;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
}

.home-figure figcaption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.home-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.home-stats div {
  padding: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(49, 93, 100, 0.14);
  border-radius: 8px;
}

.home-stats strong,
.home-stats span {
  display: block;
}

.home-stats strong {
  font-size: 1.65rem;
  line-height: 1;
}

.home-stats span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.home-modes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.home-mode-card {
  display: grid;
  gap: 10px;
  min-height: 132px;
  padding: 20px;
  color: var(--ink);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(49, 93, 100, 0.14);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(43, 38, 31, 0.08);
}

.home-mode-card span {
  color: var(--accent-2);
  font-weight: 900;
}

.home-mode-card strong {
  font-size: 1.04rem;
  line-height: 1.65;
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 20px 72px;
}

.hero h1 {
  margin: 8px 0 12px;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  letter-spacing: 0;
  text-transform: uppercase;
  font-weight: 700;
}

.lede {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.05rem;
}

.controls,
.board,
.card,
.guide {
  border: 1px solid rgba(93, 81, 66, 0.12);
  box-shadow: var(--shadow);
}

.controls {
  margin-top: 28px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  background: rgba(255, 250, 242, 0.92);
  padding: 20px;
  border-radius: 8px;
  backdrop-filter: blur(12px);
}

label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

select,
button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 1rem;
  background: #fff;
}

select {
  width: 100%;
  color: var(--ink);
  appearance: auto;
}

select:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.actions {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  cursor: pointer;
  color: #fff;
  background: var(--accent);
}

button.secondary {
  background: var(--accent-2);
}

button.ghost {
  color: var(--ink);
  background: #f7efe3;
}

.control-hint {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.board {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
  border: none;
  box-shadow: none;
}

.guide,
.card {
  background: var(--panel);
  border-radius: 8px;
  padding: 24px;
  min-width: 0;
}

.guide h2,
.card h2 {
  margin-top: 0;
}

.guide p,
.guide li {
  color: var(--muted);
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--accent);
  font-weight: 700;
}

.images {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 20px 0;
}

.images img,
.inline-image {
  max-width: min(100%, 480px);
  max-height: 320px;
  width: auto;
  height: auto;
  border-radius: 8px;
  background: transparent;
  object-fit: contain;
}

.image-block {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  gap: 4px;
  position: relative;
}

.img-desc {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  min-width: min(320px, 86vw);
  max-width: min(560px, 90vw);
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
  font-size: 0.9rem;
  font-style: normal;
  line-height: 1.65;
  padding: 10px 12px;
  border: 1px solid rgba(93, 81, 66, 0.18);
  border-radius: 8px;
  box-shadow: 0 14px 44px rgba(31, 41, 51, 0.18);
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 10;
}

.img-desc .katex-display {
  margin: 4px 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.img-desc .katex {
  font-size: 1em;
}

.image-block:hover .img-desc {
  opacity: 1;
}

.md-table {
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 0.9rem;
  display: block;
  overflow-x: auto;
  max-width: 100%;
}
.md-table th,
.md-table td {
  border: 1px solid var(--line);
  padding: 4px 10px;
  text-align: left;
}
.md-table thead th {
  background: var(--line);
  font-weight: 600;
}

.math-error {
  color: var(--accent);
  font-size: 0.85em;
}

.practical-formula {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}

.practical-formula .katex-display {
  margin: 4px 0;
}

.practical-formula .katex,
.lesson-section .katex {
  max-width: 100%;
}

.practical-formula .katex-mathml,
.lesson-section .katex-mathml {
  width: 0;
  max-width: 0;
  overflow: hidden;
}

.lesson-section li,
.practical-content-block,
.practical-study-note {
  overflow-wrap: anywhere;
}

.options {
  display: grid;
  gap: 12px;
  padding-left: 0;
  list-style: none;
}

.options li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.options li > span:last-child,
.review-options li > span:last-child,
.opt-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.option-label {
  color: var(--accent);
  font-weight: 800;
}

.answer {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: 8px;
  background: rgba(31, 111, 120, 0.1);
  color: #16454a;
}

.explanation {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(31, 111, 120, 0.22);
}

.explanation h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 1rem;
}

.explanation p {
  margin: 8px 0;
  line-height: 1.7;
}

.explanation ul {
  margin: 8px 0 0;
  padding-left: 1.2rem;
}

.explanation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.hidden {
  display: none;
}

.practical-shell {
  max-width: 1280px;
}

.practical-hero {
  padding-bottom: 12px;
}

.practical-controls {
  margin-top: 24px;
  display: flex;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px;
  background: rgba(255, 250, 242, 0.94);
  border: 1px solid rgba(93, 81, 66, 0.12);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.practical-controls label {
  min-width: min(220px, 100%);
}

.practical-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.practical-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-2);
}

.practical-list {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.practical-item {
  min-width: 0;
  padding: 22px;
  background: var(--panel);
  border: 1px solid rgba(93, 81, 66, 0.12);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(43, 38, 31, 0.08);
}

.practical-item-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.practical-item h2 {
  margin: 6px 0 0;
  font-size: 1.45rem;
  line-height: 1.35;
}

.practical-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.practical-meta span {
  padding: 6px 9px;
  background: #fff;
  border: 1px solid rgba(93, 81, 66, 0.12);
  border-radius: 8px;
}

.practical-item details {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(93, 81, 66, 0.12);
  border-radius: 8px;
}

.practical-item summary {
  cursor: pointer;
  color: var(--accent-2);
  font-weight: 900;
}

.practical-pages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 14px;
  margin-top: 14px;
}

.practical-pages figure,
.practical-page-image figure {
  margin: 0;
  min-width: 0;
  padding: 10px;
  background: #fff;
  border: 1px solid rgba(93, 81, 66, 0.12);
  border-radius: 8px;
}

.practical-pages img,
.practical-page-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.practical-pages figcaption,
.practical-page-image figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.practical-page-list {
  display: grid;
  gap: 16px;
  margin-top: 14px;
}

.practical-page-card {
  padding: 14px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(93, 81, 66, 0.12);
  border-radius: 8px;
}

.practical-page-content {
  min-width: 0;
}

.practical-page-content h3 {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 1.08rem;
}

.practical-page-content details {
  margin-top: 10px;
  background: #fffaf2;
}

.lesson-page {
  display: grid;
  gap: 14px;
}

.lesson-header {
  min-width: 0;
  padding: 16px;
  background: #fff;
  border: 1px solid rgba(93, 81, 66, 0.12);
  border-radius: 8px;
}

.lesson-header h3 {
  margin: 8px 0;
  color: var(--ink);
  font-size: 1.28rem;
}

.lesson-header p {
  margin: 0;
  color: var(--muted);
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 12px;
}

.lesson-section-primary {
  background: #fff;
}

.lesson-section {
  min-width: 0;
  padding: 14px;
  background: #fffaf2;
  border: 1px solid rgba(93, 81, 66, 0.1);
  border-radius: 8px;
}

.lesson-section h4 {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 1rem;
}

.lesson-section ul {
  margin: 8px 0 0;
  padding-left: 1.2rem;
}

.debug-details {
  opacity: 0.88;
}

.practical-page-nav {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  padding: 10px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  background: rgba(250, 246, 238, 0.94);
  border: 1px solid rgba(93, 81, 66, 0.12);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(83, 67, 46, 0.08);
}

.practical-page-nav a {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  color: var(--accent-2);
  text-decoration: none;
  white-space: nowrap;
  background: #fff;
  border: 1px solid rgba(93, 81, 66, 0.14);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 900;
}

.practical-page-nav a:hover,
.practical-page-nav a:focus-visible {
  color: #fff;
  background: var(--accent-2);
}

.practical-page-nav span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  font-size: 0.78rem;
}

.practical-page-section {
  margin-top: 10px;
}

.practical-page-section > strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-2);
}

.practical-table {
  width: 100%;
  background: #fff;
}

.practical-block-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.practical-content-block {
  min-width: 0;
  padding: 12px;
  background: #fff;
  border: 1px solid rgba(93, 81, 66, 0.12);
  border-radius: 8px;
}

.practical-content-block h4,
.practical-block-explanation h4 {
  margin: 4px 0 8px;
  color: var(--ink);
  font-size: 1rem;
}

.practical-block-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  color: #fff;
  background: var(--accent-2);
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 900;
}

.practical-inline-assets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(620px, 100%), 1fr));
  gap: 14px;
  margin-top: 12px;
}

.practical-inline-assets figure {
  margin: 0;
  padding: 10px;
  background: #fffaf2;
  border: 1px solid rgba(93, 81, 66, 0.12);
  border-radius: 8px;
}

.practical-asset-button {
  display: block;
  width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: zoom-in;
}

.practical-inline-assets img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(86vh, 1100px);
  object-fit: contain;
}

.asset-lightbox[hidden] {
  display: none;
}

.asset-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 21, 18, 0.82);
}

.asset-lightbox figure {
  margin: 0;
  max-width: min(96vw, 1800px);
  max-height: 92vh;
  overflow: auto;
  padding: 14px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

.asset-lightbox img {
  display: block;
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
}

.asset-lightbox figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.asset-lightbox-close {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 1001;
  width: 44px;
  height: 44px;
  padding: 0;
  color: #fff;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
}

.lightbox-open {
  overflow: hidden;
}

.practical-study-note {
  color: #315b61;
  font-weight: 700;
}

.practical-block-explanation {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(93, 81, 66, 0.12);
}

.practical-ai-block {
  margin-top: 12px;
  line-height: 1.75;
}

.practical-ai-block ul {
  margin: 8px 0 0;
  padding-left: 1.2rem;
}

.practical-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 12px;
  margin-top: 12px;
}

.practical-mini-grid > div,
.practical-subitem {
  min-width: 0;
  padding: 12px;
  background: #fffaf2;
  border: 1px solid rgba(93, 81, 66, 0.1);
  border-radius: 8px;
}

.practical-mini-grid strong,
.practical-subitem h4 {
  display: block;
  margin: 0 0 8px;
  color: var(--accent);
}

.crop-controls {
  align-items: end;
}

.crop-review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}

.crop-page-panel,
.crop-side-panel {
  min-width: 0;
  padding: 14px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(93, 81, 66, 0.12);
  border-radius: 8px;
}

.crop-page-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 10px 12px;
  color: #fff;
  background: #1f2933;
  border-radius: 8px;
  font-weight: 900;
}

.crop-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.crop-page-toolbar button,
.crop-page-quicknav button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 10px;
  color: #1f2933;
  background: #fff;
  border: 0;
  border-radius: 8px;
  font-weight: 900;
}

.crop-page-toolbar button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.crop-page-quicknav {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  padding: 8px;
  overflow-x: auto;
  background: #fffaf2;
  border: 1px solid rgba(93, 81, 66, 0.12);
  border-radius: 8px;
}

.crop-page-quicknav button {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-width: 48px;
  justify-content: center;
  border: 1px solid rgba(93, 81, 66, 0.16);
}

.crop-page-quicknav button.is-active {
  color: #fff;
  background: var(--accent);
}

.crop-page-quicknav span {
  min-width: 18px;
  padding: 1px 5px;
  color: #fff;
  background: var(--accent-2);
  border-radius: 999px;
  font-size: 0.76rem;
}

.crop-page-stage {
  position: relative;
  min-height: 280px;
  overflow: auto;
  background: #fff;
  border: 1px solid rgba(93, 81, 66, 0.12);
  border-radius: 8px;
}

.crop-type-review {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px;
  background: #fff;
  border: 1px solid rgba(93, 81, 66, 0.12);
  border-radius: 8px;
}

.crop-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  max-height: 58vh;
  overflow: auto;
}

.crop-type-page {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  background: #fffaf2;
  border: 1px solid rgba(93, 81, 66, 0.14);
  border-radius: 8px;
}

.crop-type-page header {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.crop-type-page header button {
  min-height: 32px;
  padding: 5px 9px;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  font-weight: 900;
}

.crop-type-page header span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.crop-type-page-thumb {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: #fff;
  border: 1px solid rgba(93, 81, 66, 0.1);
  border-radius: 6px;
}

.crop-type-assets {
  display: grid;
  gap: 8px;
}

.crop-type-asset {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: #fff;
  border: 1px solid rgba(93, 81, 66, 0.12);
  border-radius: 8px;
}

.crop-type-asset img {
  width: 76px;
  height: 76px;
  object-fit: contain;
  background: #fffaf2;
  border: 1px solid rgba(93, 81, 66, 0.1);
}

.crop-type-asset div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.crop-type-asset strong,
.crop-type-asset small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.crop-type-asset small {
  color: var(--muted);
  font-size: 0.78rem;
}

.crop-type-asset select,
.crop-type-field select {
  width: 100%;
  min-height: 34px;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(93, 81, 66, 0.2);
  border-radius: 8px;
}

.crop-page-canvas {
  position: relative;
  width: 100%;
  background: #fff;
}

.crop-page-canvas img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
}

.crop-page-canvas svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  touch-action: none;
}

.crop-box rect:first-child {
  fill: rgba(255, 214, 0, 0.22);
  stroke: #0057ff;
  stroke-width: 4;
  stroke-dasharray: 10 5;
  vector-effect: non-scaling-stroke;
  cursor: move;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 5px rgba(0, 87, 255, 0.55));
}

.crop-box text {
  fill: #fff;
  paint-order: stroke;
  stroke: #1f2933;
  stroke-width: 5px;
  font-size: 14px;
  font-weight: 900;
  pointer-events: none;
}

.crop-box.is-active rect:first-child {
  fill: rgba(255, 45, 0, 0.24);
  stroke: #ff2d00;
  stroke-width: 5;
  stroke-dasharray: none;
}

.crop-handle {
  fill: #ff2d00;
  stroke: #fff;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.5));
}

.crop-side-panel {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.crop-side-panel h2 {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 1rem;
}

.crop-asset-list {
  display: grid;
  gap: 10px;
}

.crop-asset-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  width: 100%;
  padding: 8px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid rgba(93, 81, 66, 0.14);
  border-radius: 8px;
}

.crop-asset-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(178, 74, 42, 0.14);
}

.crop-asset-card img {
  grid-row: span 3;
  width: 96px;
  max-height: 96px;
  object-fit: contain;
  background: #fffaf2;
  border: 1px solid rgba(93, 81, 66, 0.1);
}

.crop-asset-card strong,
.crop-asset-card small,
.crop-asset-card span {
  min-width: 0;
}

.crop-asset-card small,
.crop-asset-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.crop-editor {
  display: grid;
  gap: 10px;
}

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

.crop-fields label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.crop-fields input,
.crop-patch-output {
  width: 100%;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(93, 81, 66, 0.2);
  border-radius: 8px;
}

.crop-fields input {
  min-height: 38px;
  padding: 6px 8px;
}

.crop-patch-output {
  min-height: 180px;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.82rem;
  resize: vertical;
}

.empty-note {
  color: var(--muted);
}

@media (max-width: 900px) {
  .home-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .home-badges {
    justify-content: flex-start;
  }

  .home-hero {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 38px 24px;
  }

  .home-copy,
  .home-preview {
    grid-column: 1;
    grid-row: auto;
  }

  .home-copy h1 {
    font-size: 3.4rem;
  }

  .home-preview {
    max-width: 640px;
  }

  .home-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-modes {
    grid-template-columns: 1fr;
  }

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

  .practical-item-header {
    flex-direction: column;
  }

  .practical-meta {
    justify-content: flex-start;
  }

  .practical-page-card {
    grid-template-columns: 1fr;
  }

  .crop-review-layout {
    grid-template-columns: 1fr;
  }

  .crop-side-panel {
    position: static;
    max-height: none;
  }

  .crop-page-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .crop-toolbar-actions {
    justify-content: stretch;
  }

  .crop-toolbar-actions button {
    flex: 1 1 auto;
  }
}

@media (max-width: 560px) {
  .home-shell,
  .shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .home-actions,
  .actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .button-link,
  .actions button {
    width: 100%;
  }

  .home-hero {
    padding: 30px 16px;
  }

  .home-copy h1 {
    font-size: 2.48rem;
  }

  .home-copy .lede {
    font-size: 1rem;
  }

  .home-preview-body {
    padding: 16px;
  }

  .home-preview h2 {
    font-size: 1.12rem;
  }

  .img-desc {
    left: 0;
    transform: none;
    min-width: min(280px, 88vw);
    max-width: 88vw;
  }

  .home-stats {
    grid-template-columns: 1fr;
  }

  .controls,
  .guide,
  .card {
    padding: 16px;
  }

  .meta {
    flex-direction: column;
  }

  .options li {
    grid-template-columns: 30px minmax(0, 1fr);
    padding: 12px;
  }
}
