/* Explo map maker. Cream page, navy ink, Satoshi (max Medium 500), flat fills, no pure white or black anywhere.
   The tool is one night card: the map on the left (on a phone, on top) with its zoom and region controls floating on it,
   and a side panel with the brush, the numbers, the actions and your list. */
@font-face { font-family: "Satoshi"; src: url("/fonts/Satoshi-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Satoshi"; src: url("/fonts/Satoshi-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  color-scheme: light;
  --font: "Satoshi", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: #f7f7f2;
  --fg: #041122;
  --muted: #465260;
  --line: rgba(2, 13, 27, 0.16);
  --soft: rgba(2, 13, 27, 0.06);
  --link: #4a6400;
  --night: #041122;
  --night-2: #0b1d2f;
  --night-3: #12293f;
  --sea: #081b30;
  --land: #223a58;
  --land-hover: #2e4d73;
  --dot: #4a6a92;
  --cream: #d8d8cb;
  --cream-dim: rgba(216, 216, 203, 0.7);
  --cream-line: rgba(216, 216, 203, 0.16);
  --cream-wash: rgba(216, 216, 203, 0.08);
  --blue: #108ae1;
  --blue-hover: #2f9eee;
  --blue-text: #5eb4f0;
  --lime: #c6f24e;
  --gutter: 16px;
  --max: 1240px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 18px/1.6 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
b, strong, h1, h2, h3, h4, th { font-weight: 500; }
button, input { font-family: inherit; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: #364a00; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.prose { max-width: 720px; margin: 0 auto; padding: 0 var(--gutter); }

/* ---- header ---- */
.bar { border-bottom: 1px solid var(--line); }
.bar-in { max-width: var(--max); margin: 0 auto; padding: 12px var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; font-weight: 500; font-size: 22px; line-height: 1; }
.brand img { width: 32px; height: 32px; border-radius: 8px; display: block; }
.bar nav { display: flex; align-items: center; gap: 22px; }
.bar nav a:not(.btn) { color: var(--fg); text-decoration: none; font-size: 17px; }
.bar nav a:not(.btn):hover { text-decoration: underline; text-underline-offset: 6px; }

/* ---- buttons: flat, one accent for what you act on ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 24px; border-radius: 999px; border: 0; background: var(--lime); color: var(--night); text-decoration: none; font: 500 16px/1 var(--font); cursor: pointer; }
.btn:hover { background: #d4f76e; color: var(--night); }
.btn.sm { min-height: 40px; padding: 0 18px; font-size: 15px; }
.btn[disabled] { background: var(--soft); color: #6a7480; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px rgba(2, 13, 27, 0.32); }
.btn-ghost:hover { background: var(--soft); color: var(--fg); }
.btn-ghost[disabled] { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.btn:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 999px; }
.linkbtn { background: none; border: 0; padding: 8px 4px; color: var(--muted); font: 400 15px/1.2 var(--font); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkbtn:hover { color: var(--fg); }
.linkbtn[disabled] { opacity: .4; cursor: default; text-decoration: none; }

/* ---- intro: short, so the map is on screen at once ---- */
.intro { padding: 22px 0 16px; }
.tag { margin: 0 0 8px; font-size: 13px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
h1 { font-weight: 500; font-size: clamp(30px, 5.4vw, 46px); line-height: 1.06; margin: 0 0 10px; letter-spacing: -0.015em; text-wrap: balance; }
.dek { font-size: 17px; line-height: 1.5; color: var(--muted); margin: 0; max-width: 720px; text-wrap: pretty; }

/* ---- the tool: one night card ---- */
.card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; background: var(--night); color: var(--cream); border-radius: 24px; padding: 10px; }
.card .notice { margin: 0; padding: 10px 14px; border-radius: 14px; background: var(--night-2); border: 1px solid var(--cream-line); font-size: 15px; line-height: 1.4; color: var(--cream); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.notice button { height: 34px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--cream); color: var(--night); font: 500 14px/1 var(--font); cursor: pointer; }
.notice button + button { background: transparent; color: var(--cream); box-shadow: inset 0 0 0 1px var(--cream-line); }
.notice button:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

.search { position: relative; }
.search label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.search input { width: 100%; height: 48px; padding: 0 16px 0 44px; border-radius: 14px; border: 1px solid var(--cream-line); background: var(--night-2); color: var(--cream); font-size: 16px; }
.search input::placeholder { color: var(--cream-dim); }
.search input:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.search svg { position: absolute; left: 14px; top: 14px; width: 20px; height: 20px; color: var(--cream-dim); pointer-events: none; }
.results { position: absolute; z-index: 30; left: 0; right: 0; top: 54px; margin: 0; padding: 6px; list-style: none; max-height: 300px; overflow: auto; background: var(--night-3); border: 1px solid var(--cream-line); border-radius: 14px; }
.results li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: 16px; line-height: 1.3; }
.results li[aria-selected="true"], .results li:hover { background: rgba(216, 216, 203, 0.1); }
.results .st { font-size: 14px; color: var(--cream-dim); white-space: nowrap; }
.results .st.v { color: var(--cream); }
.results .st.w { color: var(--blue-text); }
.results .none { color: var(--cream-dim); cursor: default; }
.results .none:hover { background: none; }

/* the brush: what a tap does, coloured like the fill it paints */
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; }
.sw.a { background: var(--cream); }
.sw.b { background: var(--blue); }
.brush { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 16px; background: var(--night-2); }
.brush button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 8px; border: 0; border-radius: 12px; background: transparent; color: var(--cream); font: 400 15px/1.1 var(--font); cursor: pointer; white-space: nowrap; }
.brush button:hover { background: var(--cream-wash); }
.brush button svg { width: 14px; height: 14px; flex: none; }
.brush button[aria-checked="true"] { font-weight: 500; }
.brush button[data-brush="1"][aria-checked="true"] { background: var(--cream); color: var(--night); }
.brush button[data-brush="1"][aria-checked="true"] .sw { background: var(--night); }
.brush button[data-brush="2"][aria-checked="true"] { background: var(--blue); color: var(--night); }
.brush button[data-brush="2"][aria-checked="true"] .sw { background: var(--night); }
.brush button[data-brush="0"][aria-checked="true"] { background: rgba(216, 216, 203, 0.18); }
.brush button:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

/* the map: fills its stage, and the controls float on it */
.stage { position: relative; min-height: 0; aspect-ratio: 6 / 5; border-radius: 18px; overflow: hidden; background: var(--sea); user-select: none; -webkit-user-select: none; }
#map { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.stage.zoomed #map { touch-action: none; cursor: grab; }
.stage.drag #map { cursor: grabbing; }
#map path { fill: var(--land); stroke: var(--sea); stroke-width: 0.8px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
#map path.t { pointer-events: none; fill: #14283f; }
#map path.v { fill: var(--cream); animation: lit .3s ease-out; }
#map path.w { fill: var(--blue); animation: lit .3s ease-out; }
#map .dot { fill: var(--dot); stroke: none; pointer-events: none; }
#map .dot.v { fill: var(--cream); stroke: var(--sea); stroke-width: 1.5px; vector-effect: non-scaling-stroke; animation: lit .3s ease-out; }
#map .dot.w { fill: var(--blue); stroke: var(--sea); stroke-width: 1.5px; vector-effect: non-scaling-stroke; animation: lit .3s ease-out; }
#map .hit { fill: transparent; stroke: none; }
@keyframes lit { from { opacity: .3; } to { opacity: 1; } }
@media (hover: hover) {
  /* hover previews what the brush would do */
  #map path:not(.t):not(.v):not(.w):hover { fill: var(--land-hover); }
  .stage[data-brush="1"] #map path:not(.t):not(.v):not(.w):hover { fill: #7b8a96; }
  .stage[data-brush="2"] #map path:not(.t):not(.v):not(.w):hover { fill: #1b6ba8; }
  #map path.v:hover { fill: #ececdf; }
  #map path.w:hover { fill: var(--blue-hover); }
  .stage[data-brush="0"] #map path.v:hover, .stage[data-brush="0"] #map path.w:hover { fill: #5a6a78; }
}

.regions { position: absolute; z-index: 3; top: 10px; left: 10px; right: 10px; display: flex; gap: 6px; padding-right: 24px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; pointer-events: none; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
.regions::-webkit-scrollbar { display: none; }
.regions button { pointer-events: auto; flex: none; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--cream-line); background: var(--night); color: var(--cream); font-size: 14px; line-height: 1; cursor: pointer; }
.regions button:hover { background: var(--night-3); }
.regions button[aria-pressed="true"] { background: var(--cream); border-color: var(--cream); color: var(--night); }
.regions .n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: rgba(216, 216, 203, 0.16); font-size: 12px; font-weight: 500; }
.regions button[aria-pressed="true"] .n { background: rgba(4, 17, 34, 0.14); }
.regions button:focus-visible, .zoom button:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

