/* Minecraft's own interface language: bevelled containers, slots, a hotbar and hard text shadows, and a GTA-style radar. Every word, Chinese or Latin, is set in the system face (--text). */

:root {
  /* One tone for every piece of interface: light by day, dark at night
     (main.js sets body.night), never pure white or pure black. --mc-frame is
     Minecraft's container frame as a 9-slice: outline with stepped corners,
     light bevel top-left, dark bevel bottom-right, GUI fill inside. */
  --gui: #c4c2bc;
  --gui-light: #e6e4de;
  --gui-shade: #77746d;
  --ink: #34322e;
  --ink-soft: #5e5b55;
  --slot: #a9a69f;
  --slot-shade: #77746d;
  --slot-on: #dcdad4;
  --line: #2a2926;
  --btn: #7d7a73;
  --btn-hover: #8e8b84;
  --field: #ebe9e4;
  --field-edge: #8f8c85;
  --field-hint: #8a877f;
  --mc-frame: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'><path fill='%232a2926' d='M2 0h5v1H2zM1 1h1v1H1zM7 1h1v1H7zM0 2h1v5H0zM8 2h1v5H8zM1 7h1v1H1zM7 7h1v1H7zM2 8h5v1H2z'/><path fill='%23e6e4de' d='M2 1h4v1H2zM1 2h5v1H1zM1 3h2v3H1z'/><path fill='%2377746d' d='M7 2h1v1H7zM6 3h2v3H6zM3 6h5v1H3zM2 7h5v1H2z'/><path fill='%23c4c2bc' d='M6 1h1v2H6zM3 3h3v3H3zM1 6h2v1H1z'/></svg>");
  --accent: #2f5b46;
  --gold: #f2c14e;
  /* San Francisco for Latin (Safari knows it as -apple-system, Chrome as
     BlinkMacSystemFont), PingFang for Chinese. */
  --text: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  color-scheme: only light;
}
body.night {
  --gui: #3b3a37;
  --gui-light: #56544f;
  --gui-shade: #22211f;
  --ink: #e4e1da;
  --ink-soft: #aeaba3;
  --slot: #2b2a28;
  --slot-shade: #1a1918;
  --slot-on: #5a5853;
  --line: #121211;
  --btn: #55534f;
  --btn-hover: #64625d;
  --field: #252422;
  --field-edge: #67655f;
  --field-hint: #85827b;
  --mc-frame: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'><path fill='%23121211' d='M2 0h5v1H2zM1 1h1v1H1zM7 1h1v1H7zM0 2h1v5H0zM8 2h1v5H8zM1 7h1v1H1zM7 7h1v1H7zM2 8h5v1H2z'/><path fill='%2356544f' d='M2 1h4v1H2zM1 2h5v1H1zM1 3h2v3H1z'/><path fill='%2322211f' d='M7 2h1v1H7zM6 3h2v3H6zM3 6h5v1H3zM2 7h5v1H2z'/><path fill='%233b3a37' d='M6 1h1v2H6zM3 3h3v3H3zM1 6h2v1H1z'/></svg>");
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { overflow: hidden; background: #7fb2e8; font-family: var(--text); color: var(--ink); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

#world { position: fixed; inset: 0; }
#world canvas { display: block; width: 100%; height: 100%; touch-action: none; }
/* Eyes open under water: the world goes a little soft. */
#world canvas { transition: filter .45s ease; }
body.underwater #world canvas { filter: blur(1.05px) saturate(.92); }
#world, #hud, #bigmap { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* Lying on the pool's floor looking up, the screen clears to the water and
   the sky; the next touch, key or mouse movement brings everything back. */
#hud { transition: opacity .3s; }
body.quiet #hud { opacity: 0; pointer-events: none; transition: opacity 1.6s ease; }
#minimap canvas { touch-action: manipulation; }

/* ---------- Bevelled pieces ---------- */
.gui, dialog#panel {
  background: var(--gui);
  box-shadow: 0 0 0 2px var(--line), inset 3px 3px 0 var(--gui-light), inset -3px -3px 0 var(--gui-shade);
}
.mc-button, .page .links a {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border: 0;
  font: 600 15px/1 var(--text); color: #fff; text-decoration: none; text-shadow: 2px 2px 0 rgba(0, 0, 0, .35);
  background: var(--btn);
  box-shadow: 0 0 0 2px var(--line), inset 2px 2px 0 rgba(255, 255, 255, .32), inset -2px -3px 0 rgba(0, 0, 0, .38);
}
.mc-button:hover, .page .links a:hover { background: var(--btn-hover); box-shadow: 0 0 0 2px var(--gui-light), inset 2px 2px 0 rgba(255, 255, 255, .32), inset -2px -3px 0 rgba(0, 0, 0, .38); }
.mc-button:active, .page .links a:active { transform: translateY(1px); }

/* ---------- Hotbar ---------- */
#hotbar {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; gap: 2px; padding: 2px;
  border: 4px solid transparent; border-image: var(--mc-frame) 4 fill / 4px;
  z-index: 10;
}
/* Slots are pressed into the bar like an inventory's; the chosen one stands
   up out of it, lighter, and its item lifts. */
#hotbar button {
  position: relative; width: 50px; height: 50px; padding: 0; border: 0;
  background: var(--slot);
  box-shadow: inset 2px 2px 0 var(--slot-shade), inset -2px -2px 0 var(--gui-light);
  transition: background .15s, box-shadow .15s;
}
#hotbar button img { width: 32px; height: 32px; image-rendering: pixelated; display: block; margin: auto; transition: transform .15s ease-out; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .3)); }
#hotbar button:hover { background: color-mix(in srgb, var(--slot) 70%, var(--slot-on)); }
#hotbar button:hover img { transform: translateY(-1px); }
#hotbar button:active img { transform: translateY(1px) scale(.92); }
#hotbar button.on {
  background: var(--slot-on);
  box-shadow: inset 2px 2px 0 var(--gui-light), inset -2px -2px 0 var(--gui-shade);
}
#hotbar button.on img { transform: translateY(-2px); filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .35)); }

/* ---------- Experience bar ---------- */
/* Minecraft's own: a thin green bar riding on the hotbar, the level in green above it.
   The bar is this week's handed-in work against the target; the number is the total. */
#xp { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); }
#xp i { display: block; height: 10px; background: #1b1b1b; box-shadow: 0 0 0 2px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(150, 150, 150, .3); }
#xp s { display: block; width: 0; height: 100%; background: linear-gradient(#a8ff5a, #5fcf17); box-shadow: inset 0 -2px #3f9c0e; transition: width .4s ease-out; }
#xp b { position: absolute; left: 50%; bottom: calc(100% + 3px); transform: translateX(-50%); font: 600 20px/1 var(--text); color: #80ff20; text-shadow: 2px 2px 0 #15210c; letter-spacing: 1px; pointer-events: none; }
#xp b:empty { display: none; }

