/* Azumarill's colours, sampled from its official art: the azure of its body, the warm white of its
   belly spots and the pink inside its ears. Only colours and round spots are used, never the creature. */
:root {
  --sea: #3f9ccb;
  --sea-deep: #3482b0;
  --bubbles: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='520'%3E%3Cg fill='%23f4f1ed'%3E%3Ccircle cx='70' cy='90' r='34'/%3E%3Ccircle cx='300' cy='60' r='18'/%3E%3Ccircle cx='430' cy='210' r='40'/%3E%3Ccircle cx='170' cy='300' r='22'/%3E%3Ccircle cx='360' cy='420' r='28'/%3E%3Ccircle cx='60' cy='450' r='14'/%3E%3Ccircle cx='250' cy='490' r='9'/%3E%3C/g%3E%3C/svg%3E");
  --bubbles-small: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='310' height='250'%3E%3Cg fill='%23f4f1ed'%3E%3Ccircle cx='40' cy='232' r='7'/%3E%3Ccircle cx='150' cy='40' r='5'/%3E%3Ccircle cx='230' cy='170' r='10'/%3E%3Ccircle cx='280' cy='216' r='4'/%3E%3Ccircle cx='100' cy='140' r='6'/%3E%3C/g%3E%3C/svg%3E");
  --head: #fbf9f6;
  --bg: #fbf9f6;
  --panel: #fff;
  --text: #1b2329;
  --muted: #5e666c;
  --line: #e2ddd9;
  --accent: #1f6d97;
  --button: #24739f;
  --brand: #2a7cab;
  --ear: #c46469;
  --good: #1b7f3b;
  --bad: #b3261e;
  --warn: #9a6400;
  --series-1: #2f86b8;
  --series-2: #c4545a;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sea: #1f5574;
    --sea-deep: #163f58;
    --bubbles: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='520'%3E%3Cg fill='%23f4f1ed' fill-opacity='0.13'%3E%3Ccircle cx='70' cy='90' r='34'/%3E%3Ccircle cx='300' cy='60' r='18'/%3E%3Ccircle cx='430' cy='210' r='40'/%3E%3Ccircle cx='170' cy='300' r='22'/%3E%3Ccircle cx='360' cy='420' r='28'/%3E%3Ccircle cx='60' cy='450' r='14'/%3E%3Ccircle cx='250' cy='490' r='9'/%3E%3C/g%3E%3C/svg%3E");
    --bubbles-small: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='310' height='250'%3E%3Cg fill='%23f4f1ed' fill-opacity='0.13'%3E%3Ccircle cx='40' cy='232' r='7'/%3E%3Ccircle cx='150' cy='40' r='5'/%3E%3Ccircle cx='230' cy='170' r='10'/%3E%3Ccircle cx='280' cy='216' r='4'/%3E%3Ccircle cx='100' cy='140' r='6'/%3E%3C/g%3E%3C/svg%3E");
    --head: #14202a;
    --bg: #111a21;
    --panel: #16222b;
    --text: #e8edf0;
    --muted: #9aa8b2;
    --line: #26394a;
    --accent: #7fc3e3;
    --button: #24739f;
    --brand: #68b3d0;
    --ear: #e47f84;
    --good: #5cc27e;
    --bad: #f2786f;
    --warn: #e0b04f;
    --series-1: #3a95cc;
    --series-2: #d8676c;
  }
}

* { box-sizing: border-box; }

/* The page is Azumarill's blue with its white spots; the header and the content sit on its belly white. */
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bubbles) 0 0, var(--bubbles-small) 140px 90px, radial-gradient(130% 90% at 50% 0%, var(--sea) 55%, var(--sea-deep)) fixed;
  background-color: var(--sea);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  padding: 12px 16px;
  background: var(--head);
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 8px; font: 800 1.25rem/1 ui-rounded, "Nunito", system-ui, sans-serif; letter-spacing: 0.01em; text-decoration: none; color: var(--brand); }
.brand svg { width: 28px; height: 28px; flex: none; }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
header nav a, header .more summary { text-decoration: none; color: var(--text); text-underline-offset: 6px; text-decoration-thickness: 3px; }
header nav a:hover, header .more summary:hover { color: var(--accent); }
header nav a.on, header .more summary.on { font-weight: 700; text-decoration: underline; text-decoration-color: var(--ear); }
header .more > div a { color: var(--accent); white-space: nowrap; }
header .more > div a.on { color: var(--accent); }

