:root {
  color-scheme: light;
  --ink: #352a40;
  --muted: #756d7e;
  --cream: #fffaf6;
  --paper: #ffffff;
  --line: #e9e2ea;
  --pink: #dc6686;
  --purple: #6d50b6;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); overflow: hidden; }
button, input { font: inherit; }
button { min-height: 44px; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
button, input { border-radius: 10px; }
button:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #b19be2; outline-offset: 3px; }
button:hover:not(:disabled) { filter: brightness(.97); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.app-shell { height: calc(100vh - 76px); height: calc(100dvh - 76px); min-height: 0; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(400px, 1fr); }
.preview-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: 68px minmax(0,1fr) 76px; background: radial-gradient(ellipse at 50% 38%, #fffefd 0, #faf1eb 70%, #f3e7e4 100%); overflow: hidden; position: relative; }
.topbar, .preview-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 26px; position: relative; z-index: 2; }
.topbar { border-bottom: 1px solid var(--line); }
.topbar > strong { font-size: 13px; font-weight: 650; }
.view-actions, .preview-footer-actions { display: flex; gap: 8px; flex-shrink: 0; }
.view-actions button, .preview-footer-actions button { border: 1px solid var(--line); background: rgba(255,255,255,.88); padding: 0 13px; font-size: 12px; font-weight: 600; }
.view-actions button[aria-pressed="true"] { background: var(--purple); border-color: var(--purple); color: white; }
.canvas-wrap { min-width: 0; min-height: 0; position: relative; overflow: hidden; }
#preview { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#preview:active { cursor: grabbing; }
.preview-label { position: absolute; top: 18px; left: 24px; display: flex; align-items: center; gap: 7px; padding: 7px 10px; background: rgba(255,255,255,.8); border: 1px solid var(--line); border-radius: 999px; font-size: 11px; color: var(--muted); pointer-events: none; }
.preview-label span { width: 6px; height: 6px; border-radius: 50%; background: var(--pink); }
.orbit-hint { position: absolute; left: 12px; right: 12px; bottom: 14px; text-align: center; color: var(--muted); font-size: 11px; pointer-events: none; }
.loading { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; background: var(--cream); transition: opacity .2s, visibility .2s; }
.loading.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--pink); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 14px; }
.loading strong { font-size: 14px; }
.loading small { margin-top: 6px; color: var(--muted); font-size: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.preview-footer { border-top: 1px solid var(--line); background: rgba(255,255,255,.65); }
.preview-footer > div:first-child { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.preview-footer strong { font-size: 16px; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-footer span { font-size: 11px; color: var(--muted); }
#click-all { background: #f6e7ed; color: #88435f; border-color: #ecd3dd; }
.builder { min-width: 0; min-height: 0; background: var(--cream); border-left: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
.builder-heading { flex: 0 0 auto; padding: 25px 26px 20px; background: white; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 7px; color: #9b4b68; text-transform: uppercase; letter-spacing: .12em; font-size: 10px; font-weight: 700; }
.builder-heading h1 { margin: 0; font-size: 30px; line-height: 1.14; letter-spacing: -.04em; font-weight: 700; }
.builder-heading > p:not(.eyebrow) { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.workflow { display: flex; list-style: none; padding: 0; margin: 20px 0 0; gap: 14px; flex-wrap: wrap; }
.workflow li { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.workflow span { width: 21px; height: 21px; display: grid; place-items: center; border-radius: 50%; background: #f2edf8; color: var(--purple); font-size: 10px; font-weight: 700; }
.builder-scroll { min-width: 0; min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 20px 24px 28px; scrollbar-color: #d5c9db transparent; scrollbar-width: thin; }
.control-card { padding: 16px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.section-label { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-label h2 { margin: 0; font-size: 14px; font-weight: 650; }
.section-label > span { color: var(--muted); font-size: 10px; text-align: right; }
.word-card { border-color: #e8c5d0; }
.word-field { position: relative; }
.word-field input { width: 100%; min-width: 0; padding: 10px 47px 10px 12px; border: 1px solid var(--line); color: var(--ink); background: #fffafc; font-size: 23px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.word-field button { position: absolute; right: 3px; top: 3px; width: 44px; border: 0; background: transparent; color: var(--muted); font-size: 23px; }
.field-note { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.field-note.is-warning { color: #a13d5a; }
#storage-status:empty { display: none; }
.starters { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.starters button { padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--cream); font-size: 10px; font-weight: 650; letter-spacing: .02em; }
.color-line { display: flex; align-items: center; gap: 12px; padding: 9px; border-radius: 11px; background: #faf6f3; cursor: pointer; }
input[type="color"] { width: 44px; height: 44px; padding: 2px; border: 1px solid var(--line); background: white; cursor: pointer; flex: 0 0 44px; }
.color-line span { display: flex; flex-direction: column; gap: 3px; }
.color-line strong { font-size: 12px; }
.color-line small { font: 11px ui-monospace, monospace; color: var(--muted); }
.bulk-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.bulk-row label { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-radius: 10px; padding-left: 9px; background: #faf6f3; font-size: 12px; color: var(--muted); }
.bulk-row button { border: 0; background: #f1ebfa; color: #6546a5; padding: 0 14px; font-size: 12px; font-weight: 650; }
.segment-list { display: grid; gap: 8px; margin-top: 14px; }
.segment-item { min-width: 0; display: grid; grid-template-columns: 34px minmax(0,1fr) minmax(0,1fr) 44px; align-items: center; gap: 6px; padding: 8px 6px; border: 1px solid var(--line); border-radius: 11px; background: #fcfaf8; }
.segment-item.is-selected { border-color: #ad97d6; background: #faf7ff; }
.segment-index { width: 34px; height: 38px; border-radius: 9px; display: grid; place-items: center; font-size: 19px; font-weight: 750; background: var(--cap); color: var(--letter); box-shadow: inset 0 -2px rgba(0,0,0,.06); }
.segment-color { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.segment-color > span { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: var(--muted); }
.segment-color small { font: 9px ui-monospace, monospace; color: var(--ink); }
.segment-click { width: 44px; border: 1px solid var(--line); background: white; color: var(--purple); font-size: 11px; }
.empty-segments { color: var(--muted); font-size: 12px; text-align: center; padding: 12px 0; }
.saved-designs { display: grid; gap: 8px; }
.saved-designs > p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.saved-item { min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) auto 44px; gap: 6px; align-items: center; padding: 6px 6px 6px 10px; background: #faf6f3; border-radius: 10px; font-size: 12px; }
.saved-item > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.saved-item button { border: 1px solid var(--line); background: white; font-size: 11px; padding: 0 9px; }
.saved-item [data-delete] { padding: 0; font-size: 20px; }
.secondary-actions { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); gap: 8px; margin-top: 12px; }
.secondary-actions button { border: 1px solid var(--line); background: white; padding: 8px; font-size: 11px; font-weight: 600; }
.honesty-note { margin: 18px 2px 10px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.technical-details { color: var(--muted); font-size: 11px; line-height: 1.65; }
.technical-details summary { min-height: 44px; padding: 12px 2px; cursor: pointer; color: var(--ink); }
.technical-details p { margin: 4px 0 10px; }
.builder-action { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--line); background: white; box-shadow: 0 -4px 18px rgba(53,42,64,.025); z-index: 6; }
.builder-action > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.builder-action strong { font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.builder-action div > span { font-size: 10px; color: var(--muted); }
.primary-action { flex-shrink: 0; border: 1px solid var(--purple); background: var(--purple); color: white; font-size: 12px; font-weight: 650; padding: 0 16px; min-height: 46px; }
.primary-action > span { margin-left: 9px; }
#review-dialog { width: min(560px, calc(100% - 28px)); max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px); padding: 25px; border: 1px solid var(--line); border-radius: 20px; color: var(--ink); background: white; box-shadow: 0 24px 100px #352a403b; overflow-y: auto; overscroll-behavior: contain; }
#review-dialog::backdrop { background: rgba(53,42,64,.42); backdrop-filter: blur(3px); }
.review-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.review-heading h2 { margin: 0; font-size: 26px; line-height: 1.15; letter-spacing: -.03em; }
#close-review { width: 44px; flex: 0 0 44px; border: 1px solid var(--line); background: var(--cream); font-size: 24px; }
#review-description { margin: 13px 0 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.review-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px; margin: 0 0 16px; border-radius: 12px; background: var(--cream); }
.review-facts div { min-width: 0; }
.review-facts dt { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.review-facts dd { margin: 0; font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
.review-facts div:last-child { grid-column: 1 / -1; }
.review-color { display: inline-flex; align-items: center; gap: 6px; font: 11px ui-monospace, monospace; white-space: nowrap; }
.review-color i { display: inline-block; width: 15px; height: 15px; flex: 0 0 15px; border-radius: 5px; border: 1px solid rgba(53,42,64,.2); background: var(--color); }
.review-colors { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 18px; }
.review-colors caption { text-align: left; font-size: 13px; font-weight: 650; margin-bottom: 8px; }
.review-colors th { color: var(--muted); font-size: 11px; font-weight: 500; text-align: left; }
.review-colors th, .review-colors td { border-bottom: 1px solid var(--line); padding: 9px 4px; }
.review-colors tbody th { color: var(--ink); font-size: 12px; font-weight: 650; }
.save-name { display: grid; gap: 8px; }
.save-name label { font-size: 12px; font-weight: 650; }
.save-name input { min-width: 0; width: 100%; min-height: 44px; border: 1px solid var(--line); padding: 10px 12px; font-size: 14px; }
.review-boundary { font-size: 11px; color: var(--muted); line-height: 1.6; margin: 12px 0; }
.save-status { margin: 12px 0; padding: 11px 12px; border: 1px solid #c4dece; border-radius: 10px; background: #f1faf5; color: #345f47; font-size: 12px; line-height: 1.5; }
.save-status:empty { display: none; }
.save-status.is-error { background: #fff4f6; border-color: #e9bbca; color: #923654; }
.review-actions { position: sticky; bottom: -25px; display: flex; justify-content: space-between; gap: 10px; margin: 16px -25px -25px; padding: 14px 25px; background: white; border-top: 1px solid var(--line); }
.review-actions > button:not(.primary-action) { border: 1px solid var(--line); background: white; padding: 0 13px; font-size: 12px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%,10px); width: max-content; max-width: calc(100% - 32px); opacity: 0; z-index: 20; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: white; box-shadow: 0 8px 25px #352a4026; font-size: 12px; line-height: 1.5; pointer-events: none; transition: .18s; text-align: center; }
.toast.is-visible { opacity: 1; transform: translate(-50%,0); }
@media (min-width: 921px) and (max-height: 680px) {
  .builder-heading { padding-top: 15px; padding-bottom: 14px; }
  .workflow { margin-top: 12px; }
  .builder-action { padding-top: 10px; padding-bottom: 10px; }
}
@media (max-width: 920px) {
  body { overflow: auto; }
  .app-shell { display: block; height: auto; min-height: 0; padding-bottom: 92px; }
  .preview-panel { height: 400px; grid-template-rows: 62px minmax(0,1fr) 68px; }
  .builder { overflow: visible; border-left: 0; border-top: 1px solid var(--line); }
  .builder-heading { padding: 23px 24px 20px; }
  .builder-scroll { overflow: visible; padding: 20px 24px 24px; }
  .builder-action { position: fixed; bottom: 0; left: 0; right: 0; padding: 12px 24px max(12px, env(safe-area-inset-bottom)); }
  .toast { bottom: 96px; }
}
@media (max-width: 560px) {
  .preview-panel { height: 330px; grid-template-rows: 58px minmax(0,1fr) 64px; }
  .topbar, .preview-footer { padding: 0 16px; gap: 8px; }
  .topbar > strong { font-size: 12px; }
  .view-actions, .preview-footer-actions { gap: 6px; }
  .view-actions button, .preview-footer-actions button { padding: 0 10px; font-size: 11px; }
  .preview-footer strong { font-size: 14px; }
  .preview-label { top: 12px; left: 16px; font-size: 10px; }
  .orbit-hint { bottom: 10px; font-size: 10px; }
  .builder-heading { padding: 23px 18px 20px; }
  .builder-heading h1 { font-size: 26px; }
  .builder-scroll { padding: 17px 16px 24px; }
  .control-card { padding: 14px; }
  .workflow { gap: 12px; }
  .builder-action { padding-left: 16px; padding-right: 16px; gap: 8px; }
  .builder-action strong { font-size: 11px; }
  .builder-action div > span { max-width: 140px; font-size: 10px; line-height: 1.4; }
  .primary-action { font-size: 11px; padding: 0 13px; }
  #review-dialog { padding: 20px 16px; }
  .review-heading h2 { font-size: 24px; }
  .review-actions { bottom: -20px; margin: 14px -16px -20px; padding: 12px 16px; gap: 8px; }
  .review-actions > button:not(.primary-action) { padding: 0 10px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
/* Bounded style choices; native selectors remain keyboard/touch accessible. */
.style-card label{display:block;font-size:13px;margin:12px 0 6px;color:var(--muted,#776a81)}
.style-card select{width:100%;min-height:44px;border:1px solid #ddd3e5;border-radius:12px;background:#fff;color:#3e304b;padding:10px 12px;font:inherit}
.style-card select:focus-visible{outline:3px solid #b49acc;outline-offset:2px}
