/* Every page outside the 3D crossing: sheets of cream paper laid over Shibuya, which is kept as a mosaic behind
   them. Square corners, a hard ink shadow, pictures made of big pixels, the same as the tiles and cards in the
   crossing itself (public/portal/world/world.css). */
@import url('https://fonts.googleapis.com/css2?family=DotGothic16&display=swap');

:root {
  color-scheme: light;
  --ink: #1e1b1c; --paper: #f4f1e8; --card: #fbf9f2; --text: #f6f3ea; --muted: #6f6a62; --hair: #d9d3c2;
  --lit: #ffcf5a; --accent: #d9573a; --good: #2f8a5c; --bad: #c8402f; --sea: #7fc8a9;
  /* Older names, still used by a few pages. */
  --mikan: var(--accent); --mikan-deep: #b8401f; --lemon: var(--lit); --mint: #a9dcc4; --sky: #a9cfe8; --momo: #f1b9c6; --fuji: #cbbcf2;
  --edge: 2px solid var(--ink); --drop: 4px 4px 0 var(--ink); --radius: 0; --wrap: 760px;
  --dot: "DotGothic16", ui-monospace, "Hiragino Sans", monospace; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", system-ui, sans-serif;
  /* One square of the mosaic behind the page: the still is 96 by 54 and covers the window. */
  --tile: max(100vw / 96, 100dvh / 54);
  font-family: var(--sans); font-weight: 400; color: var(--ink); background: #10131a; -webkit-text-size-adjust: 100%;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100dvh; line-height: 1.75; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
/* The city, and the joints between its squares. */
body::before { content: ""; position: fixed; inset: 0; z-index: -2; background: #10131a url(/play/backdrop-day.webp) center / cover no-repeat; image-rendering: pixelated; }
html[data-sky="dusk"] body::before { background-image: url(/play/backdrop-dusk.webp); }
html[data-sky="night"] body::before { background-image: url(/play/backdrop-night.webp); }
/* A game played in another place has that place behind it. */
html[data-place="venezia"] body::before { background-image: url(/play/backdrop-venezia-day.webp); }
html[data-place="venezia"][data-sky="dusk"] body::before { background-image: url(/play/backdrop-venezia-dusk.webp); }
html[data-place="venezia"][data-sky="night"] body::before { background-image: url(/play/backdrop-venezia-night.webp); }
html[data-place="kyoto"] body::before { background-image: url(/play/backdrop-kyoto-day.webp); }
html[data-place="kyoto"][data-sky="dusk"] body::before { background-image: url(/play/backdrop-kyoto-dusk.webp); }
html[data-place="kyoto"][data-sky="night"] body::before { background-image: url(/play/backdrop-kyoto-night.webp); }
html[data-place="london"] body::before { background-image: url(/play/backdrop-london-day.webp); }
html[data-place="london"][data-sky="dusk"] body::before { background-image: url(/play/backdrop-london-dusk.webp); }
html[data-place="london"][data-sky="night"] body::before { background-image: url(/play/backdrop-london-night.webp); }
html[data-place="taipei"] body::before { background-image: url(/play/backdrop-taipei-day.webp); }
html[data-place="taipei"][data-sky="dusk"] body::before { background-image: url(/play/backdrop-taipei-dusk.webp); }
html[data-place="taipei"][data-sky="night"] body::before { background-image: url(/play/backdrop-taipei-night.webp); }
html[data-place="newyork"] body::before { background-image: url(/play/backdrop-newyork-day.webp); }
html[data-place="newyork"][data-sky="dusk"] body::before { background-image: url(/play/backdrop-newyork-dusk.webp); }
html[data-place="newyork"][data-sky="night"] body::before { background-image: url(/play/backdrop-newyork-night.webp); }
html[data-place="hawaii"] body::before { background-image: url(/play/backdrop-hawaii-day.webp); }
html[data-place="hawaii"][data-sky="dusk"] body::before { background-image: url(/play/backdrop-hawaii-dusk.webp); }
html[data-place="hawaii"][data-sky="night"] body::before { background-image: url(/play/backdrop-hawaii-night.webp); }
html[data-place="munchen"] body::before { background-image: url(/play/backdrop-munchen-day.webp); }
html[data-place="munchen"][data-sky="dusk"] body::before { background-image: url(/play/backdrop-munchen-dusk.webp); }
html[data-place="munchen"][data-sky="night"] body::before { background-image: url(/play/backdrop-munchen-night.webp); }
html[data-place="seattle"] body::before { background-image: url(/play/backdrop-seattle-day.webp); }
html[data-place="seattle"][data-sky="dusk"] body::before { background-image: url(/play/backdrop-seattle-dusk.webp); }
html[data-place="seattle"][data-sky="night"] body::before { background-image: url(/play/backdrop-seattle-night.webp); }
body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(rgba(10,12,16,.2) 1px, transparent 1px), linear-gradient(90deg, rgba(10,12,16,.2) 1px, transparent 1px), linear-gradient(rgba(10,12,16,.12), rgba(10,12,16,.3));
  background-size: var(--tile) var(--tile), var(--tile) var(--tile), auto;
  background-position: calc((100vw - 96 * var(--tile)) / 2) calc((100dvh - 54 * var(--tile)) / 2), calc((100vw - 96 * var(--tile)) / 2) calc((100dvh - 54 * var(--tile)) / 2), 0 0; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.3; font-family: var(--dot); font-weight: 400; letter-spacing: .03em; }
a { color: var(--mikan-deep); text-underline-offset: 4px; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--lit); outline-offset: 2px; }
.skip { position: absolute; left: 12px; top: -80px; z-index: 50; padding: 10px 14px; background: var(--paper); border: var(--edge); }
.skip:focus { top: 12px; }
.wrap { width: min(100% - 24px, var(--wrap)); margin-inline: auto; }
.tabular { font-variant-numeric: tabular-nums; }
/* A tile: a cream square with a pixel icon (set through --pic) and a hard shadow. */
.tile-btn { display: inline-grid; justify-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--text); font: 700 9px var(--mono); letter-spacing: .1em; text-transform: uppercase; text-decoration: none; text-shadow: 1px 1px 0 var(--ink), 0 0 8px rgba(0,0,0,.7); }
.tile-btn i { display: block; width: 44px; height: 44px; background: var(--paper) var(--pic) center / 62% no-repeat; image-rendering: pixelated; box-shadow: 3px 3px 0 var(--ink); transition: transform .1s steps(2), box-shadow .1s steps(2); }
.tile-btn:hover i { transform: translate(-1px, -3px); box-shadow: 4px 6px 0 var(--ink); }
.tile-btn:active i, .tile-btn[aria-pressed="true"] i { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); background-color: var(--lit); }
.tile-btn:disabled { opacity: .45; cursor: default; }
.tile-btn:disabled i { transform: none; box-shadow: 3px 3px 0 var(--ink); background-color: var(--paper); }
.tile-btn.maimo i { background-size: 80%; }

