:root {
  --ink: #102c35;
  --ink-2: #31515a;
  --paper: #f3f0e7;
  --paper-2: #e7e2d5;
  --cream: #fffdf7;
  --amber: #f4b942;
  --amber-soft: #ffe8a8;
  --red: #e95f4f;
  --cyan: #21a7a5;
  --blue: #3974b9;
  --line: rgba(16, 44, 53, .16);
  --shadow: 0 22px 60px rgba(16, 44, 53, .11);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(16,44,53,.035) 1px, transparent 1px),
    var(--paper);
  background-size: 100% 32px;
  font-family: "Aptos", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
}
button, textarea, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, textarea:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 10px clamp(18px, 5vw, 72px);
  color: #eef8f7;
  background: rgba(16,44,53,.96);
  border-bottom: 1px solid rgba(255,255,255,.13);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-weight: 800; letter-spacing: .08em; }
.brand-mark { display: flex; flex-direction: column; gap: 4px; width: 30px; }
.brand-mark i { display: block; height: 3px; background: var(--amber); border-radius: 2px; }
.brand-mark i:nth-child(2) { width: 72%; }
.brand-mark i:nth-child(3) { width: 88%; }
.top-links { display: flex; gap: clamp(12px, 2vw, 30px); }
.top-links a { color: rgba(255,255,255,.75); font-size: 13px; font-weight: 750; text-decoration: none; }
.top-links a:hover { color: var(--amber); }

