/* translate.nex-orion.com — the game's palette (Docs/PALETTE.md) and its own UI sprites. */

@font-face { font-family: "Gothic A1"; font-weight: 700; src: url("/static/fonts/GothicA1-Bold.otf") format("opentype"); font-display: swap; }
@font-face { font-family: "Gothic A1"; font-weight: 400; src: url("/static/fonts/GothicA1-400.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Gothic A1"; font-weight: 500; src: url("/static/fonts/GothicA1-500.woff2") format("woff2"); font-display: swap; }

:root {
  --ink: #37201e;
  --wood-dark: #582f2a;
  --wood: #9d643f;
  --wood-light: #c98463;
  --cream: #f0ecbf;
  --paper: #f4f9fd;
  --gold: #f6c95b;
  --leaf-light: #8acfb7;
  --leaf: #59837e;
  --sky: #8fb8cf;
  --red: #e0705a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--ink); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Gothic A1", system-ui, sans-serif;
  color: var(--cream);
  background: var(--ink);
  line-height: 1.45;
}
[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }

/* The main site's buttons: leaf for the one that matters, wood for the rest, ink outline, darker lip. */
.btn {
  display: inline-block;
  padding: 9px 18px 10px;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  color: #fff;
  text-shadow: 0 2px 0 var(--ink);
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: linear-gradient(var(--wood-light), var(--wood));
  box-shadow: inset 0 2px 0 rgba(255, 240, 210, .45), inset 0 -5px 0 var(--wood-dark);
  cursor: pointer;
  white-space: nowrap;
  transition: transform .08s ease-out;
}
.btn.primary { background: linear-gradient(var(--leaf-light), var(--leaf)); box-shadow: inset 0 2px 0 rgba(230, 255, 240, .5), inset 0 -5px 0 #3a5a56; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { filter: grayscale(0.6) brightness(0.8); cursor: default; transform: none; }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.field {
  width: 100%;
  background: var(--paper);
  color: var(--ink);
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
}
.field:focus { outline: 3px solid var(--gold); outline-offset: 0; }

/* ---- sign in: the main site's own scene --------------------------------------------- */

.signin-page { --tile: 96px; background: var(--wood-dark); }
.sky {
  position: relative;
  overflow: hidden;
  background: var(--sky);
  padding: clamp(40px, 8vh, 80px) 16px 0;
  text-align: center;
}
.sun { position: absolute; top: 30px; right: 8%; width: 120px; height: auto; animation: breathe 6s ease-in-out infinite; }
.cloud { position: absolute; width: 132px; height: auto; }
.cloud-a { top: 46px; left: -20px; animation: drift 58s linear -24s infinite; }
.cloud-b { top: 150px; left: -20px; width: 92px; animation: drift 84s linear -70s infinite; }
.sun, .cloud, .ground img { image-rendering: pixelated; image-rendering: crisp-edges; }

.hero { position: relative; max-width: 420px; margin: 0 auto; }
.wordmark {
  margin: 0;
  font-size: clamp(48px, 11vw, 88px);
  line-height: 1;
  color: var(--paper);
  text-shadow: 4px 4px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink);
}
.tagline {
  margin: 6px 0 20px;
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 700;
  color: var(--gold);
  text-shadow: 3px 3px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink);
}
.panel {
  border: 12px solid transparent;
  border-width: 10px 12px;
  border-image: url("/static/panel.png") 20 24 fill;
  padding: 14px 18px 18px;
}
.signin { text-align: left; }
.signin p { margin: 0 0 6px; font-size: 15px; }
.signin label { display: block; font-weight: 700; font-size: 14px; margin: 10px 0 4px; }
.signin .btn { width: 100%; margin-top: 16px; font-size: 18px; }
.error { color: var(--gold); font-weight: 700; margin: 10px 0 0; font-size: 14px; }
.error:empty { display: none; }

.ground {
  position: relative;
  height: calc(var(--tile) * 3 + 8px);
  margin: 8px -16px 0; /* edge to edge, past the sky's side padding */
  background:
    url("/static/img/grass.png") repeat-x left bottom var(--tile) / var(--tile) var(--tile),
    url("/static/img/dirt.png") repeat-x left bottom / var(--tile) var(--tile);
}
.player, .prop {
  position: absolute;
  bottom: calc(var(--tile) * 2 - var(--tile) / 32);
  width: var(--tile); height: var(--tile);
}
.player { left: calc(50% - var(--tile) / 2); animation: idle 2.4s ease-in-out infinite; }
.player img { position: absolute; inset: 0; width: 100%; height: 100%; }
.player-shut { opacity: 0; animation: blink 4.6s step-end infinite; }
.prop-sign { left: calc(50% - var(--tile) * 2.25); }
.prop-lock { left: calc(50% + var(--tile) * 1.25); }

.bedrock { height: 64px; background: var(--ink) url("/static/img/bedrock.png") repeat-x top / 64px 64px; }

@keyframes drift { from { transform: translateX(-160px); } to { transform: translateX(100vw); } }
@keyframes breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes idle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(calc(var(--tile) / -32)); } }
@keyframes blink { 0%, 93%, 100% { opacity: 0; } 94%, 97% { opacity: 1; } }