/* ---------- Corner switches ---------- */
#corner { position: fixed; top: max(16px, env(safe-area-inset-top)); right: 16px; display: flex; gap: 10px; z-index: 10; }
#corner button {
  width: 44px; height: 44px; padding: 0; border: 0; background: var(--btn);
  box-shadow: 0 0 0 2px var(--line), inset 2px 2px 0 rgba(255, 255, 255, .32), inset -2px -3px 0 rgba(0, 0, 0, .38);
  display: grid; place-items: center;
}
#corner button:hover { background: var(--btn-hover); }
#corner button span { width: 32px; height: 32px; image-rendering: pixelated; background: center / contain no-repeat; }
#viewButton[aria-pressed="true"], #webButton[aria-pressed="true"], #flyButton[aria-pressed="true"] { background: var(--accent); }
#webButton[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--line), 0 0 0 4px #e8352b, inset 2px 2px 0 rgba(255, 255, 255, .32), inset -2px -3px 0 rgba(0, 0, 0, .38); }
#moodButton { position: relative; }
#moodButton b { position: absolute; right: -4px; bottom: -6px; padding: 1px 3px; font: 600 11px/1 var(--text); color: #fff; background: rgba(12, 23, 20, .85); text-shadow: 1px 1px 0 #000; pointer-events: none; }
#moodButton b:empty { display: none; }
#moodButton[aria-expanded="true"] { background: var(--accent); }
#weatherMenu { position: fixed; right: 16px; top: calc(max(16px, env(safe-area-inset-top)) + 58px); z-index: 35; width: min(280px, calc(100vw - 32px)); max-height: calc(100dvh - max(16px, env(safe-area-inset-top)) - 74px - env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; padding: 6px; color: var(--ink); border: 8px solid transparent; border-image: var(--mc-frame) 4 fill / 8px; }
#weatherMenu h2 { margin: 0 0 8px; font: 600 14px var(--text); color: var(--ink-soft); }
#weatherMenu h2:not(:first-child) { margin-top: 16px; }
#weatherMenu [role="radiogroup"] { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#weatherMenu button { min-height: 44px; border: 0; background: var(--btn); color: #fff; font: 600 15px var(--text); text-shadow: 2px 2px 0 rgba(0, 0, 0, .35); box-shadow: 0 0 0 2px var(--line), inset 2px 2px 0 rgba(255, 255, 255, .32), inset -2px -3px 0 rgba(0, 0, 0, .38); }
#weatherMenu button:hover { background: var(--btn-hover); }
#weatherMenu button[aria-checked="true"] { background: var(--accent); }
#weatherMenu button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
#weatherMenu .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
#weatherMenu .now { margin: 0 0 12px; font: 600 15px var(--text); color: var(--ink); }
#weatherMenu p { margin: 10px 0 0; font-size: 12px; line-height: 1.6; color: var(--ink-soft); }
/* The web-zip marker: a small spider (white legs, red body), not a ring. */
#aim { position: fixed; left: 0; top: 0; width: 30px; height: 30px; margin: -15px 0 0 -15px; pointer-events: none; z-index: 9;
  background: center / contain no-repeat url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><g fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M13.5 12.5 9 8.5 7 3M13 15 7.5 13 2.5 11.5M13 17.5 7.5 19.5 2.5 22.5M13.5 20 9 24 7 29'/><path d='M18.5 12.5 23 8.5 25 3M19 15 24.5 13 29.5 11.5M19 17.5 24.5 19.5 29.5 22.5M18.5 20 23 24 25 29'/></g><ellipse cx='16' cy='12.2' rx='2.9' ry='2.7' fill='%23e8352b' stroke='%23fff' stroke-width='1.4'/><ellipse cx='16' cy='19' rx='3.8' ry='5.2' fill='%23e8352b' stroke='%23fff' stroke-width='1.4'/></svg>");
  filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, .9)) drop-shadow(0 0 5px rgba(232, 53, 43, .55)); }
#crosshair { position: fixed; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; pointer-events: none; z-index: 9; mix-blend-mode: difference; }
#crosshair::before, #crosshair::after { content: ""; position: absolute; background: #fff; }
#crosshair::before { left: 8px; top: 0; width: 2px; height: 18px; }
#crosshair::after { left: 0; top: 8px; width: 18px; height: 2px; }

/* ---------- Radar, bottom left like GTA ---------- */
#minimap {
  position: fixed; left: 20px; bottom: max(20px, env(safe-area-inset-bottom)); width: 204px; height: 204px; z-index: 10;
  border-radius: 18px; overflow: hidden;
  background: #1b2420;
  box-shadow: 0 0 0 3px rgba(10, 12, 14, .82), 0 6px 18px rgba(0, 0, 0, .35);
}
#minimap canvas { width: 100%; height: 100%; display: block; cursor: crosshair; }
#minimap .zoom { position: absolute; right: 6px; top: 6px; display: flex; flex-direction: column; gap: 4px; opacity: 0; transition: opacity .15s; }
#minimap:hover .zoom, #minimap:focus-within .zoom { opacity: 1; }
#minimap .zoom button, #minimap .expand {
  width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px;
  background: rgba(10, 12, 14, .7); color: #fff; font: 600 18px/1 var(--text);
}
#minimap .expand { position: absolute; left: 6px; top: 6px; opacity: 0; transition: opacity .15s; background: rgba(10, 12, 14, .7) center / 20px no-repeat; image-rendering: pixelated; }
#minimap:hover .expand, #minimap .expand:focus-visible { opacity: 1; }
#minimap .badge {
  position: absolute; left: 6px; bottom: 6px; display: flex; align-items: center; gap: 4px; padding: 3px 7px 3px 3px;
  border-radius: 6px; background: rgba(10, 12, 14, .7); color: #fff; text-decoration: none; font: 10px/1 var(--text);
}
#minimap .badge img { width: 16px; height: 16px; border-radius: 4px; }
#minimap .badge b { font-weight: 600; }
#minimap .badge:hover { background: rgba(10, 12, 14, .88); }
/* BetterMapIt holds its corner as an icon. homecraft keeps the name opposite;
   the radar is too small for both words. */
#minimap .badge.credit { padding: 3px; }
#minimap .badge.made { left: auto; right: 6px; }

#bigmap { position: fixed; inset: 0; z-index: 30; background: rgba(8, 12, 16, .78); display: grid; place-items: center; }
#bigmap canvas { width: min(92vw, 1100px); height: min(84vh, 860px); border-radius: 14px; box-shadow: 0 0 0 3px rgba(0, 0, 0, .8), 0 20px 60px rgba(0, 0, 0, .5); cursor: grab; touch-action: none; }
#bigmap canvas:active { cursor: grabbing; }
#bigmap .close { position: fixed; top: 18px; right: 18px; width: 44px; height: 44px; border: 0; border-radius: 10px; background: rgba(0, 0, 0, .6); color: #fff; font: 600 26px/1 var(--text); }

/* ---------- Tooltip ---------- */
#tooltip {
  position: fixed; z-index: 40; pointer-events: none; padding: 5px 9px 6px;
  font: 600 15px/1.3 var(--text); color: var(--ink);
  background: var(--gui);
  box-shadow: 0 0 0 2px var(--line), inset 2px 2px 0 var(--gui-light), inset -2px -2px 0 var(--gui-shade);
  white-space: nowrap;
}