/* ---- the bar across the top: Maimo's tile leads back to the crossing ---- */
.top { position: sticky; top: 0; z-index: 30; padding: 10px 0 6px; }
.top-inner { display: flex; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 400 20px var(--dot); letter-spacing: .06em; text-shadow: 2px 2px 0 var(--ink), 0 0 10px rgba(0,0,0,.5); }
.brand i { display: block; width: 36px; height: 36px; background: var(--paper) var(--pic) center / 80% no-repeat; image-rendering: pixelated; box-shadow: 3px 3px 0 var(--ink); }
.top-nav { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-nav .tile-btn i { width: 36px; height: 36px; }
.streak-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; background: var(--ink); color: var(--paper); font: 700 11px var(--mono); letter-spacing: .1em; text-decoration: none; }
.streak-chip[data-zero="true"] { opacity: .75; }
/* The language switch (public/shared/lang.js): two small tiles side by side, the chosen one lit. */
.lang-switch { display: inline-flex; flex: none; box-shadow: 3px 3px 0 var(--ink); }
.lang-switch button { padding: 6px 7px; border: 0; background: var(--paper); color: var(--ink); font: 700 11px var(--mono); letter-spacing: .04em; line-height: 1; cursor: pointer; }
.lang-switch button + button { border-left: 2px solid var(--ink); }
html[data-lang="en"] .lang-switch [data-set-lang="en"], html[data-lang="ja"] .lang-switch [data-set-lang="ja"] { background: var(--lit); cursor: default; }
@media (max-width: 430px) {
  .top-inner { gap: 8px; }
  .brand span { display: none; }
  .top-nav { gap: 8px; }
  .streak-chip { padding: 3px 6px; letter-spacing: .04em; }
}

