:root {
  --panel: rgba(24, 19, 14, 0.86);
  --border: rgba(255, 255, 255, 0.12);
  --text: #eef2f5;
  --muted: #9fb0bf;
  --accent: #d9a441;
  --accent-dark: #b9781f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b1016;
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  user-select: none;
}

#game, #game canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#crosshair {
  position: fixed; left: 50%; top: 50%;
  width: 6px; height: 6px; margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

#hud {
  position: fixed; top: 10px; left: 12px;
  font-size: 12px; color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
}

.overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 10, 16, 0.45);
  backdrop-filter: blur(4px);
  padding: 16px;
}
.hidden { display: none !important; }

.panel {
  width: 100%; max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 26px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

h1, h2 { margin: 0 0 4px; letter-spacing: 0.02em; }
h1 { font-size: 26px; }
h2 { font-size: 22px; margin-bottom: 18px; }
.sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

button {
  width: 100%;
  padding: 11px 14px;
  margin-top: 10px;
  font: inherit; font-size: 15px; font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
button:hover { background: rgba(255, 255, 255, 0.15); }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); border-color: var(--accent-dark); color: #1b1206; margin-top: 0; }
button.primary:hover { background: #f2b456; }

.controls {
  margin-top: 22px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px;
  font-size: 13px; color: var(--muted);
}
kbd {
  display: inline-block; min-width: 20px;
  padding: 1px 6px; margin-right: 3px;
  font: 11px/18px ui-monospace, Consolas, monospace;
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  text-align: center;
}

.setting { margin-top: 18px; }
.setting label { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px; }
.setting label span { color: var(--accent); font-variant-numeric: tabular-nums; }
.setting.row { display: flex; align-items: center; justify-content: space-between; }
.setting.row label { margin: 0; }

input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

.hint { color: var(--accent); font-size: 13px; margin: 8px 0 0; }

#aiStatus { margin-top: 4px; color: #ffcf8a; }
#hints {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: rgba(255,255,255,0.8); text-shadow: 0 1px 2px #000;
  pointer-events: none; white-space: nowrap;
}
#toast {
  position: fixed; top: 18%; left: 50%; transform: translateX(-50%);
  padding: 8px 14px; border-radius: 8px;
  background: rgba(20, 14, 8, 0.8); border: 1px solid var(--border);
  font-size: 14px; color: var(--text);
  opacity: 0; transition: opacity 0.25s; pointer-events: none;
}
#toast.show { opacity: 1; }
h3 { margin: 24px 0 2px; font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); border-top: 1px solid var(--border); padding-top: 18px; }
.btnrow { display: flex; gap: 8px; }
.btnrow button { margin-top: 10px; }
.hint.muted { color: var(--muted); font-size: 12px; }
button:disabled { opacity: 0.6; cursor: progress; }
.panel { max-height: calc(100vh - 32px); overflow-y: auto; }
@media (max-width: 600px) { #hints { display: none; } }

#gameHud {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 10px; pointer-events: none;
}
#gameHud, #raidInfo { display: flex; gap: 10px; }
#gameHud.night #timeLabel { color: #9fb6e8; }
.stat.raid { border-color: #a3362a; background: rgba(120,30,20,0.55); }
.stat.raid .label { color: #ffb4a0; }
.stat.raid .value { color: #ffcf9a; }
#stormInfo.hidden { display: none !important; }
.stat {
  display: flex; flex-direction: column; align-items: center;
  min-width: 108px; padding: 6px 12px; border-radius: 8px;
  background: rgba(20, 14, 8, 0.62); border: 1px solid var(--border);
  text-shadow: 0 1px 2px #000;
}
.stat .label { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stat .value { font-size: 18px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
#crosshair.hit { animation: hitmark 0.25s ease-out; }
/* hit marker: a little X of four ticks round the crosshair */
#hitX { position: fixed; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; opacity: 0; }
#hitX i { position: absolute; left: -1px; top: -9px; width: 2px; height: 6px; background: #fff; box-shadow: 0 0 2px rgba(0,0,0,0.8); transform-origin: 1px 9px; }
#hitX i:nth-child(1) { transform: rotate(45deg) translateY(-3px); }
#hitX i:nth-child(2) { transform: rotate(135deg) translateY(-3px); }
#hitX i:nth-child(3) { transform: rotate(225deg) translateY(-3px); }
#hitX i:nth-child(4) { transform: rotate(315deg) translateY(-3px); }
#hitX.hit { animation: hitx 0.32s ease-out; }
#hitX.kill { animation: hitx 0.6s ease-out; }
#hitX.kill i { background: #ff4a3a; }
@keyframes hitx { 0% { opacity: 1; transform: scale(1.25); } 30% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1); } }
#crosshair.kill { animation: killmark 0.5s ease-out; }
@keyframes hitmark { 0% { transform: scale(2.6); background: #ffd28a; } 100% { transform: scale(1); } }
@keyframes killmark { 0% { transform: scale(3.5); background: #ff6a3a; } 100% { transform: scale(1); } }
button.danger { background: #8a2a1c; border-color: #6a1e14; color: #fff; }
button.danger:hover { background: #a3362a; }
.hint kbd { font-size: 10px; line-height: 15px; }
@media (max-width: 600px) { .stat { min-width: 80px; padding: 4px 8px; } .stat .value { font-size: 15px; } }

#vignette {
  position: fixed; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(120,0,0,0) 45%, rgba(150,0,0,0.75) 100%);
}
#bandages {
  position: fixed; left: 16px; bottom: 70px; padding: 3px 9px; font-size: 12px; color: var(--text);
  background: rgba(20, 14, 8, 0.7); border: 1px solid var(--border); border-radius: 6px; pointer-events: none;
}
#bandages kbd { font-size: 10px; }
#dialog {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); width: min(640px, calc(100vw - 32px));
  background: rgba(24, 17, 10, 0.92); border: 1px solid var(--accent); border-radius: 10px; padding: 14px 18px 12px;
  color: var(--text); pointer-events: none; box-shadow: 0 8px 30px rgba(0,0,0,0.5); z-index: 30;
}
#dialog .dlg-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 6px; }
#dlgName { font-weight: 700; font-size: 17px; color: var(--accent); }
#dlgTitle { font-size: 12px; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.06em; }
#dlgText { font-size: 15px; line-height: 1.5; }
#dlgChoices { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
#dlgChoices .dlg-choice { padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px; background: rgba(255,255,255,0.05); font-size: 14px; }
#dlgHint { margin-top: 8px; font-size: 11px; opacity: 0.6; text-align: right; }
#dlgHint kbd, #dlgChoices kbd { font-size: 10px; }
#leafShade {
  position: fixed; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, #16300f 30%, #071405 100%);
}
#insideShade {
  position: fixed; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, #0d0806 55%, #000 100%);
}
#vignette.flash { animation: hurt 0.7s ease-out; }
@keyframes hurt { 0% { opacity: 1; } 100% { opacity: 0; } }
#healthBar {
  position: fixed; left: 16px; bottom: 44px; width: 220px; height: 18px;
  background: rgba(20, 14, 8, 0.7); border: 1px solid var(--border); border-radius: 9px; overflow: hidden;
  pointer-events: none;
}
#healthFill { height: 100%; width: 100%; background: linear-gradient(90deg, #8a1c14, #c8402c); transition: width 0.06s linear; }
#healthBar span { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 18px; letter-spacing: 0.08em; text-transform: uppercase; text-shadow: 0 1px 2px #000; }
#healthBar.low #healthFill { animation: pulse 0.8s infinite alternate; }
@keyframes pulse { from { filter: brightness(1); } to { filter: brightness(1.6); } }
#deathScreen {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(60, 0, 0, 0.55); pointer-events: none; text-shadow: 0 2px 6px #000;
}
#deathScreen div { font-size: 42px; font-weight: 800; letter-spacing: 0.04em; color: #f2d0c0; }
#deathScreen small { margin-top: 8px; font-size: 15px; color: #e8c8b8; }
#deathScreen.hidden { display: none; }
@media (max-width: 600px) { #healthBar { width: 140px; } }

#hotbar { position: fixed; right: 16px; bottom: 44px; display: flex; gap: 6px; pointer-events: none; }
#hotbar .slot {
  padding: 6px 10px; border-radius: 8px; font-size: 13px;
  background: rgba(20, 14, 8, 0.6); border: 1px solid var(--border); color: var(--muted);
}
#hotbar .slot.on { color: var(--text); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
#hotbar kbd { font-size: 10px; line-height: 15px; }

#hotbar .slot.none { opacity: 0.32; }
#hotbar .dur { width: 100%; height: 3px; background: rgba(0,0,0,0.5); margin-top: 3px; border-radius: 2px; overflow: hidden; }
#shieldHp { height: 100%; width: 0; background: #c9a24a; }
#slotShield { display: flex; flex-direction: column; align-items: stretch; }
#prompt {
  position: fixed; left: 50%; top: 70%; transform: translateX(-50%);
  padding: 5px 12px; border-radius: 6px; background: rgba(20, 14, 8, 0.7); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; pointer-events: none; text-shadow: 0 1px 2px #000; white-space: nowrap;
}