/* ---------- The prompt, bottom right ---------- */
#prompt {
  position: fixed; right: 20px; bottom: max(22px, env(safe-area-inset-bottom)); z-index: 12;
  display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border: 0;
  font: 600 16px/1 var(--text); color: var(--ink);
  background: var(--gui);
  box-shadow: 0 0 0 2px var(--line), inset 2px 2px 0 var(--gui-light), inset -2px -2px 0 var(--gui-shade);
  animation: nudge .18s ease-out;
}
#prompt:hover { background: color-mix(in srgb, var(--gui) 80%, var(--gui-light)); }
@keyframes nudge { from { transform: translateY(8px); opacity: 0; } }
#prompt kbd {
  display: grid; place-items: center; width: 28px; height: 28px; font: 600 15px/1 var(--text); color: #fff; text-shadow: 2px 2px 0 rgba(0, 0, 0, .35);
  background: var(--btn); box-shadow: inset -2px -3px 0 rgba(0, 0, 0, .38), inset 2px 2px 0 rgba(255, 255, 255, .32), 0 0 0 2px var(--line);
}
#prompt .icon { width: 24px; height: 24px; image-rendering: pixelated; background: center / contain no-repeat; }
@media (pointer: coarse) { #prompt kbd { display: none; } #prompt { padding-left: 10px; } }

/* ---------- Phone, bottom right like GTA ---------- */
/* It slides up and back. The home screen holds one app per public account;
   an app opens a card that says where its link goes. */
#phone {
  --s: 1;
  position: fixed; right: 30px; bottom: 26px; z-index: 15; width: 232px; height: 478px; padding: 8px;
  border-radius: 40px; background: linear-gradient(150deg, #5a5f66, #23262a 34%, #17191c 70%, #3e4248);
  box-shadow: 0 0 0 1.5px #08090a, inset 0 0 0 1.5px rgba(255, 255, 255, .16), inset 0 0 0 4px #0c0d0f, 0 22px 44px rgba(0, 0, 0, .45);
  transform-origin: 100% 100%; transform: translateY(calc(100% + 60px)) rotate(4deg) scale(var(--s)); visibility: hidden;
  transition: transform .24s cubic-bezier(.5, 0, .75, .4), visibility 0s .24s;
  pointer-events: auto; user-select: none; -webkit-user-select: none;
}
#phone.up { transform: scale(var(--s)); visibility: visible; transition: transform .34s cubic-bezier(.2, .95, .3, 1.08), visibility 0s; }
/* A plain wallpaper in the interface tone, the same as the Dock and the
   workbench: light grey by day, dark grey at night (body.night). */
#phone .screen {
  position: relative; height: 100%; overflow: hidden; border-radius: 32px; color: var(--ink);
  background: var(--gui); font: 500 11px/1.2 var(--text);
}
#phone .island { position: absolute; top: 10px; left: 50%; width: 74px; height: 22px; margin-left: -37px; border-radius: 12px; background: #000; z-index: 2; }
#phone .status { display: flex; align-items: center; gap: 5px; height: 42px; padding: 0 22px 0 26px; font: 600 13px/1 var(--text); }
#phone .status time { margin-right: auto; }
#phone .signal { display: flex; align-items: flex-end; gap: 1.5px; height: 9px; }
#phone .signal i { width: 2.5px; background: currentColor; border-radius: 1px; }
#phone .signal i:nth-child(1) { height: 3px; } #phone .signal i:nth-child(2) { height: 5px; } #phone .signal i:nth-child(3) { height: 7px; } #phone .signal i:nth-child(4) { height: 9px; }
#phone .battery { position: relative; width: 20px; height: 10px; margin-left: 4px; border: 1.5px solid color-mix(in srgb, currentColor 55%, transparent); border-radius: 3px; }
#phone .battery::before { content: ""; position: absolute; inset: 1px 5px 1px 1px; border-radius: 1px; background: currentColor; }
#phone .battery::after { content: ""; position: absolute; right: -4px; top: 2px; width: 2px; height: 3px; border-radius: 0 1px 1px 0; background: color-mix(in srgb, currentColor 55%, transparent); }
#phone .today { margin-top: 18px; text-align: center; }
#phone .today span { font-size: 12px; opacity: .88; letter-spacing: .5px; }
#phone .today b { display: block; margin-top: 2px; font: 600 60px/1 var(--text); letter-spacing: 1px; }
#phone .apps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px 6px; margin-top: 40px; padding: 0 16px; }
#phone .app { display: grid; justify-items: center; gap: 6px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-shadow: inherit; cursor: pointer; }
#phone .app:active .tile { transform: scale(.92); }
#phone button:focus-visible, #phone a:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
#phone .tile { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--tile); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), inset 0 -2px 0 rgba(0, 0, 0, .12), 0 3px 8px rgba(0, 0, 0, .28); }
#phone .tile span { width: 32px; height: 32px; image-rendering: pixelated; background: center / contain no-repeat; }
#phone .tile b { font: 800 12px/1 var(--text); letter-spacing: -.3px; text-shadow: none; }
#phone .tile.real { background: var(--tile) center / cover no-repeat; box-shadow: 0 3px 8px rgba(0, 0, 0, .28); }
/* The home indicator is also the way back to the home screen. */
#phone .bar { position: absolute; bottom: 4px; left: 50%; width: 120px; height: 14px; margin-left: -60px; padding: 0; border: 0; background: none; cursor: pointer; }
#phone .bar::before { content: ""; position: absolute; left: 14px; right: 14px; top: 6px; height: 4px; border-radius: 2px; background: currentColor; opacity: .75; }
#phone .home[hidden], #phone .card[hidden] { display: none; }
/* An opened app: one centred group on a quiet page, white space all round. */
#phone .card { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 18px 30px; background: var(--gui); color: var(--ink); text-align: center; text-shadow: none; animation: open-app .22s cubic-bezier(.2, .8, .3, 1); }
@keyframes open-app { from { transform: scale(.86); opacity: 0; } }
#phone .back { position: absolute; left: 12px; top: 44px; width: 30px; height: 30px; padding: 0 0 2px; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink); font: 600 20px/1 var(--text); cursor: pointer; }
#phone .card .tile { width: 60px; height: 60px; border-radius: 16px; box-shadow: 0 6px 16px rgba(0, 0, 0, .18); }
#phone .card h3 { margin: 10px 0 0; font: 600 16px/1.2 var(--text); }
#phone .who { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 16px 0 0; font: 600 13px/1.2 var(--text); }
#phone .who img { width: 22px; height: 22px; border-radius: 6px; image-rendering: pixelated; }
#phone .handle { margin: 4px 0 0; max-width: 100%; font: 400 12px/1.35 var(--text); color: var(--ink-soft); overflow-wrap: anywhere; }
#phone .note { margin: 12px 0 0; font: 400 12px/1.5 var(--text); color: var(--ink); }
#phone .note:empty, #phone .where:empty { display: none; }
#phone .where { margin: 6px 0 0; max-width: 100%; font: 400 11px/1.4 var(--text); color: var(--ink-soft); overflow-wrap: anywhere; }
#phone .go { display: inline-flex; align-items: center; justify-content: center; min-width: 150px; height: 40px; margin: 22px 0 0; padding: 0 20px; border-radius: 20px; background: var(--tile); color: var(--ink); font: 600 14px/1 var(--text); text-decoration: none; }
#phone .go:active { transform: translateY(1px); }
#phone .in-app .status { color: var(--ink); text-shadow: none; position: relative; z-index: 1; }
#phone .in-app .bar::before { background: var(--ink); }
body.phone-on #prompt { right: 286px; }
@media (max-height: 640px) { #phone { --s: .82; } body.phone-on #prompt { right: 246px; } }
@media (max-height: 480px) { #phone { --s: .6; } body.phone-on #prompt { right: 190px; } }

/* ---------- Touch ---------- */
#shootButton {
  position: fixed; right: 22px; bottom: 96px; z-index: 10; width: 72px; height: 72px; border: 0; border-radius: 50%;
  background: rgba(20, 20, 20, .5) center / 44px no-repeat; image-rendering: pixelated;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .55);
}
/* Flying by hand on a touch screen: Minecraft's pocket D-pad in the
   bottom-left corner (above the radar where that sits bottom left) and a
   climb/descend rocker on the right, in the stone of the corner switches.
   A held arrow is pressed in and green, like a switch that is on. */
