/* Arf Matematik Topluluğu
   Layout: kareli defter (graph paper) ground, one 1180px column; the crest's concentric
   rings are the single bold motif (hero), everything else stays quiet. */

@font-face {
  font-family: "Arf Display";
  font-weight: 800;
  font-style: normal;
  font-display: block;
  src: url("../assets/fonts/archivo-semiexpanded-800.woff") format("woff");
}

:root {
  --paper: #f4f6fb; --surface: #ffffff; --sunk: #e9edf5; --ink: #0b1730; --muted: #56627b;
  --line: rgba(11, 23, 48, .13); --grid: rgba(2, 52, 101, .055); --grid-major: rgba(2, 52, 101, .09);
  --red: #970101; --navy: #023465; --blue: #011d98; --accent: #970101; --accent-strong: #970101; --accent-ink: #ffffff;
  --ring-a: #970101; --ring-b: #023465; --crest-text: #011d98; --focus: #011d98;
  --ok: #1d7a4a; --warn: #9a6200; --scrim: rgba(5, 10, 25, .6); --shadow: rgba(11, 23, 48, .35);
  --display: "Arf Display", "Archivo", system-ui, sans-serif;
  --body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --math: "STIX Two Text", "Cambria Math", "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
/* dark: the device setting unless the header switch chose light; the switch can also force dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --paper: #08112a; --surface: #0f1b38; --sunk: #16244a; --ink: #e8edf8; --muted: #9ba8c4;
  --line: rgba(232, 237, 248, .14); --grid: rgba(160, 185, 255, .045); --grid-major: rgba(160, 185, 255, .08);
  --red: #ef5a62; --navy: #a9c3f2; --blue: #a6b4ff; --accent: #ef5a62; --accent-strong: #d93a44; --accent-ink: #ffffff;
  --ring-a: #e0414a; --ring-b: #e8edf8; --crest-text: #e8edf8; --focus: #a6b4ff;
  --ok: #5fc48c; --warn: #e7b04a; --scrim: rgba(0, 0, 0, .65); --shadow: rgba(0, 0, 0, .5);
  color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #08112a; --surface: #0f1b38; --sunk: #16244a; --ink: #e8edf8; --muted: #9ba8c4;
  --line: rgba(232, 237, 248, .14); --grid: rgba(160, 185, 255, .045); --grid-major: rgba(160, 185, 255, .08);
  --red: #ef5a62; --navy: #a9c3f2; --blue: #a6b4ff; --accent: #ef5a62; --accent-strong: #d93a44; --accent-ink: #ffffff;
  --ring-a: #e0414a; --ring-b: #e8edf8; --crest-text: #e8edf8; --focus: #a6b4ff;
  --ok: #5fc48c; --warn: #e7b04a; --scrim: rgba(0, 0, 0, .65); --shadow: rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h, 64px) + 12px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.eyebrow { font-family: var(--mono); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 500; }
.hint { font-size: .8rem; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 40px; padding: .5em 1em; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: .92rem; text-decoration: none; cursor: pointer; transition: border-color .15s, transform .1s; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 32px; padding: .3em .8em; font-size: .84rem; }
.btn.danger { color: var(--red); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink); flex-shrink: 0; }
.icon-btn:hover { border-color: var(--ink); }
.icon-btn[disabled] { opacity: .4; cursor: default; }
.icon-btn svg { width: 16px; height: 16px; }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; flex-shrink: 0; }
.brand svg { width: 36px; height: 36px; flex-shrink: 0; }
.brand b { font-family: var(--display); font-size: .95rem; line-height: 1.05; display: block; }
.brand small { display: block; font-size: .72rem; color: var(--muted); font-family: var(--mono); letter-spacing: .06em; }
.nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { white-space: nowrap; text-decoration: none; font-weight: 500; font-size: .9rem; padding: .45em .75em; border-radius: 999px; color: var(--muted); }
.nav a:hover { color: var(--ink); background: var(--sunk); }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; flex-shrink: 0; }
.lang button { border: 0; background: transparent; border-radius: 999px; padding: .25em .6em; font-family: var(--mono); font-size: .76rem; font-weight: 600; cursor: pointer; color: var(--muted); }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
#authBtn { flex-shrink: 0; }
.theme-btn { border-radius: 999px; }
.theme-btn .i-sun { display: none; }
.theme-btn[data-mode="dark"] .i-sun { display: block; }
.theme-btn[data-mode="dark"] .i-moon { display: none; }
#authBtn.on { color: var(--ok); border-color: currentColor; }
@media (max-width: 900px) { .brand-text { display: none; } }
@media (max-width: 640px) {
  .top .wrap { flex-wrap: wrap; column-gap: 8px; row-gap: 0; min-height: 56px; }
  .brand { margin-right: auto; }
  .nav { order: 5; flex-basis: 100%; margin: 0 -6px; padding-bottom: 6px; }
  .nav a { font-size: .84rem; padding: .35em .6em; }
}
@media (max-width: 400px) { .nav a:first-child { display: none; } }

/* hero */
.hero { border-bottom: 1px solid var(--line); background-color: var(--paper);
  background-image: linear-gradient(var(--grid-major) 1px, transparent 1px), linear-gradient(90deg, var(--grid-major) 1px, transparent 1px), linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px; background-position: -1px -1px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 40px; align-items: center; padding-block: 64px 56px; }
.hero h1 { font-family: var(--display); font-weight: 800; font-size: clamp(2.4rem, 5.6vw, 4.5rem); line-height: .98; letter-spacing: -.01em; margin-top: 18px; }
.hero h1 .red { color: var(--accent); }
.lede { font-size: 1.12rem; max-width: 56ch; margin-top: 22px; color: var(--muted); }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.hero-mark { display: grid; place-items: center; }
.hero-mark svg { width: 100%; max-width: 440px; height: auto; aspect-ratio: 1; }
.crest .r { fill: none; stroke-dasharray: 1 1; animation: draw 1.5s cubic-bezier(.65, .05, .2, 1) both; animation-delay: calc(var(--i) * 90ms); }
.crest .tx { animation: fade .9s .8s both; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .crest .r, .crest .tx { animation: none; } }
@media (max-width: 820px) { .hero-grid { grid-template-columns: 1fr; padding-block: 40px; } .hero-mark { order: -1; } .hero-mark svg { max-width: 260px; } }

.arf { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.arf > div { padding: 26px 24px 30px 0; min-width: 0; }
.arf > div + div { padding-left: 24px; border-left: 1px solid var(--line); }
.arf h3 { font-family: var(--display); font-size: 1.05rem; margin: 8px 0; }
.arf .years { font-family: var(--mono); font-size: .8rem; font-weight: 400; color: var(--muted); }
.arf p:not(.eyebrow):not(.formula) { color: var(--muted); font-size: .95rem; max-width: 44ch; }
.formula { font-family: var(--math); font-size: clamp(1.3rem, 2.4vw, 1.7rem); margin: 10px 0 6px; white-space: nowrap; overflow-x: auto; }
.formula .bb { font-weight: 600; font-style: normal; }
@media (max-width: 820px) { .arf { grid-template-columns: 1fr; } .arf > div { padding: 22px 0; } .arf > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); } }