/* ---- Dragon logbook ---- */
#logbook { z-index: 30; }
.lb-book {
  display: flex; width: min(1060px, 96vw); height: min(720px, 92vh); border-radius: 12px; overflow: hidden;
  background: #2a2117; border: 1px solid rgba(217, 164, 65, 0.35); box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.lb-side { width: 240px; flex: none; padding: 18px 14px; background: #1d1711; display: flex; flex-direction: column; gap: 8px; border-right: 1px solid rgba(217,164,65,0.2); }
.lb-side h2 { margin: 0 0 6px; font-size: 20px; color: var(--accent); letter-spacing: 0.02em; }
.lb-list { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow: auto; }
.lb-item { display: flex; align-items: center; gap: 8px; text-align: left; padding: 8px 10px; border-radius: 7px; background: transparent; border: 1px solid transparent; color: var(--text); width: 100%; margin: 0; }
.lb-item:hover { background: rgba(255,255,255,0.05); }
.lb-item.on { background: rgba(217,164,65,0.14); border-color: rgba(217,164,65,0.45); }
.lb-item .sw { width: 16px; height: 16px; border-radius: 4px; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2); }
.lb-item .nm { flex: 1; }
.lb-item .ct { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-page { flex: 1; overflow: auto; padding: 22px 26px; background: linear-gradient(#efe4cc, #e6d7b8); color: #2b2117; }
.lb-head h2 { margin: 0; font-size: 28px; color: #3a2a18; }
.lb-head .sub { font-style: italic; color: #6b5537; margin-bottom: 10px; }
.lb-portrait { width: 100%; aspect-ratio: 420 / 260; border-radius: 8px; overflow: hidden; background: radial-gradient(#cfdbe6, #8fa6b8); border: 1px solid rgba(60,40,20,0.3); }
.lb-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-facts { margin: 12px 0; }
.lb-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.lb-tags span { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: rgba(60,40,20,0.12); color: #3a2a18; }
.lb-bar { display: flex; align-items: center; gap: 10px; font-size: 13px; margin: 3px 0; }
.lb-bar span { width: 80px; color: #5a4529; }
.lb-bar div { flex: 1; height: 7px; border-radius: 4px; background: rgba(60,40,20,0.15); overflow: hidden; }
.lb-bar i { display: block; height: 100%; background: linear-gradient(90deg, #b9781f, #d9a441); }
.lb-text { line-height: 1.55; margin: 10px 0 14px; }
.lb-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.lb-cols h4 { margin: 0 0 4px; color: #4a3520; }
.lb-cols ul { margin: 0; padding-left: 18px; line-height: 1.5; font-size: 14px; }
.lb-seen { margin: 14px 0 10px; font-size: 13px; color: #5a4529; }
.lb-devbtn { margin: 6px 0 10px; background: #3a3a44; color: #e6e6f0; border-color: #555; font-size: 12px; padding: 6px 12px; }
.lb-dev { width: 100%; border-collapse: collapse; font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #1e1f24; color: #d6dae3; border-radius: 6px; overflow: hidden; }
.lb-dev td { padding: 4px 8px; vertical-align: top; border-top: 1px solid #2c2e35; }
.lb-dev td:first-child { color: #9fb0bf; white-space: nowrap; width: 34%; }
.lb-dev tr.sec th { text-align: left; padding: 8px 8px 4px; color: #d9a441; font-weight: 600; background: #26272e; }
@media (max-width: 700px) { .lb-book { flex-direction: column; } .lb-side { width: auto; } .lb-cols { grid-template-columns: 1fr; } }

#gameHud.god::after { content: 'IMMORTAL (dev)'; align-self: center; font-size: 11px; letter-spacing: 0.08em; color: #ffcf6a; padding: 4px 8px; border: 1px solid #ffcf6a; border-radius: 6px; background: rgba(40,30,10,0.6); }

.stat .split { font-size: 10px; color: var(--muted); margin-top: 1px; }

#staminaBar {
  position: fixed; left: 16px; bottom: 34px; width: 220px; height: 6px;
  background: rgba(20, 14, 8, 0.7); border: 1px solid var(--border); border-radius: 3px; overflow: hidden;
  pointer-events: none; transition: opacity 0.6s;
}
#staminaFill { height: 100%; width: 100%; background: linear-gradient(90deg, #b9971f, #e8d06a); }
#staminaBar.full { opacity: 0.35; }
#staminaBar.tired #staminaFill { background: linear-gradient(90deg, #6a5a3a, #8a7a52); }
@media (max-width: 600px) { #staminaBar { width: 140px; } }

/* ---- Main menu, save slots, settings, developer menu ---- */
.overlay { z-index: 20; }
#slotsPanel, #settingsPanel { z-index: 40; }
#devMenu { z-index: 45; }
.menu-bg { background: linear-gradient(180deg, rgba(5,8,12,0.25), rgba(5,8,12,0.75)); backdrop-filter: blur(2px); }
.menu-panel { max-width: 400px; text-align: center; }
.menu-panel h1 { font-size: 30px; letter-spacing: 0.04em; }
.menu-panel .save-note { margin-top: 18px; }
#menuButtons button { margin-top: 10px; }
#menuButtons button.primary { margin-top: 0; }
.panel.wide { max-width: 520px; }
.slot-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: 8px; border: 1px solid var(--border); border-radius: 9px; background: rgba(255,255,255,0.04); }
.slot-row .info { flex: 1; min-width: 0; }
.slot-row .name { font-weight: 700; }
.slot-row .meta { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-row .empty { color: var(--muted); font-style: italic; font-weight: 400; }
.slot-row button { width: auto; margin: 0; padding: 7px 10px; font-size: 13px; }
.slot-row .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 520px) { .slot-row { flex-direction: column; align-items: stretch; } .slot-row .acts { justify-content: flex-start; } }
.dev-panel h2 { color: #ffcf6a; }
.dev-panel { border-color: rgba(255, 207, 106, 0.4); }

/* ---- To-do list ---- */
#todo {
  position: fixed; top: 12px; left: 14px; max-width: 290px; pointer-events: none;
  padding: 8px 12px 9px; border-radius: 8px; background: rgba(20, 14, 8, 0.55); border: 1px solid var(--border);
  text-shadow: 0 1px 2px #000; font-size: 13px;
}
#todo .todo-head { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
#todo ul { list-style: none; margin: 0; padding: 0; }
#todo li { display: flex; gap: 8px; align-items: flex-start; margin-top: 4px; line-height: 1.35; transition: opacity 1s; }
#todo .box { flex: none; width: 11px; height: 11px; margin-top: 3px; border: 1.5px solid rgba(255,255,255,0.75); border-radius: 2px; position: relative; }
#todo li.done .txt { text-decoration: line-through; opacity: 0.6; }
#todo li.done .box { border-color: var(--accent); background: var(--accent); }
#todo li.done .box::after { content: ''; position: absolute; left: 3px; top: 0px; width: 3px; height: 6px; border: solid #1b1206; border-width: 0 2px 2px 0; transform: rotate(45deg); }
#todo li.new .txt { animation: todoNew 2.4s ease-out; }
#todo small { display: block; font-size: 11px; color: var(--muted); }
@keyframes todoNew { 0%, 30% { color: #ffd889; } 100% { color: inherit; } }
#hud { top: auto; bottom: 120px; }

/* ---- New game: story text, then the flight over the island ---- */
#intro { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; cursor: pointer; }
#introText { max-width: 640px; text-align: center; font-family: Georgia, "Times New Roman", serif; font-size: clamp(18px, 2.4vw, 26px); line-height: 1.6; color: #e9dfcc; }
#introText p { margin: 0 0 18px; opacity: 0; transform: translateY(6px); transition: opacity 1.6s ease, transform 1.6s ease; }
#introText p.on { opacity: 1; transform: none; }
#introHint { position: absolute; bottom: 28px; font-size: 13px; color: rgba(233, 223, 204, 0.55); }
#introHint kbd { font-size: 10px; }
#cine { position: fixed; inset: 0; z-index: 15; pointer-events: none; }
#cine .bar { position: absolute; left: 0; right: 0; height: 11vh; background: #000; }
#cine .bar.top { top: 0; } #cine .bar.bottom { bottom: 0; }
#cineCaption { position: absolute; left: 50%; bottom: calc(11vh + 22px); transform: translateX(-50%); width: min(760px, 90vw); text-align: center; font-family: Georgia, "Times New Roman", serif; font-size: clamp(16px, 2vw, 22px); color: #f3ead8; text-shadow: 0 2px 8px #000; opacity: 0; transition: opacity 1.2s; }
#cineCaption.on { opacity: 1; }
#cineHint { position: absolute; right: 18px; bottom: calc(11vh - 30px); font-size: 12px; color: rgba(255,255,255,0.5); }
#cineHint kbd { font-size: 10px; }
#fade { position: fixed; inset: 0; z-index: 60; background: #000; opacity: 0; pointer-events: none; transition: opacity 1.2s ease; }
#fade.on { opacity: 1; }
body.cinematic #bandageHud, body.inmenu #bandageHud, body.cinematic #crosshair, body.cinematic #hotbar, body.cinematic #healthBar, body.cinematic #staminaBar, body.cinematic #gameHud,
body.cinematic #hints, body.cinematic #todo, body.cinematic #prompt, body.cinematic #bandages, body.inmenu #crosshair, body.inmenu #hotbar,
body.inmenu #healthBar, body.inmenu #staminaBar, body.inmenu #gameHud, body.inmenu #hints, body.inmenu #todo, body.inmenu #prompt, body.inmenu #bandages { visibility: hidden; }
@media (max-width: 1100px) { #todo { max-width: 250px; font-size: 12px; } }
/* what you're carrying: a short list in the bottom left, one row per thing you have */
#resources {
  position: fixed; left: 16px; bottom: 70px; min-width: 120px; padding: 5px 9px; font-size: 12px; color: var(--text);
  background: rgba(20, 14, 8, 0.7); border: 1px solid var(--border); border-radius: 6px; pointer-events: none;
  display: flex; flex-direction: column; gap: 2px;
}
#resources.hidden { display: none; }
#resources .res { display: flex; align-items: baseline; gap: 10px; }
#resources .res .nm { flex: 1; opacity: 0.85; }
#resources .res .n { font-weight: 700; font-variant-numeric: tabular-nums; }
#resources .res kbd { font-size: 10px; }
#resources .res.flash { color: var(--accent); }
#resources .res.flash .nm { opacity: 1; }
body.cinematic #resources, body.inmenu #resources { visibility: hidden; }
/* logbook: a kind you haven't caught yet */
.lb-item.unknown .nm { color: var(--muted); font-style: italic; }
.lb-portrait.unknown img { filter: saturate(0.6); }
.lb-unknown { margin: 12px 0; padding: 10px 12px; border-radius: 8px; background: rgba(60,40,20,0.1); color: #4a3520; line-height: 1.5; }

/* ---- time and food in the top right; compass along the top ---- */
#gameHud { left: auto; right: 14px; transform: none; }
#compass {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%); width: min(420px, 30vw); height: 30px; overflow: hidden;
  pointer-events: none; border-radius: 6px; background: rgba(20, 14, 8, 0.5); border: 1px solid var(--border);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent); mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
}
#compassStrip { position: absolute; inset: 0; }
#compassStrip span { position: absolute; top: 0; transform: translateX(-50%); color: var(--text); text-shadow: 0 1px 2px #000; }
#compassStrip .lbl { top: 6px; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; }
#compassStrip .lbl.n { color: #ff8a6a; }
#compassStrip .lbl.mid { font-size: 10px; top: 9px; color: var(--muted); font-weight: 600; }
#compassStrip .tick { top: 22px; width: 1px; height: 6px; background: rgba(255,255,255,0.5); }
#compass .needle { position: absolute; left: 50%; top: 0; width: 2px; height: 6px; margin-left: -1px; background: var(--accent); }
#compassPin { position: absolute; top: 2px; width: 14px; height: 14px; margin-left: -7px; color: #ffd36a; font-size: 13px; line-height: 14px; text-align: center; text-shadow: 0 0 4px #000; }
#compassDist { position: fixed; top: 40px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: #ffd36a; text-shadow: 0 1px 2px #000, 0 0 4px #000; pointer-events: none; white-space: nowrap; padding: 1px 5px; border-radius: 4px; background: rgba(20, 14, 8, 0.55); }
#todo li.pinned .txt::before { content: '📍 '; }
body.cinematic #compass, body.inmenu #compass, body.cinematic #compassDist, body.inmenu #compassDist { visibility: hidden; }
#todoMenu { z-index: 42; }
.todo-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin-top: 8px; border: 1px solid var(--border); border-radius: 9px; background: rgba(255,255,255,0.04); }
.todo-row.pinned { border-color: #ffd36a; background: rgba(255, 211, 106, 0.08); }
.todo-row .info { flex: 1; min-width: 0; }
.todo-row .where { font-size: 12px; color: var(--muted); margin-top: 2px; }
.todo-row button { width: auto; margin: 0; padding: 6px 12px; font-size: 13px; }

/* research bench and anvil: a name, and the price as a short list */
.bench-row .cost { margin: 4px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.bench-row .cost li::marker { color: var(--accent); }
.bench-row .muted { color: var(--muted); font-weight: 400; }

/* bandages: to the right of the health bar, a + and the count, with the key to use one */
#bandageHud {
  position: fixed; left: 244px; bottom: 44px; height: 18px; padding: 0 6px 0 7px; display: flex; align-items: center; gap: 5px;
  background: rgba(20, 14, 8, 0.7); border: 1px solid var(--border); border-radius: 9px; pointer-events: none;
  font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums;
}
#bandageHud.hidden { display: none; }
#bandageHud b { color: #e05a48; font-size: 15px; line-height: 1; font-weight: 800; }
#bandageHud span { font-weight: 700; }
#bandageHud kbd { font-size: 10px; padding: 0 4px; }
@media (max-width: 600px) { #bandageHud { left: 164px; } }

/* low health: red creeping in from the edges of the screen (opacity set by the game) */
#lowHealth {
  position: fixed; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(120,0,0,0) 38%, rgba(140,0,0,0.45) 68%, rgba(175,0,0,0.9) 100%);
  box-shadow: inset 0 0 120px 30px rgba(150, 0, 0, 0.6); transition: opacity 0.5s linear;
}
#lowHealth.throb { animation: lowbeat 0.9s ease-in-out infinite alternate; }
@keyframes lowbeat { from { filter: brightness(0.8); } to { filter: brightness(1.35) saturate(1.2); } }
body.inmenu #lowHealth, body.cinematic #lowHealth { visibility: hidden; }

/* UI size (Settings): every piece of the interface is drawn at --ui times its normal size */
:root { --ui: 1; }
#crosshair, #hitX, #hotbar, #prompt, #healthBar, #bandageHud, #staminaBar, #resources, #dialog, #gameHud,
#todo, #compass, #compassDist, #hud, #hints, #toast, #deathScreen > *, .panel, .lb-book { zoom: var(--ui); }

/* Settings: a wide panel, two columns side by side (one on narrow screens) */
.panel.settings-panel { max-width: min(860px, calc((100vw - 32px) / var(--ui))); }
.settings-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 34px; }
.settings-col > h3:first-child { margin-top: 0; }
.settings-col .controls { grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .settings-cols { grid-template-columns: 1fr; } }
/* every menu stays on screen whatever the UI size: limits are divided by the zoom */
.panel { max-width: min(380px, calc((100vw - 32px) / var(--ui))); max-height: calc((100vh - 32px) / var(--ui)); overflow-y: auto; }
.menu-panel { max-width: min(400px, calc((100vw - 32px) / var(--ui))); }
.panel.wide { max-width: min(520px, calc((100vw - 32px) / var(--ui))); }
.lb-book { width: min(1060px, calc(96vw / var(--ui))); height: min(720px, calc(92vh / var(--ui))); }
#dialog { width: min(640px, calc((100vw - 32px) / var(--ui))); }
#todo { max-height: calc((100vh - 220px) / var(--ui)); overflow: hidden; }

/* food made or lost each day, under the food count */
.stat .rate { font-weight: 700; margin-top: 2px; }
.stat .rate.neg { color: #e0705a; }
.stat .rate.pos { color: #7ccf6a; }

/* =====================================================================================
   Parchment and carved-wood look (ui/frame.webp, ui/clock.webp and the resource icons).
   Menus and the bigger HUD boxes are framed parchment with dark ink; the frame is a
   9-slice border image, so it fits any size.
   ===================================================================================== */
.panel, #todo, #gameHud .stat:not(.raid), #resources, #toast, #dialog {
  --text: #2e1d0e; --muted: #6b4f33; --accent: #8a4512; --accent-dark: #5e2e0b; --border: rgba(70, 40, 15, 0.28);
  color: var(--text); text-shadow: none;
  background: none; border-style: solid; border-color: transparent;
  border-image: url(hud/frame.webp) 52 fill / 22px / 0 stretch;
  border-radius: 0; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.panel { padding: 34px 34px 30px; border-width: 30px; border-image-width: 34px; }
.panel h2 { color: #3a220c; font-family: Georgia, "Times New Roman", serif; letter-spacing: 0.03em; }
.panel h3 { font-family: Georgia, "Times New Roman", serif; }
.panel .sub, .panel .hint.muted { color: var(--muted); }
.panel button { background: rgba(90, 55, 25, 0.12); border: 1px solid rgba(70, 40, 15, 0.4); color: #2e1d0e; }
.panel button:hover { background: rgba(90, 55, 25, 0.22); }
.panel button.primary { background: #6e4019; border-color: #4a2a0e; color: #f7e8c8; }
.panel button.primary:hover { background: #855024; }
.panel button.danger { background: #8a2a1c; border-color: #5e1810; color: #fbe6d8; }
.panel kbd, #todo kbd, #resources kbd, #toast kbd, #dialog kbd { color: #2e1d0e; background: rgba(255, 245, 220, 0.6); border-color: rgba(70, 40, 15, 0.45); }
.panel .todo-row { background: rgba(255, 248, 230, 0.35); border-color: rgba(70, 40, 15, 0.3); }
.panel .todo-row.pinned { background: rgba(200, 140, 40, 0.18); border-color: #a8701e; }
.panel input[type="range"], .panel input[type="checkbox"] { accent-color: #7a4416; }
.dev-panel h2 { color: #8a2a12; }
/* the pause menu's dim background stays dim; the panels are the parchment */
.overlay { background: rgba(8, 6, 4, 0.5); }

/* the to-do list, top left */
#todo { padding: 12px 18px 13px; border-width: 18px; border-image-width: 22px; border-radius: 0; }
#todo .todo-head { color: #8a4512; font-family: Georgia, serif; font-size: 11px; }
#todo .box { border-color: rgba(60, 35, 12, 0.75); }
#todo li.done .box { border-color: #6e4019; background: #6e4019; }
#todo li.done .box::after { border-color: #f7e8c8; }
#todo small { color: #6b4f33; }

/* food, top right */
#gameHud { align-items: flex-start; }
#gameHud .stat:not(.raid) { padding: 6px 14px 7px; border-width: 14px; border-image-width: 18px; min-width: 120px; }
#gameHud .stat .label { color: #6b4f33; font-family: Georgia, serif; }
#gameHud .stat .value { color: #2e1d0e; }
#gameHud .stat .split { color: #6b4f33; }
.stat .rate.neg { color: #a62a14; }
.stat .rate.pos { color: #2e7a1e; }

/* the clock: the round parchment dial, a sun and moon painted on it, and a hand that goes
   round once a day (day across the top half, night across the bottom) */
#clock { position: relative; width: 104px; height: 104px; flex: none; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.45)); }
#clock::before { content: ''; position: absolute; inset: 0; background: url(hud/clock.webp) center / contain no-repeat; }
#clockDial { position: absolute; inset: 15px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(180deg, rgba(240, 200, 110, 0.35) 0 50%, rgba(40, 50, 90, 0.35) 50% 100%); }
#clockDial .sun, #clockDial .moon { position: absolute; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; }
#clockDial .sun { top: 7px; background: radial-gradient(circle, #ffd25a 45%, #e08a1a 70%, transparent 72%); }
#clockDial .moon { bottom: 7px; background: radial-gradient(circle at 60% 40%, transparent 38%, #e6e2cf 40%, #c9c3a8 70%, transparent 72%); }
#clockHand { position: absolute; left: 50%; top: 50%; width: 4px; height: 34px; margin-left: -2px; margin-top: -32px; border-radius: 2px;
  background: linear-gradient(#3a220c, #6e4019); transform-origin: 2px 32px; box-shadow: 0 0 2px rgba(255,240,200,0.6); }
#clockHand::after { content: ''; position: absolute; left: -3px; bottom: -5px; width: 10px; height: 10px; border-radius: 50%; background: #3a220c; border: 2px solid #b48a3c; }
#clockText { position: absolute; left: 0; right: 0; top: 100%; margin-top: 1px; text-align: center; line-height: 1.1; }
#clockText #timeLabel { display: block; font: 700 10px Georgia, serif; letter-spacing: 0.1em; text-transform: uppercase; color: #f3e2bd; text-shadow: 0 1px 2px #000; }
#clockText #timeLeft { display: block; font-size: 12px; font-weight: 700; color: #fff4dc; text-shadow: 0 1px 3px #000; font-variant-numeric: tabular-nums; }
#gameHud.night #timeLabel { color: #b8c8f0; }

/* what you carry, bottom left: the resource icons beside the counts */
#resources { padding: 6px 12px 6px 10px; border-width: 14px; border-image-width: 18px; gap: 3px; min-width: 112px; }
#resources .res { align-items: center; gap: 8px; }
#resources .res .ic { width: 22px; height: 22px; flex: none; background: center / contain no-repeat; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.35)); }
#resources .res .ic.wood { background-image: url(hud/wood.png); }
#resources .res .ic.wool { background-image: url(hud/wool.png); }
#resources .res .ic.rope { background-image: url(hud/rope.png); }
#resources .res .ic.nets { background: radial-gradient(circle, transparent 30%, transparent 31%), repeating-linear-gradient(45deg, #8a6a3a 0 2px, transparent 2px 6px), repeating-linear-gradient(-45deg, #8a6a3a 0 2px, transparent 2px 6px); border-radius: 50%; }
#resources .res.flash { color: #8a4512; }
#foodSplit::before { content: ''; display: inline-block; width: 14px; height: 14px; margin-right: 3px; vertical-align: -3px; background: url(hud/fish.png) center / contain no-repeat; }

/* toasts and dialogue on parchment too */
#toast { padding: 8px 16px; border-width: 14px; border-image-width: 18px; color: #2e1d0e; }
#dialog { border-width: 18px; border-image-width: 22px; padding: 12px 18px 10px; }
#dialog #dlgName { color: #8a2e12; }
#dialog #dlgTitle { color: #6b4f33; opacity: 1; }
#dialog #dlgText { color: #2e1d0e; }
#dialog #dlgHint { color: #6b4f33; }

/* the hotbar: only the things you actually have */
#hotbar .slot.none { display: none; }
#todo li, #todo li .txt { color: #2e1d0e; }
#todo li.new .txt { animation: todoNewInk 2.4s ease-out; }
@keyframes todoNewInk { 0% { color: #b5560e; } 100% { color: #2e1d0e; } }
#foodSplit::before { display: none; }
#gameHud .stat:first-child .label::before { content: ''; display: inline-block; width: 15px; height: 15px; margin-right: 4px; vertical-align: -3px; background: url(hud/fish.png) center / contain no-repeat; }

/* frames: the shadow follows the frame's own shape (a plain box-shadow drew a faint
   rectangle round each menu), and the HUD cards use the thinner border */
.panel, #todo, #gameHud .stat:not(.raid), #resources, #toast, #dialog { box-shadow: none; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.4)); }
#todo, #gameHud .stat:not(.raid), #resources, #toast { border-image: url(hud/frame-thin.webp) 34 fill / 14px / 0 stretch; }
#todo { padding: 10px 14px 11px; border-width: 12px; }
#gameHud .stat:not(.raid) { padding: 5px 12px 6px; border-width: 11px; }
#resources { padding: 5px 10px 5px 8px; border-width: 11px; }
#toast { padding: 7px 14px; border-width: 11px; }
#resources .res .ic.nets { background: url(hud/net.png) center / contain no-repeat; border-radius: 0; }
#resources .res .ic.ore { background-image: url(hud/ore.png); }
#resources .res .ic.iron { background-image: url(hud/iron.png); }
#gameHud .stat:first-child .label::before { background-image: url(hud/sheep.png); width: 17px; height: 17px; }
#foodSplit .mini { display: inline-block; width: 15px; height: 15px; margin-right: 2px; vertical-align: -3px; background: center / contain no-repeat; }
#foodSplit .mini.sheep { background-image: url(hud/sheep.png); }
#foodSplit .mini.fish { background-image: url(hud/fish.png); }
#gameHud .stat:first-child .label::before { display: none; }

/* the mine: a turning stone with five weak points, the pickaxe raised above it */
#mineStage { position: relative; width: 300px; height: 290px; margin: 6px auto 4px; cursor: pointer; user-select: none; }
#mineStage img { -webkit-user-drag: none; pointer-events: none; }
#mineOre { position: absolute; left: 95px; top: 120px; width: 110px; height: 110px; opacity: 0; transform: scale(0.6); transition: opacity 0.35s, transform 0.5s cubic-bezier(.2,1.6,.4,1); filter: drop-shadow(0 0 10px rgba(255,170,90,0.6)); }
#mineBall { position: absolute; left: 70px; top: 95px; width: 160px; height: 160px; }
#mineBall .half { position: absolute; inset: 0; transition: transform 0.6s cubic-bezier(.3,1.4,.5,1), opacity 0.6s; }
#mineBall .half img { width: 100%; height: 100%; display: block; }
/* (the shadow goes on the whole ball, outside the halves' clip-paths, which cut it off square) */
#mineBall { filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6)); }
#mineBall .half.l { clip-path: polygon(0 0, 52% 0, 46% 18%, 55% 36%, 45% 55%, 54% 74%, 48% 100%, 0 100%); }
#mineBall .half.r { clip-path: polygon(52% 0, 100% 0, 100% 100%, 48% 100%, 54% 74%, 45% 55%, 55% 36%, 46% 18%); }
#minePoints { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
#minePoints i { position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%; transform-origin: 9px 9px;
  background: radial-gradient(circle, #ffcf7a 0 25%, #c26a2a 45%, rgba(120,50,20,0) 72%); box-shadow: 0 0 8px rgba(255,170,80,0.8); transition: background 0.2s, box-shadow 0.2s; }
#minePoints i.hit { background: radial-gradient(circle, #1a1410 0 30%, #3a3028 55%, rgba(0,0,0,0) 72%); box-shadow: none; }
#minePick { position: absolute; left: 8px; top: 33px; width: 150px; height: 150px; transform-origin: 18px 138px; filter: drop-shadow(0 4px 5px rgba(0,0,0,0.6)); }
#mineChips { position: absolute; inset: 0; pointer-events: none; }
#mineStage::after { content: ''; position: absolute; left: 146px; top: 101px; width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.35); pointer-events: none; }
#mineStage.cracked #mineOre { opacity: 1; transform: scale(1); }
#mineStage.cracked .half.l { transform: translate(-48px, 14px) rotate(-22deg); opacity: 0.95; }
#mineStage.cracked .half.r { transform: translate(48px, 14px) rotate(22deg); opacity: 0.95; }
#mineStage.cracked #minePoints { display: none; }
#mineStage.done #mineBall, #mineStage.done #minePick { opacity: 0.35; filter: grayscale(1); }

/* swimming: the sea closing over your head, how much breath is left, and a warning about the current */
#underwater { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.4s;
  background: radial-gradient(ellipse at center, rgba(20, 70, 90, 0.55) 30%, rgba(4, 22, 34, 0.92) 100%); }
#underwater.on { opacity: 1; }
#airBar { position: fixed; left: 16px; bottom: 98px; width: 220px; height: 14px; pointer-events: none;
  background: rgba(20, 14, 8, 0.7); border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
#airFill { height: 100%; width: 100%; background: linear-gradient(90deg, #2a6a8a, #7ac4e0); }
#airBar span { position: absolute; inset: 0; text-align: center; font-size: 10px; line-height: 14px; letter-spacing: 0.08em; text-transform: uppercase; text-shadow: 0 1px 2px #000; }
#currentWarn { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); padding: 6px 14px; border-radius: 8px; pointer-events: none;
  background: rgba(10, 30, 44, 0.8); color: #dff2fa; font-size: 14px; text-shadow: 0 1px 2px #000; }
@media (max-width: 600px) { #airBar { width: 140px; } }

/* a progress bar below the crosshair while you work at something (bandaging, rebuilding…) */
#progress { position: fixed; left: 50%; top: calc(70% + 40px); transform: translateX(-50%); width: min(300px, 70vw); pointer-events: none;
  padding: 6px 12px 8px; border-radius: 8px; background: rgba(20, 14, 8, 0.72); border: 1px solid var(--border); text-align: center; }
#progressLabel { display: block; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text); text-shadow: 0 1px 2px #000; margin-bottom: 5px; }
#progress .track { height: 10px; border-radius: 5px; background: rgba(0, 0, 0, 0.55); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,0.6); }
#progressFill { height: 100%; width: 0; background: linear-gradient(90deg, #8a5a26, #e0a050); border-radius: 5px; }

/* under the raid sign: a dragon was killed */
#raidInfo { flex-direction: column; align-items: center; }
.raid-note { padding: 3px 10px; border-radius: 6px; background: rgba(40, 20, 12, 0.75); border: 1px solid #a3362a; color: #ffd8b0;
  font-size: 12px; white-space: nowrap; pointer-events: none; text-shadow: 0 1px 2px #000; animation: raidNote 0.4s ease-out; }
@keyframes raidNote { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
#resources .res .ic.mushrooms { background-image: url(hud/mushrooms.png); }
#resources .res .ic.wheat { background-image: url(hud/wheat.png); }
.mini.grain { background-image: url(hud/wheat.png); }

/* the torch (F): always on the hotbar, lit while it's out */
#hotbar .slot.torch { display: flex; align-items: center; gap: 5px; padding: 4px 9px 4px 7px; }
#hotbar .slot.torch .ico { width: 17px; height: 23px; filter: drop-shadow(0 1px 1px #000); }
#hotbar .slot.torch .fl { fill: #6b5a44; } #hotbar .slot.torch .fc { fill: #8a7658; }
#hotbar .slot.torch .hd { fill: #5a4a3a; } #hotbar .slot.torch .sk { fill: #6a4a2a; }
#hotbar .slot.torch .bd { stroke: #3a2614; stroke-width: 1; fill: none; }
#hotbar .slot.torch.on .fl { fill: #f08a24; } #hotbar .slot.torch.on .fc { fill: #ffe08a; }
#hotbar .slot.torch.on .ico { filter: drop-shadow(0 0 4px rgba(255, 150, 50, 0.9)) drop-shadow(0 1px 1px #000); }

/* fishing: the reeling game (right of centre) and the strike hint */
#fishGame { position: fixed; left: calc(50% + 140px); top: 50%; transform: translateY(-50%); display: flex; gap: 8px; align-items: flex-end; pointer-events: none; z-index: 30; }
#fishGame .fg-track { position: relative; width: 70px; height: 360px; border-radius: 10px; background: linear-gradient(#21485e, #0d2533); border: 2px solid #b48a3c; box-shadow: 0 2px 10px rgba(0,0,0,0.6), inset 0 0 12px rgba(0,0,0,0.6); overflow: hidden; }
#fishGame .fg-zone { position: absolute; left: 4px; right: 4px; bottom: 0; height: 96px; border-radius: 8px; background: rgba(120, 200, 110, 0.35); border: 2px solid rgba(150, 230, 130, 0.7); }
#fishGame .fg-zone.on { background: rgba(140, 230, 120, 0.55); border-color: #c8ff9a; }
#fishGame .fg-fish { position: absolute; left: 0; right: 0; bottom: 0; height: 36px; line-height: 36px; text-align: center; font-size: 32px; filter: drop-shadow(0 1px 1px #000); }
#fishGame .fg-bar { width: 16px; height: 360px; border-radius: 8px; background: rgba(0,0,0,0.55); border: 1px solid #b48a3c; position: relative; overflow: hidden; }
#fishGame .fg-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 30%; background: linear-gradient(#ffd36a, #c9862a); }
#fishGame .fg-hint { position: absolute; left: 0; top: calc(100% + 10px); width: 280px; font-size: 15px; color: #f3ead8; text-shadow: 0 1px 2px #000; }
#fishHint { position: fixed; left: 50%; top: calc(50% + 40px); transform: translateX(-50%); padding: 4px 10px; border-radius: 6px; font-size: 14px; color: #f3ead8; background: rgba(20, 14, 8, 0.65); text-shadow: 0 1px 2px #000; pointer-events: none; white-space: nowrap; z-index: 30; }
body.cinematic #fishGame, body.inmenu #fishGame, body.cinematic #fishHint, body.inmenu #fishHint { display: none; }

/* the raid warning: bright, readable text on its red plate */
#gameHud .stat.raid, #raidInfo .stat.raid { background: linear-gradient(#8e2418, #5e140c) !important; border: 1px solid #ff9a6a !important; box-shadow: 0 0 10px rgba(255, 80, 40, 0.45); }
#gameHud .stat.raid .label, #raidInfo .stat.raid .label { color: #fff3e0 !important; font-weight: 700; font-size: 12px; letter-spacing: 0.1em; text-shadow: 0 1px 2px #000, 0 0 6px rgba(0,0,0,0.8); }
#gameHud .stat.raid .value, #raidInfo .stat.raid .value { color: #ffd36a !important; text-shadow: 0 1px 2px #000; }

/* the to-do menu's "Places" section: always there, below the jobs */
.todo-section { margin: 16px 2px 2px; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.7; border-top: 1px solid var(--border); padding-top: 10px; }
.todo-row.place { padding-top: 6px; padding-bottom: 6px; }

/* bigger dialogue text */
#dlgText { font-size: 19px; line-height: 1.5; }
#dlgName { font-size: 20px; }
#dlgChoices .dlg-choice { font-size: 16px; }
#dlgHint { font-size: 13px; }

/* the hall's oven: ingredient toggles */
.cook-pick { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.cook-pick button { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: rgba(0,0,0,0.25); color: inherit; font: inherit; cursor: pointer; }
.cook-pick button.on { background: #b9862c; color: #1d140a; border-color: #ffd36a; font-weight: 700; }
.cook-pick button:disabled { opacity: 0.4; cursor: default; }

/* the furnace's prompt: a bar for the ingot being smelted and the count still to come */
.fprog { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; vertical-align: middle; }
.fbar { display: inline-block; width: 64px; height: 7px; border-radius: 4px; background: rgba(0,0,0,0.5); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18); overflow: hidden; }
.fbar i { display: block; height: 100%; background: linear-gradient(90deg, #ff8a2a, #ffc46a); }
.fnum { font-weight: 700; color: #ffc46a; min-width: 1em; }
#sheepCount.low { color: #ff4a3a; text-shadow: 0 0 8px rgba(255,60,40,0.5); }

/* the end of the game: cast out */
#cine.exile #cineHint { display: none; }
#exileScreen { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: #000; color: #f3ead8; text-align: center; font-family: Georgia, "Times New Roman", serif; }
#exileScreen.hidden { display: none; }
#exileScreen .ex-title { font-size: clamp(36px, 6vw, 64px); letter-spacing: 0.08em; color: #e8c8a8; }
#exileScreen p { font-size: clamp(15px, 1.8vw, 20px); max-width: 640px; opacity: 0.85; margin: 0 16px 10px; }

/* the catapult's strength (scroll wheel) */
#catPower { position: fixed; left: 50%; bottom: 170px; transform: translateX(-50%); z-index: 12; display: flex; align-items: center; gap: 10px; padding: 7px 14px; border-radius: 10px; background: rgba(20,16,12,0.62); color: #f1e6cf; font: 600 14px/1 Georgia, serif; letter-spacing: 0.03em; pointer-events: none; }
#catPower.hidden { display: none; }
#catPower .cp-bar { width: 150px; height: 9px; border-radius: 5px; background: rgba(0,0,0,0.55); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15); overflow: hidden; }
#catPower .cp-bar i { display: block; height: 100%; width: 80%; background: linear-gradient(90deg, #c9a35a, #ffb35c, #ff6a3a); transition: width 0.12s; }
#catPower b { min-width: 3.2em; text-align: right; color: #ffd28a; }
#catPower small { opacity: 0.6; font-size: 11px; }

/* the Pit's pens: a card per dragon */
.pens-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; max-height: 58vh; overflow-y: auto; margin: 8px 0 12px; padding-right: 4px; }
.pen-card { border: 1px solid var(--border); border-radius: 8px; background: rgba(255,255,255,0.04); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.pen-card.out { border-color: #d9a441; box-shadow: 0 0 0 1px #d9a44155 inset; }
.pen-head { display: flex; align-items: center; gap: 10px; }
.pen-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(0,0,0,0.35); flex: none; }
.pen-name { font-weight: 700; font-size: 16px; }
.pen-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; font-size: 13px; }
.pen-stats div { display: flex; justify-content: space-between; gap: 6px; }
.pen-stats span { opacity: 0.7; }
.pen-tame { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; font-size: 13px; }
.pen-tame b { grid-column: 1 / -1; font-size: 12px; opacity: 0.85; }
.pen-tame .tbar { height: 8px; border-radius: 4px; background: rgba(0,0,0,0.3); overflow: hidden; }
.pen-tame .tbar i { display: block; height: 100%; background: linear-gradient(90deg, #c96a6a, #e9c46a, #7fbf6a); }
.pen-card button { align-self: stretch; }

/* the little pictures by the places in the to-do list */
.todo-row .pico { width: 26px; height: 26px; flex: none; padding: 4px; border-radius: 6px; background: rgba(120, 84, 40, 0.18); color: #6b4a22; box-sizing: border-box; }

/* riding a dragon: the controls, along the bottom */
#rideHelp { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 6; padding: 6px 12px; border-radius: 8px; background: rgba(20, 14, 8, 0.6); color: #f1e6cf; font-size: 13px; white-space: nowrap; pointer-events: none; }
#rideHelp kbd { background: rgba(255,255,255,0.15); border-radius: 4px; padding: 0 5px; }
body.inmenu #rideHelp, body.cinematic #rideHelp { display: none; }

/* hold E to skip a spoken line */
.dlg-hold { display: inline-flex; align-items: center; gap: 6px; }
.dlg-holdbar { display: inline-block; width: 46px; height: 4px; border-radius: 2px; background: rgba(107, 79, 51, 0.25); overflow: hidden; vertical-align: middle; }
.dlg-holdbar i { display: block; height: 100%; width: 0%; background: #8a5a2b; }
#devMenu select { font: inherit; font-size: 12px; padding: 3px 6px; border-radius: 4px; border: 1px solid rgba(107, 79, 51, 0.45); background: #f3e8d2; color: #3a2a1a; max-width: 230px; }

/* ---- controller and touch screen (js/input.js) ---- */
.pad-focus { outline: 3px solid #f2c14e !important; outline-offset: 2px; box-shadow: 0 0 0 6px rgba(242, 193, 78, 0.25) !important; }
.dlg-choice { pointer-events: auto; cursor: pointer; }
kbd.kbd-gone { display: none; }
#touchUI { display: none; position: fixed; inset: 0; z-index: 8; pointer-events: none; user-select: none; -webkit-user-select: none; }
#touchUI.show { display: block; }
body.input-touch { touch-action: none; overscroll-behavior: none; }
#tLook { position: absolute; left: 40%; right: 0; top: 0; bottom: 0; pointer-events: auto; }
#tStickZone { position: absolute; left: 0; bottom: 0; width: 40%; height: 70%; pointer-events: auto; }
#tStick { position: absolute; left: 40px; bottom: 40px; width: 140px; height: 140px; border-radius: 50%; background: rgba(20, 14, 8, 0.28); border: 2px solid rgba(243, 234, 216, 0.35); opacity: 0.55; }
#tStick.live { opacity: 1; bottom: auto; }
#tKnob { position: absolute; left: 45px; top: 45px; width: 50px; height: 50px; border-radius: 50%; background: rgba(243, 234, 216, 0.7); box-shadow: 0 2px 8px rgba(0,0,0,0.4); }
#tBtns { position: absolute; right: 22px; bottom: 28px; display: grid; grid-template-columns: 76px 76px; gap: 12px; pointer-events: auto; }
#tRow { position: absolute; right: 16px; bottom: 206px; width: 300px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; pointer-events: auto; }
#touchUI .tb { font: 600 13px/1 Georgia, serif; width: 66px; color: #f3ead8; background: rgba(20, 14, 8, 0.5); border: 2px solid rgba(243, 234, 216, 0.4); border-radius: 12px; padding: 9px 10px; min-width: 64px; text-shadow: 0 1px 2px #000; touch-action: none; }
#touchUI .tb.big { min-width: 0; width: 76px; height: 76px; border-radius: 50%; padding: 0; font-size: 14px; }
#touchUI .tb.on, #touchUI .tb.latched { background: rgba(242, 193, 78, 0.55); border-color: #f2c14e; color: #1b130a; }
#touchUI.talking #tRow, #touchUI.talking #tStickZone { display: none; }
/* (with the touch controls on the right, the tool bar moves to the bottom middle) */
body.input-touch #hotbar { right: auto; left: 50%; transform: translateX(-50%); bottom: 12px; }

/* the developer menu's picture sliders */
.pfx-tune summary { cursor: pointer; font-weight: 600; }
.pfx-sliders { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(120px, 2fr) 54px; gap: 6px 12px; align-items: center; margin: 10px 0; }
.pfx-sliders label { margin: 0; font-size: 13px; }
.pfx-sliders input[type=range] { width: 100%; }
.pfx-sliders output { font-variant-numeric: tabular-nums; font-size: 12px; text-align: right; opacity: 0.85; }
.pfx-code { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pfx-code input { flex: 1 1 260px; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 12px; padding: 6px 8px; }

/* the developer menu opened during play (P): docked down the right-hand side, the game left
   clear and unblurred beside it so picture settings can be judged as you change them */
#devMenu.docked { background: none; backdrop-filter: none; justify-content: flex-end; align-items: stretch; padding: 8px; pointer-events: none; }
#devMenu.docked .panel { pointer-events: auto; max-width: min(440px, calc((100vw - 16px) / var(--ui))); max-height: calc((100vh - 16px) / var(--ui)); margin: 0; }