.zoom { position: absolute; z-index: 3; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.zoom button { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--cream-line); background: var(--night); color: var(--cream); cursor: pointer; padding: 0; }
.zoom button:hover { background: var(--night-3); }
.zoom svg { width: 18px; height: 18px; }
.start { position: absolute; z-index: 2; left: 10px; bottom: 10px; max-width: calc(100% - 76px); margin: 0; padding: 8px 14px; border-radius: 999px; background: var(--night); border: 1px solid var(--cream-line); font-size: 14px; line-height: 1.3; color: var(--cream-dim); pointer-events: none; }
.stage:not(.empty) .start { display: none; }
.coarse { display: none; }
.dek .more { display: inline; }
@media (pointer: coarse) { .fine { display: none; } .coarse { display: inline; } .zoom button { width: 44px; height: 44px; } }

.tip { position: absolute; z-index: 5; pointer-events: none; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--cream); color: var(--night); font-size: 14px; font-weight: 500; line-height: 1.2; white-space: nowrap; transform: translate(-50%, -140%); }
.tip.below { transform: translate(-50%, 45%); }
.tip i { font-style: normal; font-weight: 400; color: #465260; }
.tip .d { width: 9px; height: 9px; border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 1.5px #8a949c; }
.tip .d.v { background: var(--night); box-shadow: none; }
.tip .d.w { background: var(--blue); box-shadow: none; }

/* the numbers: big count, a bar, three small ones (the same layout as the picture) */
.stats { padding: 14px 16px 12px; border-radius: 16px; background: var(--night-2); }
.stats .big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.stats b { font-weight: 500; color: var(--cream); line-height: 1; }
.stats b span, .stats b small { font-size: inherit; color: inherit; }
.stats .big b { font-size: 48px; letter-spacing: -0.02em; }
.stats b small { font-weight: 400; color: var(--cream-dim); letter-spacing: 0; }
.stats .big b small { font-size: 22px; margin-left: 2px; }
.stats .lbl { font-size: 15px; color: var(--cream-dim); }
.meter { height: 6px; margin: 12px 0 14px; border-radius: 999px; background: rgba(216, 216, 203, 0.12); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--cream); transition: width .35s ease; }
.sub { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; padding: 0; list-style: none; }
.sub li { padding: 0 10px; border-left: 1px solid var(--cream-line); }
.sub li:first-child { padding-left: 0; border-left: 0; }
.sub b { display: block; font-size: 22px; }
.sub b small { font-size: 14px; }
.sub .lbl { display: block; margin-top: 2px; font-size: 13px; }

/* ---- actions ---- */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card .btn { flex: 1 1 calc(50% - 4px); min-width: 0; }
.card #make { flex-basis: calc(50% - 4px); }
.actions.has-share #make { flex-basis: 100%; }
.card .btn-ghost { color: var(--cream); box-shadow: inset 0 0 0 1px rgba(216, 216, 203, 0.34); }
.card .btn-ghost:hover { background: var(--cream-wash); color: var(--cream); }
.card .btn[disabled] { background: var(--cream-wash); color: rgba(216, 216, 203, 0.38); box-shadow: none; }
.card .btn:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.minor { flex: 1 1 100%; display: flex; justify-content: center; gap: 18px; }
.card .linkbtn { color: var(--cream-dim); }
.card .linkbtn:hover { color: var(--cream); }
.card .linkbtn:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.panel { margin: 22px 0 0; padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--soft); }

