:root {
  --bg: #0b0c0f;
  --surface: #111318;
  --surface-2: #171a20;
  --surface-3: #1d2027;
  --text: #f4f5f7;
  --muted: #9ba2ad;
  --line: rgba(255,255,255,.10);
  --accent: #c8ff43;
  --accent-text: #11140a;
  --danger: #ff7a7a;
  --shadow: 0 30px 90px rgba(0,0,0,.35);
}

:root.light {
  --bg: #f4f4ef;
  --surface: #fff;
  --surface-2: #f5f5f0;
  --surface-3: #ecece6;
  --text: #151619;
  --muted: #666d76;
  --line: rgba(0,0,0,.10);
  --accent: #b6f12f;
  --accent-text: #12150b;
  --shadow: 0 30px 70px rgba(34,40,25,.10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 78% 10%, rgba(200,255,67,.09), transparent 25%),
    radial-gradient(circle at 10% 45%, rgba(104,123,255,.07), transparent 28%),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background .25s, color .25s;
}
button, textarea, select { font: inherit; }
button { color: inherit; }
.noise {
  position: fixed; inset: 0; pointer-events: none; opacity: .16; z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
}
.shell { width: min(1220px, calc(100% - 36px)); margin: 0 auto; padding: 24px 0 36px; }
.topbar { display: flex; align-items: center; justify-content: space-between; }
.brand { color: inherit; text-decoration: none; display: inline-flex; gap: 11px; align-items: center; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--accent); color: var(--accent-text); font-weight: 900; letter-spacing: -.06em; }
.brand strong { display: block; font-size: 14px; }
.brand small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 20px; }
.hero { padding: 70px 2px 42px; max-width: 790px; }
.eyebrow { font-size: 11px; letter-spacing: .16em; font-weight: 800; color: var(--accent); margin-bottom: 14px; }
.hero h1 { font-size: clamp(44px, 6vw, 82px); line-height: .98; letter-spacing: -.06em; margin: 0; font-weight: 800; }
.hero h1 em { font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
.hero p { color: var(--muted); max-width: 680px; font-size: clamp(16px, 2vw, 20px); line-height: 1.55; margin: 24px 0 0; }
.app-card { border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(18px); border-radius: 26px; padding: 18px; box-shadow: var(--shadow); }
.tabs { display: inline-flex; padding: 5px; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 13px; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 9px 14px; border-radius: 9px; font-size: 13px; font-weight: 700; cursor: pointer; }
.tab.active { background: var(--text); color: var(--bg); }
.controls { margin-top: 18px; display: flex; gap: 22px; justify-content: space-between; align-items: end; }
.control-group { min-width: 0; }
.control-group.compact { width: 180px; flex: 0 0 180px; }
.control-label { display: block; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 8px 2px; }
.segmented { display: flex; gap: 7px; flex-wrap: wrap; }
.pill { border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 700; cursor: pointer; }
.pill.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, var(--surface-2)); color: var(--text); }
select { width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; outline: 0; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 58px minmax(0, 1fr); gap: 0; margin-top: 16px; align-items: stretch; }
.editor-panel { background: var(--surface-2); border: 1px solid var(--line); border-radius: 18px; min-height: 390px; overflow: hidden; display: flex; flex-direction: column; }
.panel-head, .panel-foot { display: flex; align-items: center; justify-content: space-between; padding: 18px 19px; }
.panel-head { border-bottom: 1px solid var(--line); }
.panel-kicker { color: var(--muted); font-size: 11px; font-weight: 700; }
.panel-head h2 { margin: 4px 0 0; font-size: 15px; letter-spacing: -.01em; }
.text-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 5px; font-size: 12px; font-weight: 700; }
.text-btn:not(:disabled):hover { color: var(--text); }
.text-btn:disabled { opacity: .35; cursor: default; }
textarea { flex: 1; resize: none; width: 100%; min-height: 260px; border: 0; outline: 0; background: transparent; color: var(--text); padding: 22px 20px; font-size: 18px; line-height: 1.65; }
textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.panel-foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; min-height: 48px; }
.shortcut { opacity: .72; }
.action-rail { display: grid; place-items: center; }
.run-btn { width: 45px; height: 45px; border-radius: 50%; border: 7px solid var(--surface); background: var(--accent); color: var(--accent-text); font-size: 20px; font-weight: 900; cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.20); transition: transform .2s; }
.run-btn:hover { transform: translateX(2px); }
.run-btn:disabled { opacity: .55; cursor: progress; transform: none; }
.output-panel { background: color-mix(in srgb, var(--surface-2) 85%, var(--accent) 2%); }
.output-text { flex: 1; padding: 22px 20px; font-size: 18px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.output-text.empty { color: var(--muted); }
.output-text.loading { color: var(--muted); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .48; } }
.result-foot { gap: 10px; }
.subtle { margin-left: auto; }
.grammar-detail { margin-top: 14px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface-2); }
.detail-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.detail-head span { font-weight: 800; font-size: 13px; }
.detail-head small { color: var(--muted); }
.notes-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); }
.note { background: var(--surface-2); padding: 15px; }
.note strong { font-size: 12px; display: block; margin-bottom: 5px; }
.note p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0; }
.quick-examples { margin: 24px 0 0; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding: 0 2px; }
.section-head span { font-size: 13px; font-weight: 800; }
.section-head small { color: var(--muted); }
.example-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.example { text-align: left; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 15px; padding: 15px; cursor: pointer; min-height: 94px; }
.example small { display: block; color: var(--accent); font-weight: 800; margin-bottom: 8px; }
.example span { display: block; color: var(--muted); line-height: 1.45; font-size: 12px; }
.example:hover { border-color: color-mix(in srgb, var(--accent) 65%, var(--line)); }
footer { display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 11px; padding: 28px 2px 0; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--text); color: var(--bg); border-radius: 999px; padding: 10px 14px; font-size: 12px; font-weight: 700; transition: .22s ease; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #250909; }

@media (max-width: 820px) {
  .shell { width: min(100% - 22px, 680px); }
  .hero { padding-top: 50px; }
  .controls { align-items: stretch; flex-direction: column; }
  .control-group.compact { width: 100%; flex-basis: auto; }
  .workspace { grid-template-columns: 1fr; gap: 10px; }
  .action-rail { height: 42px; }
  .run-btn { transform: rotate(90deg); }
  .run-btn:hover { transform: rotate(90deg) translateX(2px); }
  .editor-panel { min-height: 330px; }
  .example-grid, .notes-grid { grid-template-columns: 1fr; }
  footer { flex-direction: column; }
}