/* ---- sheets of paper ---- */
main { display: grid; gap: 22px; padding: 6px 0 30px; }
/* A reading page (about, privacy, the card guide) is a single sheet. */
main.article { display: block; margin: 6px auto 30px; }
main.article .page-head { margin-bottom: 18px; }
main.article .page-head .eyebrow { margin-bottom: 4px; }
main:not(.article) > section, main:not(.article) > article, main.article, .sheet { width: min(100% - 24px, var(--wrap)); margin-inline: auto; padding: 18px 18px 22px; background: var(--paper); box-shadow: 6px 6px 0 var(--ink);
  background-image: linear-gradient(rgba(30,27,28,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(30,27,28,.045) 1px, transparent 1px); background-size: 18px 18px; }
main > div.wrap:empty, main > div.wrap:has(> [hidden]:only-child) { display: none; }
.stub { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 8px; margin-bottom: 14px; border-bottom: 2px dashed var(--ink); font: 700 10px var(--mono); letter-spacing: .16em; text-transform: uppercase; }
.eyebrow { font: 700 11px var(--mono); letter-spacing: .16em; color: var(--mikan-deep); text-transform: uppercase; }
.jp { display: block; font-size: .62em; letter-spacing: .08em; color: var(--muted); margin-top: 2px; }
.section-title { font-size: clamp(20px, 4vw, 26px); margin-bottom: 6px; }
.section-lead { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.page-head h1 { font-size: clamp(26px, 6vw, 38px); }
.page-head p { margin-top: 8px; color: var(--muted); }

/* ---- buttons, chips, cards ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 9px 18px; border: var(--edge); background: var(--card); box-shadow: var(--drop); font: 400 16px var(--dot); color: var(--ink); text-decoration: none; transition: transform .08s steps(2), box-shadow .08s steps(2); }
.btn:hover { transform: translate(-1px, -2px); box-shadow: 5px 6px 0 var(--ink); }
.btn:active, .btn.pressed { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn.primary { background: var(--ink); color: var(--paper); box-shadow: 4px 4px 0 var(--accent); }
.btn.primary:hover { box-shadow: 5px 6px 0 var(--accent); }
.btn.dark { background: var(--ink); color: var(--paper); }
.btn.line { background: #06c755; color: #fff; }
.btn.small { min-height: 38px; padding: 5px 12px; font-size: 14px; box-shadow: 3px 3px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.block { width: 100%; }
.card { background: var(--card); border: var(--edge); box-shadow: var(--drop); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px; background: var(--ink); color: var(--paper); font: 700 11px var(--mono); letter-spacing: .08em; white-space: nowrap; }
.chip.done { background: var(--good); }

/* ---- reading ---- */
.prose h2, .article h2 { font-size: 22px; margin: 30px 0 10px; padding-top: 14px; border-top: 2px dashed var(--ink); }
.prose > h2:first-child, .article > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h3, .article h3 { font-size: 17px; margin: 22px 0 6px; }
.prose p, .prose li, .article p, .article li { font-size: 15px; color: #37322f; }
.prose p + p, .article p + p { margin-top: 10px; }
.prose ul, .prose ol, .article ul, .article ol { padding-left: 22px; }
.prose .figure, .article .figure { margin: 16px 0; padding: 14px; background: var(--card); border: var(--edge); }
.figure figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }
.demo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 420px; margin-inline: auto; }
.rules { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.rules li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; font-size: 14px; }
.rules b.num { display: grid; place-items: center; width: 24px; height: 24px; background: var(--ink); color: var(--paper); font: 700 12px var(--mono); }
.rules small { display: block; color: var(--muted); font-size: 12px; }
.article-note { margin-top: 16px; padding: 12px 14px; border: 2px dashed var(--ink); font-size: 13px; color: var(--muted); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.facts dt { font: 700 11px var(--mono); letter-spacing: .1em; color: var(--muted); padding-top: 3px; }

/* ---- other places: small tickets to the other games ---- */
.mini-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mini-tile { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; padding: 10px 12px; color: var(--ink); text-decoration: none; box-shadow: 3px 3px 0 var(--ink); }
.mini-tile:hover { background: #fff; transform: translate(-1px, -2px); box-shadow: 4px 5px 0 var(--ink); }
.mini-tile img, .mini-tile i { width: 34px; height: 34px; flex: none; }
.mini-tile i { display: block; background: var(--lit) var(--pic) center / 68% no-repeat; image-rendering: pixelated; box-shadow: 2px 2px 0 var(--ink); }
.mini-tile b { display: block; font: 400 15px/1.3 var(--dot); }
.mini-tile small { display: block; font-size: 11px; color: var(--muted); line-height: 1.4; }
.mini-tile.done b::after { content: " ★"; color: var(--accent); }
.news-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.news-list li { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; align-items: baseline; padding: 10px 12px; background: var(--card); border: var(--edge); }
.news-list time { grid-row: span 2; font: 700 11px var(--mono); color: var(--muted); }
.news-list a { font: 400 15px var(--dot); color: var(--ink); }
.news-list li > span { font-size: 13px; color: var(--muted); }

/* ---- dialogs ---- */
dialog { width: min(440px, calc(100% - 28px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 0; border: 0; background: var(--paper); color: var(--ink); box-shadow: 8px 8px 0 var(--ink);
  background-image: linear-gradient(rgba(30,27,28,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(30,27,28,.045) 1px, transparent 1px); background-size: 18px 18px; }
dialog[open] { animation: sheet-in .22s steps(5); }
@keyframes sheet-in { from { transform: scaleX(.04); } }
dialog::backdrop { background: rgba(10,12,16,.62); }
.dialog-body { padding: 26px 20px 20px; text-align: center; display: grid; gap: 12px; }
.dialog-body h2 { font-size: 24px; }
.dialog-close { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border: 0; background: var(--ink); color: var(--paper); font-size: 20px; line-height: 1; }
.help-body { padding: 26px 20px 20px; display: grid; gap: 14px; }
.help-body h2 { font-size: 22px; text-align: center; }
.result-cat { width: 96px; height: 96px; margin: 0 auto -4px; }
.result-stars { font-size: 34px; line-height: 1; letter-spacing: 6px; color: var(--accent); }
.result-numbers { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.result-numbers div { padding: 8px 4px; border: var(--edge); background: var(--card); }
.result-numbers b { display: block; font: 400 21px/1.2 var(--dot); font-variant-numeric: tabular-nums; }
.result-numbers span { font: 700 10px var(--mono); letter-spacing: .1em; color: var(--muted); }
.share-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.share-row > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.share-preview { padding: 10px; border: 2px dashed var(--ink); background: var(--card); font-size: 13px; text-align: left; white-space: pre-wrap; word-break: break-all; }
.next-up { display: grid; gap: 8px; padding-top: 12px; border-top: 2px dashed var(--ink); }
.next-up p { font-size: 13px; color: var(--muted); }
.result-rpg { padding: 8px 10px; border: var(--edge); background: var(--card); font-size: 13px; }
.result-rpg p { margin: 0; }
.result-rpg-head { font: 400 14px var(--dot); }
/* Friends, the cast and the keepsake code (opened from the island). */
.friends-dialog { width: min(480px, calc(100vw - 24px)); }
.friends-body { text-align: left; }
.friends-body .eyebrow, .friends-body h2 { text-align: center; }
.friend-tabs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.rank-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.rank-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--card); border: var(--edge); font-size: 14px; }
.rank-row.me { background: var(--lit); }
.rank-pos { width: 24px; text-align: center; font-weight: 700; flex: none; }
.rank-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.rank-stat { flex: none; font: 400 13px var(--dot); }
.rank-del { border: 0; background: none; color: var(--muted); font-size: 16px; padding: 0 4px; }
.friend-hint { padding: 9px 10px; border: 2px dashed var(--ink); font-size: 13px; line-height: 1.5; text-align: center; }
.friend-profile { margin: 10px 0; padding: 12px; background: var(--card); border: var(--edge); display: grid; gap: 8px; }
.friend-profile label, .friend-profile b { font-size: 13px; font-weight: 700; }
.friend-input { width: 100%; padding: 8px 10px; font-size: 14px; border: var(--edge); background: #fff; }
.cat-picker { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.cat-pick { padding: 3px; border: var(--edge); background: var(--card); line-height: 0; }
.cat-pick.on { background: var(--lit); box-shadow: 2px 2px 0 var(--ink); }
.friend-sub { margin: 12px 0 6px; font: 400 14px var(--dot); text-align: center; }
.cast-grid { display: grid; gap: 8px; }
.cast-card { display: flex; align-items: flex-start; gap: 10px; padding: 10px; background: var(--card); border: var(--edge); }
.cast-card.hid { opacity: .55; }
.cast-avatar { position: relative; flex: none; width: 52px; height: 52px; display: grid; place-items: center; border: var(--edge); background: var(--paper); }
.cast-card.hid img { filter: brightness(0); opacity: .4; }
.cast-badge { position: absolute; right: -4px; bottom: -4px; font-style: normal; font-size: 14px; line-height: 1; background: var(--paper); border: var(--edge); padding: 1px 2px; }
.cast-card b { display: block; font: 400 15px var(--dot); }
.cast-card small { display: block; font-size: 12px; color: var(--muted); }
.cast-card p { margin: 4px 0 0; font-size: 12px; line-height: 1.5; }
.sup-desc { margin: 0; font-size: 12px; line-height: 1.55; white-space: pre-line; }
.inline-row { display: flex; gap: 6px; align-items: stretch; }
.inline-row .friend-input { flex: 1; min-width: 0; }
.season-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* ---- support, adverts ---- */
.support { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 14px; background: var(--lit); }
.support img { display: none; }
.support h2 { font-size: 18px; }
.support p { font-size: 13px; }
.ad-slot { margin: 0 auto; max-width: 728px; min-height: 100px; text-align: center; background: var(--paper); box-shadow: 6px 6px 0 var(--ink); padding: 8px; }
.ad-slot small { display: block; font: 700 9px var(--mono); color: var(--muted); letter-spacing: .14em; margin-bottom: 4px; }

/* ---- the foot of every page ---- */
.foot { padding: 6px 0 34px; }
.foot-inner { display: grid; gap: 10px; justify-items: center; text-align: center; }
.foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; }
.foot a { font-size: 12px; color: var(--text); text-decoration: none; text-shadow: 0 0 4px rgba(0,0,0,.9); border-bottom: 1px solid transparent; }
.foot a:hover { border-bottom-color: currentColor; }
.foot small { font-size: 11px; color: #cfcabb; text-shadow: 0 0 4px rgba(0,0,0,.9); }

/* ---- a word at the bottom, and paper thrown in the air ---- */
.toast { position: fixed; left: 50%; bottom: 26px; z-index: 80; transform: translate(-50%, 20px); padding: 8px 16px; background: var(--ink); color: var(--paper); font: 400 15px var(--dot); box-shadow: 3px 3px 0 var(--accent); opacity: 0; pointer-events: none; transition: opacity .15s steps(3), transform .15s steps(3); white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.confetti { position: fixed; inset: 0; z-index: 90; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -40px; width: 12px; height: 12px; font-size: 0; background: var(--lit); box-shadow: 2px 2px 0 var(--ink); animation: nyant-fall linear forwards; }
.confetti i:nth-child(3n) { background: var(--accent); } .confetti i:nth-child(3n + 1) { background: var(--paper); } .confetti i:nth-child(5n) { background: var(--sea); }
@keyframes nyant-fall { to { transform: translateY(110vh) rotate(540deg); } }
@keyframes nyant-pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
@keyframes nyant-shake { 20%, 60% { transform: translateX(-3px); } 40%, 80% { transform: translateX(3px); } }

@media (max-width: 560px) {
  main:not(.article) > section, main:not(.article) > article, main.article, .sheet { padding: 14px 12px 18px; }
  .mini-tiles { grid-template-columns: 1fr; }
  .support { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
