:root {
  color-scheme: dark;
  --bg: #120d09;
  --felt: #1c140e;
  --felt-2: #3a2c1f;
  --ink: #f1e4c8;
  --muted: #b39a74;
  --gold: #d9a441;
  --gold-hi: #f3cf7a;
  --line: rgba(217, 164, 65, 0.42);
  --panel: linear-gradient(180deg, rgba(38, 27, 18, 0.95), rgba(19, 13, 9, 0.95));
  --serif: Georgia, "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
  --red: #c43a2c;
  --violet: #a678ff;
  --shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.55), 0 8px 24px rgba(0, 0, 0, 0.5);
  --sans: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

canvas#game, canvas#world { position: fixed; inset: 0; display: block; }
canvas#world { pointer-events: none; }
button { font: inherit; color: inherit; cursor: pointer; }

/* top bar */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: max(8px, env(safe-area-inset-top)) 8px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  z-index: 5;
}
.hud[hidden], .actions[hidden] { display: none; }
.hud p { margin: 0; }
.chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 44px;
  padding: 0 9px;
  border-radius: 10px;
  background: var(--felt);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}
.chip b { font-variant-numeric: tabular-nums; }
.regen { position: absolute; left: 8px; right: 8px; bottom: 5px; height: 3px; background: var(--felt-2); border-radius: 2px; overflow: hidden; }
.regen i { display: block; height: 100%; width: 0; background: var(--gold); }
.season { flex: 1 1 120px; min-width: 70px; flex-direction: column; align-items: stretch; justify-content: center; gap: 4px; }
.season small { font-size: 12px; color: var(--ink); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.season.win .bar i { background: #6aa84f; }
.bar { height: 6px; border-radius: 3px; background: var(--felt-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width 0.3s; }
.tribes { display: flex; gap: 5px; }
.tribe {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 150px;
  height: 44px;
  padding: 5px 7px;
  border-radius: 10px;
  background: var(--felt);
  color: var(--ink);
  box-shadow: var(--shadow);
  border-left: 5px solid var(--c);
  position: relative;
}
.tribe .ava { width: 32px; height: 32px; flex: none; }
.tribe .tb { flex: 1; min-width: 0; }
.tribe .tick { position: absolute; right: -6px; bottom: -6px; width: 20px; height: 20px; border-radius: 50%; background: #6aa84f; color: #fff; font-size: 12px; font-weight: 900; display: none; place-items: center; box-shadow: var(--shadow); }
.tribe.ok .tick { display: grid; }
.tribe.bump .ava { animation: bump 0.55s ease-out; }
.tribe.sink .ava { animation: sink 0.55s ease-out; }
@keyframes bump { 35% { transform: translateY(-9px) scale(1.18); } }
@keyframes sink { 35% { transform: translateY(4px) scale(0.9); filter: grayscale(0.6); } }
.delta { position: absolute; right: 30px; top: 3px; font-size: 13px; font-weight: 900; color: #2f7a1a; text-shadow: 0 1px 0 #fff; animation: rise 1.3s ease-out forwards; pointer-events: none; }
.delta.down { color: var(--red); }
@keyframes rise { from { transform: translateY(6px); opacity: 0; } 20% { opacity: 1; } to { transform: translateY(-14px); opacity: 0; } }
.tribe .tn { display: block; font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tribe .bar { margin-top: 5px; position: relative; height: 9px; overflow: visible; }
.tribe .bar i { border-radius: 4px; }
.tribe .bar::after { content: ""; position: absolute; left: 55%; top: -4px; bottom: -4px; width: 3px; border-radius: 2px; background: var(--ink); }
.tribe .bar i { background: var(--c); }
.tribe.ok .bar i { background: var(--gold); }
.tribe .fear { position: absolute; right: 4px; top: 2px; font-size: 11px; letter-spacing: -3px; }
.icon {
  flex: none;
  width: 40px;
  height: 44px;
  border-radius: 10px;
  border: 0;
  background: var(--felt);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 16px;
  font-weight: 800;
}

/* three actions at the bottom */
.actions {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 5;
}
.act {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  min-width: 128px;
  height: 66px;
  padding: 5px 14px;
  border: 3px solid transparent;
  border-radius: 14px;
  background: var(--felt);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: left;
}
.act[hidden] { display: none; }
.act .ai { grid-row: span 2; width: 44px; height: 44px; }
.ava svg, .ai svg { display: block; width: 100%; height: 100%; }
.act.glow { animation: glow 0.9s ease-in-out infinite alternate; }
@keyframes glow { from { box-shadow: var(--shadow), 0 0 0 0 rgba(255, 220, 120, 0.9); } to { box-shadow: var(--shadow), 0 0 0 8px rgba(255, 220, 120, 0); } }
.act { grid-template-rows: auto auto auto; row-gap: 0; }
.act .ai { grid-row: span 3; }
.act .an { font-weight: 800; font-size: 15px; line-height: 1.1; white-space: nowrap; }
.act .as { font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.act .ac { font-size: 10px; }
.tip {
  position: fixed;
  z-index: 8;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: min(330px, calc(100vw - 16px));
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--felt);
  color: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.15s, transform 0.15s;
  pointer-events: none;
}
.tip.on { opacity: 1; transform: none; }
.tip .ava { width: 52px; height: 52px; flex: none; }
.tip b { font-size: 15px; }
.tip p { margin: 3px 0 4px; font-size: 13.5px; line-height: 1.35; }
.tip small { font-size: 12px; color: var(--muted); font-weight: 700; }
.act.sel { border-color: var(--gold); background: #fff6dc; transform: translateY(-3px); }
.act.off { opacity: 0.55; }

.hint {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translate(-50%, 10px);
  max-width: min(560px, 92vw);
  margin: 0;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(20, 14, 8, 0.86);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  z-index: 6;
}
.hint.on { opacity: 1; transform: translate(-50%, 0); }

.toasts { position: fixed; top: 64px; right: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 6; pointer-events: none; }
.toast {
  max-width: 320px;
  padding: 8px 12px;
  border-radius: 10px;
  border-left: 5px solid var(--c, var(--gold));
  background: var(--felt);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: in 0.3s ease-out;
  transition: opacity 0.5s;
}
.toast { display: flex; gap: 8px; align-items: center; }
.toast .ava { width: 36px; height: 36px; flex: none; }
.toast b { display: block; font-size: 12px; color: var(--muted); }
.toast.out { opacity: 0; }
@keyframes in { from { transform: translateX(30px); opacity: 0; } }

/* the advisor speaking */
.coach {
  position: fixed;
  left: 12px;
  bottom: 96px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: min(460px, calc(100vw - 24px));
  z-index: 7;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.coach.on { opacity: 1; transform: none; }
.coach .ava { width: 72px; height: 72px; flex: none; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5)); }
.coach .said {
  position: relative;
  padding: 10px 14px;
  border-radius: 14px 14px 14px 4px;
  background: var(--felt);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.coach .said b { display: block; font-size: 12px; color: var(--muted); }
.coach .said p { margin: 2px 0 0; font-size: 15px; font-weight: 600; line-height: 1.35; }

/* the title over the living steppe */
#ui.cine { background: linear-gradient(180deg, rgba(20, 12, 24, 0) 30%, rgba(20, 12, 10, 0.55) 70%, rgba(14, 8, 6, 0.85)); align-items: end; }
.title { width: min(640px, 100%); padding: 0 16px max(40px, 7vh); text-align: center; color: #fff4dc; animation: titleIn 1.6s ease-out both; }
@keyframes titleIn { from { opacity: 0; transform: translateY(18px); } }
.title h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(56px, 11vw, 112px);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  background: linear-gradient(180deg, #fff3cf 10%, #f2c25a 55%, #b8792a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.55));
}
.title .orn { width: min(280px, 70%); margin: 4px auto 6px; color: #f2c25a; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6)); }
.title .orn svg { display: block; width: 100%; }
.title .sub { margin: 0 0 22px; font-family: Georgia, serif; font-style: italic; font-size: clamp(17px, 2.6vw, 24px); color: #f6e2bd; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7); }
.title .play {
  position: relative;
  min-width: 240px;
  height: 62px;
  font-size: 22px;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #ffd978, #e0a43a);
  box-shadow: 0 4px 0 #8a5a18, 0 0 0 0 rgba(255, 210, 110, 0.7), 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: glowPlay 1.8s ease-in-out infinite;
  overflow: hidden;
}
.title .play::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.55) 45%, transparent 60%); transform: translateX(-120%); animation: shine 3.2s ease-in-out infinite; }
@keyframes glowPlay { 50% { box-shadow: 0 4px 0 #8a5a18, 0 0 0 10px rgba(255, 210, 110, 0), 0 10px 30px rgba(0, 0, 0, 0.5); } }
@keyframes shine { 60%, 100% { transform: translateX(120%); } }
.title .link { color: #e8d6b4; }
.title .small { color: #d9c6a2; font-size: 13px; }

/* screens */
#ui:empty { display: none; }
#ui { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(15, 10, 6, 0.55); padding: 16px; }
.screen {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 22px 22px 20px;
  border-radius: 18px;
  background: var(--felt);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: center;
}
.screen h1 { margin: 0; font-size: 52px; letter-spacing: 0.04em; }
.screen h2 { margin: 0 0 6px; font-size: 26px; }
.screen h3 { margin: 14px 0 4px; font-size: 15px; color: var(--muted); text-align: left; }
.screen .sub { margin: 0 0 12px; font-size: 18px; color: var(--muted); font-weight: 700; }
.screen .intro, .screen .line { margin: 6px 0; font-size: 16px; line-height: 1.4; }
.screen .small { margin: 6px 0; font-size: 13px; color: var(--muted); }
.screen ul { margin: 0; padding: 0; list-style: none; text-align: left; font-size: 14px; line-height: 1.5; }
.screen .muted { color: var(--muted); }
.big {
  margin-top: 14px;
  min-width: 180px;
  height: 50px;
  border: 0;
  border-radius: 12px;
  background: var(--gold);
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 3px 0 #9a7424;
}
.link { display: block; margin: 10px auto 0; border: 0; background: none; color: var(--muted); text-decoration: underline; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 12px; }
.choice {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 10px;
  border: 2px solid var(--felt-2);
  border-radius: 12px;
  background: #fffaf0;
  color: var(--ink);
  text-align: left;
}
.choice:hover:not(:disabled) { border-color: var(--gold); }
.choice:disabled { opacity: 0.45; }
.choice b { font-size: 15px; }
.choice:has(.cost) b { padding-right: 34px; }
.choice small { font-size: 12.5px; color: var(--muted); }
.choice .cost { position: absolute; right: 8px; top: 8px; font-size: 12px; }

.ring { display: flex; justify-content: center; gap: 12px; margin: 14px 0 6px; }
.seat {
  width: 120px;
  padding: 10px 6px;
  border-radius: 14px;
  border: 3px solid var(--c);
  background: #fffaf0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform 0.3s;
}
.seat .whip { font-size: 30px; line-height: 1; }
.seat small { color: var(--muted); }
.seat .why { font-size: 11px; color: var(--red); }
.seat em { font-style: normal; font-weight: 800; }
.seat.yes { transform: translateY(-6px); background: #fff1c4; }
.seat.yes em { color: #8a6412; }
.seat.no { opacity: 0.75; }
.seat.no em { color: var(--red); }
.warn { color: var(--red); font-weight: 800; }
.pic svg { display: block; width: 100%; height: auto; border-radius: 12px; margin-bottom: 12px; }
.speaker { display: flex; gap: 12px; align-items: center; margin: 10px 0; text-align: left; }
.speaker .ava { width: 76px; height: 76px; flex: none; }
.speaker b { color: var(--muted); font-size: 13px; }
.speaker p { margin: 2px 0 0; font-size: 16px; line-height: 1.4; }
.goalbars { display: grid; gap: 8px; margin: 12px 0; }
.gb { display: grid; grid-template-columns: 40px 90px 1fr 22px; align-items: center; gap: 8px; text-align: left; font-weight: 800; }
.gb .ava { width: 40px; height: 40px; }
.gb .bar { height: 10px; position: relative; overflow: visible; }
.gb .bar i { background: var(--c); border-radius: 3px; }
.gb.ok .bar i { background: var(--gold); }
.gb .bar::after { content: ""; position: absolute; left: 55%; top: -4px; bottom: -4px; width: 3px; background: var(--ink); }
.gb em { font-style: normal; color: #4a8a32; }
.faces { display: flex; justify-content: center; gap: 10px; margin-bottom: 8px; }
.faces .ava { width: 64px; height: 64px; }
.seat .ava { width: 48px; height: 48px; }

@media (max-width: 760px), (max-height: 520px) {
  .chip { height: 38px; font-size: 13px; padding: 0 7px; }
  .tribe { width: 66px; height: 38px; padding: 4px 5px; }
  .tribe .tn { font-size: 10.5px; }
  .icon { width: 34px; height: 38px; font-size: 14px; }
  .act { min-width: 96px; height: 52px; padding: 4px 10px; }
  .act .ai { font-size: 22px; }
  .act .an { font-size: 13px; }
  .act .as { font-size: 10px; }
  .hint { bottom: 72px; font-size: 13px; }
  .coach { bottom: 70px; }
  .coach .ava { width: 52px; height: 52px; }
  .coach .said p { font-size: 13px; }
  .tribe { width: 112px; }
  .tribe .ava { width: 26px; height: 26px; }
  .act .ai { width: 34px; height: 34px; }
  .toasts { top: 54px; }
  .screen h1 { font-size: 40px; }
}
@media (max-width: 560px) {
  .season { order: 8; flex: 1 0 100%; height: 34px; }
  .hud { justify-content: space-between; }
  .tribes { order: 9; flex: 1 0 100%; }
  .tribe { flex: 1; width: auto; }
  .actions { gap: 5px; width: calc(100vw - 12px); justify-content: center; }
  .act { min-width: 0; width: auto; flex: 1 1 0; max-width: 31vw; padding: 4px 6px; column-gap: 5px; }
  .act .ai { width: 28px; height: 28px; }
  .act .an { font-size: 12px; white-space: normal; }
  .act .an { font-size: 13px; }
}

/* a phone held sideways: the council, the kurultai and the scenes must fit without scrolling */
@media (max-height: 500px) {
  #ui { padding: 6px; }
  .screen { padding: 10px 14px 12px; max-height: calc(100vh - 12px); }
  .screen h2 { font-size: 19px; margin-bottom: 2px; }
  .screen .line { font-size: 13.5px; margin: 3px 0; }
  .screen .small { font-size: 11.5px; margin: 3px 0; }
  .big { height: 40px; margin-top: 6px; font-size: 16px; }
  .ring { margin: 6px 0 2px; gap: 8px; }
  .seat { width: 104px; padding: 5px 4px; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 2px 6px; }
  .seat .ava { width: 30px; height: 30px; }
  .seat .whip { font-size: 18px; }
  .faces .ava { width: 40px; height: 40px; }
  .speaker { margin: 4px 0; }
  .speaker .ava { width: 40px; height: 40px; }
  .speaker p { font-size: 13px; }
  .choices { grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 6px; }
  .choice { padding: 7px 8px; }
  .choice b { font-size: 13px; }
  .choice small { font-size: 11px; }
}

/* the title: the steppe of the day, the chronicle, the steppes */
.title .daily { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 12px auto 0; min-width: 240px; padding: 8px 18px; border-radius: 14px; border: 2px solid rgba(242, 194, 90, 0.8); background: rgba(30, 18, 10, 0.55); color: #fff1d6; }
.title .daily b { font-size: 17px; }
.title .daily small { font-size: 12.5px; color: #e9d3ae; }
.title .daily em { font-style: normal; font-weight: 800; color: #ffb35a; font-size: 13px; }
.title .daily.done { opacity: 0.75; }
.titlerow { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
.titlerow .link { margin-top: 10px; }
.styles { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip-style { padding: 5px 10px; border-radius: 999px; border: 1px solid rgba(242, 194, 90, 0.6); background: rgba(30, 18, 10, 0.5); color: #f4e2c0; font-size: 12px; }
.chip-style.on { background: #f2c25a; color: #2e2116; font-weight: 800; }
.chip-style.locked { opacity: 0.55; }
.chronicle .tiles { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chronicle .tile { padding: 5px 10px; border-radius: 8px; background: #e6d6b6; color: var(--muted); font-size: 13px; font-weight: 700; }
.chronicle .tile.got { background: #f2c25a; color: var(--ink); }
.ava.unknown { filter: grayscale(1) brightness(0.25); }
.deeds li { display: flex; flex-direction: column; padding: 3px 0; color: var(--muted); }
.deeds li.got { color: var(--ink); }
.deeds small { font-size: 12px; color: var(--muted); }
.journal .hint, .hintlist li { display: block; font-size: 12.5px; color: #7a4a2a; font-style: italic; margin-left: 20px; }
.hintlist { margin: 8px 0; }
.choice.suspect { align-items: center; text-align: center; }
.choice.suspect .ava { width: 56px; height: 56px; }
.end .culprit { justify-content: center; text-align: left; }
.end .culprit .ok { color: #3a7a20; font-weight: 800; }
.end .culprit .warn { font-weight: 700; }
.end .glory { font-size: 17px; font-weight: 800; color: #9a6a10; margin: 8px 0 2px; }
.end .deed { font-weight: 800; color: #2f6a1a; margin: 2px 0; animation: titleIn 0.8s ease-out both; }

/* —— the grown-up look: lacquered panels with a gold line, serif titles, no toy colours —— */
.chip, .tribe, .icon, .act, .tip, .toast, .coach .said, .screen {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
}
.icon { display: grid; place-items: center; color: var(--gold-hi); padding: 0; }
.icon svg, .chip .hi svg { width: 20px; height: 20px; display: block; }
.chip .hi { color: var(--gold-hi); display: grid; place-items: center; }
.icon:hover, .act:hover:not(.off) { border-color: var(--gold); box-shadow: var(--shadow), 0 0 14px rgba(217, 164, 65, 0.28); }
.season small { color: var(--ink); font-weight: 600; letter-spacing: 0.02em; }
.tribe { border-left: 3px solid var(--c); }
.tribe .tn { font-family: var(--serif); font-weight: 700; letter-spacing: 0.03em; }
.tribe .bar::after { background: var(--gold-hi); }
.tribe .tick { background: var(--gold); color: #1e140b; }
.tribe .fear { color: #e0805a; font-size: 12px; letter-spacing: 1px; }
.delta { color: #8fd36a; text-shadow: 0 1px 2px #000; }
.act { border-radius: 10px; }
.act .an { font-family: var(--serif); font-weight: 700; letter-spacing: 0.02em; }
.act .ac { color: var(--gold); display: flex; gap: 1px; }
.act .ac svg { width: 13px; height: 13px; }
.act.sel { border-color: var(--gold-hi); background: linear-gradient(180deg, rgba(70, 48, 22, 0.96), rgba(30, 20, 11, 0.96)); box-shadow: 0 0 0 1px var(--gold), 0 0 18px rgba(243, 207, 122, 0.35); }
.act.off { opacity: 0.45; }
.ai, .ava { border-radius: 50%; }
.coach .said { border-radius: 10px 10px 10px 2px; }
.coach .said b, .toast b, .tip small, .speaker b { color: var(--gold); letter-spacing: 0.06em; text-transform: uppercase; font-size: 11px; }
.toast { border-left: 3px solid var(--c, var(--gold)); }
.hint { background: rgba(14, 9, 6, 0.9); border: 1px solid var(--line); border-radius: 8px; }
#ui { background: radial-gradient(ellipse at center, rgba(10, 6, 4, 0.35), rgba(8, 5, 3, 0.78)); }
.screen { border-radius: 10px; padding: 26px 26px 22px; position: relative; }
/* the corners of a panel carry a little ornament, like the edge of a tus kiiz */
.screen::before, .screen::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  border: 2px solid var(--gold);
  opacity: 0.65;
  pointer-events: none;
}
.screen::before { left: 7px; top: 7px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.screen::after { right: 7px; bottom: 7px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }
.screen h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  color: var(--gold-hi);
  font-size: 28px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}
.screen h3 { font-family: var(--serif); color: var(--gold); letter-spacing: 0.08em; text-transform: uppercase; font-size: 12px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.screen .line { color: #ead9b8; }
.big {
  background: linear-gradient(180deg, #f0c86a, #c8902e);
  color: #1e140b;
  border: 1px solid #f7dc98;
  border-radius: 8px;
  box-shadow: 0 2px 0 #6a4510, 0 8px 18px rgba(0, 0, 0, 0.45);
  font-family: var(--serif);
  letter-spacing: 0.04em;
}
.big:hover { filter: brightness(1.08); }
.link { color: var(--muted); text-decoration: none; border-bottom: 1px dotted var(--muted); padding: 0; }
.choice {
  background: linear-gradient(180deg, rgba(48, 34, 22, 0.9), rgba(26, 18, 12, 0.9));
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}
.choice b { font-family: var(--serif); letter-spacing: 0.02em; }
.choice:hover:not(:disabled) { border-color: var(--gold-hi); box-shadow: 0 0 16px rgba(217, 164, 65, 0.3); transform: translateY(-1px); }
.choice .cost { color: var(--gold); display: flex; align-items: center; gap: 2px; }
.choice .cost svg { width: 14px; height: 14px; }
.seat { background: linear-gradient(180deg, rgba(48, 34, 22, 0.9), rgba(22, 15, 10, 0.9)); border: 1px solid var(--c); border-radius: 10px; }
.seat b { font-family: var(--serif); }
.seat.yes { background: linear-gradient(180deg, rgba(110, 78, 30, 0.95), rgba(40, 28, 14, 0.95)); box-shadow: 0 0 18px rgba(243, 207, 122, 0.35); }
.seat.yes em { color: var(--gold-hi); }
.seat .whip { color: var(--gold-hi); }
.warn { color: #e0805a; }
.gb .bar::after { background: var(--gold-hi); }
.gb em { color: var(--gold-hi); }
.chronicle .tile { background: rgba(58, 44, 31, 0.9); color: var(--muted); border: 1px solid var(--line); }
.chronicle .tile.got { background: linear-gradient(180deg, #f0c86a, #c8902e); color: #1e140b; }
.deeds li.got { color: var(--ink); }
.deeds li.got b { color: var(--gold-hi); }
.journal .hint, .hintlist li { color: #d9b77a; }
.end .culprit .ok { color: #9ad46e; }
.end .glory { color: var(--gold-hi); font-family: var(--serif); letter-spacing: 0.04em; }
.end .deed { color: #b9e08e; }
.title .daily { border-radius: 8px; border: 1px solid var(--gold); background: rgba(16, 10, 6, 0.72); }
.title .daily b { font-family: var(--serif); letter-spacing: 0.05em; color: var(--gold-hi); }
.title .daily em { color: #f0a85a; }
.title .play { border-radius: 8px; font-family: var(--serif); letter-spacing: 0.08em; text-transform: uppercase; font-size: 20px; color: #1e140b; background: linear-gradient(180deg, #f6d27e, #c8902e); border: 1px solid #f7dc98; }
.chip-style { border-radius: 6px; font-family: var(--serif); letter-spacing: 0.03em; background: rgba(16, 10, 6, 0.65); }
.chip-style.on { background: linear-gradient(180deg, #f0c86a, #c8902e); }

/* how to play: one line of words over the map, the steps as dots, a way out */
.tour { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 9; width: min(720px, calc(100vw - 20px)); padding: 14px 18px 12px; border-radius: 10px; border: 1px solid var(--gold); background: linear-gradient(180deg, rgba(30, 20, 12, 0.95), rgba(14, 9, 6, 0.95)); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); text-align: center; }
.tourline { margin: 0; font-family: var(--serif); font-size: 19px; line-height: 1.35; color: #f6e6c6; }
.tourline.in { animation: titleIn 0.6s ease-out both; }
.tourdots { display: flex; justify-content: center; gap: 6px; margin: 8px 0 2px; }
.tourdots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(217, 164, 65, 0.3); }
.tourdots i.on { background: var(--gold-hi); }
.tour .big { height: 38px; margin-top: 6px; min-width: 140px; font-size: 15px; }
@media (max-width: 560px), (max-height: 500px) { .tour { bottom: 72px; padding: 8px 10px; } .tourline { font-size: 14px; } .tour .big { height: 32px; } }

/* a long name (the English one) sets smaller and may take two lines */
.title h1.long { font-size: clamp(38px, 6.6vw, 84px); line-height: 1.04; letter-spacing: 0.04em; }

/* the one-line hint (no horses, Aria busy…) must stand out over the map */
.hint { color: #fff1d0; border-color: var(--gold); font-weight: 700; text-shadow: 0 1px 2px #000; }

/* every press answers: a small spring */
button { transition: transform 0.08s ease-out, filter 0.15s, box-shadow 0.15s, border-color 0.15s; }
button:active:not(:disabled) { transform: scale(0.95); }
.act.sel:active { transform: translateY(-1px) scale(0.96); }
/* a horse came back */
#horsesChip.gain { animation: gain 0.6s ease-out; }
@keyframes gain { 30% { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 18px rgba(243, 207, 122, 0.6); transform: scale(1.06); } }

/* the elder's temper on the clan chip */
.tribe .tb { display: grid; grid-template-columns: 1fr auto; align-items: baseline; column-gap: 4px; }
.tribe .tb .bar { grid-column: 1 / -1; grid-row: 2; }
.tribe .trait { grid-row: 1; grid-column: 2; font-size: 10px; font-family: var(--serif); font-style: italic; color: var(--gold); white-space: nowrap; }
.seat .trait { font-family: var(--serif); font-style: italic; color: var(--gold); }
@media (max-width: 560px) { .tribe .trait { display: none; } }

.tribe:has(.trait) { width: 184px; }
@media (max-width: 1100px) { .tribe .trait { display: none; } .tribe:has(.trait) { width: 150px; } }
@media (max-width: 760px), (max-height: 520px) { .tribe:has(.trait) { width: 112px; } }
@media (max-width: 560px) { .tribe:has(.trait) { width: auto; } }

/* the chronicle: every ending a scroll — sealed with a hint how to open it, or open in gold */
.chronicle .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.chronicle .tile { display: grid; grid-template-columns: 22px 1fr; column-gap: 8px; align-items: center; text-align: left; padding: 8px 10px; border-radius: 8px; background: rgba(40, 30, 20, 0.85); border: 1px dashed var(--line); color: var(--muted); }
.chronicle .tile i { grid-row: span 2; color: var(--muted); }
.chronicle .tile i svg { width: 20px; height: 20px; display: block; }
.chronicle .tile b { font-family: var(--serif); font-size: 13px; letter-spacing: 0.04em; }
.chronicle .tile small { font-size: 11px; line-height: 1.3; }
.chronicle .tile.got { background: linear-gradient(180deg, rgba(110, 78, 30, 0.95), rgba(48, 34, 16, 0.95)); border: 1px solid var(--gold); color: var(--ink); }
.chronicle .tile.got i, .chronicle .tile.got b { color: var(--gold-hi); }

/* QA fixes */
.icon[hidden], .act[hidden] { display: none !important; }
/* the top bar stays above a pause screen, so pause and sound still answer */
.hud { z-index: 12; }
/* on a phone the news sits low, out of the way of the bars */
@media (max-width: 560px) { .toasts { top: auto; bottom: 150px; right: 6px; left: 6px; align-items: flex-end; } .toast { max-width: 86vw; } }
/* the title on a phone held sideways: smaller, and it may scroll */
@media (max-height: 500px) {
  #ui.cine { overflow-y: auto; align-items: start; }
  .title { padding: 10px 12px 14px; }
  .title h1 { font-size: 38px; }
  .title h1.long { font-size: 30px; }
  .title .orn { width: 160px; margin: 2px auto; }
  .title .sub { font-size: 14px; margin-bottom: 8px; }
  .title .play { height: 44px; font-size: 16px; min-width: 200px; }
  .title .daily { margin-top: 6px; padding: 5px 12px; }
  .title .daily b { font-size: 14px; }
  .titlerow .link { margin-top: 6px; }
  .styles { margin-top: 6px; }
}
/* a cooldown on an action shows on its button */
.act .cdn { position: absolute; right: 6px; top: 4px; font-size: 11px; font-weight: 800; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.act { position: relative; }
/* the turn-your-phone hint on the title */
.title .rotate { display: none; align-items: center; justify-content: center; gap: 6px; margin-top: 8px; font-size: 13px; color: #e9d3ae; }
.title .rotate svg { width: 20px; height: 20px; animation: tilt 2.4s ease-in-out infinite; }
@keyframes tilt { 0%, 30% { transform: rotate(0); } 50%, 80% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
@media (orientation: portrait) and (max-width: 560px) { .title .rotate { display: flex; } }
@media (max-width: 400px) { .act .as { display: none; } .act .an { font-size: 11.5px; } }

.tribe .fear { display: flex; gap: 2px; }
.tribe .fear svg { width: 11px; height: 11px; display: block; }
.choice .why { color: #e0905a; font-size: 11px; }
/* the chronicle's Back stays in sight while the list scrolls */
.chronicle > .big { position: sticky; bottom: -10px; box-shadow: 0 -10px 18px rgba(14, 9, 6, 0.9), 0 2px 0 #6a4510; }
/* four suspects in one row (two by two on a phone) */
.suspects .choices { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 560px) { .suspects .choices { grid-template-columns: repeat(2, 1fr); } }

/* where the grading pass is off (phones, slow machines) the edges of the world still darken */
.veil { position: fixed; inset: 0; pointer-events: none; z-index: 0; background: radial-gradient(ellipse 75% 70% at 50% 52%, transparent 55%, rgba(16, 10, 5, 0.42) 100%); }