/* ---- your countries ---- */
.mine { padding: 4px 4px 2px; }
.mine.empty .grp { display: none; }
.mine:not(.empty) .none-yet { display: none; }
.none-yet { margin: 0; font-size: 14px; line-height: 1.45; color: var(--cream-dim); }
.mine .grp + .grp { margin-top: 14px; }
.mine h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--cream-dim); }
.mine h3 span { color: var(--cream); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; max-height: 200px; overflow: auto; }
.chips button { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 4px 8px 4px 11px; border: 0; border-radius: 999px; background: var(--cream-wash); color: var(--cream); font-size: 15px; line-height: 1.2; cursor: pointer; }
.chips button:hover { background: rgba(216, 216, 203, 0.16); }
.chips button:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.chips button .x { width: 14px; height: 14px; color: var(--cream-dim); }
.chips .empty { color: var(--cream-dim); font-size: 14px; }

.cta { margin: 22px 0 0; padding: 24px; border-radius: 24px; background: var(--night); color: var(--cream); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; }
.cta h2 { margin: 0 0 6px; font-size: 24px; line-height: 1.2; color: var(--cream); }
.cta p { margin: 0; font-size: 16px; color: var(--cream-dim); max-width: 520px; }

/* ---- picture dialog ---- */
dialog { padding: 0; border: 0; border-radius: 24px; background: var(--bg); color: var(--fg); width: min(94vw, 560px); max-height: 94vh; overflow: auto; }
dialog::backdrop { background: rgba(4, 17, 34, 0.62); }
.dlg { padding: 18px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.dlg-head h2 { margin: 0; font-size: 20px; }
.x-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--soft); color: var(--fg); cursor: pointer; padding: 0; }
.x-btn svg { width: 18px; height: 18px; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--soft); margin: 0 0 14px; }
.seg button { height: 36px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--fg); font-size: 15px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--night); color: var(--cream); }
.pv { display: grid; place-items: center; min-height: 160px; }
.pv img { display: block; border-radius: 14px; max-width: 100%; max-height: min(62vh, 640px); height: auto; width: auto; }
.pv p { margin: 0; color: var(--muted); font-size: 15px; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 0; }
.dlg .note { margin: 12px 0 0; font-size: 14px; color: var(--muted); }

