:root {
  --bg: #faf7f2;
  --panel: #ffffff;
  --ink: #2b2a27;
  --muted: #6f6a62;
  --line: #e4ddd2;
  --accent: #1f6f78;      /* deep teal, from the Zee deck */
  --accent-ink: #ffffff;
  --accent-soft: #e3f0f0;
  --warn: #b5532f;
  --warn-soft: #fbe9e1;
  --ok: #3f7d3a;
  --ok-soft: #e6f2e2;
  --gold: #b88a1b;
  --gold-soft: #fbf1d6;
  --radius: 10px;
  font-size: 17px;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Andika", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}
a { color: var(--accent); }
h1 { font-size: 1.7rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.25rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ------------------------------------------------ header */
.top {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .7rem 1.25rem; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.2rem; color: var(--ink); text-decoration: none; }
.brand span { color: var(--accent); }
.top .spacer { flex: 1; }
.top form { margin: 0; }
.lang button { border: 1px solid var(--line); background: none; padding: .15rem .5rem;
  border-radius: 6px; cursor: pointer; color: var(--muted); font: inherit; font-size: .85rem; }
.lang button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.worker { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: .35rem; }
.dot { width: .65rem; height: .65rem; border-radius: 50%; background: #c9c2b6; display: inline-block; }
.dot.on { background: #3fa34d; box-shadow: 0 0 0 3px #3fa34d33; }

main { max-width: 1180px; margin: 0 auto; padding: 1.25rem; }

/* ------------------------------------------------ messages */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: .6rem .9rem; border-radius: var(--radius); margin-bottom: .4rem;
  background: var(--accent-soft); }
.messages .success { background: var(--ok-soft); }
.messages .error { background: var(--warn-soft); }

/* ------------------------------------------------ buttons & forms */
.btn, button.btn {
  display: inline-block; padding: .5rem 1rem; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font: inherit; cursor: pointer;
  text-decoration: none; line-height: 1.3;
}
.btn.secondary { background: var(--panel); color: var(--accent); }
.btn.danger { background: var(--panel); color: var(--warn); border-color: var(--warn); }
.btn.small { padding: .25rem .6rem; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: default; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .8rem 0; }
.actions form { margin: 0; }

label { font-weight: 600; display: block; margin-bottom: .2rem; }
input[type=text], input[type=number], input[type=password], input:not([type]), select, textarea {
  font: inherit; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; max-width: 100%;
}
textarea.wide, input.wide { width: 100%; }
textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: .95rem; width: 100%; max-width: 28rem; }
.field { margin-bottom: 1rem; }
.helptext, .field .help { display: block; color: var(--muted); font-size: .85rem; }
.errorlist { color: var(--warn); margin: .2rem 0; padding-left: 1rem; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.2rem; margin-bottom: 1rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }

/* ------------------------------------------------ deck list */
.decks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.deck-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; text-decoration: none; color: var(--ink); display: block; }
.deck-card:hover { border-color: var(--accent); }
.deck-card h3 { margin: 0 0 .2rem; }
.bar { height: .5rem; background: var(--line); border-radius: 99px; overflow: hidden; margin: .6rem 0 .3rem; }
.bar > i { display: block; height: 100%; background: var(--ok); }

/* ------------------------------------------------ tabs */
.deck-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.deck-head h1 { margin-bottom: .3rem; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: .5rem 0 1.2rem;
  overflow-x: auto; }
.tabs a { padding: .5rem .9rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent;
  white-space: nowrap; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

/* ------------------------------------------------ status chips */
.chip { display: inline-block; padding: .05rem .55rem; border-radius: 99px; font-size: .8rem;
  background: var(--line); color: var(--ink); white-space: nowrap; }
.chip.approved { background: var(--ok-soft); color: var(--ok); }
.chip.review { background: var(--gold-soft); color: var(--gold); }
.chip.queued, .chip.generating { background: var(--accent-soft); color: var(--accent); }
.chip.failed { background: var(--warn-soft); color: var(--warn); }
.chip.special { background: var(--gold-soft); color: var(--gold); }
.chip.ref { background: #efe6f5; color: #6b3f8c; }

/* ------------------------------------------------ card grid */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); overflow: hidden; display: flex; flex-direction: column; }
.card:hover { border-color: var(--accent); }
.card .thumb { aspect-ratio: 1; background: #f1ece4; display: flex; align-items: center;
  justify-content: center; color: var(--muted); font-size: .8rem; text-align: center; padding: .4rem; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .meta { padding: .45rem .55rem; font-size: .85rem; }
.card .meta b { display: block; }
.filters { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .8rem; }
.filters button { font: inherit; font-size: .85rem; border: 1px solid var(--line); background: var(--panel);
  border-radius: 99px; padding: .15rem .7rem; cursor: pointer; }
.filters button.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ------------------------------------------------ slot detail */
.slot-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.2rem; align-items: start; }
@media (max-width: 900px) { .slot-layout { grid-template-columns: 1fr; } }
.approved-art img { width: 100%; max-width: 520px; border-radius: 6px; display: block; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }
.option { background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius); padding: .5rem; }
.option.picked { border-color: var(--ok); }
.option img { width: 100%; border-radius: 4px; display: block; cursor: zoom-in; }
.option .row { display: flex; justify-content: space-between; align-items: center; gap: .4rem; margin-top: .4rem; flex-wrap: wrap; }
.round { margin-bottom: 1.4rem; }
.round-head { display: flex; gap: .8rem; align-items: baseline; flex-wrap: wrap; }
.feedback-quote { border-left: 3px solid var(--gold); padding: .1rem .7rem; color: var(--muted); margin: .3rem 0 .6rem; }
details.prompt pre { white-space: pre-wrap; font-size: .8rem; background: #f5f1ea; padding: .6rem; border-radius: 6px; }
.pager { display: flex; justify-content: space-between; margin-bottom: .6rem; }
.words-big { font-size: 1.5rem; font-weight: 700; letter-spacing: .03em; }
.busy { display: flex; gap: .7rem; align-items: center; padding: .8rem 1rem; background: var(--accent-soft);
  border-radius: var(--radius); margin-bottom: 1rem; }
.spinner { width: 1.1rem; height: 1.1rem; border: 3px solid var(--accent); border-right-color: transparent;
  border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

dialog.zoom { border: none; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; }
dialog.zoom img { max-width: 96vw; max-height: 92vh; display: block; }
dialog.zoom::backdrop { background: rgba(0,0,0,.8); }

table.plain { border-collapse: collapse; width: 100%; }
table.plain td, table.plain th { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.freq { display: flex; flex-wrap: wrap; gap: .3rem; }
.freq span { background: #f1ece4; padding: .05rem .45rem; border-radius: 5px; font-size: .85rem; }

.login { max-width: 380px; margin: 4rem auto; }

/* ------------------------------------------------ lettering tab */
.lettering { grid-template-columns: minmax(0, 1fr) 380px; }
.lettering #preview { min-height: 300px; display: flex; align-items: center; justify-content: center; }
input[type=color] { width: 4rem; height: 2.2rem; padding: .1rem; }
.field ul { list-style: none; padding: 0; margin: 0; }