/* sections */
.section { padding-block: 72px; border-bottom: 1px solid var(--line); }
.sec-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 32px; }
.sec-head h2 { font-family: var(--display); font-size: clamp(1.9rem, 3.6vw, 2.8rem); line-height: 1.02; margin-top: 10px; }
.sec-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* board */
.board-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.board-layout.editing { grid-template-columns: minmax(0, 1fr) 360px; }
@media (max-width: 1000px) { .board-layout.editing { grid-template-columns: minmax(0, 1fr); } }
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; align-content: start; }
.advisor { margin-top: 22px; font-size: .92rem; color: var(--muted); }
.advisor b { color: var(--ink); font-weight: 600; }
.advisor .eyebrow { margin-right: 10px; }
.m-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px 18px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; min-width: 0; }
.m-photo { position: relative; width: 132px; height: 132px; margin-bottom: 10px; flex-shrink: 0; }
.m-photo svg.halo { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.face { position: absolute; inset: 16px; border-radius: 50%; overflow: hidden; background: var(--sunk); display: grid; place-items: center; }
.face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.initials { font-family: var(--display); font-size: 1.6rem; color: var(--navy); }
.m-role { font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.m-name { font-family: var(--display); font-size: 1.12rem; line-height: 1.15; overflow-wrap: anywhere; }
.m-duty { font-size: .86rem; color: var(--muted); margin-top: 4px; }
.m-card.editing { align-items: stretch; text-align: left; }
.m-card.editing .m-photo { align-self: center; }
.photo-btn { position: absolute; right: -2px; bottom: -2px; width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; cursor: pointer; border: 2px solid var(--surface); }
.photo-btn svg { width: 16px; height: 16px; }
.photo-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: .74rem; font-family: var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.input { width: 100%; max-width: 100%; min-width: 0; min-height: 40px; padding: .45em .65em; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); font-size: 1rem; }
select.input { -webkit-appearance: none; appearance: none; padding-right: 2.2em; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
/* iOS draws date/time fields at an intrinsic width and centres the text; make them behave like text inputs */
input.input[type="date"], input.input[type="time"] { -webkit-appearance: none; appearance: none; display: block; text-align: left; line-height: 1.4; }
input.input::-webkit-date-and-time-value { text-align: left; margin: 0; }
input.input::-webkit-datetime-edit { padding: 0; }
input.input::-webkit-calendar-picker-indicator { opacity: .6; }
textarea.input { resize: vertical; min-height: 64px; line-height: 1.45; }
.input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.crop { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; font-size: .76rem; color: var(--muted); font-family: var(--mono); padding: 8px 10px; border-radius: 8px; background: var(--sunk); }
.crop input { width: 100%; accent-color: var(--accent); }
.card-actions { display: flex; gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.card-actions .spacer { flex: 1; }
.confirm { display: flex; gap: 6px; align-items: center; font-size: .82rem; flex-wrap: wrap; }
.add-card { border: 1.5px dashed var(--line); background: transparent; border-radius: 14px; min-height: 220px; display: grid; place-content: center; justify-items: center; color: var(--muted); cursor: pointer; font-weight: 600; gap: 6px; padding: 20px; }
.add-card:hover { border-color: var(--ink); color: var(--ink); }
.add-card b { font-size: 1.6rem; line-height: 1; }
@media (max-width: 640px) {
  .board-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .board-layout.editing .board-grid { grid-template-columns: minmax(0, 1fr); }
  .m-card:not(.editing) { padding: 16px 10px 14px; gap: 4px; }
  .m-card:not(.editing) .m-photo { width: 92px; height: 92px; margin-bottom: 6px; }
  .m-card:not(.editing) .face { inset: 11px; }
  .m-card:not(.editing) .initials { font-size: 1.15rem; }
  .m-card:not(.editing) .m-role { font-size: .62rem; letter-spacing: .05em; }
  .m-card:not(.editing) .m-name { font-size: .95rem; }
  .m-card:not(.editing) .m-duty { font-size: .74rem; line-height: 1.4; }
  .add-card { min-height: 120px; }
}
.empty-board { grid-column: 1 / -1; padding: 40px 24px; text-align: center; border: 1.5px dashed var(--line); border-radius: 14px; color: var(--muted); }

.side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; min-width: 0; }
.panel h3 { font-family: var(--display); font-size: 1rem; margin-bottom: 12px; }
.role-group { border-top: 1px solid var(--line); }
.role-group:first-of-type { border-top: 0; }
.role-group summary { cursor: pointer; list-style: none; padding: 12px 0; display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.role-group summary::-webkit-details-marker { display: none; }
.role-group summary::after { content: "+"; font-size: 1rem; }
.role-group[open] summary::after { content: "−"; }
.role-list { display: flex; flex-direction: column; margin: 0 0 8px; padding: 0; list-style: none; }
.role-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 9px 0; border-top: 1px dashed var(--line); align-items: center; }
.role-list .rn { font-weight: 600; font-size: .92rem; }
.role-list .re { font-size: .78rem; color: var(--muted); }
.role-list .who { grid-column: 1 / -1; font-size: .78rem; font-family: var(--mono); color: var(--muted); }
.role-list .who.filled { color: var(--ok); }
.role-list .acts { display: flex; gap: 6px; }
.tag { font-family: var(--mono); font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; padding: .1em .45em; border-radius: 4px; background: var(--sunk); color: var(--muted); margin-left: 6px; vertical-align: 1px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 420px) { .form-grid { grid-template-columns: 1fr; } }

/* studio */
.studio { display: grid; grid-template-columns: minmax(0, 430px) minmax(0, 1fr); grid-template-areas: "tpls preview" "controls preview"; grid-template-rows: auto 1fr; gap: 18px 28px; align-items: start; }
.tpls { grid-area: tpls; }
.controls { grid-area: controls; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.preview { grid-area: preview; }
.tpls { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tpl { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; min-width: 0; }
.tpl b { font-size: .9rem; }
.tpl small { font-size: .74rem; color: var(--muted); line-height: 1.3; }
.tpl[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tpl[aria-pressed="true"] b { color: var(--accent); }
.opt-row { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1fr); gap: 10px; }
.opt-row .seg.wide { grid-column: 1 / -1; }
.seg { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.seg > span { font-size: .72rem; font-family: var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.seg .opts { display: flex; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--surface); }
.seg .opts button { flex: 1; border: 0; background: transparent; border-radius: 6px; padding: .4em .2em; font-size: .8rem; font-weight: 600; cursor: pointer; color: var(--muted); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg .opts button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.seg .opts button.shuffle { flex: 0 0 auto; padding-inline: .7em; }
.fields { display: flex; flex-direction: column; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.bi { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 520px) { .bi { grid-template-columns: 1fr; } }
.bi .lg { position: relative; }
.bi .lg::after { content: attr(data-lg); position: absolute; top: 7px; right: 8px; font-family: var(--mono); font-size: .62rem; font-weight: 600; color: var(--muted); pointer-events: none; letter-spacing: .06em; }
.bi .lg .input { padding-right: 2.2em; }
.symbols { display: flex; flex-wrap: wrap; gap: 4px; }
.symbols button { font-family: var(--math); font-size: 1rem; min-width: 32px; height: 30px; border-radius: 6px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; }
.symbols button:hover { border-color: var(--ink); }
.photo-field { display: flex; gap: 14px; align-items: center; }
.photo-field .thumb { position: relative; width: 72px; height: 72px; flex-shrink: 0; }
.photo-field .thumb .face { inset: 0; }
.photo-field .thumb .initials { font-size: 1.1rem; }
.photo-field .btns { display: flex; flex-wrap: wrap; gap: 6px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.preview { display: flex; flex-direction: column; gap: 14px; min-width: 0; position: sticky; top: calc(var(--header-h, 64px) + 16px); }
.actions { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.stage { position: relative; background: var(--sunk); border-radius: 14px; padding: 18px; display: grid; place-items: center; min-width: 0; }
.stage canvas { display: block; max-width: 100%; max-height: 72vh; width: auto; height: auto; box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 12px 32px -12px var(--shadow); border-radius: 3px; transition: max-height .2s ease; }
.stage-toggle { display: none; }

/* phones and tablets: templates scroll sideways, the preview sticks under the header while the form scrolls */
@media (max-width: 1000px) {
  .studio { grid-template-columns: minmax(0, 1fr); grid-template-areas: "tpls" "stage" "controls" "actions"; grid-template-rows: none; gap: 14px; }
  .preview { display: contents; }
  .actions { grid-area: actions; }
  .stage { grid-area: stage; position: sticky; top: var(--header-h, 64px); z-index: 6; padding: 10px 10px 40px; border-radius: 0 0 14px 14px; box-shadow: 0 10px 20px -14px rgba(5, 10, 25, .45); }
  .stage canvas { max-height: 40svh; }
  .stage.typing canvas { max-height: 24svh; }
  .stage.mini canvas { max-height: 13svh; }
  .stage-toggle { display: inline-flex; align-items: center; gap: 4px; position: absolute; left: 50%; bottom: 7px; transform: translateX(-50%); border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: .25em .65em .25em .45em; font-size: .74rem; font-weight: 600; cursor: pointer; }
  .stage-toggle svg { width: 13px; height: 13px; transition: transform .2s; }
  .stage.mini .stage-toggle svg { transform: rotate(180deg); }
  .tpls { display: flex; overflow-x: auto; scroll-snap-type: x proximity; gap: 8px; margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); padding-inline: max(16px, env(safe-area-inset-left, 0px)); padding-bottom: 4px; scrollbar-width: none; }
  .tpls::-webkit-scrollbar { display: none; }
  .tpl { flex: 0 0 auto; width: 152px; scroll-snap-align: start; }
}
@media (max-width: 1000px) and (prefers-reduced-motion: reduce) { .stage canvas, .stage-toggle svg { transition: none; } }
.export { display: flex; flex-wrap: wrap; gap: 8px; }
.caption { display: flex; flex-direction: column; gap: 6px; }
.caption .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.caption textarea { min-height: 120px; font-size: .9rem; }
@media (max-width: 1000px) { .caption textarea { font-size: 1rem; } }

/* brand kit */
.logos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .logos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) {
  .logos { gap: 10px; }
  .logo-tile .art { padding: 12%; }
  .logo-tile .meta { padding: 10px; gap: 6px; }
  .logo-tile .meta b { font-size: .84rem; }
  .logo-tile .hint { font-size: .72rem; }
  .logo-tile .btn.small { min-height: 30px; padding: .25em .6em; font-size: .76rem; }
  .specimen .s1 { font-size: 1.4rem; }
  .section { padding-block: 52px; }
}
.logo-tile { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; min-width: 0; }
.logo-tile .art { aspect-ratio: 1; display: grid; place-items: center; padding: 14%; max-width: 100%; }
.logo-tile .art svg { width: 100%; height: 100%; }
.logo-tile .meta { padding: 12px 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.logo-tile .meta b { font-size: .92rem; }
.logo-tile .btns { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
@media (max-width: 900px) { .swatches { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 440px) { .swatches { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sw { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); text-align: left; cursor: pointer; padding: 0; min-width: 0; }
.sw .chip { height: 76px; border-bottom: 1px solid var(--line); }
.sw .info { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.sw b { font-size: .86rem; }
.sw code { font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.sw small { font-size: .74rem; color: var(--muted); line-height: 1.3; }
.type-rules { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; margin-top: 28px; }
@media (max-width: 900px) { .type-rules { grid-template-columns: 1fr; } }
.specimen { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.specimen > div { padding: 18px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; align-items: center; }
.specimen > div:first-child { border-top: 0; }
.specimen .lbl { font-family: var(--mono); font-size: .72rem; color: var(--muted); letter-spacing: .04em; line-height: 1.5; }
.specimen .s1 { font-family: var(--display); font-size: 1.8rem; line-height: 1.1; }
.specimen .s2 { font-family: var(--body); font-size: 1.02rem; }
.specimen .s3 { font-family: var(--math); font-style: italic; font-size: 1.4rem; line-height: 1.2; }
.specimen .s4 { font-family: var(--mono); font-size: .9rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
@media (max-width: 520px) { .specimen > div { grid-template-columns: 1fr; gap: 6px; } }
.rules { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.rules li { padding: 14px 18px; border-top: 1px solid var(--line); font-size: .92rem; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px; }
.rules li:first-child { border-top: 0; }
.rules .k { font-family: var(--mono); font-weight: 600; color: var(--accent); }
.rules .k.no { color: var(--muted); }

footer { padding-block: 40px calc(56px + env(safe-area-inset-bottom, 0px)); color: var(--muted); font-size: .88rem; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center; }
footer .at { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
footer .at svg { height: 40px; width: auto; display: block; color: var(--ink); }

/* toast + modals */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--paper); padding: .7em 1.1em; border-radius: 999px; font-size: .88rem; font-weight: 500; opacity: 0; pointer-events: none; transition: .25s; z-index: 60; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%); }
.modal { position: fixed; inset: 0; z-index: 50; background: var(--scrim); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.modal .box { background: var(--surface); border-radius: 16px; max-width: 760px; width: 100%; max-height: 100%; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal .box.narrow { max-width: 400px; }
.modal .box header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.modal .box h3 { font-family: var(--display); font-size: 1.1rem; }
.form-error { color: var(--red); font-size: .88rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* photo controls */
.photo-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.photo-field .thumb { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; }
.photo-field .thumb .face { inset: 0; }

/* crop dialog */
.crop-box { gap: 12px; }
.crop-view { position: relative; width: min(100%, 360px); aspect-ratio: 1; margin: 0 auto; overflow: hidden; border-radius: 12px; background: #0b1020; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; outline-offset: 3px; }
.crop-view.dragging { cursor: grabbing; }
.crop-view img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; -webkit-user-drag: none; }
.crop-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .9); box-shadow: 0 0 0 100vmax rgba(5, 10, 25, .55); pointer-events: none; }
.crop-zoom { display: flex; align-items: center; gap: 10px; }
.crop-zoom input { flex: 1; accent-color: var(--accent); }
.crop-box .hint { text-align: center; }

/* new release available */
.update-bar { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 70; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: .9rem; box-shadow: 0 10px 30px -10px var(--shadow); width: max-content; max-width: calc(100vw - 32px); }
