/* 1632 bright children's-book look (design/gemini-1632-bright-spec.md): flat colours, 2px near-black borders, no shadows or gradients. */
:root {
  --bg: #FFF9E6; --ink: #111827; --muted: #4B5563; --orange: #FF5E00; --yellow: #FFEB3B;
  --green: #2E7D32; --blue: #1565C0; --red: #D32F2F; --amber: #FF9800;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 18px/1.6 Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", Roboto, "Hiragino Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow-wrap: anywhere;
}
:lang(ko) { word-break: keep-all; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 48px; }
.wrap.wide { max-width: 1120px; }

h1 { font-size: 30px; line-height: 1.3; font-weight: 600; margin: 16px 0 8px; }
h2 { font-size: 26px; line-height: 1.3; font-weight: 600; margin: 0 0 8px; }
h3 { font-size: 18px; font-weight: 600; margin: 24px 0 8px; }
p { margin: 0 0 16px; }
.privacy, .help, .note, figcaption { color: var(--muted); }
.note { font-size: 17px; margin: 8px 0 12px; }
.privacy { display: flex; gap: 8px; align-items: flex-start; }
.privacy svg { flex: none; margin-top: 3px; color: var(--blue); }

.langrow { display: flex; justify-content: flex-end; align-items: center; gap: 10px; font-size: 17px; }
select, input[type=text], input[type=number], textarea {
  font: inherit; color: inherit; background: #fff; border: 2px solid var(--ink); border-radius: 8px;
  min-height: 52px; padding: 10px 14px; width: 100%;
}
select { width: auto; min-height: 44px; padding: 6px 12px; font-size: 17px; }
textarea { resize: vertical; }
::placeholder { color: var(--muted); opacity: 1; }
:focus-visible, .vh:focus-visible + .btn { outline: 3px solid var(--blue); outline-offset: 3px; }
h2:focus { outline: none; }

/* flat blocks; the step name is in #stepText below (four names do not fit across a phone in every language) */
.progress ol { list-style: none; display: flex; gap: 8px; padding: 0; margin: 20px 0 8px; }
.progress li {
  flex: 1; min-height: 44px; border-radius: 8px; border: 2px solid var(--ink); background: #fff; color: var(--ink);
  display: grid; place-items: center; font-weight: 600; font-size: 17px;
}
.progress li[aria-current] { background: var(--orange); }
#stepText { font-weight: 600; margin-bottom: 12px; }

.card { background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 28px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  min-height: 52px; padding: 8px 22px; border-radius: 8px; border: 2px solid var(--ink);
  background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
}
.btn.primary { min-height: 56px; background: var(--orange); font-size: 19px; } /* near-black on orange: white would fail AA */
.navrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 2px solid var(--ink); }
.navrow .btn { min-width: 120px; }

.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.slot h3 { margin-top: 8px; }
.slot .btn { width: 100%; }
.slots .field:first-child { margin-top: 8px; }
.preview {
  aspect-ratio: 1; border: 2px dashed var(--ink); border-radius: 8px; background: var(--bg);
  display: grid; place-items: center; overflow: hidden; margin-bottom: 12px; text-align: center;
}
.preview img { width: 100%; height: 100%; object-fit: cover; }
.preview p { margin: 0; padding: 8px; color: var(--muted); font-size: 17px; }