@media (max-width: 520px) { .signin-page { --tile: 64px; } .sun { width: 84px; } }

/* ---- app ----------------------------------------------------------------------------- */

.app-page { background: var(--wood-dark); }
.top {
  position: sticky; top: 0; z-index: 5;
  background:
    url("/static/img/grass.png") repeat-x left bottom / 48px 48px,
    var(--sky);
  padding-bottom: 40px;
}
.bar {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px;
}
.brand {
  font-weight: 700; font-size: 24px; color: var(--paper); margin-right: auto;
  text-shadow: 3px 3px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink);
}
.brand span { color: var(--gold); }
.who { font-size: 14px; font-weight: 700; color: var(--ink); }

select.field { width: auto; min-width: 170px; padding: 8px 10px; }

.tools {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 0 16px 10px;
}
.progress { flex: 1 1 220px; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; color: var(--ink); }
.track { flex: 1; height: 12px; background: var(--ink); border-radius: 6px; overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--leaf-light); transition: width 0.3s ease; }

.filters { display: flex; gap: 4px; background: var(--ink); border-radius: 10px; padding: 3px; }
.filters button {
  border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  font-weight: 700; font-size: 14px; color: var(--cream);
}
.filters button[aria-pressed="true"] { background: var(--wood); color: var(--paper); }
.search { flex: 1 1 200px; max-width: 300px; padding: 8px 12px; font-size: 15px; }

.hint { max-width: 1100px; margin: 0 auto; padding: 10px 16px 0; font-size: 13px; opacity: 0.8; }
kbd {
  font: inherit; font-weight: 700; font-size: 12px;
  background: var(--wood-dark); border-radius: 5px; padding: 1px 6px;
}

main { max-width: 1100px; margin: 0 auto; padding: 12px 16px 40px; min-height: 60vh; }
.app-page .bedrock { height: 64px; background: var(--ink) url("/static/img/bedrock.png") repeat-x top / 64px 64px; }

.empty { text-align: center; padding: 60px 16px; font-size: 17px; }
.empty .btn { margin-top: 14px; font-size: 17px; }

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  margin-bottom: 8px;
  background: #4a2723;
  border-radius: 12px;
  border-left: 5px solid var(--wood);
}
.row.done { border-left-color: var(--leaf-light); }
.row.active { background: #67382f; }
.row.bad { border-left-color: var(--red); }

.source { min-width: 0; }
.ctx { font-size: 12px; font-weight: 700; color: var(--sky); text-transform: uppercase; letter-spacing: 0.04em; }
.en { font-size: 16px; color: var(--paper); overflow-wrap: anywhere; margin-top: 2px; }
.tok {
  display: inline-block; font-size: 13px; font-weight: 700; line-height: 1.3;
  background: var(--ink); color: var(--gold); border-radius: 5px; padding: 0 5px; margin: 0 1px;
}
.tok.color { color: var(--leaf-light); }
.tok.nl { color: var(--sky); }

.target { min-width: 0; }
.target textarea {
  display: block; width: 100%; resize: none; overflow: hidden;
  min-height: 44px; line-height: 1.4;
}
.meta { font-size: 12px; margin-top: 4px; min-height: 1.3em; opacity: 0.85; }
.meta.err { color: var(--gold); font-weight: 700; opacity: 1; }
.meta.warn { color: var(--sky); font-weight: 700; opacity: 1; }
.meta.ok { color: var(--leaf-light); }

dialog {
  border: 12px solid transparent; border-width: 10px 12px;
  border-image: url("/static/panel.png") 20 24 fill;
  background: none; color: var(--cream);
  padding: 14px 18px 18px; width: min(420px, calc(100% - 32px));
}
dialog::backdrop { background: rgba(30, 16, 14, 0.7); }
dialog h2 { margin: 0 0 6px; color: var(--paper); text-shadow: 2px 2px 0 var(--ink); }
dialog p { margin: 0 0 10px; font-size: 14px; }
dialog label { display: block; font-weight: 700; font-size: 14px; margin: 10px 0 4px; }
dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

@media (max-width: 720px) {
  /* On a phone the bar scrolls away: a sticky one ate half the screen. Shortcuts need a keyboard. */
  .top { position: static; padding-bottom: 32px; background-size: 32px 32px, auto; }
  .hint { display: none; }
  .bar { gap: 8px; padding: 10px 12px; }
  .brand { font-size: 18px; }
  .who { display: none; }
  .btn { font-size: 14px; }
  select.field { flex: 1 1 100%; order: 5; min-width: 0; }
  .tools { padding: 0 12px 10px; gap: 8px; }
  .progress { flex-basis: 100%; }
  .filters button { padding: 6px 10px; }
  .search { flex: 1; max-width: none; min-width: 0; }
  main { padding: 10px 12px 60px; }
  .row { grid-template-columns: 1fr; gap: 8px; padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .fill, .btn { transition: none; }
  .sun, .cloud, .player, .player-shut { animation: none; }
}