main { width: min(1320px, calc(100% - 36px)); margin: 0 auto; }
.access-page { max-width: 1160px; }
.access-hero { display: grid; grid-template-columns: minmax(0, 1fr) 270px; align-items: stretch; gap: clamp(25px, 5vw, 70px); padding: clamp(46px, 6vw, 86px) 0 30px; }
.access-hero > div > p:last-child { max-width: 650px; margin: 22px 0 0; color: var(--ink-2); font-size: 17px; }
.demo-entry { display: flex; flex-direction: column; justify-content: space-between; min-height: 200px; padding: 24px; color: #fff; background: var(--red); border-radius: 4px 22px 4px 4px; text-decoration: none; box-shadow: 0 13px 0 #ac4035; transition: transform .15s ease; }
.demo-entry:hover { transform: translateY(-4px); }
.demo-entry span { font-size: 14px; font-weight: 800; }
.demo-entry strong { font-family: Georgia, serif; font-size: 46px; letter-spacing: .04em; line-height: 1; }
.demo-entry small { font-weight: 800; }
.study-intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: clamp(38px, 5vw, 64px) 0 27px; }
.study-intro h1 { font-size: clamp(35px, 4.2vw, 56px); }
.study-intro > p { max-width: 340px; margin: 0; color: var(--ink-2); font-size: 14px; text-align: right; }
.intro {
  display: grid;
  grid-template-columns: 1.35fr .65fr;
  align-items: end;
  gap: 44px;
  padding: clamp(38px, 5vw, 64px) 0 26px;
}
.kicker, .card-kicker { margin: 0 0 12px; color: var(--cyan); font-size: 13px; font-weight: 900; letter-spacing: .2em; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Songti SC", "STSong", Georgia, serif; }
h1 { margin-bottom: 0; font-size: clamp(40px, 5vw, 68px); line-height: 1.04; letter-spacing: -.045em; }
h1 em { color: var(--red); font-style: normal; }
.intro-copy { margin: 0 0 8px; padding-left: 20px; color: var(--ink-2); border-left: 3px solid var(--amber); font-size: 17px; }

.entrances { padding: 22px 0 46px; scroll-margin-top: 85px; }
.entrances-head { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 19px; }
.entrances-head h2 { margin: 0; font-size: clamp(28px, 3.4vw, 42px); line-height: 1.1; }
.entrances-head > p { max-width: 400px; margin: 0; color: var(--ink-2); font-size: 14px; }
.entrance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.entrance-card { display: flex; flex-direction: column; align-items: stretch; min-height: 252px; padding: clamp(22px, 3vw, 35px); border: 1px solid var(--line); border-radius: 4px 22px 4px 4px; text-align: left; box-shadow: 0 14px 36px rgba(16,44,53,.09); transition: transform .2s, box-shadow .2s; }
.entrance-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.entrance-overseas { color: #fff; background: var(--ink); }
.entrance-gaokao { color: var(--ink); background: var(--amber-soft); }
.entrance-top, .entrance-bottom { display: flex; justify-content: space-between; align-items: center; }
.entrance-top { margin-bottom: 22px; opacity: .75; font-family: Georgia, serif; font-size: 12px; letter-spacing: .12em; }
.entrance-top > span { font-size: 22px; line-height: 1; }
.entrance-card > strong { margin-bottom: 10px; font-family: "Songti SC", "STSong", Georgia, serif; font-size: clamp(30px, 3.3vw, 44px); line-height: 1.1; }
.entrance-description { max-width: 480px; opacity: .83; font-size: 15px; }
.entrance-bottom { gap: 10px; margin-top: auto; padding-top: 24px; font-size: 13px; font-weight: 900; }
.entrance-bottom > span { font-size: 22px; }
.demo-note { display: flex; align-items: baseline; gap: 12px; margin: 16px 0 0; color: var(--ink-2); font-size: 13px; }
.demo-note span { flex: 0 0 auto; color: #9a443b; font-weight: 900; }
.workbench, .results, .practice { scroll-margin-top: 80px; }

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  overflow: hidden;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 4px 28px 4px 4px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.input-column { min-width: 0; padding: clamp(24px, 3vw, 40px); }
.section-label { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-weight: 850; }
.section-label span { display: grid; place-items: center; width: 28px; height: 28px; color: var(--cream); background: var(--ink); border-radius: 50%; font-size: 12px; }
.sentence-label { margin-top: 30px; }
.mode-switch { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 17px 19px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
  transition: .2s ease;
}
.mode-btn strong { font-size: 17px; }
.mode-btn small { color: var(--ink-2); font-size: 13px; }
.mode-btn.active { color: #fff; background: var(--ink); border-color: var(--ink); transform: translateY(-2px); }
.mode-btn.active small { color: rgba(255,255,255,.72); }
.editor-shell { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
textarea { width: 100%; max-width: 100%; min-height: 140px; padding: 18px 22px; resize: vertical; overflow-wrap: anywhere; white-space: pre-wrap; color: var(--ink); background: transparent; border: 0; font-family: Georgia, "Times New Roman", serif; font-size: 19px; line-height: 1.65; }
.editor-footer { display: flex; justify-content: space-between; padding: 10px 16px; color: var(--ink-2); background: rgba(16,44,53,.045); border-top: 1px solid var(--line); font-size: 13px; }
.editor-actions { display: flex; align-items: center; gap: 8px; }
.image-ocr-btn { padding: 4px 10px; color: var(--ink); background: var(--cream); border: 1px solid rgba(16,44,53,.22); border-radius: 7px; font-size: 13px; font-weight: 800; }
.image-ocr-btn:hover { background: var(--amber-soft); }
.image-ocr-btn:disabled { opacity: .6; cursor: wait; }
.image-ocr-hint { margin: 8px 4px 0; color: var(--ink-2); font-size: 12px; line-height: 1.5; }
.image-ocr-message { min-height: 20px; margin: 5px 4px 0; color: var(--ink-2); font-size: 13px; line-height: 1.5; }
.image-ocr-message[data-state="error"] { color: #a43e33; }
.image-ocr-message[data-state="success"] { color: #287468; }
.clear-btn { padding: 0; color: var(--ink-2); background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; }
.sample-row { display: flex; align-items: flex-start; gap: 12px; margin: 16px 0 22px; color: var(--ink-2); font-size: 13px; }
.sample-row > span { flex: 0 0 auto; padding-top: 5px; }
#sampleButtons { display: flex; flex-wrap: wrap; gap: 8px; }
.sample-btn { padding: 5px 10px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 999px; }
.sample-btn:hover { background: var(--amber-soft); }
.analyze-btn { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 16px 19px; color: #fff; background: var(--red); border: 0; border-radius: 10px; font-weight: 900; box-shadow: 0 9px 0 #aa3e34; transition: .15s ease; }
.analyze-btn:hover { transform: translateY(-2px); box-shadow: 0 11px 0 #aa3e34; }
.analyze-btn:active { transform: translateY(6px); box-shadow: 0 3px 0 #aa3e34; }
.analyze-btn svg { width: 24px; fill: none; stroke: currentColor; stroke-width: 2; }

.mode-guide { position: relative; padding: 36px 30px; color: #ecf6f4; background: var(--ink); }
.mode-guide::after { content: ""; position: absolute; right: -34px; bottom: -34px; width: 150px; height: 150px; border: 34px solid rgba(244,185,66,.13); border-radius: 50%; }
.guide-index { display: inline-block; margin-bottom: 30px; color: var(--amber); font-family: Georgia, serif; font-size: 13px; letter-spacing: .2em; }
.mode-guide h2 { margin-bottom: 24px; font-size: 29px; line-height: 1.15; }
.mode-guide ol { display: grid; gap: 18px; margin: 0; padding: 0; list-style: none; counter-reset: guide; }
.mode-guide li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; color: rgba(255,255,255,.82); }
.mode-guide li::before { counter-increment: guide; content: "0" counter(guide); color: var(--amber); font-weight: 900; }
.guide-rule { width: 42px; height: 3px; margin: 34px 0 18px; background: var(--red); }
.mode-guide p { position: relative; z-index: 1; color: rgba(255,255,255,.64); font-size: 14px; }

.results { padding: clamp(70px, 9vw, 124px) 0 30px; }
.results-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 24px; }
.results-head h2, .practice h2 { margin-bottom: 0; font-size: clamp(36px, 5vw, 58px); line-height: 1; }
.result-head-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: end; gap: 12px; }
.result-view-switch { display: flex; gap: 4px; padding: 4px; background: var(--paper-2); border-radius: 10px; }
.result-view-btn { padding: 8px 14px; color: var(--ink-2); background: transparent; border: 0; border-radius: 7px; font-size: 14px; font-weight: 800; white-space: nowrap; }
.result-view-btn.active { color: #fff; background: var(--ink); }
.result-view-btn:disabled { opacity: .45; cursor: not-allowed; }
.status-pill { padding: 7px 12px; color: var(--ink); background: var(--amber-soft); border: 1px solid rgba(244,185,66,.6); border-radius: 99px; font-size: 13px; font-weight: 800; }
.overview-card { margin-bottom: 18px; padding: clamp(24px, 4vw, 46px); background: var(--cream); border: 1px solid var(--line); border-radius: 4px 24px 4px 4px; box-shadow: var(--shadow); }
.overview-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 34px; }
.overview-heading h3 { margin: 0; font-size: clamp(26px, 3vw, 36px); line-height: 1.15; }
.overview-heading > p { max-width: 270px; margin: 0; color: var(--ink-2); font-size: 14px; }
.overview-root { position: relative; display: grid; justify-items: center; gap: 1px; width: min(320px, 100%); margin: 0 auto; padding: 10px 18px; color: #fff; background: var(--ink); border-radius: 9px; text-align: center; }
.overview-root span { color: var(--amber); font-size: 13px; font-weight: 900; letter-spacing: .16em; }
.overview-root b { font-size: 16px; }
.overview-root::after { content: ""; position: absolute; top: 100%; left: 50%; height: 25px; border-left: 2px solid var(--ink-2); }
.overview-branches { position: relative; display: grid; grid-template-columns: .9fr 1.05fr 1.4fr; align-items: start; gap: 16px; margin-top: 24px; padding-top: 25px; }
.overview-branches::before { content: ""; position: absolute; top: 0; left: 16%; right: 16%; border-top: 2px solid var(--ink-2); }
.overview-branch { position: relative; min-width: 0; min-height: 154px; padding: 19px; background: var(--paper); border-top: 5px solid var(--cyan); border-radius: 11px; }
.overview-branch::before { content: ""; position: absolute; bottom: 100%; left: 50%; height: 25px; border-left: 2px solid var(--ink-2); }
.overview-subject { border-color: var(--red); }
.overview-predicate { border-color: var(--blue); }
.overview-role { display: block; margin-bottom: 11px; color: var(--ink-2); font-size: 13px; font-weight: 900; letter-spacing: .08em; }
.overview-branch strong { display: block; overflow-wrap: anywhere; font-family: Georgia, "Times New Roman", serif; font-size: clamp(19px, 2.2vw, 28px); line-height: 1.18; }
.overview-children { display: grid; gap: 7px; margin: 16px 0 0 2px; padding-left: 13px; border-left: 2px solid rgba(16,44,53,.35); }
.overview-child { position: relative; min-width: 0; overflow-wrap: anywhere; padding: 2px 0 2px 7px; color: var(--ink-2); font-size: 14px; font-weight: 750; line-height: 1.45; }
.overview-child::before { content: ""; position: absolute; top: 13px; left: -13px; width: 13px; border-top: 2px solid rgba(16,44,53,.35); }
.overview-child .overview-children { margin-top: 9px; padding-left: 10px; }
.overview-child .overview-child::before { left: -10px; width: 10px; }
.visual-tree-card {
  margin-bottom: 18px;
  padding: clamp(24px, 4vw, 46px);
  color: #f7fbfa;
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
    var(--ink);
  background-size: 24px 24px;
  border-radius: 4px 24px 4px 4px;
  box-shadow: var(--shadow);
}
.tree-card-head { display: grid; grid-template-columns: 1fr minmax(260px, .6fr); gap: 30px; align-items: end; }
.tree-card-head h3 { margin: 0; font-size: clamp(24px, 3vw, 34px); line-height: 1.2; }
.tree-card-head > p { margin: 0; color: rgba(255,255,255,.63); font-size: 14px; }
.visual-tree-card .card-kicker { color: var(--amber); }
.syntax-tree-scroll { overflow-x: auto; padding: 34px 2px 8px; scrollbar-color: var(--amber) rgba(255,255,255,.1); }
.syntax-tree { min-width: 930px; }
.tree-root-wrap { display: grid; justify-items: center; }
.syntax-node {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 16px;
  color: var(--ink);
  background: #fffdf7;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,.16);
}
.syntax-node.root-node { width: min(620px, 78%); padding: 19px 22px; border-top: 5px solid var(--amber); text-align: center; }
.node-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.node-level { flex: 0 0 auto; padding: 3px 8px; color: #fff; background: var(--ink); border-radius: 999px; font-family: Georgia, serif; font-size: 12px; font-weight: 900; }
.node-relation { color: var(--red); font-size: 13px; font-weight: 900; }
.node-text { margin: 0 0 12px; font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1.45; }
.root-node .node-text { margin-bottom: 0; font-size: 18px; }
.grammar-row { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 11px; border-top: 1px solid var(--line); }
.grammar-chip { padding: 5px 8px; border-radius: 6px; font-size: 12px; font-weight: 800; }
.grammar-chip.subject { color: #823128; background: rgba(233,95,79,.16); }
.grammar-chip.predicate { color: #20558f; background: rgba(57,116,185,.16); }
.grammar-chip.logic { color: #116968; background: rgba(33,167,165,.16); }
.grammar-chip.none { color: var(--ink-2); background: var(--paper-2); }
.tree-stem { width: 2px; height: 30px; background: rgba(244,185,66,.85); }
.tree-branches {
  --branch-count: 2;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--branch-count), minmax(220px, 1fr));
  gap: 22px;
  padding-top: 30px;
}
.tree-branches::before { content: ""; position: absolute; top: 0; left: calc(50% / var(--branch-count)); right: calc(50% / var(--branch-count)); height: 2px; background: rgba(244,185,66,.7); }
.tree-branch { position: relative; min-width: 0; }
.tree-branch::before { content: ""; position: absolute; z-index: 0; top: -30px; left: 50%; width: 2px; height: 30px; background: rgba(244,185,66,.7); }
.tree-branch.main-branch > .syntax-node { border-top: 5px solid var(--red); }
.tree-branch.clause-branch > .syntax-node { border-top: 5px solid var(--blue); }
.tree-branch.modifier-branch > .syntax-node { border-top: 5px solid var(--cyan); }
.node-children { display: grid; gap: 10px; margin: 16px 0 0 18px; padding-left: 18px; border-left: 2px solid rgba(244,185,66,.65); }
.node-child { position: relative; }
.node-child::before { content: ""; position: absolute; top: 26px; left: -18px; width: 18px; height: 2px; background: rgba(244,185,66,.65); }
.node-child .syntax-node { box-shadow: none; border: 1px solid rgba(16,44,53,.18); }
.tree-caption { margin: 18px 0 0; color: rgba(255,255,255,.58); font-size: 13px; text-align: center; }
.results.is-unavailable .overview-card, .results.is-unavailable .trunk-card, .results.is-unavailable .result-grid, .results.is-unavailable .reading-card { display: none; }
.unavailable-note { max-width: 720px; margin: 0 auto; padding: 24px; color: var(--ink); background: var(--cream); border-left: 5px solid var(--amber); border-radius: 4px 15px 4px 4px; }
.unavailable-note p:last-child { margin-bottom: 0; color: var(--ink-2); }
.unavailable-sentence { overflow-wrap: anywhere; font-family: Georgia, "Times New Roman", serif; font-size: 19px; }
.trunk-card, .reading-card { display: grid; grid-template-columns: 60px 1fr; gap: 24px; padding: clamp(26px, 4vw, 48px); background: var(--ink); color: #fff; border-radius: 4px 22px 4px 4px; }
.card-number { display: grid; place-items: center; align-self: start; width: 48px; height: 48px; color: var(--amber); border: 1px solid rgba(255,255,255,.3); border-radius: 50%; font-family: Georgia, serif; font-weight: 900; }
.trunk-card .card-kicker, .reading-card .card-kicker { color: var(--amber); }
.trunk-line { margin: 0 0 10px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(25px, 4vw, 42px); line-height: 1.25; }
.trunk-note { margin: 0; color: rgba(255,255,255,.66); }
.result-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; margin: 18px 0; }
.result-card { padding: clamp(24px, 3.5vw, 40px); background: var(--cream); border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(16,44,53,.06); }
.result-card h3, .reading-card h3 { margin-bottom: 24px; font-size: 26px; line-height: 1.2; }
.card-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.view-toggle { display: flex; flex: 0 0 auto; padding: 3px; background: var(--paper); border-radius: 8px; }
.view-btn { padding: 6px 10px; color: var(--ink-2); background: transparent; border: 0; border-radius: 6px; font-size: 13px; }
.view-btn.active { color: #fff; background: var(--ink); }
.annotated { min-height: 180px; padding: 24px 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(20px, 2.25vw, 28px); line-height: 1.9; }
.segment { padding: 3px 4px; border-bottom: 3px solid; border-radius: 4px 4px 0 0; transition: .25s ease; }
.segment[data-role="subject"], .segment[data-role="predicate"] { border-color: var(--red); background: rgba(233,95,79,.10); }
.segment[data-role="inner"], .segment[data-role="object"] { border-color: var(--blue); background: rgba(57,116,185,.10); }
.segment[data-role="outer"] { border-color: var(--cyan); background: rgba(33,167,165,.10); }
.segment[data-role="unknown"] { border-color: var(--amber); background: rgba(244,185,66,.13); }
.annotated[data-view="trunk"] .segment:not([data-role="subject"]):not([data-role="predicate"]) { opacity: .12; filter: grayscale(1); }
.trunk-fallback { display: none; border-bottom: 3px solid var(--red); background: rgba(233,95,79,.10); }
.annotated[data-view="trunk"][data-fallback="true"] .segment { display: none; }
.annotated[data-view="trunk"][data-fallback="true"] .trunk-fallback { display: inline; }
.legend { display: flex; flex-wrap: wrap; gap: 9px 16px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 18px; height: 4px; border-radius: 4px; }
.layer-tree { display: grid; gap: 12px; }
.layer-item { position: relative; padding: 14px 15px 14px 46px; background: var(--paper); border-left: 4px solid; border-radius: 0 10px 10px 0; }
.layer-item::before { content: attr(data-level); position: absolute; left: 12px; top: 15px; color: var(--ink-2); font-family: Georgia, serif; font-size: 12px; font-weight: 900; }
.layer-item strong { display: block; margin-bottom: 3px; }
.layer-item p { margin: 0; color: var(--ink-2); font-size: 14px; }
.layer-item.level-0 { border-color: var(--red); }
.layer-item.level-1 { margin-left: 18px; border-color: var(--blue); }
.layer-item.level-2 { margin-left: 36px; border-color: var(--cyan); }
.reading-card { background: var(--red); }
.reading-card .card-number { color: #fff; }
.reading-card .card-kicker { color: #fff3c5; }
.reading-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.reading-step { padding: 16px; background: rgba(255,255,255,.11); border: 1px solid rgba(255,255,255,.2); border-radius: 10px; }
.reading-step b { display: block; margin-bottom: 6px; color: #fff3c5; font-size: 13px; }
.reading-step p { margin: 0; color: rgba(255,255,255,.82); font-size: 14px; }
.meaning { margin: 20px 0 0; padding-top: 18px; color: #fff; border-top: 1px solid rgba(255,255,255,.25); }

.practice { display: grid; grid-template-columns: .7fr 1.3fr; gap: clamp(28px, 6vw, 80px); align-items: center; padding: clamp(70px, 10vw, 138px) 0; }
.practice-copy > p:last-child { margin-top: 22px; color: var(--ink-2); }
.quiz-card { padding: clamp(26px, 4vw, 46px); background: var(--cream); border: 1px solid var(--line); border-radius: 22px 4px 4px 4px; box-shadow: var(--shadow); }
.quiz-meta { display: flex; justify-content: space-between; margin-bottom: 22px; color: var(--ink-2); font-size: 13px; font-weight: 800; }
.quiz-meta span:first-child { color: var(--red); }
.quiz-sentence { font-family: Georgia, "Times New Roman", serif; font-size: 23px; line-height: 1.65; }
.quiz-options { display: grid; gap: 10px; }
.quiz-option { width: 100%; padding: 13px 15px; color: var(--ink); background: var(--paper); border: 1px solid transparent; border-radius: 9px; text-align: left; }
.quiz-option:hover { border-color: var(--ink); }
.quiz-option.correct { color: #fff; background: var(--cyan); }
.quiz-option.wrong { color: #fff; background: var(--red); }
.quiz-feedback { min-height: 26px; margin: 17px 0 0; color: var(--ink-2); font-size: 14px; }
.account-section { display: grid; grid-template-columns: 1fr; gap: 25px; align-items: start; padding: 34px 0 60px; scroll-margin-top: 90px; }
.account-heading h2 { margin: 0 0 18px; font-size: clamp(30px, 4vw, 50px); line-height: 1.12; }
.account-heading > p:last-child { max-width: 680px; color: var(--ink-2); }
.access-options { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 20px; align-items: stretch; }
.access-option-label { margin: 0 0 11px; color: #a54c3e; font-size: 12px; font-weight: 900; letter-spacing: .12em; }
.account-panel h3, .purchase-panel h3 { margin: 0 0 10px; font-size: clamp(23px, 2.5vw, 31px); line-height: 1.2; }
.access-option-copy { margin: 0 0 22px; color: var(--ink-2); font-size: 14px; }
.account-panel { padding: clamp(24px, 3vw, 38px); background: var(--cream); border: 1px solid var(--line); border-radius: 4px 22px 4px 4px; box-shadow: var(--shadow); }
.purchase-panel { display: flex; flex-direction: column; align-items: flex-start; padding: clamp(24px, 3vw, 38px); color: #fff; background: var(--ink); border-radius: 4px 22px 4px 4px; box-shadow: var(--shadow); }
.purchase-panel .access-option-label { color: var(--amber); }
.purchase-panel > p:not(.access-option-label):not(.purchase-caption) { max-width: 390px; margin: 0 0 18px; color: rgba(255,255,255,.82); font-size: 14px; line-height: 1.7; }
.purchase-price { display: flex; align-items: baseline; gap: 9px; margin: 6px 0 14px; color: var(--amber); }
.purchase-price strong { font-size: clamp(45px, 5vw, 66px); line-height: 1; }
.purchase-price span { font-weight: 800; }
.purchase-qr { display: block; width: min(100%, 225px); height: auto; margin-top: auto; padding: 7px; background: white; border-radius: 10px; }
.purchase-caption { margin: 9px 0 0; color: rgba(255,255,255,.75); font-size: 12px; }
.account-state { display: flex; align-items: flex-start; gap: 13px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.account-indicator { flex: 0 0 auto; width: 12px; height: 12px; margin-top: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 5px var(--amber-soft); }
.account-state.is-active .account-indicator { background: var(--cyan); box-shadow: 0 0 0 5px rgba(33,167,165,.14); }
.account-state strong { display: block; font-size: 19px; }
.account-state p { margin: 3px 0 0; color: var(--ink-2); font-size: 14px; }
.account-form { display: grid; grid-template-columns: 105px 1fr; gap: 12px 16px; align-items: center; margin-top: 24px; }
.account-form label { font-size: 14px; font-weight: 900; }
.account-form input { width: 100%; min-height: 47px; padding: 10px 13px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.account-form button { grid-column: 2; min-height: 47px; padding: 10px 18px; color: #fff; background: var(--ink); border: 0; border-radius: 8px; font-weight: 900; }
.account-form button:disabled { opacity: .6; cursor: wait; }
.enter-study { display: inline-block; margin-top: 18px; padding: 10px 16px; color: white; background: var(--red); border-radius: 8px; font-weight: 900; text-decoration: none; }
.analysis-message { min-height: 23px; margin: 14px 0 0; color: #a43e33; font-size: 14px; }
.analysis-history { padding: 48px 0 8px; }
.analysis-history h2 { margin: 0 0 18px; font-size: clamp(25px, 3vw, 38px); }
.analysis-history-list { display: grid; gap: 9px; }
.analysis-history-list button { display: flex; justify-content: space-between; gap: 20px; width: 100%; padding: 12px 15px; color: var(--ink); background: var(--cream); border: 1px solid var(--line); border-radius: 8px; text-align: left; }
.analysis-history-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.analysis-history-list time { flex: 0 0 auto; color: var(--ink-2); font-size: 12px; }
.account-message { grid-column: 2; min-height: 22px; margin: 0; color: #a43e33; font-size: 13px; }
.account-signed-in { padding-top: 18px; }
.account-signed-in p { margin-bottom: 12px; color: var(--ink-2); font-size: 14px; }
.account-signed-in button { padding: 8px 14px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 7px; font-weight: 800; }
.account-help { margin: 18px 0 0; padding-top: 15px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 13px; }
.practice-history { grid-column: 1 / -1; display: grid; grid-template-columns: .7fr 1.3fr; gap: 12px 40px; padding: 28px 32px; background: var(--paper-2); border-radius: 4px 18px 4px 4px; }
.practice-history h3 { margin: 0; font-size: 25px; }
.practice-history > p { align-self: end; margin: 0; color: var(--ink-2); font-weight: 800; }
.practice-history ol { grid-column: 1 / -1; display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.practice-history li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.practice-history li span:last-child { color: var(--ink-2); white-space: nowrap; }
.admin-main { width: min(760px, calc(100% - 32px)); padding: clamp(50px, 7vw, 90px) 0; }
.admin-main h1 { margin: 0 0 18px; }
.admin-intro { max-width: 640px; color: var(--ink-2); }
.admin-panel { margin-top: 28px; padding: clamp(22px, 4vw, 36px); background: var(--cream); border: 1px solid var(--line); border-radius: 4px 22px 4px 4px; box-shadow: var(--shadow); }
.admin-panel h2 { margin-bottom: 16px; }
.admin-form { display: grid; gap: 10px; }
.admin-form label { font-weight: 800; }
.admin-form input { min-height: 47px; padding: 10px 13px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.admin-form button { justify-self: start; min-height: 45px; margin-top: 5px; padding: 10px 18px; color: #fff; background: var(--ink); border: 0; border-radius: 8px; font-weight: 900; }
.admin-form button:disabled { opacity: .6; cursor: wait; }
.code-type-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.admin-form .code-type-actions .secondary-button { color: var(--ink); background: var(--paper); border: 1px solid var(--line); }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.secondary-button { padding: 8px 12px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 7px; font-size: 13px; font-weight: 800; }
.new-code { display: grid; justify-items: start; gap: 8px; margin: 25px 0; padding: 19px; background: var(--amber-soft); border-radius: 10px; }
.new-code span { font-size: 13px; }
.new-code strong { overflow-wrap: anywhere; font-family: monospace; font-size: clamp(16px, 3vw, 22px); letter-spacing: .06em; }
.admin-code-list { display: grid; gap: 0; }
.admin-code-list > div { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.admin-code-list > div span:first-child { flex: 1 1 230px; font-weight: 800; }
.admin-code-list > div span:nth-child(2) { color: var(--ink-2); }
.admin-message { min-height: 25px; margin-top: 18px; color: #a43e33; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 28px clamp(18px, 5vw, 72px); color: rgba(255,255,255,.66); background: var(--ink); font-size: 13px; }
footer p { margin: 0; }

@media (max-width: 900px) {
  .intro, .access-hero, .workbench, .result-grid, .practice, .account-section, .access-options { grid-template-columns: 1fr; }
  .study-intro { align-items: start; flex-direction: column; }
  .study-intro > p { text-align: left; }
  .entrances-head { align-items: start; flex-direction: column; gap: 8px; }
  .intro { gap: 22px; }
  .mode-guide { min-height: auto; }
  .guide-index { margin-bottom: 22px; }
  .mode-guide ol { grid-template-columns: repeat(3, 1fr); }
  .reading-steps { grid-template-columns: 1fr; }
  .tree-card-head { grid-template-columns: 1fr; gap: 12px; }
  .overview-heading { align-items: start; flex-direction: column; gap: 8px; }
  .overview-heading > p { max-width: none; }
  .overview-branches { grid-template-columns: 1fr; gap: 14px; margin: 19px 0 0 12px; padding: 0 0 0 20px; border-left: 2px solid var(--ink-2); }
  .overview-branches::before, .overview-root::after { display: none; }
  .overview-branch { min-height: 0; }
  .overview-branch::before { top: 24px; bottom: auto; left: -22px; width: 22px; height: 0; border-left: 0; border-top: 2px solid var(--ink-2); }
  .syntax-tree-scroll { padding: 20px 0 4px; overflow-x: visible; }
  .syntax-tree { min-width: 0; }
  .tree-root-wrap { justify-items: stretch; }
  .syntax-node.root-node { width: 100%; padding: 16px; text-align: left; }
  .root-node .node-text { font-size: 16px; }
  .tree-stem { height: 18px; margin-left: 18px; }
  .tree-branches { display: grid; grid-template-columns: 1fr; gap: 15px; padding-top: 0; }
  .tree-branches::before { display: none; }
  .tree-branch::before { top: -15px; left: 18px; height: 15px; }
  .node-children { margin-left: 8px; padding-left: 12px; }
  .node-child::before { left: -12px; width: 12px; }
  .syntax-node { padding: 13px; }
  .node-text { font-size: 15px; overflow-wrap: anywhere; }
}
@media (max-width: 620px) {
  main { width: min(100% - 22px, 1320px); }
  .top-links { gap: 12px; }
  .top-links a { font-size: 11px; }
  .intro { padding-top: 44px; }
  .entrance-grid { grid-template-columns: 1fr; gap: 10px; }
  .entrance-card { min-height: 220px; }
  .demo-note { display: block; }
  .demo-note span { margin-right: 8px; }
  .mode-switch, .mode-guide ol { grid-template-columns: 1fr; }
  .workbench { border-radius: 3px 18px 3px 3px; }
  .input-column, .mode-guide { padding: 24px 19px; }
  .sample-row { flex-direction: column; }
  .results-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .result-head-actions { justify-content: space-between; width: 100%; }
  .trunk-card, .reading-card { grid-template-columns: 1fr; gap: 10px; }
  .card-topline { flex-direction: column; }
  .visual-tree-card { margin-left: -11px; margin-right: -11px; padding: 24px 16px; border-radius: 0; }
  .overview-card { margin-left: -11px; margin-right: -11px; padding: 24px 16px; border-radius: 0; }
  .node-children { margin-left: 0; padding-left: 8px; }
  .node-child::before { left: -8px; width: 8px; }
  .syntax-node { padding: 10px; }
  .grammar-chip { font-size: 11px; }
  .annotated { font-size: 20px; }
  .practice { padding-top: 74px; }
  .account-section { padding-top: 18px; }
  .account-form { grid-template-columns: 1fr; }
  .account-form button, .account-message { grid-column: 1; }
  .practice-history { grid-template-columns: 1fr; padding: 22px 18px; }
  .practice-history ol { grid-column: 1; }
  .practice-history li { flex-direction: column; gap: 0; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
