:root {
  color-scheme: dark;
  --bg: #08090c;
  --surface: #101218;
  --surface-strong: #151820;
  --ink: #f3f5f8;
  --muted: #969da9;
  --faint: #242832;
  --line: #303641;
  --accent: #8cb2ff;
  --accent-hover: #a9c6ff;
  --accent-soft: #182541;
  --orange: #ff8b4d;
  --green: #55d99b;
  --danger: #ff8f96;
  --shadow: 0 32px 80px rgba(0, 0, 0, 0.44);
  --radius-panel: 26px;
  --radius-control: 12px;
  font-family: "Outfit", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 18% -10%, rgba(84, 122, 255, .16), transparent 34rem),
    radial-gradient(circle at 92% 12%, rgba(255, 108, 64, .08), transparent 26rem),
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 74px 74px, 74px 74px, auto;
  color: var(--ink);
}

body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .22; background-image: radial-gradient(rgba(255,255,255,.3) .45px, transparent .45px); background-size: 5px 5px; }

button, input, select, textarea { font: inherit; }
button, summary, select { cursor: pointer; }
a { color: inherit; }

.site-header {
  min-height: 82px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 28px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  position: relative;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 780;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 13px;
  background: #111;
  box-shadow: 0 8px 28px rgba(112, 149, 255, .2);
  overflow: hidden;
  font-weight: 700;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-copy { display: grid; line-height: 1.05; }
.brand-copy strong { font-size: 15px; }
.brand-copy small { margin-top: 5px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }

nav { width: fit-content; display: flex; align-items: center; gap: 3px; padding: 4px; border: 1px solid rgba(255,255,255,.075); border-radius: 15px; background: rgba(15,17,23,.7); box-shadow: inset 0 1px 0 rgba(255,255,255,.035), 0 12px 34px rgba(0,0,0,.18); backdrop-filter: blur(16px); white-space: nowrap; }
nav { justify-self: center; }
nav a, nav .text-button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 8px 13px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 650; transition: color .2s ease, background .2s ease, transform .2s ease; }
nav a:hover, nav .text-button:hover { color: var(--ink); background: rgba(255,255,255,.055); }
nav a[aria-current="page"] { color: var(--ink); background: #222630; box-shadow: inset 0 1px 0 rgba(255,255,255,.07); }
nav .text-button { min-width: 42px; color: #9fbbff; }

main { max-width: 1400px; margin: 0 auto; padding: 34px 28px 80px; }

.intro { max-width: 780px; margin-bottom: 36px; }
.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.intro h1 { margin: 0; max-width: 820px; font-size: clamp(42px, 6.4vw, 86px); line-height: .98; letter-spacing: -0.065em; text-wrap: balance; }
.intro h1 span { color: transparent; background: linear-gradient(92deg, #f4f6fa 10%, #99baff 55%, #70e2b0); background-clip: text; -webkit-background-clip: text; }
.intro > p:last-child { margin: 18px 0 0; max-width: 650px; color: var(--muted); font-size: 17px; line-height: 1.7; }

.intro-stage { max-width: none; min-height: 440px; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(270px, .65fr); align-items: center; gap: 54px; margin-bottom: 50px; }
.intro-copy > p:last-of-type { max-width: 650px; margin: 22px 0 0; color: var(--muted); font-size: 17px; line-height: 1.7; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 25px; }
.hero-tags span { padding: 8px 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: rgba(255,255,255,.035); color: #c5cbd4; font-size: 11px; font-weight: 650; letter-spacing: .04em; }
.mascot-stage { --mx: 50%; --my: 58%; --tilt-x: 0deg; --tilt-y: 0deg; min-height: 350px; display: grid; place-items: center; position: relative; border: 0; border-radius: 38px; background: radial-gradient(circle at var(--mx) var(--my), rgba(104,151,255,.11), transparent 31%), radial-gradient(circle at 86% 15%, rgba(255,255,255,.075), transparent 22%), linear-gradient(155deg, rgba(255,255,255,.065), rgba(255,255,255,.018) 52%, rgba(53,73,121,.055)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.085), inset 0 1px 0 rgba(255,255,255,.09), 0 34px 80px rgba(0,0,0,.27); overflow: hidden; transition: box-shadow .35s ease, transform .35s cubic-bezier(.2,.8,.2,1); }
.mascot-stage:hover { box-shadow: inset 0 0 0 1px rgba(144,177,255,.18), inset 0 1px 0 rgba(255,255,255,.12), 0 44px 100px rgba(37,75,178,.24); transform: translateY(-3px); }
.mascot-stage::after { content: ""; position: absolute; width: 125%; height: 72%; left: -13%; bottom: -43%; border-radius: 50%; background: radial-gradient(ellipse at var(--mx) 42%, rgba(73,117,255,.9) 0, rgba(65,105,235,.52) 23%, transparent 54%), radial-gradient(ellipse at 68% 48%, rgba(91,202,182,.4) 0, transparent 46%); filter: blur(28px); opacity: .78; transform: rotate(-5deg); transition: opacity .35s ease; }
.mascot-stage:hover::after { opacity: .95; }
.mascot-stage::before { content: "4PIE"; position: absolute; inset: 27px auto auto 29px; color: rgba(255,255,255,.095); font-size: 34px; font-weight: 800; letter-spacing: .16em; }
.mascot-stage > img { width: min(68%, 250px); position: relative; z-index: 2; border-radius: 28%; filter: drop-shadow(0 28px 25px rgba(0,0,0,.42)); transform: perspective(720px) rotateX(var(--tilt-y)) rotateY(var(--tilt-x)); transition: transform .24s cubic-bezier(.2,.8,.2,1), filter .3s ease; will-change: transform; }
.mascot-stage:hover > img { filter: drop-shadow(0 34px 30px rgba(0,0,0,.5)) saturate(1.08); transform: perspective(720px) translateY(-8px) rotateX(var(--tilt-y)) rotateY(var(--tilt-x)) scale(1.035); }
.mascot-caption { position: absolute; right: 24px; bottom: 21px; z-index: 3; display: grid; justify-items: end; padding: 0; border: 0; background: transparent; text-align: right; filter: drop-shadow(0 2px 8px rgba(0,0,0,.6)); }
.mascot-caption small { color: rgba(223,230,243,.58); font-size: 8px; font-weight: 700; letter-spacing: .16em; }
.mascot-caption strong { margin-top: 4px; color: #f2f5fa; font-size: 13px; }

.workspace { display: grid; grid-template-columns: minmax(320px, 430px) minmax(0, 1fr); gap: 22px; align-items: start; }
.chart-form, .result-panel {
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-panel);
  background: linear-gradient(180deg, rgba(22,24,31,.96), rgba(12,14,19,.98));
  box-shadow: var(--shadow);
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.chart-form::after, .result-panel::after, .library-card::after, .prompt-editor::after, .admin-auth::after, .community-editor::after { content: ""; position: absolute; z-index: -1; width: 132%; height: 180px; left: -16%; bottom: -132px; border-radius: 50%; filter: blur(30px); opacity: .74; pointer-events: none; transform: rotate(-2deg); }
.chart-form::after { background: radial-gradient(ellipse at 37% 28%, rgba(255,120,65,.92), rgba(255,96,44,.38) 30%, transparent 62%); }
.result-panel::after { background: radial-gradient(ellipse at 63% 26%, rgba(73,126,255,.9), rgba(70,108,227,.32) 31%, transparent 63%); }
.chart-form { padding: 24px; }
.result-panel { min-height: 690px; padding: 30px; }

fieldset { margin: 0; padding: 0; border: 0; }
legend, .field > span { color: var(--ink); font-size: 14px; font-weight: 720; }
.system-switch, .view-switch { display: grid; gap: 6px; padding: 5px; border: 1px solid rgba(255,255,255,.07); border-radius: var(--radius-control); background: rgba(0,0,0,.28); }
.system-switch { grid-template-columns: repeat(4, 1fr); margin-top: 12px; }
.system-option, .view-option {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}
.system-option.is-active, .view-option.is-active { background: #222733; color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 7px 20px rgba(0,0,0,.25); }
.combined-option { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid rgba(185,205,255,.18); background: linear-gradient(105deg, rgba(255,126,75,.4), rgba(112,142,255,.42) 48%, rgba(71,211,157,.38)); background-size: 180% 180%; color: #f7f9ff; box-shadow: inset 0 1px 0 rgba(255,255,255,.13), 0 10px 28px rgba(53,92,190,.12); transition: transform .2s ease, filter .2s ease, box-shadow .2s ease; }
.combined-option:hover { transform: translateY(-1px); filter: brightness(1.15) saturate(1.08); box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 14px 34px rgba(68,102,202,.2); }
.combined-option.is-active { background: linear-gradient(105deg, #d76b45, #6f8ee5 48%, #47b987); color: white; }
.combined-option small { color: rgba(255,255,255,.68); font-size: 10px; font-weight: 650; }
.combined-option em { margin-left: 5px; padding: 2px 5px; border: 1px solid rgba(255,255,255,.28); border-radius: 5px; color: #fff; font-size: 8px; font-style: normal; letter-spacing: .12em; }
.combined-option.is-locked { filter: saturate(.55) brightness(.78); }
.combined-option.is-locked:hover { filter: saturate(.72) brightness(.92); }
.field-help { color: var(--muted); font-size: 12px; line-height: 1.55; }
#system-note { margin: 10px 2px 0; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 12px; margin-top: 24px; }
.field { display: grid; align-content: start; gap: 7px; }
.field-wide { grid-column: 1 / -1; }
.field small, .field > span small { color: var(--muted); font-size: 11px; font-weight: 500; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #0e1117;
  color: var(--ink);
  outline: 0;
}
input, select { min-height: 45px; padding: 10px 12px; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 78%, transparent); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 17%, transparent); }
input:disabled { opacity: 0.6; cursor: not-allowed; }

.advanced { margin-top: 18px; border-top: 1px solid var(--faint); padding-top: 16px; }
.advanced summary { color: var(--accent); font-size: 13px; font-weight: 700; }
.advanced-fields { margin-top: 16px; }
.conditional-fields { display: grid; gap: 14px; margin-top: 18px; }
.check-field { display: flex; align-items: flex-start; gap: 10px; }
.check-field input { width: 18px; min-height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.check-field span { display: grid; gap: 3px; font-size: 13px; }
.check-field small { color: var(--muted); line-height: 1.45; }
.is-hidden { display: none !important; }

.primary-button, .secondary-button {
  min-height: 44px;
  border-radius: var(--radius-control);
  padding: 10px 16px;
  white-space: nowrap;
  font-weight: 760;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}
.primary-button { width: 100%; margin-top: 22px; border: 1px solid #9cbcff; background: linear-gradient(180deg, #a8c5ff, #719dff); color: #09101e; box-shadow: 0 10px 28px rgba(75,120,255,.2); }
.primary-button:hover { background: linear-gradient(180deg, #bfd3ff, #88adff); border-color: #c6d8ff; transform: translateY(-1px); }
.secondary-button { border: 1px solid var(--line); background: #171a21; color: var(--ink); }
.secondary-button:hover { border-color: var(--accent); color: var(--accent); }
.primary-button:active, .secondary-button:active { transform: translateY(1px); }
.primary-button:disabled, .secondary-button:disabled { opacity: 0.48; cursor: not-allowed; }
.primary-button.compact { width: auto; margin: 0; }
.privacy-note { margin: 12px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.form-error { margin: 16px 0 0; padding: 12px; border-radius: var(--radius-control); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger); font-size: 13px; line-height: 1.5; }

.empty-state, .loading-state { min-height: 620px; display: grid; place-content: center; justify-items: center; text-align: center; }
.empty-state h2 { margin: 26px 0 8px; font-size: 25px; letter-spacing: -0.035em; }
.empty-state p, .loading-state p { max-width: 440px; margin: 0; color: var(--muted); line-height: 1.65; }
.empty-orbit { width: 116px; height: 116px; border: 1px solid #526ca8; border-radius: 42% 58% 58% 42%; display: grid; place-items: center; position: relative; box-shadow: inset 0 -20px 40px rgba(69,112,255,.15), 0 18px 50px rgba(53,91,191,.16); transform: rotate(-5deg); }
.empty-orbit::before { content: ""; width: 66px; height: 66px; border: 1px solid var(--accent); border-radius: 50%; }
.empty-orbit span { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); transform: translate(48px, -18px); }
.loading-state { align-content: center; gap: 14px; }
.skeleton { width: min(100%, 660px); border-radius: var(--radius-control); background: linear-gradient(90deg, var(--faint), var(--surface-strong), var(--faint)); background-size: 240% 100%; }
.skeleton-title { height: 34px; width: min(60%, 360px); }
.skeleton-line { height: 16px; }
.skeleton-table { height: 220px; }

.result-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.result-header h2 { margin: 3px 0 0; font-size: 30px; letter-spacing: -0.04em; }
.result-kicker { margin: 0; color: var(--accent); font-size: 13px; font-weight: 760; }
.audit-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 24px 0; padding: 1px; border-radius: var(--radius-control); background: var(--line); overflow: hidden; }
.audit-strip div { min-width: 0; padding: 13px; background: var(--surface-strong); }
.audit-strip dt { color: var(--muted); font-size: 11px; }
.audit-strip dd { margin: 4px 0 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-size: 13px; font-weight: 700; white-space: nowrap; }
.view-switch { grid-template-columns: 1fr 1fr; max-width: 360px; margin-bottom: 22px; }

.result-view { overflow-x: auto; }
.result-view h3 { margin: 24px 0 12px; font-size: 17px; }
.result-view h3:first-child { margin-top: 0; }
.result-table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 13px; }
.result-table th { padding: 11px 10px; background: var(--bg); color: var(--muted); text-align: left; font-size: 11px; }
.result-table td { padding: 12px 10px; border-bottom: 1px solid var(--faint); }
.chart-section { margin-top: 12px; border: 1px solid var(--faint); border-radius: var(--radius-control); background: var(--surface-strong); overflow: hidden; }
.chart-section > summary { padding: 15px 16px; color: var(--ink); font-weight: 760; list-style-position: inside; }
.chart-section[open] > summary { border-bottom: 1px solid var(--faint); color: var(--accent); }
.chart-section-body { padding: 12px 14px 16px; overflow-x: auto; }
.cycle-section { margin-top: 8px; border: 1px solid var(--faint); border-radius: 8px; overflow: hidden; }
.cycle-section > summary { padding: 11px 12px; background: var(--bg); color: var(--ink); font-size: 13px; font-weight: 700; }
.cycle-section .result-table { margin: 0; }
.data-note { margin: 12px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.fact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fact { padding: 14px; border-radius: var(--radius-control); background: var(--bg); }
.fact span { display: block; color: var(--muted); font-size: 11px; }
.fact strong { display: block; margin-top: 5px; font-size: 17px; }
#markdown-output { min-height: 430px; }
.action-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }

.prompt-area { margin-top: 32px; padding-top: 28px; border-top: 1px solid var(--line); }
.prompt-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.prompt-heading h3 { margin: 0; font-size: 21px; }
.prompt-heading p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.prompt-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.prompt-card { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-control); background: #11141a; color: var(--ink); text-align: left; transition: transform .2s ease, border-color .2s ease, background .2s ease; }
.prompt-card:hover { transform: translateY(-2px); }
.prompt-card:hover, .prompt-card.is-selected { border-color: var(--accent); }
.prompt-card.is-selected { background: var(--accent-soft); }
.prompt-card strong { display: block; }
.prompt-card span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.prompt-preview { margin-top: 12px; padding: 14px; border-radius: var(--radius-control); background: var(--bg); color: var(--muted); font-size: 12px; line-height: 1.65; }
.prompt-actions .primary-button { margin: 0; }
.copy-status { min-height: 20px; margin: 10px 0 0; color: var(--accent); font-size: 12px; }
.text-link { color: var(--accent); font-size: 13px; font-weight: 700; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

footer { max-width: 1400px; margin: 0 auto; padding: 26px 28px 34px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 12px; }
footer p { margin: 0; }
footer a { color: var(--accent); }

.admin-main { max-width: 1280px; }
.admin-heading { margin-bottom: 28px; }
.admin-heading h1 { margin: 0; font-size: clamp(34px, 5vw, 56px); letter-spacing: -0.05em; }
.admin-heading > p:last-child { max-width: 680px; color: var(--muted); line-height: 1.7; }
.admin-auth { max-width: 520px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); box-shadow: var(--shadow); position: relative; isolation: isolate; overflow: hidden; }
.admin-auth::after, .prompt-editor::after, .community-editor::after { background: radial-gradient(ellipse at 48% 28%, rgba(75,218,157,.82), rgba(50,155,112,.3) 32%, transparent 64%); }
.admin-auth .primary-button { margin-top: 14px; }
.admin-workspace { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.prompt-manager-list, .prompt-editor { border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); box-shadow: var(--shadow); }
.prompt-manager-list { position: sticky; top: 16px; max-height: calc(100dvh - 32px); padding: 14px; overflow-y: auto; }
.manager-list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 4px 14px; }
.manager-list-head div { display: grid; gap: 3px; }
.manager-list-head span { color: var(--muted); font-size: 11px; }
.manager-prompt { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 7px; padding: 12px; border: 1px solid transparent; border-radius: var(--radius-control); background: var(--bg); color: var(--ink); text-align: left; }
.manager-prompt:hover, .manager-prompt.is-selected { border-color: var(--accent); }
.manager-prompt.is-selected { background: var(--accent-soft); }
.manager-prompt span { min-width: 0; }
.manager-prompt strong, .manager-prompt small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manager-prompt small { margin-top: 4px; color: var(--muted); }
.manager-prompt em { flex: none; padding: 3px 6px; border-radius: 999px; background: var(--faint); color: var(--muted); font-size: 10px; font-style: normal; }
.manager-prompt em.is-live { background: var(--accent-soft); color: var(--accent); }
.prompt-editor { padding: 24px; position: relative; isolation: isolate; overflow: hidden; }
.editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.editor-heading h2 { margin: 0; font-size: 25px; }
.editor-heading .eyebrow { margin-bottom: 4px; }
.active-toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.active-toggle input { width: 18px; min-height: 18px; accent-color: var(--accent); }
.prompt-editor textarea { padding: 12px; resize: vertical; line-height: 1.6; }
.prompt-content-editor { min-height: 320px; font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; font-size: 13px; }
.bilingual-divider { display: grid; gap: 4px; margin-top: 14px; padding: 16px 0 2px; border-top: 1px solid var(--line); }
.bilingual-divider > span { color: #a9c1ff; font-weight: 760; }
.bilingual-divider small { color: var(--muted); line-height: 1.55; }
.editor-actions { display: flex; gap: 10px; margin-top: 14px; }
.danger-button { min-height: 44px; padding: 10px 16px; border: 1px solid color-mix(in srgb, var(--danger) 55%, var(--line)); border-radius: var(--radius-control); background: transparent; color: var(--danger); font-weight: 760; }
.admin-message { min-height: 20px; margin: 14px 0 0; color: var(--accent); font-size: 13px; }
.admin-message.is-error { color: var(--danger); }
.admin-operations { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 24px; }
.admin-operation { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); }
.admin-users { grid-column: 1 / -1; }
.admin-purchases { grid-column: 1 / -1; }
.operation-list { display: grid; gap: 10px; }
.operation-item { display: grid; gap: 10px; padding: 14px; border-radius: 14px; background: var(--bg); }
.operation-item > div:first-child { display: grid; gap: 4px; }
.operation-item span, .operation-item > p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.operation-item .risk-note { color: #ff9b7d; }
.operation-empty { color: var(--muted); }
.user-row { grid-template-columns: minmax(240px, 1fr) 110px 110px auto; align-items: center; }
.user-row select, .user-row button { min-height: 40px; }

.library-main { max-width: 1320px; }
.library-hero { max-width: 860px; padding: 22px 0 38px; }
.library-hero h1 { margin: 0; font-size: clamp(42px, 6vw, 74px); line-height: 1.02; letter-spacing: -0.06em; text-wrap: balance; }
.library-hero > p:last-child { max-width: 650px; color: var(--muted); font-size: 16px; line-height: 1.75; }
.account-area { min-height: 44px; display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid rgba(255,255,255,.065); border-radius: 14px; background: rgba(15,17,23,.52); white-space: nowrap; }
.account-area .text-button { min-height: 34px; padding: 7px 10px; border-radius: 9px; color: #a9c1ff; font-size: 12px; text-decoration: none; }
.account-area .text-button:hover { background: rgba(255,255,255,.055); color: #fff; }
.account-user { max-width: 120px; overflow: hidden; padding: 0 8px; color: #c1c6cf; font: 650 12px/1.2 "Cascadia Code", monospace; text-overflow: ellipsis; }
.plan-badge { padding: 3px 5px; border: 1px solid rgba(130,166,255,.28); border-radius: 5px; color: #9bb8ff; font: 800 8px/1 "Cascadia Code", monospace; letter-spacing: .1em; }
.account-fact { padding: 10px 12px; border-radius: 10px; background: var(--faint); color: var(--muted); font-size: 12px; }
.auth-panel { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(300px, 1fr); gap: 38px; margin: 0 0 28px; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface-strong); box-shadow: var(--shadow); }
.auth-panel h2 { margin: 0; font-size: 30px; letter-spacing: -.04em; }
.auth-panel > div > p:last-child { color: var(--muted); line-height: 1.65; }
.auth-panel form { display: grid; gap: 12px; }
.library-source-switch { display: inline-grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 26px; padding: 5px; border-radius: var(--radius-control); background: var(--faint); }
.source-option { min-width: 140px; min-height: 42px; padding: 8px 16px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 760; }
.source-option.is-active { background: var(--surface-strong); color: var(--accent); box-shadow: 0 4px 12px rgba(34,55,51,.08); }
.library-workspace { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 34px; align-items: start; }
.category-rail { position: sticky; top: 20px; display: grid; gap: 5px; }
.category-option { display: grid; gap: 3px; padding: 13px 14px; border: 0; border-left: 3px solid transparent; background: transparent; color: var(--ink); text-align: left; }
.category-option span { color: var(--muted); font-size: 11px; }
.category-option:hover, .category-option.is-active { border-left-color: var(--accent); background: var(--accent-soft); }
.library-toolbar { display: grid; grid-template-columns: minmax(180px, .35fr) 1fr auto; gap: 12px; align-items: end; }
.library-toolbar > .primary-button { min-height: 45px; }
.library-count { margin: 18px 0 10px; color: var(--muted); font-size: 12px; }
.library-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.library-card { padding: 22px; border: 1px solid rgba(255,255,255,.11); border-radius: var(--radius-panel); background: linear-gradient(180deg, #161922, #0e1015); box-shadow: 0 22px 55px rgba(0,0,0,.28); position: relative; isolation: isolate; overflow: hidden; transition: transform .24s ease, border-color .24s ease; }
.library-card:hover { transform: translateY(-4px); border-color: rgba(139,177,255,.48); }
.library-card::after { background: radial-gradient(ellipse at 42% 27%, rgba(77,126,255,.84), rgba(58,95,202,.3) 33%, transparent 64%); }
.library-card:nth-child(3n + 2)::after { background: radial-gradient(ellipse at 58% 25%, rgba(255,127,70,.8), rgba(198,83,39,.28) 33%, transparent 64%); }
.library-card:nth-child(3n + 3)::after { background: radial-gradient(ellipse at 46% 27%, rgba(78,219,159,.78), rgba(48,149,105,.26) 33%, transparent 64%); }
.library-card-meta { display: flex; gap: 7px; }
.library-card-meta span { padding: 3px 7px; background: var(--bg); color: var(--muted); font-size: 10px; font-weight: 700; }
.library-card-meta .source-badge.official { background: var(--accent-soft); color: var(--accent); }
.library-card-meta .source-badge.community { background: var(--ink); color: var(--surface); }
.library-card .library-card-author { min-height: 0; margin-top: 10px; font-size: 11px; }
.library-card h3 { margin: 16px 0 7px; font-size: 20px; letter-spacing: -0.03em; }
.library-card > p { min-height: 42px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.library-card details { margin-top: 16px; border-top: 1px solid var(--faint); padding-top: 12px; }
.library-card summary { color: var(--accent); font-size: 12px; font-weight: 700; }
.library-card pre { max-height: 240px; overflow: auto; white-space: pre-wrap; color: var(--muted); font: 12px/1.65 "Cascadia Code", Consolas, monospace; }
.library-card-actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.community-actions { flex-wrap: wrap; gap: 8px; }
.moderation-badge { color: #ffd18d !important; }
.moderation-badge.is-rejected { color: #ff927d !important; }
.report-button { margin-left: auto; color: var(--muted); }
.reaction-button { min-height: 36px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 720; }
.reaction-button { display: inline-flex; align-items: center; gap: 6px; }
.reaction-icon { width: 17px; height: 17px; flex: none; transition: transform .2s ease; }
.reaction-button:hover .reaction-icon { transform: scale(1.12); }
.reaction-button:hover, .reaction-button.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.reaction-button:disabled { opacity: .55; cursor: wait; }
.text-button { padding: 8px 4px; border: 0; background: transparent; color: var(--accent); font-weight: 700; }
.library-empty { grid-column: 1 / -1; min-height: 220px; display: grid; place-content: center; justify-items: center; gap: 6px; border: 1px dashed var(--line); border-radius: var(--radius-panel); color: var(--muted); }
.library-empty strong { color: var(--ink); }
.community-editor { max-width: 900px; margin: 34px auto 0; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface-strong); box-shadow: var(--shadow); position: relative; isolation: isolate; overflow: hidden; }
.community-editor > p { color: var(--muted); line-height: 1.65; }
.community-editor textarea { padding: 12px; resize: vertical; line-height: 1.6; }
.library-status { position: fixed; right: 24px; bottom: 24px; z-index: 10; min-height: 0; margin: 0; padding: 11px 14px; border-radius: var(--radius-control); background: var(--ink); color: var(--surface); box-shadow: var(--shadow); }
.library-status:empty { display: none; }
.saved-profile-panel { margin: 18px 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(135deg, rgba(82,126,255,.11), rgba(255,255,255,.02)); }
.saved-profile-panel > div:first-child { display: grid; gap: 3px; }
.saved-profile-panel small { color: var(--muted); }
.saved-profile-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.saved-profile-controls select { flex: 1 1 220px; }
.western-tools { margin: 18px 0; padding: 18px; border: 1px solid rgba(119,157,255,.28); border-radius: 18px; background: linear-gradient(145deg, rgba(67,104,195,.12), rgba(13,15,20,.7)); }
.pro-access-note { margin: 0 0 14px; padding: 11px 12px; border-left: 2px solid #7e9df1; background: rgba(75,108,195,.1); color: #aebddd; font-size: 12px; line-height: 1.6; }
.western-tools.is-pro-locked .field-grid, .western-tools.is-pro-locked .professional-toggle, .western-tools.is-pro-locked #professional-fields { opacity: .48; }
.western-tools.is-pro-locked .field-grid, .western-tools.is-pro-locked .professional-toggle { pointer-events: none; }
.western-tool-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 16px; }
.western-tool-heading h3 { margin: 0; }
.western-tool-heading > span { max-width: 240px; color: var(--muted); font-size: .84rem; text-align: right; }
.professional-toggle { margin: 16px 0 4px; padding-top: 16px; border-top: 1px solid var(--line); }
#professional-fields { margin-top: 12px; }
.inline-check { display: flex; align-items: center; gap: 7px; margin-top: 8px; font-size: .9rem; }
.inline-check input { width: auto; }
.relationship-settings { margin-top: 14px; }
.markdown-stack { display: grid; gap: 16px; }
.markdown-card { border: 1px solid rgba(255,255,255,.11); border-radius: 18px; background: #0b0e13; overflow: hidden; box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }
.markdown-card-head { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 13px 11px 16px; border-bottom: 1px solid var(--faint); background: linear-gradient(90deg, rgba(79,126,255,.16), transparent 54%); }
.markdown-card-professional .markdown-card-head { background: linear-gradient(90deg, rgba(75,220,154,.14), transparent 54%); }
.markdown-card-head > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.markdown-card-head > small { color: #7899e3; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.markdown-index { width: 27px; height: 27px; display: grid; place-items: center; flex: none; border: 1px solid #5476c5; border-radius: 8px; color: #a9c1ff; font: 700 10px/1 "Cascadia Code", monospace; }
.markdown-card-professional .markdown-index { border-color: #397a5d; color: #75e3ae; }
.markdown-label { display: block; margin: 0; color: var(--ink); font-size: .82rem; font-weight: 720; letter-spacing: .015em; }
.markdown-card textarea, #markdown-output, #professional-markdown-output { display: block; min-height: 350px; padding: 18px; border: 0; border-radius: 0; background: #0a0c11; resize: vertical; color: #dbe3f1; font: 12px/1.72 "Cascadia Code", "SFMono-Regular", Consolas, monospace; tab-size: 2; }
#markdown-output { min-height: 430px; }
#professional-markdown-output { min-height: 350px; }
.markdown-card textarea:focus { box-shadow: inset 0 0 0 2px rgba(123,163,255,.52); }
.markdown-card-professional textarea:focus { box-shadow: inset 0 0 0 2px rgba(77,219,155,.48); }
footer > div { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
footer span { color: var(--muted); font-size: .82rem; }
.legal-main { max-width: 860px; }
.legal-main h1 { margin: 0 0 18px; font-size: clamp(42px, 7vw, 72px); letter-spacing: -.055em; }
.legal-lead { max-width: 680px; color: #cbd2df; font-size: 18px; line-height: 1.75; }
.legal-main section { padding: 22px 0; border-top: 1px solid var(--line); }
.legal-main h2 { margin: 0 0 8px; font-size: 20px; }
.legal-main section p { margin: 0; color: var(--muted); line-height: 1.78; }
.pro-main { max-width: 1320px; }
.pro-hero { min-height: 560px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(310px, .75fr); gap: 72px; align-items: center; padding: 46px 0 80px; }
.pro-copy h1 { margin: 0; max-width: 820px; font-size: clamp(50px, 8vw, 94px); line-height: .98; letter-spacing: -.07em; text-wrap: balance; }
.pro-copy h1 span { background: linear-gradient(90deg, #f4f7ff, #91b4ff 48%, #72dfb0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pro-copy > p:not(.eyebrow) { max-width: 650px; color: var(--muted); font-size: 17px; line-height: 1.75; }
.pro-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.pro-hero-actions .primary-button, .pro-hero-actions .secondary-button { width: auto; display: inline-flex; align-items: center; justify-content: center; margin: 0; text-decoration: none; }
.pro-compare-button { min-height: 46px; }
.pro-copy .pro-no-renewal { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; color: #929baa; font-size: 12px; line-height: 1.4; }
.pro-no-renewal span { width: 18px; height: 18px; display: inline-grid; place-items: center; border-radius: 50%; background: rgba(83,215,157,.12); color: #72dfb0; font-size: 10px; }
.pro-feature-grid { max-width: 720px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-top: 32px; background: var(--line); border: 1px solid var(--line); }
.pro-feature-grid > div { display: grid; gap: 5px; padding: 17px; background: var(--bg); }
.pro-feature-grid span { color: var(--muted); font-size: 12px; }
.pro-price-card { min-height: 420px; display: grid; place-items: center; align-content: center; gap: 14px; padding: 34px; border: 1px solid rgba(140,174,255,.24); border-radius: 40px; background: radial-gradient(circle at 50% 18%, rgba(107,143,238,.18), transparent 38%), linear-gradient(155deg, #171a22, #0c0e13); box-shadow: 0 38px 90px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.07); text-align: center; }
.pro-price-card img { width: 118px; height: 118px; border-radius: 30px; box-shadow: 0 18px 45px rgba(0,0,0,.38); }
.pro-price-card > span { color: #92aff1; font: 800 10px/1 "Cascadia Code", monospace; letter-spacing: .16em; }
.pro-price-card > strong { font-size: 76px; line-height: 1; letter-spacing: -.07em; font-variant-numeric: tabular-nums; }
.pro-price-card > strong small { margin-right: 7px; color: var(--muted); font-size: 18px; letter-spacing: 0; }
.pro-price-card p { margin: 0; color: var(--muted); line-height: 1.6; }
.plan-comparison { padding: 78px 0 92px; border-top: 1px solid var(--line); }
.comparison-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 480px); gap: 48px; align-items: end; margin-bottom: 32px; }
.comparison-heading h2 { margin: 0; font-size: clamp(38px, 5.2vw, 66px); line-height: 1; letter-spacing: -.055em; }
.comparison-heading > p { margin: 0; color: var(--muted); line-height: 1.75; }
.mobile-swipe-hint { display: none; }
.comparison-scroll { overflow-x: auto; padding: 1px 1px 20px; scrollbar-color: #34415e transparent; }
.comparison-board { min-width: 780px; border: 1px solid rgba(255,255,255,.1); border-radius: 30px; background: linear-gradient(145deg, rgba(26,29,38,.96), rgba(12,14,19,.98)); box-shadow: 0 32px 80px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.045); }
.comparison-row { display: grid; grid-template-columns: minmax(250px, 1.2fr) minmax(200px, .9fr) minmax(220px, 1fr); }
.comparison-row:not(:last-child) { border-bottom: 1px solid rgba(255,255,255,.07); }
.comparison-row > * { min-width: 0; padding: 19px 24px; }
.comparison-row > :nth-child(2) { border-left: 1px solid rgba(255,255,255,.07); }
.comparison-row > :nth-child(3) { border-left: 1px solid rgba(126,162,255,.17); background: linear-gradient(90deg, rgba(89,124,224,.09), rgba(73,195,146,.035)); }
.comparison-header > * { min-height: 142px; padding-top: 27px; padding-bottom: 27px; }
.comparison-header .comparison-label { display: grid; align-content: center; gap: 7px; color: #c8cfdd; }
.comparison-header .comparison-label > span { font-size: 18px; font-weight: 760; }
.comparison-label { display: grid; align-content: center; gap: 5px; }
.comparison-label strong { font-size: 14px; }
.comparison-label small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.comparison-plan { position: relative; display: grid; align-content: center; gap: 6px; }
.comparison-plan strong { font-size: 26px; letter-spacing: -.035em; }
.comparison-plan small { color: var(--muted); font-size: 11px; }
.comparison-plan.comparison-pro { overflow: hidden; }
.comparison-plan.comparison-pro::after { content: ""; position: absolute; width: 180px; height: 180px; top: -92px; right: -70px; border-radius: 50%; background: #739bff; opacity: .14; filter: blur(36px); pointer-events: none; }
.comparison-plan.comparison-pro strong { color: #dce7ff; }
.plan-kicker { width: fit-content; padding: 5px 8px; border: 1px solid rgba(255,255,255,.1); border-radius: 999px; color: #98a0af; font: 800 9px/1 "Cascadia Code", monospace; letter-spacing: .13em; }
.comparison-pro .plan-kicker { border-color: rgba(126,162,255,.28); background: rgba(94,129,226,.13); color: #a9c1ff; }
.plan-value { display: flex; align-items: center; gap: 10px; color: #cfd5df; font-size: 13px; line-height: 1.45; }
.plan-value.pro-value { color: #eef3ff; font-weight: 690; }
.plan-icon { width: 21px; height: 21px; display: inline-grid; place-items: center; flex: none; border-radius: 50%; font-size: 11px; font-weight: 900; }
.plan-icon.included { background: rgba(83,215,157,.13); color: #6fe0ae; box-shadow: inset 0 0 0 1px rgba(83,215,157,.16); }
.plan-icon.unavailable { color: #646d7d; }
.muted-value { color: #737d8d; }
.comparison-price-row > * { min-height: 190px; }
.plan-price { display: grid; align-content: center; justify-items: start; gap: 6px; }
.plan-price > strong { font-size: 33px; line-height: 1; letter-spacing: -.045em; }
.plan-price > span:not(.plan-badge) { margin-bottom: 12px; color: var(--muted); font-size: 11px; }
.plan-price .primary-button, .plan-price .secondary-button { width: auto; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; margin: 0; padding: 8px 13px; text-decoration: none; font-size: 12px; }
.plan-badge { margin-bottom: 1px; color: #9fbbff; font: 800 9px/1 "Cascadia Code", monospace; letter-spacing: .1em; }
.comparison-note { margin: 5px 2px 0; color: #747d8c; font-size: 10px; line-height: 1.5; }
.purchase-state { max-width: 900px; display: flex; align-items: center; gap: 18px; margin: 0 auto 40px; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.purchase-state > p, .purchase-state div p { margin: 5px 0 0; color: var(--muted); line-height: 1.6; }
.purchase-state .primary-button { display: inline-flex; width: auto; margin: 14px 0 0; text-decoration: none; }
.purchase-state.is-pro { border-color: rgba(83,215,157,.34); background: linear-gradient(135deg, rgba(65,190,137,.13), rgba(41,60,87,.2)); }
.status-symbol { width: 46px; height: 46px; display: grid; place-items: center; flex: none; border-radius: 14px; background: #53d79d; color: #07120e; font-size: 24px; font-weight: 900; }
.purchase-workspace { padding: 32px; border-top: 1px solid var(--line); }
.purchase-heading { display: grid; grid-template-columns: 1fr minmax(280px, 520px); gap: 40px; align-items: end; margin-bottom: 28px; }
.purchase-heading h2 { margin: 0; font-size: clamp(34px, 5vw, 58px); letter-spacing: -.05em; }
.purchase-heading > p { margin: 0; color: var(--muted); line-height: 1.7; }
.payment-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 0; border: 0; }
.payment-grid legend { margin-bottom: 12px; color: var(--muted); font-size: 12px; }
.payment-method { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); cursor: pointer; }
.payment-method:has(input:checked) { border-color: #7fa4ff; background: linear-gradient(145deg, rgba(83,116,207,.17), var(--surface)); box-shadow: inset 0 0 0 1px rgba(127,164,255,.24); }
.payment-method input { position: absolute; opacity: 0; pointer-events: none; }
.payment-name { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.payment-name small { color: var(--muted); }
.payment-method img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 15px; background: #fff; }
.payment-method em { color: #9bb8ff; font-size: 12px; font-style: normal; text-align: center; }
.purchase-form-fields { max-width: 760px; display: grid; gap: 14px; margin: 30px auto 0; }
.purchase-confirm { display: flex; align-items: flex-start; gap: 10px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.purchase-confirm input { width: 18px; min-height: 18px; flex: none; accent-color: var(--accent); }
.creator-lockup { display: inline-flex; align-items: center; gap: 7px; }
.creator-lockup img { width: 24px; height: 24px; border-radius: 7px; }
.hero-creator-chip { width: fit-content; display: flex; align-items: center; gap: 10px; margin-bottom: 22px; padding: 7px 12px 7px 7px; border: 1px solid rgba(255,255,255,.11); border-radius: 15px; background: rgba(255,255,255,.035); }
.hero-creator-chip img { width: 36px; height: 36px; border-radius: 10px; }
.hero-creator-chip span { display: grid; }
.hero-creator-chip small { color: #7697dd; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.hero-creator-chip strong { margin-top: 2px; font-size: 12px; }
.guest-result-note { margin-top: 16px; padding: 18px; border: 1px solid rgba(127,161,245,.24); border-radius: 16px; background: linear-gradient(135deg, rgba(78,112,205,.13), rgba(62,202,150,.06)); }
.guest-result-note p { color: var(--muted); line-height: 1.6; }
.guest-result-note .primary-button { display: inline-flex; width: auto; margin: 0; text-decoration: none; }

.spotlight-card { --spot-x: 50%; --spot-y: 50%; position: relative; isolation: isolate; overflow: hidden; transition: transform .26s cubic-bezier(.2,.8,.2,1), border-color .26s ease, box-shadow .26s ease; }
.spotlight-card::before { content: ""; position: absolute; inset: 0; z-index: 0; border-radius: inherit; pointer-events: none; opacity: 0; background: radial-gradient(360px circle at var(--spot-x) var(--spot-y), rgba(127,163,255,.13), rgba(92,218,167,.055) 34%, transparent 68%); box-shadow: inset 0 0 0 1px rgba(161,187,255,.14); transition: opacity .24s ease; }
.spotlight-card:hover::before { opacity: 1; }
.spotlight-card:hover { border-color: rgba(135,169,248,.34); box-shadow: 0 24px 60px rgba(4,8,18,.34), inset 0 1px 0 rgba(255,255,255,.055); }
.spotlight-card > * { position: relative; z-index: 1; }

@media (prefers-reduced-motion: no-preference) {
  .loading-state .skeleton { animation: shimmer 1.4s ease-in-out infinite; }
  .empty-orbit span { animation: orbit 5s linear infinite; }
  .mascot-stage:not(:hover) > img { animation: mascot-float 4.8s ease-in-out infinite; }
}
@keyframes shimmer { to { background-position: -240% 0; } }
@keyframes orbit { to { transform: rotate(360deg) translate(48px, -18px) rotate(-360deg); } }
@keyframes mascot-float { 50% { transform: translateY(-9px) rotate(1deg) scale(1.015); } }

@media (max-width: 900px) {
  .site-header { grid-template-columns: auto 1fr; }
  .site-header nav { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; width: 100%; overflow-x: auto; }
  .account-area { grid-column: 2; grid-row: 1; justify-self: end; }
  .intro-stage { min-height: 0; grid-template-columns: 1fr; gap: 32px; }
  .mascot-stage { width: min(100%, 520px); min-height: 300px; }
  .workspace { grid-template-columns: 1fr; }
  .result-panel { min-height: 560px; }
  .empty-state, .loading-state { min-height: 480px; }
  .admin-workspace { grid-template-columns: 1fr; }
  .pro-hero { grid-template-columns: 1fr; gap: 34px; }
  .pro-price-card { min-height: 340px; }
  .comparison-heading { grid-template-columns: 1fr; gap: 18px; }
  .purchase-heading { grid-template-columns: 1fr; gap: 12px; }
  .admin-operations { grid-template-columns: 1fr; }
  .admin-users { grid-column: auto; }
  .admin-purchases { grid-column: auto; }
  .user-row { grid-template-columns: 1fr 1fr; }
  .user-row > div:first-child { grid-column: 1 / -1; }
  .prompt-manager-list { position: static; max-height: 360px; }
  .library-workspace { grid-template-columns: 1fr; gap: 20px; }
  .category-rail { position: static; grid-template-columns: repeat(3, 1fr); }
  .category-option { border-left: 0; border-bottom: 3px solid transparent; }
  .category-option:hover, .category-option.is-active { border-left-color: transparent; border-bottom-color: var(--accent); }
  .auth-panel { grid-template-columns: 1fr; gap: 18px; }
}

@media (max-width: 640px) {
  .site-header { min-height: 64px; grid-template-columns: minmax(0, 1fr) auto; padding: 10px 16px; gap: 10px; }
  .site-header nav { width: 100%; }
  nav a, nav .text-button { flex: 1 0 auto; padding-inline: 10px; }
  .account-area { max-width: 200px; font-size: 12px; }
  .account-area .account-user { display: none; }
  .account-area .text-button { padding-inline: 8px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand-copy strong { font-size: 13px; }
  .brand-copy small { font-size: 8px; }
  main { padding: 24px 14px 56px; }
  .intro { margin-bottom: 34px; }
  .intro h1 { font-size: clamp(40px, 13vw, 58px); }
  .intro > p:last-child { font-size: 15px; }
  .intro-stage { gap: 26px; }
  .intro-copy > p:last-of-type { font-size: 15px; }
  .mascot-stage { min-height: 255px; border-radius: 30px; }
  .mascot-stage > img { width: 58%; }
  .mascot-caption { right: 12px; bottom: 12px; }
  .chart-form, .result-panel { padding: 18px; }
  .field-grid { grid-template-columns: 1fr; }
  .system-switch { grid-template-columns: repeat(2, 1fr); }
  .field-wide { grid-column: auto; }
  .audit-strip { grid-template-columns: 1fr; }
  .prompt-list, .fact-grid { grid-template-columns: 1fr; }
  .library-grid, .library-toolbar { grid-template-columns: 1fr; }
  .category-rail { display: flex; overflow-x: auto; scrollbar-width: none; }
  .category-rail::-webkit-scrollbar { display: none; }
  .category-option { min-width: 150px; }
  .library-source-switch { width: 100%; }
  .source-option { min-width: 0; padding-inline: 8px; }
  .western-tool-heading { display: grid; }
  .western-tool-heading > span { text-align: left; }
  .saved-profile-controls > * { width: 100%; }
  .auth-panel, .community-editor { padding: 18px; }
  .pro-feature-grid, .payment-grid { grid-template-columns: 1fr; }
  .pro-hero { padding-top: 18px; }
  .plan-comparison { padding: 58px 0 64px; }
  .comparison-heading h2 br { display: none; }
  .mobile-swipe-hint { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 12px; color: #8393b8; font-size: 10px; font-weight: 760; letter-spacing: .04em; }
  .comparison-board { min-width: 710px; }
  .comparison-row { grid-template-columns: minmax(210px, 1.1fr) minmax(180px, .9fr) minmax(210px, 1fr); }
  .comparison-row > * { padding-inline: 17px; }
  .purchase-workspace { padding: 24px 0 0; }
  .user-row { grid-template-columns: 1fr; }
  .user-row > div:first-child { grid-column: auto; }
  .result-header { align-items: flex-start; }
  .prompt-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .prompt-actions button { width: 100%; }
  .markdown-card-head { align-items: flex-start; }
  .markdown-card-head > div { align-items: flex-start; }
  .markdown-card-head .text-button { padding-top: 4px; font-size: 11px; }
  .markdown-card textarea, #markdown-output, #professional-markdown-output { min-height: 320px; padding: 14px; font-size: 11px; }
  footer { padding: 22px 16px; flex-direction: column; }
}
