/* The shop config tool (tools/shop-admin): lists, forms, the game beside them. Wide screens show all
   three; narrower ones slide the preview in; phones show the list and the editor in turn. */
:root {
  --ink: #14123A; --muted: #5E6390; --line: #DCDEEE; --bg: #F4F5FB; --card: #FFFFFF;
  --accent: #6A3CF0; --accent-soft: #EEE8FF; --go: #07C100; --bad: #D8304B; --bad-soft: #FDECEF; --warn-soft: #FFF6DA;
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); }
body { display: flex; flex-direction: column; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }
input, select, textarea { font: inherit; color: inherit; }
.grow { flex: 1; }
[hidden] { display: none !important; }

/* header */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 18px; background: var(--card); border-bottom: 1px solid var(--line); }
.top h1 { margin: 0 8px 0 0; font-size: 18px; }
.pill { padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px; white-space: nowrap; }
.pill.quiet { background: transparent; color: var(--muted); font-weight: 500; }
.pill.changed { background: var(--warn-soft); color: #8A5A00; }
.pill.err { background: var(--bad-soft); color: var(--bad); }
.primary, .ghost, .danger { height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); font-weight: 600; }
.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.danger { border-color: #F2B8C2; color: var(--bad); }
.ghost.small, .danger.small { height: 28px; padding: 0 10px; font-size: 13px; }
.banner { padding: 10px 18px; background: var(--bad-soft); color: var(--bad); border-bottom: 1px solid #F2B8C2; }
.banner.info { background: var(--warn-soft); color: #6B4A00; border-color: #F0DC9A; }

/* tabs */
.tabs { display: flex; align-items: flex-end; gap: 2px; padding: 0 18px; background: var(--card); border-bottom: 1px solid var(--line); }
.tabs [data-tab] { padding: 10px 16px; border: 0; border-bottom: 3px solid transparent; background: none; font-weight: 600; color: var(--muted); }
.tabs [data-tab][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.problems { margin: 6px 0; height: 30px; padding: 0 12px; border-radius: 99px; border: 0; font-weight: 600; font-size: 13px; }
.problems.ok { background: #E7F8E6; color: #1C7A18; }
.problems.bad { background: var(--bad-soft); color: var(--bad); }
.problems-list { padding: 8px 18px 10px; background: var(--bad-soft); border-bottom: 1px solid #F2B8C2; }
.problems-list button { display: block; border: 0; background: none; padding: 3px 0; color: var(--bad); text-align: left; text-decoration: underline; }

/* the three columns */
main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(250px, 300px) minmax(420px, 1fr) 430px; }
main.wide { grid-template-columns: minmax(420px, 1fr) 430px; }
main.wide .list { display: none; }
.col { min-height: 0; overflow: auto; }
.list { padding: 14px; border-right: 1px solid var(--line); }
.editor { padding: 18px 22px 60px; }
.phone { padding: 12px; background: #1C1640; display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* lists */
.list h2, .editor h2 { margin: 0 0 12px; font-size: 16px; }
.list-tools { display: flex; gap: 6px; margin-bottom: 10px; }
.list-tools input, .list-tools select { flex: 1; min-width: 0; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.row { display: flex; align-items: center; gap: 10px; width: 100%; margin-bottom: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); text-align: left; }
.row[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.row .txt { flex: 1; min-width: 0; }
.row b { display: block; font-size: 14px; overflow-wrap: anywhere; }
.row small { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.row .thumb { flex: none; width: 54px; height: 34px; object-fit: contain; }
.row .ic { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); font-size: 18px; }
.row .moves { display: flex; flex-direction: column; gap: 2px; }
.row .moves button { width: 24px; height: 18px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: var(--card); font-size: 10px; line-height: 1; }
.status { flex: none; padding: 1px 7px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.status.now { background: #E7F8E6; color: #1C7A18; }
.status.soon { background: var(--accent-soft); color: var(--accent); }
.status.past { background: #ECEDF3; color: var(--muted); }
.add { width: 100%; height: 36px; border: 1px dashed #B9BDD8; border-radius: 10px; background: none; color: var(--accent); font-weight: 600; }

/* forms */
.field { margin: 0 0 16px; }
.field > label, .field > .label { display: block; margin-bottom: 5px; font-weight: 600; }
.field .hint { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.field input[type="text"], .field input[type="number"], .field input[type="url"], .field input[type="datetime-local"], .field select, .field textarea { width: 100%; max-width: 420px; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.field textarea { height: 70px; padding: 8px 9px; }
.field input.small, .field select.small { width: 120px; }
.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inline > input, .inline > select { width: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--card); }
.seg button { height: 32px; padding: 0 12px; border: 0; border-right: 1px solid var(--line); background: none; font-weight: 600; color: var(--muted); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 30px; padding: 0 11px; border: 1px solid var(--line); border-radius: 99px; background: var(--card); font-weight: 600; font-size: 13px; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 74px; height: 46px; border: 2px solid transparent; border-radius: 10px; color: #fff; font-weight: 700; font-size: 12px; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }
.sw-felt { background: linear-gradient(180deg, #1DB37C, #0E7A55); } .sw-paint { background: linear-gradient(160deg, #19C3D6, #1673E0); }
.sw-blue { background: linear-gradient(180deg, #3B86FF, #1F49D2); } .sw-gold { background: linear-gradient(180deg, #FFC43A, #FF8A1F); }
.sw-neon { background: linear-gradient(180deg, #0B0630, #2B0D66); } .sw-sunset { background: linear-gradient(180deg, #7B2FE0, #E83E8C, #FF8A3D); }
.sw-none { background: repeating-linear-gradient(45deg, #ECEDF3 0 6px, #fff 6px 12px); color: var(--muted); text-shadow: none; }
.box { margin: 0 0 16px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.box > h3 { margin: 0 0 10px; font-size: 14px; }
.items .item { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px; background: #FBFBFE; }
.items .item select, .items .item input { height: 32px; border: 1px solid var(--line); border-radius: 7px; padding: 0 8px; background: #fff; }
.items .item select { flex: 1; min-width: 0; }
.items .item input[type="number"] { width: 110px; }
.items .item .thumb { width: 60px; height: 36px; object-fit: contain; }
.items .item .kind { width: 54px; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.x { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); }
.adds { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.adds button, .adds select { height: 30px; padding: 0 10px; border: 1px dashed #B9BDD8; border-radius: 8px; background: none; color: var(--accent); font-weight: 600; }
.colors { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.colors input[type="color"] { width: 42px; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.backdrop-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.backdrop-pick button { width: 76px; height: 110px; padding: 0; border: 2px solid transparent; border-radius: 9px; overflow: hidden; background: #ECEDF3; }
.backdrop-pick button img { width: 100%; height: 100%; object-fit: cover; }
.backdrop-pick button[aria-pressed="true"] { border-color: var(--accent); }
.used { color: var(--muted); font-size: 12px; }
.empty { padding: 30px 0; color: var(--muted); text-align: center; }
.foot { display: flex; gap: 8px; margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); }
table.prices { border-collapse: collapse; margin-bottom: 8px; }
table.prices th, table.prices td { padding: 5px 10px 5px 0; text-align: left; }
table.prices th { color: var(--muted); font-size: 12px; font-weight: 600; }
table.prices input { height: 32px; border: 1px solid var(--line); border-radius: 7px; padding: 0 8px; }
table.prices input.id { width: 150px; } table.prices input.usd { width: 90px; }

/* the phone */
.phone-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; color: #E6E0FF; font-size: 13px; }
.phone-bar .when input { height: 28px; margin-left: 4px; border: 0; border-radius: 6px; padding: 0 6px; }
.phone-bar .seg { border-color: #3A3170; background: #2A2160; }
.phone-bar .seg button { height: 28px; color: #C9C2F5; border-color: #3A3170; }
.phone-bar .ghost.small { border-color: #3A3170; background: #2A2160; color: #E6E0FF; }
.phone-frame { position: relative; width: 390px; height: min(760px, calc(100vh - 170px)); min-height: 420px; flex: none; border: 6px solid #0B0826; border-radius: 34px; overflow: hidden; background: #000; }
.phone-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.pv-wait { position: absolute; inset: 0; display: grid; place-items: center; color: #C9C2F5; background: #1C1640; }
.phone-note { max-width: 380px; margin: 0; color: #A79FD6; font-size: 12px; text-align: center; }

/* dialogs, toast */
dialog { width: 560px; max-width: 92vw; max-height: 86vh; padding: 0; border: 0; border-radius: 16px; box-shadow: 0 20px 60px rgba(20, 18, 58, 0.35); }
dialog::backdrop { background: rgba(20, 18, 58, 0.45); }
dialog .dlg-in { padding: 22px 24px; overflow: auto; max-height: 86vh; }
dialog h2 { margin: 0 0 12px; font-size: 18px; }
dialog ul { margin: 0 0 14px; padding-left: 20px; }
dialog .dlg-go { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.versions .v { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.versions .v .txt { flex: 1; }
.versions .v small { color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); padding: 10px 18px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 600; box-shadow: 0 8px 30px rgba(20, 18, 58, 0.35); }
.badge-notes { margin: -8px 0 16px; padding-left: 18px; color: var(--muted); font-size: 12px; }
.badge-notes li { margin: 2px 0; }
.badge-notes li.no { color: #A0263A; }
.item.offer { padding: 4px 6px; }
.item.offer .open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px; border: 0; border-radius: 7px; background: none; text-align: left; }
.item.offer .open:hover { background: var(--accent-soft); }
.item.offer .open .txt { flex: 1; min-width: 0; }
.item.offer .open b { display: block; overflow-wrap: anywhere; }
.item.offer .open small { display: block; color: var(--muted); font-size: 12px; }
.item.offer .open .edit { color: var(--accent); font-weight: 600; font-size: 12px; }
.back { margin-bottom: 12px; }
code { padding: 1px 6px; border-radius: 5px; background: #F0F1F8; font-size: 12.5px; }
/* an offer opens under its row */
.items .item.offer { display: block; padding: 4px 6px; }
.item.offer.open { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 2px var(--accent-soft); }
.offer-head { display: flex; align-items: center; gap: 6px; }
.offer-body { margin: 6px 4px 6px; padding: 14px 8px 4px; border-top: 1px solid var(--line); }
.offer-body .field input[type="text"], .offer-body .field select { max-width: 360px; }
/* drag and drop */
.grip { flex: none; width: 18px; color: #A6AACB; font-size: 16px; line-height: 1; text-align: center; cursor: grab; user-select: none; }
[draggable="true"] { cursor: grab; }
.offer-head[draggable="true"] .open { cursor: pointer; }
.dragging { opacity: 0.45; }
.drop-before { box-shadow: 0 -3px 0 var(--accent) !important; }
.drop-after { box-shadow: 0 3px 0 var(--accent) !important; }

/* When it's on: Launch → End, straight */
.timing { display: grid; grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr); align-items: stretch; max-width: 640px; }
.tcard { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #FBFBFE; }
.tlabel { display: flex; align-items: center; justify-content: space-between; height: 26px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.tcard input[type="datetime-local"], .thours input { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font: inherit; }
.thours { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 600; }
.thours input { width: 88px; flex: none; font-weight: 700; text-align: center; }
.tnever { display: flex; align-items: center; height: 38px; padding: 0 12px; border: 1px dashed #C9CCE2; border-radius: 9px; color: var(--muted); font-weight: 600; }
.thint { min-height: 17px; margin: 0; color: var(--muted); font-size: 12px; }
.tclear { border: 0; background: none; padding: 0; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.tarrow { display: grid; place-items: center; color: #A6AACB; font-size: 18px; font-weight: 700; }
.seg.small { border-radius: 8px; }
.seg.small button { height: 26px; padding: 0 10px; font-size: 12px; letter-spacing: 0; text-transform: none; }
.tstatus { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; font-weight: 600; }
.tstatus .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.tstatus.now { color: #1C7A18; } .tstatus.now .dot { background: #2FB52A; box-shadow: 0 0 0 3px #DDF5DC; }
.tstatus.soon { color: var(--accent); } .tstatus.soon .dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tstatus.past { color: var(--muted); } .tstatus.past .dot { background: #A6AACB; }
/* (a narrow editor column: Launch above End) */
.timing-box { container-type: inline-size; }
@container (max-width: 520px) {
  .timing { grid-template-columns: minmax(0, 1fr); }
  .tarrow { height: 26px; transform: rotate(90deg); }
}
.tstatus { flex-wrap: wrap; row-gap: 3px; }
.tstatus .tnow { white-space: nowrap; }
.tstatus .tnote { flex-basis: 100%; padding-left: 17px; color: var(--muted); font-weight: 500; font-size: 12px; }
.thours span { white-space: nowrap; }
.ghost.icon { width: 34px; padding: 0; font-size: 18px; line-height: 1; }

/* ------------------------------------------------------------ sign-in (the web tool) */
dialog.gate { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 20px; border: 0; border-radius: 0; box-shadow: none; background: var(--bg); }
dialog.gate[open] { display: grid; place-items: center; }
dialog.gate::backdrop { background: var(--bg); }
.gate-card { width: 100%; max-width: 380px; padding: 28px 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); text-align: center; box-shadow: 0 14px 40px rgba(20, 18, 58, 0.12); }
.gate-card h1 { margin: 0 0 10px; font-size: 22px; }
.gate-card p { margin: 0 0 18px; overflow-wrap: anywhere; }
.gate-go { display: flex; flex-direction: column; gap: 8px; }
.gate-go button { height: 44px; font-size: 15px; }
.gate-go:empty { display: none; }
.gate-note { margin: 16px 0 0 !important; color: var(--muted); font-size: 12px; }
.who { display: inline-flex; align-items: center; gap: 8px; }
.who-ic { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; }

/* ------------------------------------------------------------ narrower than three columns */
.pv-open, .pv-close, .nv-back { display: none; }
@media (max-width: 1179px) {
  main { grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); }
  main.wide { grid-template-columns: minmax(0, 1fr); }
  /* the preview: a panel that slides in from the right (kept running while it's away) */
  .phone { position: fixed; top: 0; right: 0; bottom: 0; z-index: 30; width: min(430px, 100vw); transform: translateX(105%); transition: transform 0.22s ease; box-shadow: -12px 0 40px rgba(11, 8, 38, 0.35); }
  body.pv-on .phone { transform: none; }
  .phone-frame { flex: 1 1 auto; width: min(390px, 100%); height: auto; min-height: 0; }
  .pv-open { display: block; position: fixed; right: 16px; bottom: 16px; z-index: 25; height: 44px; padding: 0 20px; border-radius: 99px; box-shadow: 0 8px 24px rgba(106, 60, 240, 0.35); }
  body.pv-on .pv-open { display: none; }
  .pv-close { display: inline-block; }
  .editor { padding-bottom: 90px; }
}
@media (prefers-reduced-motion: reduce) { .phone { transition: none; } }

/* ------------------------------------------------------------ phones: the list and the editor take turns */
@media (max-width: 759px) {
  .top { padding: 8px 12px; }
  .top h1 { font-size: 16px; margin-right: 0; }
  .top .pill { font-size: 12px; white-space: normal; }
  .top .grow { flex-basis: 100%; height: 0; }
  .top { gap: 6px; }
  .top .pill.quiet { display: none; }
  #btn-history, #btn-publish { padding: 0 11px; }
  .who { width: 40px; padding: 0; justify-content: center; }
  .who .who-t { display: none; }
  .who-ic { width: 26px; height: 26px; font-size: 13px; }
  .primary, .ghost, .danger { height: 40px; }
  .ghost.icon { width: 40px; }
  .tabs { padding: 0 6px; overflow-x: auto; scrollbar-width: none; }
  .seg { flex-wrap: wrap; max-width: 100%; }
  .seg button { flex: 1 1 auto; padding: 0 9px; }
  .tabs [data-tab] { flex: none; padding: 12px 12px; }
  .problems { flex: none; }
  .problems-list { padding: 8px 12px 10px; }
  .banner { padding: 10px 12px; }
  main, main.wide { display: block; overflow: hidden; }
  main > .col { height: 100%; }
  body[data-view="list"] main .editor { display: none; }
  body[data-view="edit"] main .list { display: none; }
  body.no-list main .list { display: none; }
  body.no-list main .editor { display: block; }
  .list { padding: 12px; border-right: 0; }
  .editor { padding: 12px 12px 90px; }
  .nv-back { display: inline-block; margin: 0 0 12px; height: 36px; }
  .row { padding: 10px 12px; }
  .field input[type="text"], .field input[type="number"], .field input[type="url"], .field input[type="datetime-local"], .field select, .field textarea { height: 40px; font-size: 16px; max-width: none; }
  .field textarea { height: 80px; }
  .items .item { flex-wrap: wrap; }
  .items .item select, .items .item input { height: 38px; font-size: 16px; }
  .items .item select { order: 10; flex: 1 1 100%; }
  .offer-body { padding: 12px 2px 4px; }
  .offer-body .field input[type="text"], .offer-body .field select { max-width: none; }
  .phone { width: 100vw; padding: 8px 8px 10px; }
  .phone-frame { width: 100%; border-width: 0; border-radius: 14px; }
  .phone-note { display: none; }
  table.prices { display: block; max-width: 100%; overflow-x: auto; }
  dialog { max-width: 96vw; }
  dialog .dlg-in { padding: 18px 16px; }
  .versions .v { flex-wrap: wrap; }
  .toast { max-width: 92vw; text-align: center; }
}
/* fingers: the drag handle is bigger, and holding it doesn't scroll the page */
@media (pointer: coarse) {
  .grip { width: 34px; height: 40px; display: grid; place-items: center; font-size: 20px; touch-action: none; }
}

/* the Content tab (content.js): liveries and Shop pictures without a build */
.content-drop { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px; margin: 8px 0 10px; border: 2px dashed var(--line); border-radius: 12px; }
.items .item.bad { border-color: #F2B8C2; background: var(--bad-soft); }
.items .item .txt { flex: 1; min-width: 0; }
.items .item .txt small { display: block; overflow-wrap: anywhere; }
.problems-in { margin: 4px 0 0; padding-left: 18px; color: var(--bad); font-size: 13px; }
.content-thumb { width: 96px; height: auto; flex: none; object-fit: contain; border-radius: 6px; }
label.chip { display: inline-flex; align-items: center; gap: 4px; height: auto; min-height: 30px; padding: 4px 11px; font-weight: 500; }
label.chip.off { opacity: 0.55; text-decoration: line-through; }
@media (max-width: 759px) { .content-thumb { width: 72px; } .items .item { flex-wrap: wrap; } }
