:root {
  --paper: #f5f1eb;
  --surface: #fffdfa;
  --ink: #181515;
  --muted: #6f6965;
  --line: #dcd5ce;
  --burgundy: #8f2634;
  --burgundy-dark: #6f1825;
  --rose: #f2dfe1;
  --green: #39705c;
  --green-soft: #edf4f0;
  --amber: #a46d23;
  --blue: #496b7c;
  --shadow: 0 20px 60px rgba(48, 37, 34, .09);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); font-family: "IBM Plex Sans", Arial, sans-serif; }
button { font: inherit; }
button:focus-visible, a:focus-visible, .drop-zone:focus-visible { outline: 3px solid rgba(143, 38, 52, .3); outline-offset: 3px; }

.app-shell { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0 36px; }
.app-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 14px; font-weight: 700; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--burgundy); color: #fff; font: 600 12px "IBM Plex Mono", monospace; }
.preview-label, .eyebrow, .stage-kicker { color: var(--burgundy); font: 600 10px "IBM Plex Mono", monospace; letter-spacing: .09em; text-transform: uppercase; }

.hero { margin-top: 24px; padding: 36px 40px 30px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.eyebrow { margin: 0 0 12px; }
.hero h1 { max-width: 830px; margin: 0 auto; font-size: clamp(30px, 4vw, 48px); line-height: 1.06; letter-spacing: -.045em; }
.hero > p:not(.eyebrow) { margin: 15px auto 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.hero .hero-note { margin-top: 2px; }

.stage-nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 25px; }
.stage-tab { min-height: 52px; padding: 9px 12px; display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--muted); text-align: left; cursor: pointer; }
.stage-tab:disabled { cursor: not-allowed; opacity: .62; }
.stage-tab.is-active { border-color: var(--burgundy); box-shadow: 0 0 0 2px rgba(143, 38, 52, .1); color: var(--ink); }
.stage-tab.is-complete { border-color: #a9c7b9; background: var(--green-soft); color: var(--green); }
.stage-number { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 5px; background: var(--rose); color: var(--burgundy); font: 600 10px "IBM Plex Mono", monospace; }
.stage-tab > span:nth-child(2) { font-size: 13px; font-weight: 600; }
.stage-tab small { padding: 4px 7px; border-radius: 99px; background: #f1ede8; font-size: 9px; font-weight: 600; }
.stage-tab.is-complete small { background: #dcece3; }

.activity { margin-top: 18px; padding: 30px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.activity-top { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.stage-kicker { margin: 0 0 7px; }
.activity-top h2 { margin: 0; font-size: 30px; letter-spacing: -.035em; }
.activity-top p:not(.stage-kicker) { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.activity-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.remaining { min-height: 40px; display: inline-flex; align-items: center; padding: 0 13px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font-size: 12px; }
.secondary-button, .restart-button, .primary-button { min-height: 40px; padding: 0 15px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 600; cursor: pointer; }
.primary-button { border-color: var(--burgundy); background: var(--burgundy); color: #fff; }
.primary-button:hover { background: var(--burgundy-dark); }
.status { min-height: 19px; margin: 18px 0 10px; color: var(--muted); font-size: 12px; text-align: center; }
.status.is-error { color: var(--burgundy); }
.status.is-success { color: var(--green); }

.buckets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.bucket { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.bucket header { min-height: 42px; padding: 0 15px; display: flex; align-items: center; justify-content: space-between; background: var(--burgundy); color: #fff; }
.bucket h3 { margin: 0; font-size: 15px; }
.bucket-count { font: 600 11px "IBM Plex Mono", monospace; }
.drop-zone { width: 100%; min-height: 172px; padding: 12px; display: flex; flex-direction: column; justify-content: center; border: 0; background: #fff; color: #aaa29c; cursor: pointer; }
.drop-zone > span { font-size: 12px; }
.drop-zone.has-items { justify-content: flex-start; }
.drop-zone.has-items > span { display: none; }
.bucket-definition .drop-zone { box-shadow: inset 0 0 0 2px #b9cfdb; }
.bucket-features .drop-zone { box-shadow: inset 0 0 0 2px #dcc38a; }
.bucket-examples .drop-zone { box-shadow: inset 0 0 0 2px #acd0bf; }
.bucket-nonexamples .drop-zone { box-shadow: inset 0 0 0 2px #ddb5b9; }
.drop-zone.is-dragover { background: #faf4f4; box-shadow: inset 0 0 0 3px var(--burgundy); }
.drop-zone.is-wrong { animation: nudge .26s ease; background: #fae8e9; }
.placed-items { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.placed-card { width: 100%; padding: 10px 12px; border: 1px solid #acd0bf; border-radius: 7px; background: var(--green-soft); color: #284c3f; font-size: 12px; font-weight: 600; line-height: 1.35; text-align: left; }

.card-bank { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.card-bank-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 11px; }
.card-bank-heading h3 { margin: 0; font-size: 17px; }
.card-bank-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.cards { min-height: 82px; padding: 10px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; border: 1px solid var(--line); border-radius: 10px; background: #f5f7f8; }
.card { min-height: 62px; padding: 11px 12px; border: 1px solid #cfd6da; border-radius: 8px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 600; line-height: 1.35; text-align: left; cursor: grab; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.card:hover { transform: translateY(-1px); border-color: #9da9ae; }
.card.is-selected { border-color: var(--burgundy); background: var(--rose); box-shadow: 0 0 0 2px rgba(143, 38, 52, .1); }
.card.is-dragging { opacity: .45; }

.app-footer { padding: 18px 2px 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 11px; }
.restart-button { border-color: var(--ink); background: var(--ink); color: #fff; }

.dialog { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; }
.dialog[hidden] { display: none; }
.dialog-backdrop { position: absolute; inset: 0; background: rgba(24, 21, 21, .57); }
.dialog-panel { position: relative; width: min(430px, 100%); padding: 34px; border-radius: 15px; background: var(--surface); box-shadow: 0 28px 90px rgba(0, 0, 0, .24); text-align: center; }
.dialog-symbol { width: 46px; height: 46px; margin: 0 auto 13px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-size: 22px; font-weight: 700; }
.dialog-panel h2 { margin: 0; font-size: 30px; letter-spacing: -.035em; }
.dialog-panel p { margin: 9px 0 23px; color: var(--muted); }
.dialog-actions { display: flex; justify-content: center; gap: 8px; }

@keyframes nudge { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

@media (max-width: 850px) {
  .stage-nav { grid-template-columns: 1fr; }
  .activity-top { align-items: flex-start; flex-direction: column; }
  .activity-actions { width: 100%; justify-content: space-between; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .app-shell { width: min(100% - 22px, 1240px); padding-top: 12px; }
  .preview-label { display: none; }
  .hero { padding: 30px 18px 20px; }
  .hero h1 { font-size: 34px; }
  .activity { padding: 16px; }
  .activity-top h2 { font-size: 26px; }
  .buckets, .cards { grid-template-columns: 1fr; }
  .drop-zone { min-height: 135px; }
  .card-bank-heading, .app-footer { align-items: flex-start; flex-direction: column; }
  .restart-button { align-self: stretch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
