* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --ink: #292432;
  --muted: #6d6577;
  --paper: #fffdf8;
  --canvas: #f3eee5;
  --line: #d9d0c5;
  --plum: #5d315f;
  --plum-dark: #402143;
  --plum-soft: #eee3ef;
  --gold: #d8933b;
  --blue: #447b88;
  --rose: #a45361;
  --danger: #a33c3c;
  --shadow: 0 16px 40px rgba(51, 38, 48, .1);
}
body {
  margin: 0;
  background: radial-gradient(circle at 8% 3%, rgba(216, 147, 59, .13), transparent 26rem), radial-gradient(circle at 95% 16%, rgba(93, 49, 95, .1), transparent 24rem), var(--canvas);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
[hidden] { display: none !important; }
button, select, textarea { font: inherit; }
button, select { min-height: 44px; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #326b79;
  outline-offset: 3px;
}
a { color: var(--plum); text-underline-offset: 4px; }
.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  transform: translateY(-180%);
  border-radius: 8px;
  background: var(--ink);
  color: white;
}
.skip-link:focus { transform: translateY(0); }
.project-nav, .site-header, .workspace, footer {
  width: min(1280px, calc(100% - 40px));
  margin-inline: auto;
}
.project-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 10px;
}
.project-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 0;
  font-size: 16px;
  font-weight: 700;
}
.project-nav span { color: var(--muted); font-size: 13px; }
.site-header {
  padding: 20px 0 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
}
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 18px;
  background: var(--plum);
  box-shadow: 0 8px 20px rgba(93, 49, 95, .22);
  color: #fff8e8;
  font-size: 26px;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.3rem);
  font-weight: 600;
  letter-spacing: -.035em;
  line-height: 1.05;
}
h2 {
  margin-bottom: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.15;
}
.eyebrow, .step-label {
  margin-bottom: 5px;
  color: var(--plum);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.intro { max-width: 480px; margin-bottom: 3px; color: var(--muted); font-size: 17px; }
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 22px;
  align-items: start;
}
.prompt-panel, .writing-panel, .tool-card {
  min-width: 0;
  border: 1px solid rgba(128, 108, 111, .22);
  border-radius: 20px;
  background: rgba(255, 253, 248, .96);
  box-shadow: var(--shadow);
}
.prompt-panel {
  grid-column: 1 / -1;
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "heading" "alert" "cards" "result" "hint" "status";
}
.prompt-heading-row { grid-area: heading; }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.section-heading h2 { margin-bottom: 0; }
.primary-button, .secondary-button {
  border-radius: 12px;
  padding: 10px 17px;
  font-weight: 750;
  transition: background 130ms ease, border-color 130ms ease;
}
.primary-button {
  border: 1px solid var(--plum);
  background: var(--plum);
  box-shadow: 0 6px 14px rgba(93, 49, 95, .16);
  color: white;
}
.primary-button:hover:not(:disabled) { background: var(--plum-dark); }
.secondary-button { border: 1px solid var(--line); background: white; color: var(--ink); }
.secondary-button:hover:not(:disabled) { border-color: var(--plum); background: var(--plum-soft); }
.compact-button { flex: 0 0 auto; }
.full-button { width: 100%; }
.deck-alert {
  grid-area: alert;
  margin: -4px 0 20px;
  border: 1px solid #ddb7a3;
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff1e8;
  color: #70412e;
}
.card-grid { grid-area: cards; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.story-card {
  position: relative;
  min-width: 0;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-top: 6px solid var(--gold);
  border-radius: 16px;
  padding: 18px;
  background: #fffefa;
}
.story-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 65px;
  height: 60px;
  border-radius: 0 10px 0 100%;
  background: rgba(216, 147, 59, .08);
  pointer-events: none;
}
.setting-card { border-top-color: var(--blue); }
.setting-card::after { background: rgba(68, 123, 136, .09); }
.complication-card { border-top-color: var(--rose); }
.complication-card::after { background: rgba(164, 83, 97, .09); }
.story-card.is-locked { box-shadow: inset 0 0 0 2px rgba(93, 49, 95, .26); }
.story-card.is-empty { border-style: dashed; background: #f8f5f0; }
.card-topline {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.card-kind { margin: 0; color: var(--muted); font-size: 14px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.lock-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 7px;
  min-width: 88px;
  min-height: 44px;
  border: 1px solid #b9abbc;
  border-radius: 10px;
  padding: 9px 11px;
  background: #fffdf8;
  color: var(--plum-dark);
  font-size: 14px;
  font-weight: 750;
}
.lock-button:hover:not(:disabled) { background: var(--plum-soft); border-color: var(--plum); }
.lock-button[aria-pressed="true"] { border-color: var(--plum); background: var(--plum-soft); }
.lock-icon { font-size: 18px; line-height: 1; }
.card-text {
  margin: auto 0;
  padding: 22px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(20px, 2vw, 24px);
  line-height: 1.38;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.card-text.empty-text { color: var(--muted); font-family: inherit; font-size: 16px; }
.deck-control { margin-top: auto; min-width: 0; }
.deck-control label, .field label, .notes-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}
select, textarea { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); }
select { padding: 9px 28px 9px 12px; font-size: 16px; }
select:disabled { color: var(--muted); opacity: 1; background: #f3eff3; }
.deck-summary { margin: 7px 0 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.control-hint { margin: 7px 0 0; color: var(--plum); font-size: 13px; }
.prompt-strip {
  grid-area: result;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
  border-radius: 14px;
  padding: 16px 18px;
  background: var(--plum-soft);
  scroll-margin-top: 16px;
}
.prompt-strip > div { min-width: 0; }
.prompt-strip-label { margin-bottom: 3px; color: var(--plum); font-size: 12px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.combined-prompt { margin-bottom: 0; font-size: 17px; font-weight: 650; white-space: pre-wrap; overflow-wrap: anywhere; }
.shuffle-hint { grid-area: hint; margin: 12px 0 0; color: var(--muted); font-size: 13px; }
#copy-status { grid-area: status; }
.side-panel { display: grid; gap: 22px; min-width: 0; }
.tool-card { padding: 24px; }
.section-copy { margin-bottom: 20px; color: var(--muted); font-size: 16px; }
.field { margin-bottom: 15px; }
.field textarea { min-height: 110px; padding: 11px 12px; resize: vertical; }
textarea::placeholder { color: #746e79; opacity: 1; }
textarea[aria-invalid="true"] { border-color: var(--danger); }
.form-message { min-height: 1.5em; margin: -4px 0 10px; color: var(--muted); font-size: 14px; }
.form-message.error { color: var(--danger); }
.form-message.success { color: #356a4d; }
.session-card { background: #2f2a36; color: #fffdf8; }
.session-card .step-label { color: #e8bb78; }
.cue-list { margin: 16px 0 0; padding-left: 22px; color: #e8e2e8; }
.cue-list li + li { margin-top: 8px; }
.writing-panel { padding: 28px; }
.writing-heading-row { margin-bottom: 18px; }
.note-count { margin: 0; color: var(--muted); font-size: 14px; white-space: nowrap; }
.notes-area {
  display: block;
  min-height: 330px;
  padding: 16px 18px;
  resize: vertical;
  background: linear-gradient(to bottom, transparent 31px, rgba(80, 70, 80, .1) 32px), #fffefa;
  background-size: 100% 32px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 32px;
}
.writing-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-top: 16px; }
.privacy-note { flex: 1 1 240px; margin: 0; color: var(--muted); font-size: 14px; }
.action-status { margin: 10px 0 0; color: var(--plum-dark); font-size: 14px; overflow-wrap: anywhere; }
.action-status:empty { margin: 0; }
footer { padding: 26px 0 38px; color: var(--muted); font-size: 13px; text-align: center; }
footer p { margin: 0; }
.noscript-message { margin: 20px; padding: 16px; border: 1px solid var(--danger); }
.clipboard-helper { position: fixed; left: -10000px; top: 0; }
@media (max-width: 1060px) {
  .site-header { align-items: flex-start; flex-direction: column; gap: 18px; }
  .intro { max-width: 640px; }
  .card-grid { grid-template-columns: 1fr; }
  .story-card { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .8fr); column-gap: 28px; }
  .card-topline { grid-column: 1 / -1; }
  .card-text { padding: 18px 0 6px; }
  .deck-control { margin-top: 14px; align-self: end; }
  .workspace { grid-template-columns: minmax(0, 1fr) 310px; }
  .writing-actions { align-items: stretch; flex-direction: column; }
  .privacy-note { flex: initial; }
}
@media (max-width: 760px) {
  .project-nav, .site-header, .workspace, footer { width: calc(100% - 24px); }
  .project-nav span { display: none; }
  .site-header { padding: 18px 0 26px; }
  .brand { gap: 14px; }
  .brand-mark { width: 48px; height: 48px; border-radius: 14px; }
  .workspace { grid-template-columns: 1fr; }
  .prompt-panel, .writing-panel, .tool-card { padding: 20px; }
  .prompt-panel { grid-template-areas: "heading" "alert" "result" "cards" "hint" "status"; }
  .story-card { display: flex; min-height: 250px; }
  .card-text { padding: 24px 0; font-size: 20px; }
  .deck-control { margin-top: auto; align-self: stretch; }
  .section-heading { align-items: stretch; flex-direction: column; gap: 18px; }
  .section-heading .primary-button, .writing-actions .primary-button { width: 100%; }
  .writing-heading-row { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .prompt-strip { align-items: stretch; flex-direction: column; gap: 14px; margin-top: 0; margin-bottom: 20px; }
  .compact-button { width: 100%; }
  .notes-area { min-height: 300px; }
}
@media (max-width: 380px) {
  .prompt-panel, .writing-panel, .tool-card { padding: 16px; }
  .story-card { padding: 14px; }
  .eyebrow { letter-spacing: .06em; }
  .brand-mark { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
