:root {
  color-scheme: dark;
  --page: #241e2a;
  --panel: #302735;
  --line: #58434e;
  --cream: #ffebc8;
  --muted: #c9b69e;
  --gold: #edb962;
  --green: #a6b579;
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--page);
  color: var(--cream);
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at 48% -250px, #513841 0%, var(--page) 66%); min-height: 100vh; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
button:focus-visible, select:focus-visible, canvas:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.shell { width: min(1500px, calc(100% - 86px)); margin: 0 auto; }
.masthead { height: 74px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; font-weight: bold; font-size: 19px; }
.brand small, .network, .eyebrow, .population, .clock span, .field-footer, footer {
  font: 700 10px system-ui, sans-serif; letter-spacing: .16em; text-transform: uppercase;
}
.brand small { display: block; color: var(--muted); margin-top: 3px; font-size: 9px; }
.seal { width: 36px; height: 36px; background: var(--gold); color: #39272d; display: grid; place-items: center; border-radius: 50%; box-shadow: 0 0 0 3px #694c43; font-style: italic; }
.header-tools { display: flex; align-items: center; gap: 14px; min-width: 0; }
.header-tools select { min-height: 37px; max-width: 154px; padding: 5px 24px 5px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); font: 600 13px system-ui,sans-serif; }
.network { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.network span:first-child { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px #edb96220; }
.network span.online { background: var(--green); box-shadow: 0 0 0 4px #a6b57920; }
.title { display: flex; justify-content: space-between; align-items: end; margin: 26px 0 22px; }
.eyebrow { color: var(--gold); margin: 0 0 9px; }
h1 { margin: 0; font-size: clamp(45px, 6.7vw, 103px); font-weight: 500; letter-spacing: -.071em; line-height: .94; }
h1 i { color: var(--gold); }
.tagline { color: var(--muted); font-style: italic; font-size: 17px; margin: 0 3px 3px 24px; line-height: 1.34; }
.layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 255px; }
.field { min-width: 0; overflow: hidden; border: 1px solid #896955; border-radius: 9px; background: #392e38; }
.stage { position: relative; height: clamp(380px, 60vh, 850px); overflow: hidden; background: #59664b; }
canvas { display: block; width: 100%; height: 100%; outline-offset: -4px; }
.hdr-layer { position: absolute; inset: 0; pointer-events: none; dynamic-range-limit: no-limit; }
.sr-only { clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
.inset { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 8px; justify-content: space-between; align-items: start; pointer-events: none; }
.inset > * { min-width: 0; overflow-wrap: anywhere; }
.clock, .farm-status, .leaderboard { background: #2c2430ed; border: 1px solid #ebba804d; box-shadow: 0 4px 10px #33263838; border-radius: 6px; }
.inset-left { display: grid; justify-items: start; gap: 6px; max-width: 58%; }
.clock { padding: 8px 12px; }
.clock > span { display: block; color: var(--gold); letter-spacing: .08em; }
.clock strong { display: block; font-size: 26px; font-weight: 500; margin-top: 2px; font-variant-numeric: tabular-nums; }
.farm-status { padding: 6px 10px; color: #fff0d0; line-height: 1.3; font-size: 13px; }
.farm-status > span { display: block; }
#quota { color: var(--gold); }
.leaderboard { width: min(192px, 100%); min-width: 0; padding: 5px 7px; font: 600 11px/1.16 system-ui, sans-serif; pointer-events: auto; }
.leaderboard h2 { margin: 0 0 3px; color: var(--gold); font: inherit; }
.leaderboard select { padding: 2px 3px; width: 100%; min-width: 0; border: 1px solid #ebba8066; border-radius: 3px; background: var(--panel); }
.leaderboard ol { margin: 3px 0 0; padding-inline-start: 1.6em; font-variant-numeric: tabular-nums; }
.leaderboard li > span { float: inline-end; padding-inline-start: .35em; }
.leaderboard li[aria-current="true"] { color: var(--gold); }
.leaderboard p { margin: 4px 0 0; color: var(--muted); }
.field-caption { position: absolute; bottom: 13px; left: 12px; max-width: calc(100% - 112px); padding: 6px 10px; background: #2c2430f2; border-left: 2px solid var(--gold); border-radius: 2px 5px 5px 2px; color: var(--cream); font: 14px/1.25 Georgia, serif; pointer-events: none; }
.field-caption strong { display: inline; color: var(--gold); margin-right: .42em; }
.field-caption span { overflow-wrap: anywhere; }
.zoom { position: absolute; bottom: 12px; right: 12px; display: flex; gap: 2px; }
.zoom button { width: 32px; height: 33px; font-size: 23px; border: 1px solid #ebba8055; background: #2c2430ee; border-radius: 4px; }
.field-footer { min-height: 41px; padding: 7px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); letter-spacing: .09em; }
.marker { display: inline-block; border: 1px solid var(--cream); width: 12px; height: 8px; border-radius: 50%; margin-right: 5px; }
aside { display: grid; align-content: start; gap: 12px; }
.card { padding: 17px 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
h2 { font-size: 23px; margin: 0; font-weight: 500; }
.identity h2 { font-size: 35px; letter-spacing: -.035em; }
.identity > p:not(.eyebrow) { min-height: 35px; margin: 7px 0 13px; font-size: 13px; line-height: 1.3; color: var(--muted); }
.needs label { display: grid; grid-template-columns: minmax(50px, 31%) minmax(0,1fr); align-items: center; gap: 5px; margin: 7px 0; font: 12px system-ui,sans-serif; color: var(--muted); }
meter { width: 100%; height: 8px; border: 0; border-radius: 8px; display: block; }
meter::-webkit-meter-bar { border: 0; background: #453845; }
meter::-webkit-meter-optimum-value { background: var(--green); }
meter::-moz-meter-bar { background: var(--green); }
#thirst::-webkit-meter-optimum-value { background: #78aaa7; }
#energy::-webkit-meter-optimum-value { background: var(--gold); }
#cargo { font-size: 13px; color: var(--gold); }
#cargo:not(:empty) { margin-top: 9px; }
.bindings { display: grid; gap: 6px; margin: 14px 0; }
.bindings > div { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }
kbd { font: 700 10px system-ui,sans-serif; letter-spacing: .035em; background: #261e2b; border: 1px solid #665057; border-bottom-width: 2px; border-radius: 4px; padding: 3px 6px; color: var(--cream); }
.outline { display: block; width: 100%; font-family: system-ui,sans-serif; font-size: 11px; border: 1px solid #6f5660; background: #372b3b; border-radius: 4px; padding: 8px; margin: 5px 0 0; }
.outline:hover, .zoom button:hover { background: #594252; }
.transition { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); padding: 20px 28px; width: min(330px, 75%); background: #2e2531ef; border: 1px solid #e0ad64; text-align: center; border-radius: 9px; box-shadow: 0 14px 40px #281c2b80; pointer-events: none; }
.transition strong { display: block; color: var(--gold); font-size: 25px; margin-bottom: 5px; }
.transition span { font-size: 14px; color: var(--muted); }
footer { color: #bba38e; display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding: 18px 0; margin-top: 23px; letter-spacing: .08em; }
dialog { width: min(540px, calc(100% - 25px)); border: 1px solid #876555; border-radius: 8px; color: var(--cream); background: var(--panel); padding: 22px; max-height: 88vh; }
dialog::backdrop { background: #1a1422bc; }
#splash { padding: clamp(18px, 4vw, 32px); border-color: #b28b62; }
#splash h2 { margin: 0 0 .45em; color: var(--gold); font-size: clamp(27px, 6vw, 44px); }
#splash p { margin: 0 0 .8em; line-height: 1.5; }
#splash button { margin-top: 6px; padding: .6em 1.1em; border: 1px solid var(--gold); border-radius: 4px; color: var(--page); background: var(--gold); font-weight: bold; }
dialog header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
dialog header button { border: 0; background: transparent; font-size: 25px; }
#dialog-body { color: var(--muted); font: 13px/1.5 system-ui,sans-serif; }
.control-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
.control-grid div { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 5px; padding: 4px 3px; border-bottom: 1px solid var(--line); }
.control-grid button, #dialog-body > button { background: #433444; border: 1px solid #6f5660; border-radius: 4px; padding: 4px 8px; }
#dialog-body > button { margin-top: 12px; }
.record { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,auto) minmax(0,auto); gap: 8px 11px; }
.record span, .control-grid span { overflow-wrap: anywhere; }
@media (max-width: 950px) {
  .shell { width: calc(100% - 34px); }
  .layout { grid-template-columns: minmax(0, 1fr) 220px; }
}
@media (max-width: 660px) {
  .shell { width: calc(100% - 20px); }
  .masthead { height: 55px; }
  .title { margin: 17px 0; }
  h1 { font-size: clamp(37px, 11vw, 64px); }
  .tagline { display: none; }
  .layout { display: flex; flex-direction: column; gap: 10px; }
  .stage { height: clamp(315px, 52vh, 620px); }
  aside { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .card { padding: 11px; }
  .identity h2 { font-size: 28px; }
  h2 { font-size: 20px; }
  .population { font-size: 8px; padding: 8px; }
  .field-footer { font-size: 8px; }
}
html[data-input="touch"] .shell {
  width: min(1150px, 100%);
  padding-inline: max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-right));
  padding-top: env(safe-area-inset-top);
}
html[data-input="touch"] .masthead { min-height: 50px; height: auto; gap: 8px; }
html[data-input="touch"] .brand { font-size: 15px; gap: 8px; }
html[data-input="touch"] .brand small { font-size: 8px; letter-spacing: .04em; }
html[data-input="touch"] .seal { width: 26px; height: 26px; flex: 0 0 26px; }
html[data-input="touch"] .header-tools { gap: 8px; }
html[data-input="touch"] .header-tools select { font-size: 16px; min-height: 44px; max-width: min(36vw, 155px); }
html[data-input="touch"] .network { gap: 4px; font-size: 8px; letter-spacing: .03em; }
html[data-input="touch"] .network span:first-child { flex: 0 0 6px; width: 6px; height: 6px; }
html[data-input="touch"] .title { margin: 10px 0; }
html[data-input="touch"] .title .eyebrow { margin: 0 0 4px; }
html[data-input="touch"] h1 { font-size: clamp(32px, 8vw, 53px); }
html[data-input="touch"] .tagline { display: none; }
html[data-input="touch"] .layout { display: flex; flex-direction: column; gap: 9px; }
html[data-input="touch"] .stage { height: 48vh; height: clamp(170px, calc(100svh - 285px), 680px); }
html[data-input="touch"] .inset { top: 7px; left: 7px; right: 7px; }
html[data-input="touch"] .clock { padding: 5px 8px; }
html[data-input="touch"] .clock span { font-size: 9px; letter-spacing: .02em; }
html[data-input="touch"] .clock strong { font-size: 22px; }
html[data-input="touch"] .farm-status { padding: 5px 7px; font-size: 12px; }
html[data-input="touch"] .zoom { bottom: 7px; right: 7px; }
html[data-input="touch"] .zoom button { width: 44px; height: 44px; }
html[data-input="touch"] .bindings { display: none; }
html[data-input="touch"] .field-footer { min-height: 30px; padding: 4px 10px; }
html[data-input="touch"] .outline, html[data-input="touch"] #close { min-height: 44px; }
html[data-input="touch"] footer { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
.touch {
  --pad-key: clamp(42px, 12vw, 54px);
  position: relative;
  display: grid;
  grid-template-columns: max-content minmax(0,1fr);
  gap: 10px;
  align-items: stretch;
  padding: 8px;
  background: #322838;
  border-top: 1px solid #846654;
  user-select: none;
  -webkit-touch-callout: none;
}
.touch button {
  min-width: 0;
  min-height: 44px;
  padding: 3px 2px;
  color: var(--cream);
  font: 650 clamp(11px, 3.3vw, 15px)/1.1 system-ui,sans-serif;
  border: 1px solid #785b61;
  border-bottom: 2px solid #1c1720;
  border-radius: 6px;
  background: #473545;
  overflow-wrap: anywhere;
  touch-action: manipulation;
}
.touch button.is-down, .touch button:active, #touch-more[aria-expanded="true"] {
  background: #e5b669;
  color: #291f2b;
  border-color: #ffdc9e;
}
.dpad { display: grid; grid-template-columns: repeat(3, var(--pad-key)); grid-auto-rows: var(--pad-key); gap: 3px; }
.dpad, .dpad button, .touch-actions [data-action] { touch-action: none; }
.dpad button { min-height: 0; font-size: 21px; color: #ffe1ae; }
.pad-center { border-radius: 8px; background: #251e2a; border: 1px solid #58434e; display: grid; place-items: center; }
.pad-center::after { content: ""; width: 8px; height: 8px; border: 1px solid #bb8d65; transform: rotate(45deg); }
.touch-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; }
.touch-actions [data-action="PECK"] { border-color: #b98854; background: #684435; }
.touch-actions [data-action="PECK"].is-down { color: #291f2b; background: #e5b669; }
.touch-extra {
  box-sizing: border-box;
  position: absolute;
  z-index: 2;
  left: 5px;
  right: 5px;
  bottom: calc(100% + 5px);
  max-height: 50vh;
  max-height: min(50svh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--panel);
  border: 1px solid #a07959;
  border-radius: 7px;
  padding: 8px;
  box-shadow: 0 6px 22px #201725b0;
}
.touch-extra-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
#touch-extra-close { width: 44px; flex: 0 0 44px; font-size: 22px; }
#gesture-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(7.3em,100%), 1fr)); gap: 4px; }
@media (max-width: 360px) {
  .touch-actions { grid-template-columns: repeat(2, minmax(0,1fr)); }
  html[data-input="touch"] .network #connection { max-width: 65px; overflow-wrap: anywhere; }
}
@media (orientation: landscape) and (max-height: 620px) {
  html[data-input="touch"] .field { display: grid; grid-template-columns: minmax(0,1fr) minmax(235px, min(40%, 350px)); grid-template-areas: "stage touch" "foot touch"; }
  html[data-input="touch"] .stage { grid-area: stage; height: 64vh; height: clamp(144px, calc(100svh - 140px), 520px); }
  html[data-input="touch"] .touch { --pad-key: 43px; grid-area: touch; align-content: center; border-top: 0; border-left: 1px solid #846654; gap: 6px; padding: 5px; }
  html[data-input="touch"] .field-footer { grid-area: foot; }
  html[data-input="touch"] .touch-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
  html[data-input="touch"] .touch-extra { left: auto; right: calc(100% + 5px); bottom: 5px; width: min(390px, 53vw); max-height: min(calc(100svh - 132px), 400px); }
}

.masthead a { color: var(--gold); font-size: 14px; }
.operations form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.operations input { border: 1px solid var(--line); border-radius: 4px; padding: 6px; color: var(--cream); background: var(--page); }
.operations form button { border: 1px solid var(--gold); border-radius: 4px; padding: 6px 13px; background: var(--panel); }
.operations #state { margin: 12px 0 0; color: var(--muted); }
.operation-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 12px; margin-top: 12px; }
.operation-grid[hidden] { display: none; }
.operation-grid dl { display: grid; grid-template-columns: 1fr auto; gap: 9px; font: 13px system-ui, sans-serif; }
.operation-grid dt { color: var(--muted); }
.operation-grid dd { margin: 0; text-align: right; }

@font-face {
  font-family: "Sitelen Seli Kiwen";
  src: url("/fonts/sitelen-seli-kiwen-juniko.woff2") format("woff2");
  unicode-range: U+F1900-F19FF;
  font-display: swap;
}
html[lang="tok"] :is(button, .clock span, .population, .brand small, .network, .eyebrow, .field-footer, footer, .needs label, #dialog-body) {
  font-family: "Sitelen Seli Kiwen", system-ui, sans-serif;
  letter-spacing: 0;
}
html[lang="tok"] { font-family: "Sitelen Seli Kiwen", Georgia, serif; }
html[lang="tok"] .touch button { font-size: 17px; }
#dialog-body details { margin-bottom: 12px; padding: 8px; border: 1px solid var(--line); border-radius: 4px; }
#dialog-body summary { cursor: pointer; color: var(--cream); }
.signwriting {
  display: inline-flex;
  gap: 2px;
  padding: 2px 3px;
  margin-inline-end: .3em;
  vertical-align: middle;
  border-radius: 4px;
  background: #ffefda;
  line-height: 1;
}
.signwriting svg { width: 25px; height: 25px; }
.touch button .signwriting { display: flex; width: max-content; margin: 0 auto 2px; }
.touch button .signwriting svg { width: 21px; height: 21px; }
.touch button .signwriting { gap: 0; padding-inline: 1px; }
.field-caption .signwriting svg { width: 30px; height: 30px; }
html[data-input="touch"] .field-caption .signwriting svg { width: 24px; height: 24px; }