#flightPad .dpad {
  position: fixed; left: 20px; bottom: calc(244px + env(safe-area-inset-bottom)); z-index: 11;
  display: grid; grid-template: repeat(3, 44px) / repeat(3, 44px); gap: 2px;
  touch-action: none; animation: nudge .18s ease-out;
}
#flightPad .lift {
  position: fixed; right: 20px; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 11;
  display: grid; width: 54px; border-radius: 27px; overflow: hidden;
  box-shadow: 0 0 0 2px var(--line);
  touch-action: none; animation: nudge .18s ease-out;
}
#flightPad button {
  display: grid; place-items: center; padding: 0; border: 0; background: var(--btn);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .32), inset -2px -3px 0 rgba(0, 0, 0, .38);
  touch-action: none; -webkit-user-select: none; user-select: none;
}
#flightPad .dpad button { box-shadow: 0 0 0 2px var(--line), inset 2px 2px 0 rgba(255, 255, 255, .32), inset -2px -3px 0 rgba(0, 0, 0, .38); }
#flightPad .lift button { height: 56px; }
#flightPad .lift button + button { border-top: 2px solid var(--line); }
#flightPad button.on { background: var(--accent); box-shadow: inset 2px 3px 0 rgba(0, 0, 0, .38), inset -2px -2px 0 rgba(255, 255, 255, .16); }
#flightPad .dpad button.on { box-shadow: 0 0 0 2px var(--line), inset 2px 3px 0 rgba(0, 0, 0, .38), inset -2px -2px 0 rgba(255, 255, 255, .16); }
#flightPad svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: square; filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, .35)); }
#flightPad button.on svg { transform: translateY(1px); }
#flightPad [data-dir="up"] { grid-area: 1 / 2; }
#flightPad [data-dir="left"] { grid-area: 2 / 1; }
#flightPad [data-dir="right"] { grid-area: 2 / 3; }
#flightPad [data-dir="down"] { grid-area: 3 / 2; }
/* The rocker takes the prompt's corner while it is up. */
body.flight-pad #prompt { display: none; }

/* ---------- Panels ---------- */
dialog { padding: 0; border: 0; color: var(--ink); }
dialog::backdrop { background: rgba(0, 0, 0, .38); }
dialog#panel {
  --symbols-yellow: #f5a524; /* Exact website / promo AMBER. */
  position: fixed; inset: 16px 0 88px; margin: auto; z-index: 20;
  width: min(960px, calc(100vw - 64px)); height: min(720px, calc(100vh - 120px));
  height: min(720px, calc(100dvh - 120px)); max-height: none;
  overflow: visible; display: none; flex-direction: column;
  background: transparent; box-shadow: none;
}
dialog#panel[open] { display: flex; animation: rise .16s ease-out; }
/* The title and close button sit on the card's own top edge, and the
   switcher below it on its bottom edge: the workbench sets --card-w,
   --card-y and --card-b to its front card, the mailbox panel is its card. */
/* Above the workbench deck, whose empty top reaches over the header on a phone. */
#panel header {
  position: relative; z-index: 3;
  display: flex; flex: none; align-items: center; gap: 12px; height: 52px; padding: 0 0 12px;
  width: var(--card-w, 100%); margin: 0 auto; transform: translateY(var(--card-y, 0px));
  transition: width .35s cubic-bezier(.16, 1, .3, 1), transform .35s cubic-bezier(.16, 1, .3, 1);
}
#panel :is(header, .work-controls).is-settling { transition: none; }
#panel header .icon { width: 28px; height: 28px; image-rendering: pixelated; background: center / contain no-repeat; flex: none; }
#panel h2 { margin: 0; flex: 1; font: 600 22px/1.2 var(--text); letter-spacing: .5px; color: #fff; text-shadow: 2px 2px 0 #3f3f3f; }
.close { width: 40px; height: 40px; border: 0; background: transparent; font: 600 26px/1 var(--text); color: #3f3f3f; }
.close:hover { color: #000; }
/* The 中/EN switch stands beside the close button in the same stone. */
#panel .lang-switch { width: 40px; height: 40px; flex: none; border: 0; font: 600 16px/1 var(--text); }
#panel .close, #panel .lang-switch, #panel .work-controls > button {
  background: var(--btn); color: #fff; text-shadow: 2px 2px 0 rgba(0, 0, 0, .35);
  box-shadow: 0 0 0 2px var(--line), inset 2px 2px 0 rgba(255, 255, 255, .32), inset -2px -3px 0 rgba(0, 0, 0, .38);
}
#panel .close:hover, #panel .lang-switch:hover, #panel .work-controls > button:hover { background: var(--btn-hover); color: #fff; }
#panel .body { flex: 1; min-height: 0; padding: 0; overflow: visible; outline: none; }
#panel .body > h2 { display: none; }
.symbols-icon { padding: 7px; background: var(--symbols-yellow, #f5a524); }
/* One card sits in front; the other peeks from the side it would slide in
   from. A card is as wide as its media at full height (--ratio is the summed
   width/height of its media, --gaps the spaces between them). */
#panel .work-deck {
  --pad: 20px; --gap: 10px; --head: 64px; --peek: 64px; --top: 50%; --y: -50%; --oy: center;
  position: relative; height: 100%; margin: 0; container-type: size; touch-action: pan-y;
}
#panel .work-deck > li {
  --mh: min(calc(100cqh - var(--head) - 32px - 2 * var(--pad)),
    calc((100cqw - 2 * var(--peek) - 2 * var(--pad) - 16px - var(--gaps) * var(--gap)) / var(--ratio)));
  position: absolute; left: 50%; top: var(--top); z-index: 1; padding: 0; border: 0; overflow: hidden;
  width: calc(var(--mh) * var(--ratio) + var(--gaps) * var(--gap) + 2 * var(--pad) + 16px);
  border: 8px solid transparent; border-image: var(--mc-frame) 4 fill / 8px;
  transform: translate(calc(-50% + var(--drag, 0px)), var(--y)); transform-origin: center;
  transition: transform .35s cubic-bezier(.16, 1, .3, 1), transform-origin .35s cubic-bezier(.16, 1, .3, 1);
}
#panel .work-deck > li.is-front { z-index: 2; }
/* Edge-anchored at the deck's sides, so the peek is whatever the front card leaves free. */
#panel .work-deck > li.is-after { transform: translate(calc(50cqw - 100% + var(--drag, 0px)), var(--y)) scale(.86); transform-origin: right var(--oy); }
#panel .work-deck > li.is-before { transform: translate(calc(-50cqw + var(--drag, 0px)), var(--y)) scale(.86); transform-origin: left var(--oy); }
#panel .work-deck.is-dragging > li { transition: none; }
.work-content { display: grid; gap: 16px; padding: var(--pad); outline: none; }
.work-peek { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(0, 0, 0, .32); cursor: pointer; }
.work-peek:hover { background: rgba(0, 0, 0, .18); }
.work-peek:focus-visible { outline-color: #fff; outline-offset: 5px; }
#panel .work-deck .shots { display: flex; gap: var(--gap); margin: 0; padding: 0; overflow: visible; }
#panel .work-deck .shots a { display: block; flex: none; height: var(--mh); cursor: zoom-in; }
#panel .work-deck .shots img { display: block; width: auto; height: 100%; box-shadow: none; transition: transform .2s ease-out; }
#panel .work-deck .shots a:hover img { transform: translateY(-3px); }
#panel .work-deck .film { width: 100%; height: var(--mh); margin: 0; aspect-ratio: auto; box-shadow: none; }
#panel .mc-button.get { min-height: 44px; }
/* Below the deck the app icons speak for themselves: no game frame, the
   current one at full size, the other dimmed and a little smaller. The
   arrows keep the game's button bevel. */
.work-controls {
  position: relative; z-index: 3;
  display: flex; flex: none; align-items: center; justify-content: center; gap: 18px; height: 64px; padding-top: 12px;
  transform: translateY(calc(-1 * var(--card-b, 0px))); transition: transform .35s cubic-bezier(.16, 1, .3, 1);
}
.work-controls [role="status"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.work-controls button { display: grid; place-items: center; padding: 0; border: 0; background: none; box-shadow: none; }
.work-controls > button { width: 40px; height: 40px; }
.work-controls svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: square; filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, .35)); }
.work-tabs { display: flex; gap: 14px; }
.work-tabs button { width: 44px; height: 44px; }
.work-tabs img { display: block; width: 100%; height: 100%; border-radius: 10px; box-shadow: 0 4px 12px rgba(0, 0, 0, .4); opacity: .5; transform: scale(.84); transition: opacity .25s, transform .35s cubic-bezier(.16, 1, .3, 1); }
.work-tabs .symbols-icon { padding: 5px; }
.work-tabs button:hover img { opacity: .8; }
.work-tabs button[aria-current="true"] img { opacity: 1; transform: none; }


