:root {
  color-scheme: light;
  --bg: #f8f5fb;
  --ink: #2a1740;
  --muted: #665875;
  --line: #dfd2ea;
  --panel: #ffffff;
  --accent: #cc3366;
  --accent-strong: #663399;
  --yellow: #ffce34;
  --green: #66cc66;
  --blue: #006699;
  --shadow: 0 18px 50px rgba(102, 51, 153, 0.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}
button, input, textarea { font: inherit; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0 56px; }
.workspace { display: grid; gap: 18px; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding: 8px 0 12px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.eyebrow { margin: 0 0 4px; color: var(--blue); font-size: .78rem; font-weight: 800; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; color: var(--accent-strong); font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.05; }
h2 { margin-bottom: 12px; font-size: 1rem; }
.status-pill { min-width: 112px; border: 1px solid rgba(102,204,102,.5); border-radius: 999px; padding: 8px 12px; background: rgba(102,204,102,.13); color: #247a38; text-align: center; font-size: .9rem; font-weight: 700; }
.panel, .output-section { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); }
.panel { display: grid; gap: 18px; padding: 20px; }
.field-row { display: grid; grid-template-columns: 1fr 1.5fr; gap: 16px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: .9rem; font-weight: 700; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 12px 13px; background: #fffcf3; color: var(--ink); outline: none; }
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(204,51,102,.16); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
button { min-height: 42px; border: 0; border-radius: 7px; padding: 0 16px; cursor: pointer; font-weight: 700; }
button:disabled { cursor: wait; opacity: .62; }
.primary { background: var(--accent); color: white; }
.primary:hover:not(:disabled) { background: var(--accent-strong); }
.secondary { background: var(--accent-strong); color: white; }
.secondary:hover:not(:disabled) { background: var(--blue); }
.results { display: grid; gap: 14px; }
.output-section { padding: 18px; }
.pattern-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pattern-card { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fff9df; }
.pattern-card h3 { margin: 0 0 8px; font-size: .92rem; color: var(--blue); }
.pattern-card ul { margin: 0; padding-left: 18px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.processing-card { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; border: 1px solid rgba(0,102,153,.22); border-radius: 8px; padding: 16px; background: linear-gradient(135deg, rgba(255,206,52,.24), rgba(102,51,153,.08)); }
.processing-mark { width: 42px; height: 42px; border: 4px solid rgba(102,51,153,.18); border-top-color: var(--accent); border-right-color: var(--blue); border-radius: 999px; animation: spin 1.2s linear infinite; }
.processing-title { margin-bottom: 4px; color: var(--accent-strong); font-weight: 800; }
.processing-copy { margin-bottom: 0; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }
.question-block { display: grid; gap: 10px; margin-bottom: 14px; }
.question-text { margin-bottom: 0; color: var(--ink); font-weight: 750; }
.sticky-actions { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(180deg, rgba(248,245,251,0), var(--bg) 35%); }
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; background: rgba(42,23,64,.42); backdrop-filter: blur(2px); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(760px, 100%); max-height: min(88vh, 860px); overflow: auto; border: 1px solid var(--line); border-radius: 18px; padding: 18px; background: rgba(255,255,255,.96); box-shadow: 0 28px 80px rgba(102,51,153,.28); }
.modal-header { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 12px; padding: 4px 8px 0; }
.modal-header h2 { margin: 0 0 6px; color: var(--accent-strong); font-size: 1.45rem; }
.modal-header p { margin: 0; color: var(--muted); font-size: .92rem; }
.icon-button { display: inline-grid; place-items: center; flex: 0 0 auto; width: 38px; min-height: 38px; border: 1px solid var(--line); border-radius: 999px; padding: 0; background: white; color: var(--accent-strong); font-size: 1.45rem; font-weight: 400; line-height: 1; }
.accordion { display: grid; gap: 10px; }
.accordion-item { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: white; }
.accordion-trigger { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 52px; border-radius: 0; padding: 0 16px; background: white; color: var(--accent-strong); text-align: left; }
.accordion-trigger:hover { background: #fff9df; }
.accordion-icon { color: var(--accent); font-size: 1.25rem; font-weight: 800; }
.accordion-panel { display: none; padding: 0 16px 16px; color: var(--muted); font-size: .94rem; }
.accordion-panel p { margin-bottom: 10px; }
.accordion-item.is-open .accordion-panel { display: block; }
.save-toast { position: fixed; right: 24px; bottom: 24px; z-index: 60; display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; min-width: min(360px, calc(100vw - 32px)); border: 1px solid rgba(102,204,102,.55); border-radius: 8px; padding: 14px 16px; background: white; box-shadow: 0 18px 46px rgba(102,51,153,.2); color: var(--accent-strong); }
.save-toast[hidden] { display: none; }
.save-toast-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 999px; background: var(--green); color: white; font-weight: 800; }
.save-toast p { margin: 0; font-weight: 800; }
@media (max-width: 760px) {
  .shell { width: min(100% - 20px, 1180px); padding-top: 18px; }
  .topbar, .field-row { display: grid; grid-template-columns: 1fr; align-items: start; }
  .topbar-actions { display: grid; width: 100%; grid-template-columns: 1fr; }
  .status-pill { width: fit-content; }
  .pattern-grid { grid-template-columns: 1fr; }
  .actions { justify-content: stretch; }
  button { width: 100%; }
}
