@font-face {
  /* UK Number Plate by Gareth Attrill (Charles Wright lookalike), free for personal use - see public/fonts/README.txt */
  font-family: "UKNumberPlate"; src: url("/fonts/UKNumberPlate.ttf") format("truetype"); font-display: swap;
}
:root { --ink: #1d1d1f; --paper: #F5F5F5; --accent: #2b59c3; --plate: #F7D117; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink); font-size: 16px; line-height: 1.4;
  background: #F5F5F5;
}
/* Content spans 90% of the viewport, centered, no fixed max-width. */
.board { position: relative; width: 90vw; max-width: none; margin: 0 auto; padding: 48px 0 80px; }
.topline { height: 0; border-top: 2.4px solid var(--ink); margin: 0 0 28px; }
.title { font-weight: 700; font-size: 32px; letter-spacing: -.01em; text-align: center; margin: 0 auto 28px; width: fit-content; max-width: 90%; padding: 0 40px 4px; border-bottom: 2.4px solid var(--ink); }

/* Panels: as many columns as fit (each ≥320px) in the 90vw board. Dividers are single-thickness:
   the row's left edge is .panels' border-left; each panel draws only a right border (no negative
   margin, no overlapping). Inner padding keeps plates clear of the lines. 1–2 panels: capped
   centered columns (≤560px), with the grid itself shrink-wrapped so its outer borders hug them. */
.panels {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  row-gap: 40px; column-gap: 0;
  border-left: 2.4px solid var(--ink);
}
.panel {
  min-width: 0; min-height: 420px; margin: 0;
  padding: 32px 40px 48px;
  border: none; border-right: 2.4px solid var(--ink);
}
.panels.few {
  width: fit-content; max-width: 100%; margin-inline: auto;
  grid-template-columns: repeat(var(--cols), minmax(0, 560px));
}

/* Hong Kong rear plate: yellow, black characters, thin black border, rounded corners.
   One-line ~ 520x112mm (4.6:1); two-line ~ 340x220mm-ish (1.55:1), same font. */
.plate {
  --h: 64px;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  height: var(--h); width: calc(var(--h) * 4.6); max-width: 100%; min-width: 0; padding: 0 14px;
  background: var(--plate); color: #000; border: 2px solid #000; border-radius: 8px;
  box-shadow: inset 0 0 0 3px var(--plate), inset 0 0 0 4px rgba(0,0,0,.55), 0 2px 4px rgba(0,0,0,.15);
  font-family: "UKNumberPlate", "Arial Narrow", "Roboto Condensed", sans-serif; font-weight: 700;
  font-size: calc(var(--h) * .62); line-height: 1; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
  margin-bottom: 26px;
}
.plate span { display: block; min-height: 1em; }
.plate.two { --h: 116px; min-width: 0; width: calc(var(--h) * 1.55); font-size: calc(var(--h) * .36); gap: 6px; }

.entries { list-style: none; padding: 0; margin: 0; }
.entry { margin: 0 0 18px; }
.text { font-size: 20px; font-weight: 600; line-height: 1.3; white-space: pre-wrap; overflow-wrap: anywhere; }
.links { list-style: none; padding: 0; margin: 4px 0 0 4px; }
.links li { margin: 3px 0; font-size: 15px; }
.link { display: inline; margin: 0; color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(43,89,195,.35); overflow-wrap: anywhere; word-break: break-all; }
.links li::before { content: "– "; color: var(--ink); }
.link:hover { color: var(--ink); }

/* Forms (passcode prompt + admin) */
.lockbox, .card { background: #fff; border: 2.4px solid var(--ink); border-radius: 12px; padding: 28px 30px; margin: 30px auto; max-width: 460px; }
.lockbox { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.lockbox .plate { margin-bottom: 4px; }
input, textarea, button, select { font: inherit; font-size: 15px; color: var(--ink); }
input, textarea, select { width: 100%; padding: 4px 10px; background: #fff; border: 2px solid var(--ink); border-radius: 8px; }
textarea { min-height: 60px; resize: vertical; }
button { cursor: pointer; padding: 4px 18px; background: #fff; border: 2.4px solid var(--ink); border-radius: 10px; box-shadow: 3px 3px 0 var(--ink); }
button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
button.mini { font-size: 12px; padding: 1px 8px; padding: 0 10px; box-shadow: 2px 2px 0 var(--ink); }
.err { color: #b3261e; margin: 0; }
.ok { color: #1f7a3a; }
label { display: block; margin: 10px 0 2px; }
.small { font-size: 13px; opacity: .7; }
.card.wide { width: 90vw; max-width: none; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 18px; }
.admin-grid.fields { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.admin-grid fieldset { border: 2px dashed var(--ink); border-radius: 12px; padding: 10px 14px; min-width: 0; }
.radios { display: flex; gap: 14px; margin: 6px 0; }
.radios label { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.radios input { width: auto; }
.entry-edit { border-top: 1.5px dotted var(--ink); padding-top: 6px; margin-top: 10px; }
.entry-edit .row { display: grid; grid-template-columns: 1fr 1.6fr; gap: 6px; margin-top: 4px; }
.panel-edit > .head { display: flex; justify-content: space-between; align-items: center; }
.panel-edit > .head label { margin: 6px 0 2px; }
.entry-edit .head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.link-edit { display: flex; gap: 6px; margin-top: 4px; align-items: center; }
.link-edit input { flex: 1; }
.preview { margin: 8px 0 0; transform-origin: left top; }
.preview .plate { margin: 0; --h: 44px; }
.preview .plate.two { --h: 80px; }
.pages-list { width: 100%; border-collapse: collapse; font-size: 15px; }
.pages-list td { padding: 4px 8px; border-bottom: 1px dotted var(--ink); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
[hidden] { display: none !important; }

@media (max-width: 800px) {
  body { font-size: 16px; }
  .board { padding: 28px 0 40px; }
  .title { font-size: 26px; }
  .panels, .panels.few { grid-template-columns: 1fr; width: auto; max-width: none; margin-inline: 0; row-gap: 0; border: none; }
  .panel, .panel:last-child { min-height: 0; margin: 0; border: none; border-top: 2.4px solid var(--ink); padding: 26px 16px 18px; }
  .panel:last-child { border-bottom: 2.4px solid var(--ink); }
  .plate { --h: 56px; }
  .plate.two { --h: 104px; }
  .text { font-size: 18px; }
  .admin-grid { grid-template-columns: 1fr; }
}

/* "none" link marker → muted, non-clickable */
.link-none { color: #8a8a8a; font-style: italic; }
/* import control */
.import-row { text-align: center; margin-top: 10px; font-size: 14px; }
.import-row label.btnlike { display: inline-block; cursor: pointer; }
.import-note { display: block; margin: 8px auto 0; max-width: 720px; text-align: left; font-size: 13px; }
.import-note.ok { color: #1b6e2a; }
.import-note .bad { color: #b00020; }
.import-note ul { margin: 4px 0 0 18px; padding: 0; }
.import-row input[type=file] { width: auto; max-width: 340px; display: inline-block; border: 0; background: none; box-shadow: none; padding: 0; font-size: 13px; }

/* Destructive actions */
button.danger { color: #b3261e; border-color: #b3261e; box-shadow: 2px 2px 0 #b3261e; }
button.danger:hover { background: #b3261e; color: #fff; }
.row-actions { display: inline-flex; gap: 8px; white-space: nowrap; }
.pages-list td:last-child { text-align: right; width: 1%; }
#deleteBtn { margin-left: auto; }