/* ---- article ---- */
article.prose { padding-top: 56px; padding-bottom: 28px; }
article h2 { font-size: 28px; line-height: 1.2; margin: 44px 0 12px; letter-spacing: -0.01em; }
article h2:first-child { margin-top: 0; }
article p { margin: 0 0 16px; text-wrap: pretty; }
article ol { margin: 0 0 16px; padding-left: 22px; }
article li { margin: 0 0 8px; }
details { border-top: 1px solid var(--line); padding: 14px 0; }
details:last-of-type { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 500; font-size: 18px; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-weight: 400; color: var(--muted); }
details[open] summary::after { content: "\2212"; }
details p { margin: 10px 0 0; color: var(--muted); }
.related { margin: 18px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }

footer { max-width: var(--max); margin: 56px auto 40px; padding: 0 var(--gutter); color: var(--muted); font-size: 15px; }

/* ---- tablet: a roomier stage ---- */
@media (min-width: 700px) {
  .card { padding: 14px; gap: 12px; border-radius: 28px; }
  .stage { aspect-ratio: 16 / 10; }
  .intro { padding-top: 30px; }
  .dek { font-size: 19px; }
}

/* ---- desktop: map left, side panel right; everything above the fold ---- */
@media (min-width: 960px) {
  .card {
    grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-rows: auto auto auto auto auto auto minmax(150px, 1fr);
    grid-template-areas: "notice notice" "stage search" "stage brush" "stage stats" "stage actions" "stage mine" "stage mine";
    column-gap: 14px; row-gap: 10px; padding: 14px;
  }
  .card .notice { grid-area: notice; }
  .search { grid-area: search; }
  .brush { grid-area: brush; }
  .stage { grid-area: stage; aspect-ratio: auto; min-height: clamp(500px, calc(100svh - 340px), 720px); }
  .stats { grid-area: stats; }
  .actions { grid-area: actions; }
  .mine { grid-area: mine; contain: size; overflow: auto; padding: 6px 2px 0; scrollbar-width: thin; scrollbar-color: rgba(216, 216, 203, 0.3) transparent; }
  .chips { max-height: none; overflow: visible; }
  .intro { padding-top: 34px; }
}

@media (max-width: 959px) {
  .mine.empty { display: none; }
}
@media (max-width: 699px) {
  .dek { font-size: 16px; }
  .dek .more { display: none; }
  .zoom { flex-direction: row; right: 8px; bottom: 8px; }
  .zoom #zhome { display: none; }
  .start { left: 8px; bottom: 8px; padding: 7px 12px; font-size: 13px; max-width: calc(100% - 118px); }
  .start .fine, .start .coarse { display: none; }
  .regions { top: 8px; left: 8px; right: 8px; }
}
@media (max-width: 420px) {
  body { font-size: 17px; }
  .bar nav a:not(.btn) { display: none; }
  .cta { padding: 20px; }
  .stats .big b { font-size: 44px; }
  .brush button { font-size: 14px; gap: 6px; padding: 0 4px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
