/* Lotería Duo Creator.
   Header + footer: exactly the dark loteriaduo.com look (night/plum, cream, teal + marigold, Open Sans 800 / Lato).
   Everything between them: a light dashboard built on the same palette (white surfaces, violet ink, teal actions, gold accents).
   Printed boards keep the Canva print style (white paper, teal grid). */
:root {
  /* site (dark) */
  --night: #0F0A1F;
  --plum: #160F2E;
  --violet: #2F2468;
  --cream: #F9EFE7;
  --muted-d: #B7B0C9;
  --line-d: rgba(249, 239, 231, 0.12);
  --teal: #14B8B8;
  --teal-ink: #04292A;
  --teal-dark: #0B8585;
  --gold: #FEB500;
  --gold-ink: #241600;
  --coral: #E5533F;
  /* dashboard (light) */
  --bg: #F6F3FA;
  --surface: #FFFFFF;
  --surface-2: #FBFAFD;
  --ink: #1C1535;
  --ink-2: #5E5775;
  --ink-3: #8C86A0;
  --border: #E7E2F0;
  --border-2: #D8D1E6;
  --hover: #F2EEF9;
  --select: #E7F7F7;
  --shadow: 0 1px 2px rgba(28, 21, 53, .06), 0 4px 14px rgba(28, 21, 53, .06);
  --shadow-lg: 0 2px 6px rgba(28, 21, 53, .08), 0 18px 40px rgba(28, 21, 53, .12);
  --head: "Open Sans", system-ui, sans-serif;
  --body: "Lato", system-ui, sans-serif;
  --radius: 16px;
  --nav-h: 72px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 16px/1.5 var(--body); color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; overflow-x: clip; }
main { flex: 1; outline: none; }
h1, h2, h3, h4 { font-family: var(--head); line-height: 1.15; margin: 0 0 .4em; text-wrap: balance; color: var(--ink); }
h1 { font-weight: 800; font-size: clamp(1.8rem, 3.2vw, 2.5rem); letter-spacing: -0.025em; }
h2 { font-weight: 800; font-size: 1.35rem; letter-spacing: -0.015em; }
h3 { font-weight: 700; font-size: 1.08rem; }
h4 { font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); margin: 0 0 10px; }
p { margin: 0 0 1em; }
a { color: var(--teal-dark); }
code { font-size: .85em; background: var(--select); color: var(--teal-dark); padding: 2px 8px; border-radius: 8px; }
.wrap { width: min(1200px, 100% - 40px); margin-inline: auto; }
.muted { color: var(--ink-2); }
.grow { flex: 1; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: var(--gold-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 12px; }

/* icons */
.ico { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }
.ico.big { width: 34px; height: 34px; color: var(--teal); }
.ico.ok { color: var(--teal-dark); }

/* ---------- header (mirrors loteriaduo.com) ---------- */
.nav { position: sticky; top: 0; z-index: 60; height: var(--nav-h); background: var(--night); border-bottom: 1px solid var(--line-d); color: var(--cream); }
.nav-inner { display: flex; align-items: center; gap: 18px; height: 100%; }
body.is-workspace .nav-inner { width: calc(100% - 40px); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--cream); font: 800 1.25rem var(--head); white-space: nowrap; }
.brand img { border-radius: 10px; width: 40px; height: 40px; object-fit: contain; }
.brand b { color: var(--teal); }
.brand.small { font-size: 1.1rem; }
.creator-tag { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--cream); font: 700 1rem var(--head); padding-left: 16px; border-left: 1px solid rgba(249, 239, 231, .2); }
.beta-pill { padding: 2px 9px; border-radius: 99px; font: 700 .72rem/1.4 var(--body); color: var(--gold); box-shadow: inset 0 0 0 1px rgba(254, 181, 0, .5); text-transform: uppercase; letter-spacing: .04em; }
.nav-links { display: flex; gap: 26px; margin-left: auto; }
.nav-links a { text-decoration: none; font-weight: 700; font-size: .97rem; color: var(--muted-d); }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--cream); }
.nav-links a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--teal); }
.menu-btn { display: none; margin-left: auto; background: transparent; border: 0; color: var(--cream); padding: 10px; cursor: pointer; }
.menu-btn .ico { width: 26px; height: 26px; }