.switch { display: inline-flex; border: 1px solid var(--button); border-radius: 999px; overflow: hidden; }
.switch a { padding: 3px 12px; text-decoration: none; color: var(--accent); }
.switch a.on { background: var(--button); color: #fff; font-weight: 700; }

.more { position: relative; }
.more summary { cursor: pointer; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: " \25BE"; }
.more > div {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 10;
  display: flex; flex-direction: column; gap: 6px; min-width: 120px;
  padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
}

main {
  width: calc(100% - 24px);
  max-width: 1100px;
  margin: 20px auto 28px;
  padding: 8px 16px 40px;
  background: var(--bg);
  border-radius: 16px;
  box-shadow: 0 2px 14px rgb(0 0 0 / 0.12);
}
h1 { font-size: 1.5rem; margin: 16px 0 12px; }
h2 { font-size: 1.1rem; margin: 28px 0 8px; }
header nav.public { margin-left: auto; }
footer { margin-top: auto; padding: 12px max(16px, calc((100% - 1100px) / 2)) 28px; background: var(--head); border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
footer nav { gap: 4px 16px; }
.prose { max-width: 720px; }
.prose h2 { margin-top: 24px; }
.placeholder { color: var(--warn); font-style: italic; }
.code { font: 600 1.3rem ui-monospace, monospace; letter-spacing: 0.05em; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.tile .label { color: var(--muted); font-size: 0.85rem; }
.tile .value { font-size: 1.35rem; font-weight: 600; }
.tile .note { color: var(--muted); font-size: 0.8rem; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.th-sort { all: unset; cursor: pointer; white-space: nowrap; }
.th-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.th-sort::after { content: " \2195"; opacity: 0.35; }
th[aria-sort="ascending"] .th-sort::after { content: " \25B2"; opacity: 1; }
th[aria-sort="descending"] .th-sort::after { content: " \25BC"; opacity: 1; }
th[aria-sort] { color: var(--text); }
td { white-space: nowrap; }
td:first-child { white-space: normal; min-width: 160px; }
table.entry td { padding: 4px; }
table.entry input, table.entry select { width: 100%; min-width: 60px; }
table.entry select { min-width: 92px; }
table.entry input[data-lot-search] { min-width: 14em; }

input, select, button, .button {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
}

button, .button {
  display: inline-block;
  cursor: pointer;
  background: var(--button);
  border-color: var(--button);
  color: #fff;
  text-decoration: none;
}

button[type="button"] { background: var(--panel); color: var(--text); border-color: var(--line); }
button.link { background: none; border: none; color: var(--accent); padding: 0 4px; text-decoration: underline; }

form.inline { display: inline; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 8px 0; }
.row label, .stack > label { display: flex; flex-direction: column; gap: 2px; font-size: 0.85rem; color: var(--muted); }
/* A select is as wide as its longest option, such as a long lot name, so on a phone it is held to the row. */
.row label, .row select { max-width: 100%; }
.stack > label input { max-width: 480px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.filters input { flex: 1 1 160px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.tabs a { padding: 6px 12px; border: 1px solid transparent; border-bottom: none; border-radius: 6px 6px 0 0; color: var(--muted); text-decoration: none; }
.tabs a.on { background: var(--panel); border-color: var(--line); color: var(--text); font-weight: 600; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.suggest {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  min-width: 240px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.suggest li { padding: 8px; border-bottom: 1px solid var(--line); cursor: pointer; white-space: normal; }
.suggest li:last-child { border-bottom: none; }
.suggest li:hover, .suggest li.active { background: var(--bg); }
.suggest span { color: var(--muted); white-space: nowrap; }

.muted { color: var(--muted); }
.unpriced { color: var(--warn); font-style: italic; }
.neg { color: var(--bad); }
.warn { color: var(--warn); }
.error { color: var(--bad); font-weight: 600; }
.import-line select, .import-line > .muted:last-child { display: block; margin-top: 4px; width: 100%; max-width: 520px; }
.sell-bar { position: sticky; bottom: 0; padding: 10px 0; background: var(--bg); border-top: 1px solid var(--line); }
.sell-bar[hidden] { display: none; }
.notice { border-left: 3px solid var(--bad); padding: 2px 12px; margin: 12px 0; }
.stack > label textarea { width: 100%; font: 0.85rem ui-monospace, monospace; }

.scanner { position: relative; width: fit-content; max-width: 100%; margin: 0 auto; background: #000; border-radius: 8px; overflow: hidden; }
.scanner video { display: block; max-width: 100%; max-height: 55vh; }
.scan-box { position: absolute; border: 3px solid var(--accent); border-radius: 10px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35); pointer-events: none; }
.scan-status { text-align: center; font-weight: 600; min-height: 1.45em; margin: 6px 0; }
.setting { padding: 4px 12px 8px; margin: 8px 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.row label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 0.95rem; color: var(--text); }
img.thumb { flex: none; width: 40px; height: 56px; object-fit: contain; border-radius: 3px; display: block; }
.scan-card { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.scan-card .suggest { flex-basis: 100%; }
#scan-rows td:first-child { min-width: 250px; }
.scan-card input { flex: 1; min-width: 0; }
.scan-card img:not([src]) { display: none; }
.scan-here { margin: 0 0 12px; }
.scan-here summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.trade-total { position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: baseline; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.trade-total strong { font-size: 1.15em; }
.trade-total .verdict { flex-basis: 100%; }
.trade-total.ahead .verdict { color: var(--good); }
.trade-total.behind .verdict { color: var(--bad); }
tr.unmatched input[name="item"] { border-color: var(--warn); }
tr.flash { animation: flash 0.8s; }
@keyframes flash { from { background: color-mix(in srgb, var(--good) 30%, transparent); } }

.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 4px 0 10px; }
.progress span { display: block; height: 100%; background: var(--good); }
.binder-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.binder-tile { display: flex; gap: 10px; align-items: center; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; color: var(--text); text-decoration: none; }
.binder-tile img, .binder-tile .noimg { flex: none; width: 48px; height: 67px; object-fit: cover; border-radius: 3px; background: var(--line); }
.binder-tile > span:last-child { flex: 1; }
.binder-page { max-width: 640px; margin: 0 auto 18px; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.binder-page h3 { margin: 0 0 8px; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.pockets { display: grid; gap: 8px; }
.pockets .slot { min-width: 0; }
.pockets .slot form { margin: 0; }
.pockets .slot button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; position: relative; }
.pockets .slot button, .pockets .slot img { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.pockets .slot.holding img, .pockets .slot.holding .noimg { outline: 3px solid var(--accent); outline-offset: 1px; }
dialog.versions { width: min(420px, calc(100vw - 32px)); max-height: 85vh; overflow: auto; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); }
dialog.versions::backdrop { background: rgb(0 0 0 / 0.5); }
dialog.versions h2 { margin-top: 0; }
.versions-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.versions-list form { margin: 0; }
.versions-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px 6px 6px; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
.versions-list button.mine { border-color: var(--good); }
.versions-list img, .versions-list .noimg { flex: none; width: 44px; aspect-ratio: 63 / 88; object-fit: cover; border-radius: 3px; background: var(--line); }
.versions-list .price { margin-left: auto; color: var(--muted); }
.pockets .slot img, .pockets .slot .noimg, .pockets .slot.empty { display: block; width: 100%; aspect-ratio: 63 / 88; object-fit: cover; border-radius: 5px; background: var(--bg); }
.pockets .slot.empty { border: 1px dashed var(--line); background: none; }
.pockets .slot .noimg { display: flex; align-items: center; justify-content: center; padding: 6px; font-size: 0.75rem; color: var(--muted); border: 1px solid var(--line); text-align: center; }
.pockets .slot:not(.marked):not(.owned) img { filter: grayscale(1); opacity: 0.35; }
.pockets .slot.wished:not(.marked):not(.owned) button::after { content: "★"; position: absolute; right: 4px; top: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--warn); color: #fff; font-size: 13px; line-height: 22px; text-align: center; }
.pockets .slot.marked button::after, .pockets .slot.owned button::after { content: "✓"; position: absolute; right: 4px; top: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--good); color: #fff; font-size: 14px; line-height: 22px; text-align: center; }
.pockets .cap + .cap { margin-top: 0; }
.pockets .cap { font-size: 0.72rem; line-height: 1.25; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.check { width: 26px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); font-size: 0; }
tr.marked button.check, tr.owned button.check { background: var(--good); border-color: var(--good); }
table.add-card { max-width: 520px; }
table.add-card td:last-child { width: 1%; }
form.inline-edit { display: flex; gap: 4px; align-items: center; }
form.inline-edit input { width: 80px; }
tr.done td { opacity: 0.6; }
tr.deal td:nth-child(2) { color: var(--good); font-weight: 600; }
.good { color: var(--good); }

.with-pic { display: flex; gap: 8px; align-items: center; }
img.card-pic { float: right; width: 160px; max-width: 40%; margin: 0 0 12px 12px; border-radius: 8px; }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
figure.chart { margin: 0; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; position: relative; }
figure.chart figcaption { font-weight: 600; margin-bottom: 4px; }
figure.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
figure.chart text { fill: var(--muted); font-size: 12px; }
figure.chart .grid { stroke: var(--line); stroke-width: 1; }
figure.chart .base { stroke: var(--muted); stroke-width: 1; }
figure.chart path.s1, figure.chart .dot.s1 { fill: var(--series-1); }
figure.chart path.s2, figure.chart .dot.s2 { fill: var(--series-2); }
figure.chart path.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
figure.chart path.line.s1 { stroke: var(--series-1); }
figure.chart path.line.s2 { stroke: var(--series-2); }
figure.chart .dot { stroke: var(--panel); stroke-width: 2; }
figure.chart .hit { fill: transparent; outline: none; }
figure.chart .hit:hover, figure.chart .hit:focus { fill: var(--text); fill-opacity: 0.05; }
.legend { display: flex; gap: 14px; font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.legend .key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.legend .key.s1 { background: var(--series-1); }
.legend .key.s2 { background: var(--series-2); }
.chart-table { margin-top: 6px; font-size: 0.85rem; }
.chart-table summary { cursor: pointer; color: var(--muted); }
.chart-tip { position: absolute; pointer-events: none; white-space: pre; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 0.8rem; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); z-index: 5; }
.chart-tip strong { display: block; }

.mass-entry { margin: 1.5rem 0; }
.mass-entry summary { cursor: pointer; font-weight: 600; }
.mass-entry textarea { width: 100%; font-family: ui-monospace, monospace; font-size: 0.85rem; }

.trial-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.trial-pair { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.trial-pair p { margin: 0 0 8px; font-size: 0.85rem; }
.trial-pair .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.trial-pair figure { margin: 0; min-width: 0; }
.trial-pair img, .trial-pair .noimg { display: block; width: 100%; aspect-ratio: 63 / 88; object-fit: contain; border-radius: 5px; background: var(--bg); }
.trial-pair .noimg { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.8rem; border: 1px solid var(--line); }
.trial-pair figcaption { font-size: 0.8rem; margin-top: 4px; overflow-wrap: anywhere; }