.field { display: block; margin: 20px 0 0; font-weight: 600; }
.field > span { display: block; margin-bottom: 6px; }
.field input, .field textarea { font-weight: 400; }
.notice { border: 2px solid var(--ink); border-radius: 8px; padding: 12px 14px; margin: 12px 0 0; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tab, .chip, .pick {
  border-radius: 8px; border: 2px solid var(--ink); background: #fff; color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer;
}
.tab { flex: 1 1 auto; min-height: 52px; padding: 8px 16px; }
.tab[aria-selected=true], .chip[aria-pressed=true] { background: var(--yellow); }
#panel-upload { padding-top: 20px; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { min-height: 48px; padding: 6px 18px; font-size: 17px; font-weight: 500; }

/* card grids: the column count is set from the number of cards (cols() in app.js), so no card is left alone in the last row */
.grid { display: grid; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); gap: 10px; }
.pick { min-height: 56px; padding: 8px 14px; text-align: center; }
.pick[data-country][aria-pressed=true] { background: var(--green); color: #fff; }
#tales { display: grid; gap: 10px; } /* stacked: any count works */
.pick[data-tale] { min-height: 64px; padding: 10px 18px; text-align: start; }
.pick[data-tale][aria-pressed=true] { background: var(--blue); color: #fff; }
.talepreview { border: 2px solid var(--ink); border-radius: 8px; background: var(--bg); padding: 14px 16px; margin-top: 16px; }
.talepreview p { margin: 0; }
.tptitle { font-size: 20px; font-weight: 600; }
mark { background: var(--yellow); color: var(--ink); font-weight: 600; padding: 0 2px; border-radius: 2px; } /* narrow: a Korean particle must sit right against the name */

.forline { font-size: 22px; line-height: 1.5; font-weight: 600; margin-bottom: 8px; }
.tag { border: 2px solid var(--ink); border-radius: 8px; padding: 8px 12px; font-weight: 600; margin-bottom: 10px; }
.pages { list-style: none; padding: 0; margin: 16px 0 0; gap: 16px; }
.pp { border: 2px solid var(--ink); border-radius: 8px; background: #fff; overflow: hidden; width: 100%; max-width: 560px; justify-self: center; } /* cap: a one-page tale must not fill the wide column */
.pp.lone { grid-column: 1 / -1; width: calc(50% - 8px); justify-self: center; }
.slotbox {
  aspect-ratio: 4 / 3; display: grid; place-items: center; padding: 12px; text-align: center;
  font-size: 20px; line-height: 1.4; font-weight: 600; border-bottom: 2px solid var(--ink);
}
.s0 { background: var(--red); color: #fff; }
.s1 { background: var(--blue); color: #fff; }
.s2 { background: var(--green); color: #fff; }
.s3 { background: var(--yellow); color: var(--ink); }
.s4 { background: var(--amber); color: var(--ink); }
.ppbody { padding: 10px 16px 18px; }
.ppno { display: block; color: var(--muted); font-size: 17px; }
.ppbody p { margin: 4px 0 0; text-align: center; font-size: 18px; }

/* one row sized to the number of items (--n is set from the list), so 1, 2 or 3 never leaves an orphan */
.gallery { display: grid; grid-template-columns: repeat(var(--n, 1), minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.gallery figure { margin: 0; }
.shot { display: block; width: 100%; padding: 0; border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; background: var(--bg); cursor: zoom-in; }
.shot img, dialog img { display: block; width: 100%; height: auto; }
figcaption { font-size: 17px; margin-top: 8px; }

dialog { border: 2px solid var(--ink); border-radius: 12px; padding: 16px; width: min(1100px, calc(100vw - 24px)); max-width: none; max-height: calc(100vh - 24px); color: var(--ink); background: #fff; }
dialog::backdrop { background: rgba(17, 24, 39, .7); }
dialog img { max-height: 68vh; object-fit: contain; border-radius: 6px; }
dialog p { margin: 10px 0 12px; color: var(--muted); font-size: 17px; }

.summary { background: var(--bg); border: 2px solid var(--ink); border-radius: 8px; padding: 14px 16px; margin: 24px 0 16px; }
.summary h3 { margin: 0 0 4px; }
.summary p { margin: 0; }
.price { font-size: 30px; line-height: 1.3; }
.price s { color: var(--muted); font-size: 22px; margin-right: 8px; }
.price strong { font-weight: 600; }
.coderow { display: flex; gap: 10px; }
.coderow input { flex: 1; min-width: 0; }
#order { margin-top: 24px; width: 100%; }

.confirm { border: 2px solid var(--ink); border-radius: 8px; background: var(--bg); padding: 18px; margin-top: 24px; }
.confirm h3 { margin-top: 0; font-size: 20px; }
.confirm p { margin-bottom: 6px; }
.confirm .btn { margin-top: 12px; }

dl { margin: 0 0 8px; }
dt { font-weight: 600; margin-top: 18px; }
dd { margin: 2px 0 0; }

@media (max-width: 760px) {
  .gallery { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(var(--cols-s, 1), minmax(0, 1fr)); }
  .pp.lone { width: auto; }
}
@media (max-width: 480px) {
  h1 { font-size: 24px; }
  h2 { font-size: 23px; }
  .card { padding: 18px; }
  .btn { padding: 8px 14px; }
  .navrow .btn { min-width: 0; flex: 1; }
  .slots { grid-template-columns: 1fr; }
  .preview { max-width: 240px; }
}