/* ---------- footer (mirrors loteriaduo.com) ---------- */
.site-footer { border-top: 1px solid var(--line-d); background: var(--plum); color: var(--cream); padding: 34px 0 20px; font-size: .92rem; }
.site-footer .muted { color: var(--muted-d); }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-inner p { max-width: 46ch; margin-top: 8px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: flex-start; }
.footer-links a { color: var(--muted-d); text-decoration: none; font-weight: 700; }
.footer-links a:hover { color: var(--cream); }
.copy { font-size: .82rem; margin-top: 18px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 20px; border-radius: 999px; font: 700 .93rem var(--head); text-decoration: none; border: 0; cursor: pointer; white-space: nowrap;
  background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--border-2); transition: background .15s, box-shadow .15s, transform .05s; }
.btn:hover:not(:disabled) { background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--teal); color: var(--teal-ink); box-shadow: none; font-weight: 800; }
.btn.primary:hover:not(:disabled) { background: #22c7c7; }
.btn.ghost { background: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--hover); }
.btn.danger { background: var(--coral); color: #fff; box-shadow: none; }
.btn.big { min-height: 52px; padding: 0 26px; font-size: 1rem; }
.btn.small { min-height: 34px; padding: 0 14px; font-size: .84rem; }
.btn.wide { width: 100%; }
.danger-text { color: var(--coral) !important; }
.link-btn { background: none; border: 0; color: var(--teal-dark); text-decoration: underline; cursor: pointer; font: inherit; font-weight: 700; padding: 0; }
.icon-btn { border: 0; background: transparent; color: var(--ink-2); cursor: pointer; border-radius: 10px; width: 34px; height: 34px; display: inline-grid; place-items: center; flex: none; }
.icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.round { border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--border-2); background: var(--surface); }
.icon-btn.danger:hover { background: #FDECEA; color: var(--coral); }

input:not([type]), input[type=text], input[type=number], select { font: inherit; font-size: .93rem; border: 0; box-shadow: inset 0 0 0 1.5px var(--border-2); border-radius: 10px; padding: 8px 11px; background: var(--surface); color: var(--ink); min-width: 0; width: 100%; }
input::placeholder { color: var(--ink-3); }
input:focus, select:focus { outline: none; box-shadow: inset 0 0 0 2px var(--teal); }
input[type=range] { accent-color: var(--teal); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field.inline { flex-direction: row; align-items: center; gap: 10px; margin: 0; }
.field.inline select { width: auto; }
.field-label { font: 700 .8rem var(--head); color: var(--ink-2); }
.hint { color: var(--ink-3); font-size: .83rem; margin: 6px 0 0; line-height: 1.4; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font: 800 .7rem var(--head); color: var(--teal-dark); margin: 0 0 3px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two .field { margin-bottom: 0; }

/* segmented + switches */
.seg { display: flex; background: var(--hover); border-radius: 999px; padding: 4px; gap: 2px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--ink-2); font: 700 .86rem var(--head); padding: 7px 12px; border-radius: 999px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; margin: 10px 0 0; position: relative; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 38px; height: 22px; border-radius: 99px; background: var(--border-2); position: relative; flex: none; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .track { background: var(--teal); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 3px solid var(--gold); outline-offset: 2px; }
.switch b { display: block; font: 700 .92rem var(--head); }
.switch small { display: block; color: var(--ink-3); font-size: .8rem; }

/* banners */
.banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-radius: 12px; padding: 10px 14px; font-size: .9rem; margin: 0 0 12px; }
.banner.small { font-size: .84rem; padding: 8px 12px; }
.banner.warn { background: #FFF6DE; color: #7A5400; box-shadow: inset 0 0 0 1px #F6DE9A; }
.banner.warn .ico { color: #C98F00; }
.banner.info { background: var(--select); color: #0D4F50; box-shadow: inset 0 0 0 1px #BFE8E8; }
.banner.info .ico { color: var(--teal-dark); }

/* ---------- pages (home, deck builder) ---------- */
.page { width: min(1200px, 100% - 40px); margin: 0 auto; padding: 30px 0 56px; }
.page.narrow { width: min(640px, 100% - 40px); }
.loading { padding: 40px; text-align: center; color: var(--ink-2); }
.crumbs { margin-bottom: 10px; font-size: .92rem; }
.crumbs a { text-decoration: none; color: var(--ink-2); font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.crumbs a:hover { color: var(--ink); }
.row { display: flex; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }

/* home dashboard */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 22px; }
.lead { font-size: 1.05rem; color: var(--ink-2); max-width: 56ch; margin: 0; }
.perks { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.perks li { display: inline-flex; gap: 7px; align-items: center; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); border-radius: 999px; padding: 6px 13px; font-size: .86rem; font-weight: 700; color: var(--ink-2); }
.perks .ico { color: var(--teal-dark); }
.start-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; margin-bottom: 38px; }
.start-card { font: inherit; text-align: left; color: inherit; cursor: pointer; border: 0; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow), inset 0 0 0 1px var(--border); padding: 24px; display: flex; gap: 22px; align-items: center; transition: box-shadow .15s, transform .15s; }
.start-card:hover { box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--border-2); transform: translateY(-2px); }
.start-card.featured { background: linear-gradient(135deg, #2F2468 0%, #1d1545 100%); color: var(--cream); box-shadow: var(--shadow-lg); }
.start-card.featured h2 { color: var(--cream); }
.start-card.featured p { color: var(--muted-d); }
.start-card p { color: var(--ink-2); margin: 0 0 16px; font-size: .95rem; }
.start-card h2 { font-size: 1.4rem; margin-bottom: 6px; }
.start-text { flex: 1; min-width: 0; }
.tag { display: inline-block; font: 800 .68rem var(--head); text-transform: uppercase; letter-spacing: .08em; color: var(--gold); margin-bottom: 6px; }
.fan { position: relative; width: 190px; height: 170px; flex: none; }
.fan img { position: absolute; left: 50%; top: 50%; width: 86px; height: 116px; object-fit: contain; background: #fff; border-radius: 9px; padding: 6px; box-shadow: 0 12px 22px -8px rgba(0, 0, 0, .55), inset 0 0 0 2px #0f5383;
  transform: translate(calc(-50% + var(--i) * 28px), calc(-50% + var(--i) * var(--i) * 3px)) rotate(calc(var(--i) * 8deg)); }
.start-icon { width: 76px; height: 76px; border-radius: 22px; background: var(--select); color: var(--teal-dark); display: grid; place-items: center; flex: none; }
.start-icon .ico { width: 34px; height: 34px; }
.section-head { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.section-head h2 { margin: 0; }
.count { background: var(--hover); color: var(--ink-2); font: 800 .78rem var(--head); border-radius: 99px; padding: 2px 9px; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 38px; }
.proj { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow), inset 0 0 0 1px var(--border); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s; }
.proj:hover { box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--border-2); }
.proj-thumb { height: 210px; overflow: hidden; padding: 12px 0; display: grid; place-items: center; background: linear-gradient(180deg, #EFEBF7, #E6E0F2); text-decoration: none; color: var(--ink-3); }
.proj-thumb .muted { display: flex; gap: 6px; align-items: center; font-size: .9rem; }
.proj-canvas { box-shadow: 0 8px 18px -8px rgba(28, 21, 53, .4); border-radius: 2px; background: #fff; }
.proj-body { padding: 12px 14px 4px; display: flex; flex-direction: column; }
.proj-name { font: 700 1rem var(--head); color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-name:hover { color: var(--teal-dark); }
.proj-body small { color: var(--ink-3); font-size: .8rem; }
.proj-actions { display: flex; justify-content: flex-end; gap: 2px; padding: 0 8px 8px; }
.empty-card { background: var(--surface); border: 2px dashed var(--border-2); border-radius: var(--radius); padding: 30px; text-align: center; color: var(--ink-2); margin-bottom: 38px; }
.empty-card p { margin: 8px 0 0; }
.deck-list { list-style: none; padding: 0; margin: 0 0 38px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow), inset 0 0 0 1px var(--border); }
.deck-list li { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.deck-list li:first-child { border-top: 0; }
.deck-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--hover); color: var(--violet); display: grid; place-items: center; }
.deck-main { flex: 1; min-width: 160px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; }
.deck-main b { font-family: var(--head); }
.deck-main small { color: var(--ink-3); }
.storage { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--surface); border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--border); padding: 14px 18px; }
.storage-text { display: flex; gap: 12px; align-items: flex-start; flex: 1 1 420px; }
.storage-text .ico { color: var(--teal-dark); margin-top: 3px; width: 22px; height: 22px; }
.storage-text p { margin: 0; color: var(--ink-2); font-size: .9rem; }
.storage-text b { color: var(--ink); }
.storage-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* deck builder */
.deck-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.title-input { font: 800 clamp(1.4rem, 2.4vw, 1.9rem) var(--head) !important; letter-spacing: -0.02em; box-shadow: none !important; background: transparent !important; padding: 2px 8px !important; margin-left: -8px; width: min(620px, 100%); }
.title-input:hover, .title-input:focus { box-shadow: inset 0 0 0 1.5px var(--border-2) !important; background: var(--surface) !important; }
.deck-stats { display: flex; gap: 18px; flex-wrap: wrap; margin: 6px 0 10px; align-items: center; }
.stat { font-size: .95rem; color: var(--ink-2); }
.stat b { color: var(--ink); font-family: var(--head); }
.warn { color: #7A5400; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 2px dashed #9ADCDC; border-radius: var(--radius); padding: 30px; background: #F1FBFB; cursor: pointer; text-align: center; color: var(--ink-2); margin: 16px 0; transition: background .15s; }
.dropzone b { color: var(--ink); font: 800 1.1rem var(--head); }
.dropzone.over, .dropzone:hover { background: var(--select); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.card-tile { position: relative; background: var(--surface); box-shadow: var(--shadow), inset 0 0 0 1px var(--border); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.card-tile .icon-btn { position: absolute; right: 6px; top: 6px; background: rgba(255, 255, 255, .9); box-shadow: var(--shadow); }
.card-tile .icon-btn:hover { color: var(--coral); }
.tile-img { height: 124px; display: grid; place-items: center; background: #fff; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--border); }
.tile-img img { max-height: 112px; max-width: 92%; object-fit: contain; }
.tile-fields { display: flex; flex-direction: column; gap: 6px; }
.tile-fields input[type=text] { padding: 6px 10px; font-size: .9rem; }
.mini { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--ink-2); font-weight: 700; }
.num-input { width: 76px !important; padding: 5px 8px !important; }

/* ---------- workspace (one-screen dashboard) ---------- */
body.is-workspace .site-footer { margin-top: 0; }
.workspace { display: flex; flex-direction: column; height: calc(100vh - var(--nav-h)); min-height: 560px; }
.ws-top { display: flex; align-items: center; gap: 14px; padding: 10px 18px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ws-back { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-2); box-shadow: inset 0 0 0 1.5px var(--border-2); }
.ws-back:hover { background: var(--hover); color: var(--ink); }
.ws-title { display: flex; flex-direction: column; min-width: 180px; flex: 0 1 340px; }
.ws-name { font: 800 1.1rem var(--head) !important; box-shadow: none !important; padding: 3px 8px !important; margin-left: -8px; background: transparent !important; }
.ws-name:hover, .ws-name:focus { box-shadow: inset 0 0 0 1.5px var(--border-2) !important; background: var(--surface) !important; }
.save-status { font-size: .78rem; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.save-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.save-status[data-state="saving"]::before { background: var(--gold); }
.save-status:empty { display: none; }
.ws-stats { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
.ws-stat { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--ink-2); padding: 5px 11px; border-radius: 99px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.ws-stat .ico { color: var(--ink-3); }
.ws-stat b { color: var(--ink); font-family: var(--head); }
.ws-stat.warn-stat { background: #FFF6DE; color: #7A5400; box-shadow: inset 0 0 0 1px #F6DE9A; }
.ws-stat.warn-stat .ico { color: #C98F00; }

.ws-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 84px 148px minmax(0, 1fr) 340px; }
.workspace.no-side .ws-body { grid-template-columns: 84px minmax(0, 1fr) 340px; }
.workspace.no-side .ws-side { display: none; }
.ws-rail { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; padding: 10px 8px; }
.rail-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px; border-radius: 12px; text-decoration: none; color: var(--ink-2); font: 700 .72rem var(--head); text-align: center; line-height: 1.15; }
.rail-btn .ico { width: 24px; height: 24px; }
.rail-btn:hover { background: var(--hover); color: var(--ink); }
.rail-btn.on { background: var(--select); color: var(--teal-dark); }
.ws-side { background: var(--surface-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.side-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 8px; font: 700 .85rem var(--head); }
.thumbs { flex: 1; overflow-y: auto; padding: 4px 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.thumb { position: relative; border: 0; background: transparent; padding: 6px; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.thumb canvas { width: 96px; min-height: 118px; background: #fff; border-radius: 2px; box-shadow: 0 1px 3px rgba(28, 21, 53, .15); }
.thumb:hover { background: var(--hover); }
.thumb.on { background: var(--select); box-shadow: inset 0 0 0 2px var(--teal); }
.thumb-n { font: 700 .76rem var(--head); color: var(--ink-2); display: inline-flex; gap: 4px; align-items: center; }
.thumb.dup .thumb-n { color: #B07D00; }

.ws-center { min-width: 0; min-height: 0; overflow: auto; padding: 16px 22px; display: flex; flex-direction: column; }
.stage-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.stage-bar b { font: 800 1.05rem var(--head); min-width: 140px; text-align: center; }
.stage-wrap { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: flex-start; padding: 8px 0 12px; }
.board-canvas { background: #fff; border-radius: 3px; touch-action: none; box-shadow: var(--shadow-lg); }
.stage-hint { display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--ink-3); font-size: .84rem; margin: 10px 0 0; }
.empty-stage { margin: auto; text-align: center; max-width: 420px; padding: 30px; }
.empty-stage p { color: var(--ink-2); }

.ws-panel { background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.ws-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); border-bottom: 1px solid var(--border); padding: 0 6px; }
.ws-tab { border: 0; background: transparent; padding: 12px 4px 10px; font: 700 .8rem var(--head); color: var(--ink-3); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: inset 0 -2px 0 transparent; }
.ws-tab .ico { width: 20px; height: 20px; }
.ws-tab:hover { color: var(--ink); }
.ws-tab.on { color: var(--teal-dark); box-shadow: inset 0 -3px 0 var(--teal); }
.ws-panel-body { flex: 1; overflow-y: auto; padding: 18px; }
.group { padding: 0 0 18px; margin: 0 0 18px; border-bottom: 1px solid var(--border); }
.group:last-child { border-bottom: 0; margin-bottom: 0; }
.group > .btn { margin-top: 12px; }
.panel-intro { text-align: center; padding: 6px 4px 16px; }
.panel-intro h3 { margin-top: 10px; }
.panel-intro p { font-size: .9rem; }
.tips { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-direction: column; gap: 8px; }
.tips li { display: flex; gap: 10px; align-items: flex-start; font-size: .88rem; color: var(--ink-2); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); border-radius: 12px; padding: 10px 12px; }
.tips .ico { color: var(--teal-dark); margin-top: 2px; }
.pin-row { display: flex; gap: 8px; align-items: center; font-size: .9rem; padding: 6px 0; }
.pin-row .ico { color: #C98F00; }
.pin-row span { flex: 1; }
.pin-row small { color: var(--ink-3); }
.insp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.insp-head h3 { margin: 0; font-size: 1.15rem; }
.frame-box { display: flex; justify-content: center; background: repeating-conic-gradient(#F0ECF6 0% 25%, #FAF8FC 0% 50%) 50% / 16px 16px; border-radius: 12px; padding: 14px; }
.frame-canvas { touch-action: none; cursor: grab; border-radius: 2px; box-shadow: var(--shadow-lg); }
.zoom-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; color: var(--ink-3); }
.zoom-row input { flex: 1; }
.num { font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; font-size: .85rem; }
.count-row { display: flex; gap: 8px; align-items: center; }
.count-row input { width: 86px; flex: none; }
.quick { display: flex; gap: 4px; flex-wrap: wrap; }
.chip-btn { border: 0; background: var(--hover); color: var(--ink-2); font: 700 .8rem var(--head); border-radius: 99px; padding: 6px 10px; cursor: pointer; }
.chip-btn:hover { background: var(--select); color: var(--teal-dark); }
.cap-info { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.cap-info .banner { margin: 6px 0 0; }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; color: var(--ink-2); }
.kv b { color: var(--ink); font-family: var(--head); }
.lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lang { border: 0; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--border-2); border-radius: 12px; padding: 9px 10px; cursor: pointer; text-align: left; display: flex; flex-direction: column; color: var(--ink); }
.lang b { font: 700 .9rem var(--head); }
.lang small { color: var(--ink-3); font-size: .76rem; }
.lang:hover { background: var(--hover); }
.lang.on { box-shadow: inset 0 0 0 2px var(--teal); background: var(--select); }
.per-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.per { border: 0; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--border-2); border-radius: 12px; padding: 10px 4px 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink); }
.per b { font: 800 .9rem var(--head); }
.per:hover { background: var(--hover); }
.per.on { box-shadow: inset 0 0 0 2px var(--teal); background: var(--select); }
.per-ico { width: 30px; height: 38px; border-radius: 3px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--border-2); display: grid; gap: 2px; padding: 4px; }
.per-ico i { background: #9ADCDC; border-radius: 1px; }
.per-ico[data-n="2"] { grid-template-rows: 1fr 1fr; }
.per-ico[data-n="4"] { grid-template: 1fr 1fr / 1fr 1fr; }
.per-ico[data-n="6"] { grid-template: 1fr 1fr 1fr / 1fr 1fr; }
.per.on .per-ico i { background: var(--teal); }
.ws-panel select { margin-bottom: 10px; }
.ws-panel .seg { margin-top: 2px; }

/* cards + sheets views */
.cards-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.cards-head h2 { margin-bottom: 2px; }
.cards-head p { margin: 0; }
.cards-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 22px; padding-bottom: 20px; }
.sheet { margin: 0; cursor: zoom-in; }
.sheet-canvas { width: 100%; height: auto; background: #fff; display: block; border-radius: 2px; box-shadow: var(--shadow-lg); transition: transform .2s; }
.sheet:hover .sheet-canvas { transform: translateY(-3px); }
.sheet figcaption { font-size: .82rem; color: var(--ink-3); margin-top: 8px; display: flex; flex-direction: column; }
.sheet figcaption b { color: var(--ink); font-family: var(--head); }
.sheet.partial figcaption b::after { content: " · last sheet"; color: #B07D00; }

/* dialogs */
.dialog { border: 0; border-radius: 20px; padding: 22px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(15, 10, 31, .35); max-width: min(520px, 92vw); width: 100%; }
.dialog::backdrop { background: rgba(15, 10, 31, .55); backdrop-filter: blur(2px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.dialog-head h2 { margin: 0; }
.dialog.large { max-width: 94vw; width: auto; max-height: 94vh; }
.large-canvas { max-width: 88vw; max-height: 80vh; width: auto; height: auto; display: block; border-radius: 2px; box-shadow: var(--shadow-lg); }
.dialog.download .btn.big { margin-top: 16px; }
table.summary { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.summary th { text-align: left; color: var(--ink-3); font-weight: 700; padding: 7px 10px 7px 0; width: 38%; vertical-align: top; }
table.summary td { padding: 7px 0; border-bottom: 1px solid var(--border); }
.progress { height: 8px; background: var(--hover); border-radius: 999px; overflow: hidden; margin: 14px 0 6px; }
.progress-fill { height: 100%; width: 0; background: var(--teal); transition: width .2s; }
.dl-status { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .9rem; margin: 10px 0 0; }
.dl-status:empty { display: none; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); background: var(--ink); color: #fff; font-weight: 700; padding: 12px 20px; border-radius: 14px; box-shadow: 0 20px 40px rgba(15, 10, 31, .3); opacity: 0; pointer-events: none; transition: .2s; max-width: min(620px, 92vw); z-index: 80; font-size: .92rem; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--coral); }
.toast.warn { background: var(--gold); color: var(--gold-ink); }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .ws-body { grid-template-columns: 76px 128px minmax(0, 1fr) 310px; }
  .thumb canvas { width: 80px; min-height: 98px; }
  .ws-stats .ws-stat:nth-child(3) { display: none; }
}
@media (max-width: 980px) {
  .workspace { height: auto; min-height: 0; }
  .ws-body, .workspace.no-side .ws-body { display: flex; flex-direction: column; }
  .ws-rail { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--border); }
  .rail-btn { flex: 1; flex-direction: row; justify-content: center; font-size: .85rem; }
  .ws-side { border-right: 0; border-bottom: 1px solid var(--border); }
  .side-head { display: none; }
  .thumbs { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 8px 12px; }
  .thumb canvas { width: 64px; min-height: 78px; }
  .ws-center { overflow: visible; padding: 14px; }
  .stage-wrap { min-height: 0; }
  .ws-panel { border-left: 0; border-top: 1px solid var(--border); }
  .ws-panel-body { overflow: visible; }
}
@media (max-width: 900px) {
  .menu-btn { display: block; }
  .nav-links { display: none; position: absolute; top: var(--nav-h); left: 0; right: 0; flex-direction: column; gap: 0; background: var(--plum); border-bottom: 1px solid var(--line-d); padding: 8px 20px 14px; }
  .nav-links a { padding: 10px 0; }
  .menu-open .nav-links { display: flex; }
  .start-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .start-card { flex-direction: column; align-items: flex-start; }
  .fan { width: 100%; }
  .ws-stats { justify-content: flex-start; }
  .ws-top .btn.primary { width: 100%; }
  .stage-bar { flex-wrap: wrap; }
  .stage-bar b { min-width: 0; }
  .stage-bar .grow { display: none; }
  .nav-inner { gap: 12px; }
  .creator-tag { padding-left: 12px; }
}
@media (max-width: 480px) {
  .beta-pill { display: none; }
  .brand img { width: 34px; height: 34px; }
}

/* ---------- additions: twins, quick layouts, markers, drag coach ---------- */
.hint.top { margin: -4px 0 10px; }
.ws-panel h5 { font: 700 .8rem var(--head); color: var(--ink-2); margin: 14px 0 6px; }
.stage-wrap { position: relative; }
.stage-hint { flex-wrap: wrap; gap: 6px; color: var(--ink-2); }
.stage-hint .kbd { display: inline-flex; align-items: center; gap: 5px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border-2); border-radius: 8px; padding: 2px 8px; font: 700 .78rem var(--head); color: var(--teal-dark); }
.stage-hint .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--border-2); margin: 0 6px; }

.coach { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); width: min(360px, 92%); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg), 0 0 0 6px rgba(20, 184, 184, .18); padding: 18px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; z-index: 5; animation: coach-in .35s ease-out; }
.coach b { font: 800 1.05rem var(--head); }
.coach p { margin: 4px 0 0; font-size: .88rem; color: var(--ink-2); }
.coach-anim { position: relative; width: 150px; height: 74px; }
.coach-card { position: absolute; top: 8px; width: 46px; height: 60px; border-radius: 6px; box-shadow: inset 0 0 0 2px #3f8e89; background: #fff; }
.coach-card.a { left: 10px; background: repeating-linear-gradient(135deg, #E7F7F7 0 6px, #fff 6px 12px); animation: coach-card 2.4s ease-in-out infinite; }
.coach-card.b { right: 10px; }
.coach-hand { position: absolute; left: 26px; top: 34px; color: var(--ink); animation: coach-hand 2.4s ease-in-out infinite; }
.coach-hand .ico { width: 30px; height: 30px; fill: #fff; }
@keyframes coach-hand { 0%, 15% { transform: translate(0, 0); } 55%, 70% { transform: translate(84px, 0); } 100% { transform: translate(0, 0); } }
@keyframes coach-card { 0%, 15% { transform: translate(0, 0); box-shadow: inset 0 0 0 2px #3f8e89; } 20% { transform: translate(0, -4px) rotate(-4deg); box-shadow: inset 0 0 0 2px #14B8B8, 0 10px 18px rgba(28,21,53,.25); } 55%, 70% { transform: translate(84px, -4px) rotate(3deg); box-shadow: inset 0 0 0 2px #14B8B8, 0 10px 18px rgba(28,21,53,.25); } 100% { transform: translate(0, 0); } }
@keyframes coach-in { from { opacity: 0; transform: translate(-50%, -44%); } }
@media (prefers-reduced-motion: reduce) { .coach-card.a, .coach-hand { animation: none; } }

.twin-grid { display: grid; grid-template-columns: 1fr; gap: 6px; }
.twin { border: 0; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--border-2); border-radius: 12px; padding: 8px 10px; cursor: pointer; display: flex; gap: 12px; align-items: center; text-align: left; color: var(--ink); }
.twin:hover { background: var(--hover); }
.twin.on { box-shadow: inset 0 0 0 2px var(--teal); background: var(--select); }
.twin b { display: block; font: 700 .88rem var(--head); }
.twin small { display: block; color: var(--ink-3); font-size: .76rem; }
.twin-mini { display: grid; grid-template-columns: repeat(var(--g), 1fr); gap: 2px; width: 40px; height: 48px; flex: none; padding: 3px; background: #fff; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--border-2); }
.twin-mini i { background: #EDEAF3; border-radius: 1px; }
.twin-mini i.t0 { background: var(--teal); }
.twin-mini i.t1 { background: var(--gold); }

.locked { display: flex; gap: 10px; align-items: center; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--border); border-radius: 10px; padding: 9px 12px; font-size: .86rem; color: var(--ink-2); }
.locked .ico { color: var(--ink-3); }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.q { border: 0; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--border-2); border-radius: 12px; padding: 9px 10px; cursor: pointer; text-align: left; color: var(--ink); display: flex; flex-direction: column; }
.q b { font: 700 .88rem var(--head); }
.q small { color: var(--ink-3); font-size: .76rem; }
.q:hover { background: var(--hover); }
.q.on { box-shadow: inset 0 0 0 2px var(--teal); background: var(--select); }
.per-grid { grid-template-columns: repeat(7, 1fr); gap: 5px; }
.per { padding: 8px 2px 6px; }
.per-ico { width: 22px; height: 28px; padding: 3px; gap: 1.5px; }
.per-ico[data-n="3"] { grid-template-rows: 1fr 1fr 1fr; }
.per-ico[data-n="8"] { grid-template: repeat(4, 1fr) / 1fr 1fr; }
.per-ico[data-n="9"] { grid-template: repeat(3, 1fr) / repeat(3, 1fr); }
.ws-panel .seg button { padding: 7px 6px; font-size: .8rem; }

.marker-stage { display: flex; justify-content: center; background: repeating-conic-gradient(#F0ECF6 0% 25%, #FAF8FC 0% 50%) 50% / 16px 16px; border-radius: 14px; padding: 12px; margin-bottom: 18px; }
.marker-preview { width: 150px; height: 150px; }
.src-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.src-grid .lang, .size-grid .lang { padding: 8px; }
.size-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.size-grid .lang.on, .src-grid .lang.on { box-shadow: inset 0 0 0 2px var(--teal); background: var(--select); }
.src-extra .btn { margin-bottom: 8px; }
.ring-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ring { width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer; background: #fff; box-shadow: inset 0 0 0 5px var(--c), 0 0 0 1px var(--border-2); display: grid; place-items: center; color: var(--ink-3); }
.ring.on { box-shadow: inset 0 0 0 5px var(--c), 0 0 0 3px var(--teal); }