.page p { margin: 0 0 12px; font-size: 16px; line-height: 1.75; max-width: 62ch; }
.page .aside { color: var(--ink-soft); font-size: 15px; }
.page .links { display: flex; flex-wrap: wrap; gap: 12px; margin: 14px 0 4px; }
.page .links a { min-height: 36px; font-size: 14px; padding: 0 14px; }
.page h3 { margin: 0 0 4px; font: 600 17px/1.35 var(--text); color: var(--ink); }

.items, .feats, .list, .contact { list-style: none; margin: 0; padding: 0; }
.items li { display: grid; grid-template-columns: 64px 1fr; gap: 16px; padding: 14px 0; }
.items li + li { border-top: 2px solid color-mix(in srgb, var(--ink) 14%, transparent); }
.items img {
  width: 64px; height: 64px; padding: 8px; background: var(--slot);
  box-shadow: inset 2px 2px 0 var(--slot-shade), inset -2px -2px 0 var(--gui-light);
}
.items p { margin-bottom: 6px; }

/* Works read like an App Store listing: icon, name, one line and the get
   button, then screenshots or the promo film right in the panel. */
.store { list-style: none; margin: 0; padding: 0; }
.store > li { padding: 14px 0 18px; }
.store > li + li { border-top: 2px solid color-mix(in srgb, var(--ink) 14%, transparent); }
.listing { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.listing > img { width: 64px; height: 64px; border-radius: 14px; box-shadow: 0 0 0 2px var(--line); }
.page .listing h3 { margin: 0 0 2px; }
.page .listing p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--ink-soft); text-wrap: balance; }
.mc-button.get { min-width: 64px; min-height: 36px; padding: 0 14px; background: #3c8527; text-shadow: 2px 2px 0 #1f3d14; }
.mc-button.get:hover { background: #4b9c34; }
/* The strip runs to the panel's edges (inside the 3px bevel) and keeps a part
   of the next shot in view, so it reads as scrollable without a hint. */
.shots {
  --bleed: calc(var(--pad, 3px) - 3px);
  display: flex; gap: 10px; margin: 14px calc(-1 * var(--bleed)) 0; padding: 2px var(--bleed) 8px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding: 0 var(--bleed);
  scrollbar-width: thin; scrollbar-color: rgba(0, 0, 0, .35) transparent;
}
.shots img {
  flex: none; width: min(38%, 180px); height: auto; scroll-snap-align: start;
  border-radius: 10px; background: #1b1b1b; box-shadow: 0 0 0 2px var(--line);
}
.store .film {
  position: relative; display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; margin-top: 14px; overflow: hidden;
  border-radius: 10px; background: #0d0d0f; box-shadow: 0 0 0 2px var(--line);
}
.film img { display: block; width: 100%; height: 100%; object-fit: contain; }
/* The poster opens the film on Bilibili, so it carries the play mark. */
.film::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; translate: -50% -50%;
  border-radius: 50%; background: rgba(0, 0, 0, .6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8.5 5.5v13l10.5-6.5z' fill='%23fff'/%3E%3C/svg%3E") center / 26px no-repeat;
  transition: background-color .15s;
}
.film:hover::after { background-color: rgba(0, 0, 0, .8); }
.store .links { margin-top: 14px; }

/* Honours read like advancements: a framed icon, a title, one line. */
.feats li { position: relative; padding: 12px 0 12px 64px; min-height: 64px; }
.feats li + li { border-top: 2px solid rgba(0, 0, 0, .14); }
.feats li::before {
  content: ""; position: absolute; left: 0; top: 12px; width: 48px; height: 48px;
  background: #e2c46a var(--icon, none) center / 32px no-repeat; image-rendering: pixelated;
  box-shadow: 0 0 0 2px #000, inset 3px 3px 0 #fff3b0, inset -3px -3px 0 #a07a22;
}
.feats li[data-frame="goal"]::before { border-radius: 10px; }
.feats li[data-frame="challenge"]::before { clip-path: polygon(14% 0, 86% 0, 100% 14%, 100% 86%, 86% 100%, 14% 100%, 0 86%, 0 14%); background-color: #c9a8e8; box-shadow: inset 3px 3px 0 #efe0ff, inset -3px -3px 0 #7d58a8; }
.feats p { margin-bottom: 4px; }
.feats .links { margin-top: 8px; }

.list li { padding: 10px 0; border-top: 2px solid rgba(0, 0, 0, .14); }
.list li:last-child { border-bottom: 2px solid rgba(0, 0, 0, .14); }
.list a { font-size: 16px; line-height: 1.6; text-decoration: none; }
.list a:hover { text-decoration: underline; text-underline-offset: 3px; }

.contact li { display: grid; grid-template-columns: 76px 1fr; align-items: center; gap: 12px; padding: 12px 0; border-top: 2px solid rgba(0, 0, 0, .14); }
.contact li:first-child { border-top: 0; }
.contact span { font: 600 15px/1 var(--text); color: var(--ink-soft); }
.contact a { font-size: 16px; text-decoration: none; overflow-wrap: anywhere; }
.contact a:hover { text-decoration: underline; text-underline-offset: 3px; }
.contact p { grid-column: 2; margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink-soft); }
.contact p:empty { display: none; }

.stats { font: 600 16px/1.4 var(--text); color: #3f3f3f; }
.stats:empty { display: none; }

/* ---------- The book: the save room ---------- */
dialog.book {
  width: min(520px, calc(100vw - 28px)); max-height: min(86vh, 820px); overflow: auto;
  background: #f3e9cf; color: #3b2a1b;
  box-shadow: 0 0 0 3px #3b2a1b, inset 0 0 0 6px #c9a46a, inset 0 0 0 8px #3b2a1b, 0 24px 60px rgba(0, 0, 0, .45);
  padding: 30px 32px 34px;
}
dialog.book .close { position: absolute; top: 10px; right: 10px; color: #6b4a2e; }
#lock { width: min(360px, calc(100vw - 28px)); text-align: center; }
#lock .mark { margin: 0 0 16px; font: 600 20px/1 var(--text); letter-spacing: 2px; color: #6b4a2e; }
#lock input {
  width: 100%; height: 44px; padding: 0 12px; border: 0; font: 600 18px/1 var(--text); color: #2b1d12; text-align: center;
  background: #fffaf0; box-shadow: inset 2px 2px 0 #c9b38a, inset -2px -2px 0 #fff;
}
#lock .hint { min-height: 22px; margin: 10px 0 0; font-size: 14px; color: #8a5a2e; }
#heart .pages h2 { margin: 0 0 18px; font: 600 24px/1.2 var(--text); color: #4a3220; }
#heart .pages h3 { margin: 22px 0 6px; font: 600 15px/1.2 var(--text); color: #8a5a2e; letter-spacing: 1px; }
#heart .pages p { margin: 0 0 10px; font-size: 16px; line-height: 1.8; }
#heart .pages blockquote { margin: 8px 0 12px; padding-left: 12px; border-left: 3px solid #c9a46a; font-size: 16px; line-height: 1.8; }
#heart .pages cite { display: block; font-size: 13px; font-style: normal; color: #8a5a2e; }

/* ---------- Loading: the dirt screen ---------- */
#loading { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; background: #3b2a1e; transition: opacity .5s; }
#loading.done { opacity: 0; pointer-events: none; }
#loading .bar { width: min(320px, 70vw); height: 12px; background: #4a4a4a; box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #6f6f6f; }
#loading .bar i { display: block; height: 100%; width: 8%; background: #6fc94a; box-shadow: inset 0 -3px 0 #3f8a2a; transition: width .25s; }
#loading .loading-label { margin: 0; max-width: 70vw; color: #f0e8df; text-align: center; font: 500 16px/1.6 var(--text); overflow-wrap: anywhere; }
/* Where a door leads, while it loads. */
#loading .loading-preview { width: min(420px, 78vw); aspect-ratio: 1200 / 630; object-fit: cover; background: #4a4a4a; box-shadow: 0 0 0 2px #000, 0 0 0 4px #6f6f6f; }

/* ---------- Plain page (no WebGL, no script) ---------- */
#pages { display: none; }
body.plain { overflow: auto; background: #c6c6c6; }
body.plain #world, body.plain #hud, body.plain #loading { display: none; }
#startupNotice { max-width: 676px; margin: 28px auto 0; padding: 20px 24px; border: 2px solid #373737; background: #e0ded5; }
#startupNotice h2 { margin: 0 0 10px; font: 600 22px/1.3 var(--text); }
#startupNotice p { margin: 0 0 16px; font-size: 15px; line-height: 1.65; }
#startupNotice .lang-switch { margin-left: 12px; }
#startupNotice .startup-detail { margin-top: -8px; font: 12px/1.5 ui-monospace, Menlo, monospace; color: #6a6a6a; overflow-wrap: anywhere; }
#startupNotice:not([hidden]) + #pages { padding-top: 28px; }
@media (max-width: 720px) { #startupNotice { margin: 20px 22px 0; padding: 18px; } }
body.plain #pages, noscript ~ #pages { display: block; }
#pages { max-width: 720px; margin: 0 auto; padding: 40px 22px 80px; }
.plain-title { font: 600 34px/1.2 var(--text); color: #3f3f3f; margin: 0 0 24px; }
#pages .page { --pad: 24px; margin: 0 0 28px; padding: 22px var(--pad); background: var(--gui); box-shadow: 0 0 0 2px var(--line), inset 3px 3px 0 var(--gui-light), inset -3px -3px 0 var(--gui-shade); }
#pages .page > h2 { margin: 0 0 14px; font: 600 22px/1.2 var(--text); color: #3f3f3f; }

/* A phone, held either way: the portal keeps the top left and the switches
   the top right. The radar takes the bottom-right corner, clear of the notch
   and the rounded corners when held sideways. */
@media (max-width: 720px), (max-height: 520px) {
  #hotbar { bottom: calc(22px + env(safe-area-inset-bottom)); padding: 2px; }
  #hotbar button { width: 40px; height: 40px; }
  #minimap { left: auto; right: max(12px, env(safe-area-inset-right)); top: auto; bottom: max(12px, env(safe-area-inset-bottom)); width: 132px; height: 132px; border-radius: 14px; }
  #minimap .zoom, #minimap .expand { opacity: 1; }
  #minimap .zoom { display: none; }
  #minimap .badge { left: 4px; bottom: 4px; padding: 2px 5px 2px 2px; font-size: 9px; }
  #minimap .badge img { width: 13px; height: 13px; border-radius: 3px; }
  #minimap .badge.credit { padding: 2px; }
  #minimap .badge.made { right: 4px; }
  #corner { right: max(12px, env(safe-area-inset-right)); top: max(12px, env(safe-area-inset-top)); gap: 8px; }
  #corner button { width: 40px; height: 40px; }
  #corner button span { width: 28px; height: 28px; }
  #weatherMenu { right: max(12px, env(safe-area-inset-right)); top: calc(max(12px, env(safe-area-inset-top)) + 52px); }
  /* While a page is open the radar and switches step aside (they cannot be
     used under it anyway), so the card has the whole height. */
  body.reading :is(#minimap, #corner) { visibility: hidden; }
  #prompt { left: max(12px, env(safe-area-inset-left)); right: auto; bottom: calc(76px + env(safe-area-inset-bottom)); font-size: 15px; }
  body.phone-on #prompt { left: auto; }
  body.phone-on #minimap { visibility: hidden; }
  #xp { bottom: calc(100% + 6px); }
  #xp i { height: 8px; }
  #xp b { font-size: 16px; }
  /* Keep the prompt clear of the experience bar. */
  body.xp-on #prompt { bottom: calc(108px + env(safe-area-inset-bottom)); }
  /* The rocker stands above the radar; the D-pad stands on the Dock's
     line, or in the very corner where the Dock leaves room (held sideways). */
  #flightPad .lift { right: max(14px, env(safe-area-inset-right)); bottom: calc(156px + env(safe-area-inset-bottom)); }
  #flightPad .dpad { left: max(14px, env(safe-area-inset-left)); bottom: calc(88px + env(safe-area-inset-bottom)); grid-template: repeat(3, 42px) / repeat(3, 42px); }
  body.xp-on #flightPad .dpad { bottom: calc(120px + env(safe-area-inset-bottom)); }
}
@media (max-height: 520px) {
  #flightPad .dpad, body.xp-on #flightPad .dpad { bottom: calc(26px + env(safe-area-inset-bottom)); }
}
@media (max-width: 720px) and (min-height: 521px) {
  dialog#panel {
    inset: max(12px, env(safe-area-inset-top)) 0 calc(88px + env(safe-area-inset-bottom));
    width: calc(100vw - 28px); max-width: none;
    height: calc(100vh - 120px); height: min(720px, calc(100dvh - 120px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
  }
  #panel header { height: 48px; padding-bottom: 8px; }
  /* The card sits mid-screen as on a computer, its title above and its switcher below. */
  #panel .work-deck { --pad: 14px; --gap: 6px; --head: 44px; --peek: 18px; }
  .work-content { gap: 12px; }
  #panel .listing { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; }
  #panel .listing > img { width: 44px; height: 44px; border-radius: 10px; }
  #panel .listing h3 { font-size: 16px; }
  #panel .listing p { font-size: 12px; line-height: 1.4; }
  #panel .mc-button.get { min-width: 52px; padding: 0 8px; }
  .work-controls { gap: 12px; height: 56px; padding-top: 8px; }
  .work-tabs button { width: 40px; height: 40px; }
  .page p { font-size: 15px; }
  #shootButton { bottom: 128px; right: 16px; }
  /* The phone stands on the hotbar's right, clear of the experience bar. */
  #phone { --s: .86; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); }
  body.xp-on #phone { bottom: calc(112px + env(safe-area-inset-bottom)); }
  body.phone-on #prompt { display: none; }
}
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, dialog#panel[open] { animation: none !important; transition: none !important; }
}

/* ---------- About and mailbox ---------- */
/* Each is one bevelled card in the panel; the mailbox fields are Minecraft's text boxes in the same tone. */
dialog#panel:is([data-station="mailbox"], [data-station="about"], :has(.placeholder-card)) { width: min(560px, calc(100vw - 28px)); height: fit-content; }
/* On a computer a full-length photo stands beside the intro, and the
   lines wrap freely next to it. */
dialog#panel[data-station="about"] { width: min(700px, calc(100vw - 28px)); }
.about, .mailbox, .placeholder-card {
  position: relative; display: grid; gap: 12px; padding: 14px;
  border: 8px solid transparent; border-image: var(--mc-frame) 4 fill / 8px;
}
.placeholder-card p { margin: 0; }
.mailbox textarea, .mailbox input {
  width: 100%; padding: 10px 12px; border: 0; border-radius: 0;
  font: 400 16px/1.5 var(--text); color: var(--ink); background: var(--field); box-shadow: 0 0 0 2px var(--field-edge);
}
.mailbox textarea { min-height: 150px; resize: none; }
.mailbox textarea::placeholder, .mailbox input::placeholder { color: var(--field-hint); }
.mailbox textarea:focus, .mailbox input:focus { outline: none; box-shadow: 0 0 0 2px var(--ink); }
.mailbox .trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.mailbox-verification:not([hidden]) { min-height: 65px; min-width: 0; }
.mailbox-foot { display: flex; justify-content: flex-end; }
.mailbox-foot .mc-button:disabled { opacity: .6; }
.mailbox-status { margin: 0; font: 600 15px/1.5 var(--text); color: var(--ink); }
.mailbox-status:empty { display: none; }
.mailbox-status a { color: inherit; }
.mailbox.is-sent > :not(.mailbox-status) { display: none; }
.mailbox.is-sent .mailbox-status { padding: 28px 0; font: 600 24px/1.3 var(--text); text-align: center; }
body.plain .mailbox { margin: 16px auto; }
.about { gap: 0; }
/* PingFang Medium: Regular read thin and grey on the stone panel. On a
   computer the lines get more room; phones set their own spacing below. */
.about .nb { white-space: nowrap; }
/* The intro is written in Chinese and in English; <html lang> shows one (lang.js). */
html[lang="en"] .about-text[lang="zh-CN"], html:not([lang="en"]) .about-text[lang="en"] { display: none !important; }
/* English breaks only between words (keep-all let Safari split I’ve after
   the apostrophe), and Latin needs less leading than Chinese. */
.about-text[lang="en"] p { word-break: normal; }
.about p { max-width: none; font-weight: 500; line-height: 1.95; word-break: keep-all; overflow-wrap: break-word; }
.about-foot { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }
body.plain .about { margin: 16px auto; }
/* An app named inside a sentence: a small app icon, the name and an
   arrow to the upper right, held together on one line and clickable as one. */
.about .app { white-space: nowrap; color: var(--ink); font-weight: 600; text-decoration: none; }
.about .app img { width: 1.15em; height: 1.15em; margin: 0 .25em 0 .1em; border-radius: 22.5%; vertical-align: -.2em; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .15); }
.about .app svg { width: .62em; height: .62em; margin-left: .15em; vertical-align: .05em; }
.about .app:hover span { text-decoration: underline; text-underline-offset: 3px; }
/* A full-length photo stands to the left, the intro beside it and the
   buttons settle at its foot. Lines break only at spaces, punctuation and
   the <wbr>s in the text, so no word (平台, 工程师) is split; plain wrapping,
   not text-wrap: pretty, which in Safari evens out every line and left them
   short. The text keeps its own length: where it is shorter than the photo,
   the space stays blank. Held sideways, the card spreads wide. */
.about { grid-template-columns: 240px minmax(0, 1fr); column-gap: 24px; padding: 22px 24px; }
.about-text { display: flex; flex-direction: column; }
.about-foot { margin-top: auto; }
.about .portrait img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; box-shadow: 0 0 0 2px var(--line); }
@media (max-width: 720px), (max-height: 520px) {
  /* The photo fills whatever box the layout gives it. */
  .about .portrait { position: relative; }
  .about .portrait img { position: absolute; inset: 0; }
  .about p { line-height: 1.6; margin-bottom: 8px; }
  #panel:is([data-station="mailbox"], [data-station="about"]) .body { overflow-y: auto; overscroll-behavior: contain; }
}
@media (max-width: 720px) and (min-height: 521px) {
  /* On a phone the photo keeps its own height and the paragraphs run beside
     it at their own length, a blank row taking up any difference; the buttons
     go across the foot at full width. */
  .about { grid-template-columns: min(42%, 160px) minmax(0, 1fr); grid-template-rows: repeat(6, auto) 1fr auto; column-gap: 14px; padding: 18px 12px; padding: clamp(16px, 2.6dvh, 24px) 12px; }
  .about-text { display: contents; }
  .about .portrait { grid-area: 1 / 1 / 8 / 2; aspect-ratio: 2 / 5; place-self: stretch; }
  .about p { line-height: 1.55; margin-bottom: 6px; }
  /* The English runs to some nineteen lines here, so it gets air between
     lines and clear gaps between paragraphs; phones narrower than 430 px
     set it a little smaller, so the card still fits one screen. */
  .about-text[lang="en"] p { font-size: clamp(14px, 3.5vw, 15px); line-height: 1.5; margin-bottom: 10px; }
  .about p { grid-column: 2; }
  .about-foot { grid-area: 8 / 1 / 9 / 3; margin-top: 12px; }
  /* Rest on the Dock; a screen too short for the card scrolls inside it. */
  dialog#panel[data-station="about"] { bottom: calc(84px + env(safe-area-inset-bottom)); margin-bottom: 0; }
  #panel[data-station="about"] header { height: 44px; padding-bottom: 6px; }
  dialog#panel:is([data-station="mailbox"], [data-station="about"]) { max-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - 88px - env(safe-area-inset-bottom)); }
  dialog#panel[data-station="about"] { max-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - 84px - env(safe-area-inset-bottom)); }
}
/* A phone held sideways: a page takes the whole height, so the Dock steps
   aside with the radar while one is open, and the workbench uses the
   phone's tighter deck. */
@media (max-height: 520px) {
  body.reading #hotbar { visibility: hidden; }
  dialog#panel { inset: max(8px, env(safe-area-inset-top)) 0 max(8px, env(safe-area-inset-bottom)); height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom))); }
  dialog#panel:is([data-station="mailbox"], [data-station="about"]) { max-height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom))); }
  dialog#panel[data-station="about"] { width: min(820px, calc(100vw - 28px - env(safe-area-inset-left) - env(safe-area-inset-right))); }
  #panel header { height: 42px; padding-bottom: 6px; }
  #panel .work-deck { --pad: 14px; --gap: 6px; --head: 44px; }
  .work-content { gap: 10px; }
  #panel .listing { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; }
  #panel .listing > img { width: 44px; height: 44px; border-radius: 10px; }
  #panel .listing p { font-size: 13px; }
  .work-controls { height: 52px; padding-top: 6px; }
  .work-tabs button { width: 40px; height: 40px; }
  .about { grid-template-columns: 150px minmax(0, 1fr); column-gap: 18px; padding: 10px 14px; }
  .about p { font-size: 15px; }
  .mailbox textarea { min-height: 96px; }
}
/* The smallest phones held sideways: a little tighter, so the card still fits. */
@media (max-height: 380px) {
  .about p { font-size: 14px; line-height: 1.5; margin-bottom: 6px; }
  .about-foot .mc-button { min-height: 36px; }
}
/* The phone's mail card: write here instead of leaving for a mail app. */
#phone .write { display: block; margin: 10px auto 0; height: 34px; padding: 0 18px; border: 0; border-radius: 17px; background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink); font: 600 13px/1 var(--text); }
#phone .write[hidden] { display: none; }

/* ---------- An about card without a photo ---------- */
/* The text takes the whole card. */
.about:not(:has(> .portrait)) { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
.about:not(:has(> .portrait)) :is(p, .about-foot) { grid-area: auto; }

/* ---------- An embedded website ---------- */
/* A page with data-embed shows the site itself inside the card's frame; ↗ in
   the header opens it in a new tab. */
dialog#panel[data-kind="embed"] .body {
  position: relative; overflow: hidden; padding: 0;
  border: 8px solid transparent; border-image: var(--mc-frame) 4 fill / 8px;
}
dialog#panel[data-kind="embed"] iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
#panel .pop-out {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; text-decoration: none;
  font: 600 20px/1 var(--text); background: var(--btn); color: #fff; text-shadow: 2px 2px 0 rgba(0, 0, 0, .35);
  box-shadow: 0 0 0 2px var(--line), inset 2px 2px 0 rgba(255, 255, 255, .32), inset -2px -3px 0 rgba(0, 0, 0, .38);
}
#panel .pop-out:hover { background: var(--btn-hover); }
#panel .pop-out[hidden] { display: none; }

/* ---------- Portal: workbench framing with a quiet store-style row ---------- */
dialog#panel[data-station="portal"] { width: min(620px, calc(100vw - 40px)); height: fit-content; max-height: calc(100dvh - 100px); padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
#panel[data-station="portal"] header { height: 44px; padding: 0; margin: 0 0 14px; gap: 10px; transform: none; width: 100%; }
#panel[data-station="portal"] header .icon { display: block; width: 28px; height: 28px; }
#panel[data-station="portal"] h2 { font: 600 22px/1.25 var(--text); letter-spacing: .2px; }
#panel[data-station="portal"] :is(.close, .lang-switch) { width: 44px; height: 44px; border-radius: 0; }
#panel[data-station="portal"] .lang-switch { font-size: 15px; }
#panel[data-station="portal"] :is(button, a):focus-visible { outline: 3px solid #f2c94c; outline-offset: 3px; }
#panel[data-station="portal"] .body { min-height: 0; overflow: hidden; }
.world-directory { display: flex; flex-direction: column; gap: 10px; padding: 14px; color: var(--ink); border: 4px solid transparent; border-image: var(--mc-frame) 4 fill / 4px; }
.world-screen { max-height: min(420px, 55dvh); overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #89877f transparent; }
.world-list { list-style: none; margin: 0; padding: 0; }
.world-list li + li { border-top: 1px solid rgba(49, 48, 42, .12); }
.world-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 16px; width: 100%; padding: 16px 10px; border: 0; background: transparent; color: inherit; text-align: left; touch-action: manipulation; cursor: pointer; }
.world-row:hover:enabled { background: rgba(255, 255, 255, .24); }
.world-row:disabled { cursor: default; }
.world-icon { position: relative; display: grid; place-items: center; width: 52px; height: 52px; overflow: hidden; background: #b5b2a8; color: #4d4a42; font: 500 20px/1 var(--text); box-shadow: 0 0 0 2px var(--line); }
.world-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.world-icon img.is-pixel { image-rendering: pixelated; }
.world-text { min-width: 0; font: 400 16px/1.35 var(--text); overflow-wrap: anywhere; }
.world-text strong { font-weight: 600; letter-spacing: -.1px; }
.world-meta { display: inline-block; max-width: 100%; }
.world-intro { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin-top: 4px; color: var(--ink); font: 400 14px/1.5 var(--text); overflow-wrap: anywhere; }
.world-row .world-visit { min-width: 70px; min-height: 40px; padding-inline: 14px; font-size: 14px; }
.world-row:hover:enabled .world-visit { background: #4b9c34; }
.world-row .world-current { background: #aaa79f; color: #eeece5; box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .16), inset -2px -2px 0 rgba(255, 255, 255, .24); text-shadow: none; }
.world-list-status { margin: 20px 10px; color: var(--ink-soft); font: 400 14px/1.5 var(--text); }
.world-refresh { align-self: center; min-height: 44px; padding: 0 12px; border: 0; background: transparent; color: var(--ink); font: 500 14px/1.4 var(--text); cursor: pointer; }
.world-footer { display: flex; justify-content: flex-end; gap: 16px; padding: 4px 10px 0; }
.world-footer a { display: inline-flex; align-items: center; min-height: 32px; color: var(--ink-soft); font: 400 12px/1.4 var(--text); text-decoration: none; }
.world-footer a:hover { color: var(--ink); }
@media (max-width: 560px) {
  dialog#panel[data-station="portal"] { width: calc(100vw - 32px); }
  .world-directory { padding: 10px; }
  .world-row { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; padding: 12px 4px; }
  .world-icon { width: 44px; height: 44px; }
  .world-row .world-visit { min-width: 58px; padding-inline: 10px; }
}
/* A narrow phone cannot keep a centred Dock and a bottom-right radar apart. */
@media (max-width: 480px) {
  #hotbar { left: max(12px, env(safe-area-inset-left)); transform: none; }
}
@media (max-width: 360px) {
  #minimap { width: 104px; height: 104px; }
}
#phone .go[hidden] { display: none; }

/* ---------- ?debug ---------- */
#debugStats {
  position: fixed; left: 50%; top: max(8px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 70; margin: 0;
  padding: 4px 10px; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: #e8ffe8;
  background: rgba(0, 0, 0, .62); pointer-events: none; white-space: nowrap;
}
#debugStats b { font-weight: 600; }
#debugStats .over { color: #ff7a6b; }
