:root {
  --ink: #1F2430;
  --muted: #4A5162;
  --muted-2: #5A6170;
  --line: #E6E1D7;
  --line-2: #D6D1C7;
  --bg: #F7F5F0;
  --panel: #FBFAF7;
  --white: #FFFFFF;
  --wall: #E4EAE6;
  --mat: #9AA79E;
  --sel: #2F6FEB;
  --danger: #B42318;
  --display: Fredoka, Inter, system-ui, sans-serif;
  --body: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5; }
a { color: var(--ink); }
a:hover { color: var(--muted); }
h1, h2, h3 { font-family: var(--display); margin: 0; }
p { margin: 0; }
button { font: inherit; }
:focus-visible { outline: 3px solid var(--sel); outline-offset: 2px; }

.wrap { max-width: 1240px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
@media (max-width: 480px) { .wrap { padding-left: 16px; padding-right: 16px; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 2px solid transparent; font: 600 15px var(--body); text-decoration: none; cursor: pointer; background: var(--white); color: var(--ink); }
.btn-primary { background: var(--ink); color: var(--white); border-color: var(--ink); }
.btn-primary:hover { background: #343B4C; color: var(--white); }
.btn-outline { border-color: var(--ink); background: transparent; }
.btn-outline:hover { background: var(--white); }
.btn-soft { border-color: var(--line-2); background: var(--white); font-size: 14px; padding: 0 16px; }
.btn-soft:hover { border-color: var(--ink); }
.btn-soft:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-danger { border-color: var(--danger); color: var(--danger); background: var(--white); font-size: 14px; }
.btn-ghost { background: transparent; color: var(--muted); font-size: 14px; }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 15px; }
.btn-lg { min-height: 52px; padding: 0 28px; font-size: 16px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-row-sm { display: flex; flex-wrap: wrap; gap: 8px; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; padding-bottom: 18px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-dots { display: flex; gap: 3px; }
.logo-dots span { width: 14px; height: 14px; border-radius: 50%; }
.logo-name { font-family: var(--display); font-weight: 700; font-size: 24px; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; font-size: 15px; font-weight: 500; }
.nav a { text-decoration: none; }

/* Hero */
.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 48px; padding-top: 64px; padding-bottom: 48px; }
.hero-copy { flex: 1 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.eyebrow { font-size: 14px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-2); }
.hero h1 { font-weight: 700; font-size: clamp(40px, 6vw, 68px); line-height: 1.02; }
.lead { font-size: 19px; line-height: 1.55; color: var(--muted); max-width: 520px; }
.hero .btn-row { margin-top: 8px; }
.hero-mat { flex: 1 1 420px; min-width: 0; border-radius: 28px; padding: 32px 16px 24px; background-color: var(--wall); background-image: linear-gradient(rgba(31,36,48,0.05) 2px, transparent 2px); background-size: 100% 28px; }
.swag-preview { position: relative; width: 100%; }
.bead-static { cursor: default; touch-action: auto; }

/* Designer */
.designer-section { background: var(--white); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.designer-inner { padding-top: 64px; padding-bottom: 64px; display: flex; flex-direction: column; gap: 28px; }
.section-head { display: flex; flex-direction: column; gap: 8px; }
.section-head h2, .how h2 { font-weight: 700; font-size: clamp(32px, 4vw, 44px); }
.section-head p { font-size: 17px; color: var(--muted); max-width: 760px; }
.designer-grid { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.board-col { flex: 1 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.side-col { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.board-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

.segmented { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: #F1EEE7; }
.segmented button { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 0; background: transparent; color: var(--ink); font: 600 14px var(--body); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--white); }

/* Boards */
.garland { position: relative; width: 100%; border-radius: 24px; overflow: hidden; background-color: var(--wall); background-image: linear-gradient(rgba(31,36,48,0.05) 2px, transparent 2px); background-size: 100% 28px; }
.row-band { position: absolute; left: 0; width: 100%; transition: background 0.12s; }
.row-band.is-over { background: rgba(47,111,235,0.10); }
.row-band svg.cord { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.row-empty { position: absolute; left: 0; right: 0; top: 18%; text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); pointer-events: none; }

.strand-scroll { max-height: 720px; overflow-y: auto; border-radius: 24px; background: var(--wall); padding: 20px 16px 48px; border: 3px solid transparent; transition: border-color 0.12s; }
.strand-scroll.is-over { border-color: var(--sel); }
.strand-peg { display: block; margin: 0 auto; }
.strand { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 240px; padding-top: 12px; }
.strand-cord { position: absolute; left: calc(50% - 2px); top: -18px; bottom: -28px; width: 4px; background: var(--white); border-radius: 2px; }
.strand-empty { position: relative; margin-top: 80px; padding: 12px 16px; border-radius: 12px; background: var(--white); font-size: 14px; font-weight: 600; color: var(--muted); }

/* Beads */
.bead { position: absolute; container-type: inline-size; padding: 0; border: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; filter: drop-shadow(0 3px 2px rgba(31,36,48,0.25)); }
.strand .bead { position: relative; flex: none; }
.bead.is-selected::after { content: ""; position: absolute; inset: -16%; border-radius: 50%; border: 3px solid var(--sel); pointer-events: none; }
.strand .bead.is-selected::after { inset: -10%; }
.bead.is-dragging { opacity: 0.3; }
.bead svg, .hero-bead svg, .tray-letter svg, .ghost svg { display: block; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.letter-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 600; font-size: 54cqw; line-height: 1; pointer-events: none; }
.spacer-shape { display: block; width: 100%; height: 100%; border-radius: 30%; border: 1px solid rgba(31,36,48,0.18); pointer-events: none; }

.ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; container-type: inline-size; opacity: 0.92; filter: drop-shadow(0 8px 10px rgba(31,36,48,0.3)); }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }

/* Selection panel */
.sel-panel { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.sel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.sel-title { font-size: 15px; font-weight: 600; }
.sel-tip { font-size: 14px; color: var(--muted); }

/* Cards */
.card { display: flex; flex-direction: column; gap: 12px; padding: 20px; border-radius: 20px; border: 1px solid var(--line); background: var(--panel); }
.card-title { font-size: 15px; font-weight: 600; }
.sub-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.hint { font-size: 13px; line-height: 1.5; color: var(--muted-2); }
.words-input { min-height: 48px; padding: 0 14px; border-radius: 12px; border: 2px solid var(--line-2); background: var(--white); font: 600 18px var(--display); letter-spacing: 0.08em; color: var(--ink); width: 100%; text-transform: uppercase; }
.words-input:focus { border-color: var(--ink); outline: none; }

.tray { border: 2px dashed var(--line-2); gap: 16px; transition: border-color 0.12s, background 0.12s; }
.tray.is-over { border-color: var(--danger); background: #FDF0EF; }
.tray-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }

.swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.swatch { width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 3px solid var(--line); background: var(--white); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.swatch[aria-pressed="true"] { border-color: var(--sel); }
.swatch span { width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgba(31,36,48,0.2); }

.tray-shapes { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.tray-shape { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 14px; border: 1px solid var(--line); background: var(--white); color: var(--ink); font: 500 12px var(--body); cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.tray-shape:hover { border-color: var(--ink); }
.tray-shape .icon { width: 36px; height: 36px; display: block; position: relative; container-type: inline-size; filter: drop-shadow(0 2px 1px rgba(31,36,48,0.2)); pointer-events: none; }
.tray-shape .icon svg { display: block; width: 100%; height: 100%; overflow: visible; }
.tray-shape .icon .spacer-shape { width: 38%; height: 88%; margin: 6% auto 0; }

.tray-letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; }
.tray-letter { position: relative; container-type: inline-size; justify-self: center; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; filter: drop-shadow(0 2px 1px rgba(31,36,48,0.2)); }
.tray-letter .letter-text { font-size: 22px; }

.size-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.size-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 56px; padding: 8px; border-radius: 16px; border: 2px solid var(--line-2); background: var(--white); color: var(--ink); font: 600 14px var(--body); cursor: pointer; }
.size-btn small { font-size: 12px; font-weight: 500; opacity: 0.85; }
.size-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--white); }
.stat { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.price-lines { display: flex; flex-direction: column; gap: 8px; }
.stat .each { color: var(--muted-2); font-size: 13px; }
.stat strong { color: var(--ink); font-weight: 600; }
.divider { height: 1px; background: var(--line); }
.total { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; }
.total span:last-child { font: 700 24px var(--display); }

/* How */
.how { padding-top: 64px; padding-bottom: 64px; display: flex; flex-direction: column; gap: 28px; }
.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.how-card { display: flex; flex-direction: column; gap: 12px; padding: 28px; border-radius: 24px; background: var(--white); border: 1px solid var(--line); }
.how-num { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font: 700 24px var(--display); }
.how-card h3 { font-size: 20px; font-weight: 600; }
.how-card p { font-size: 15px; line-height: 1.55; color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); }
.footer-inner { padding-top: 28px; padding-bottom: 28px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted-2); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--white); padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 1100; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .toast, .row-band, .tray, .strand-scroll { transition: none; }
}
