:root {
  --ink: #e8dbc0;
  --ink-dim: #b6a586;
  --gold: #b08b4f;
  --gold-dim: #6d5731;
  --panel-top: rgba(39, 31, 23, 0.94);
  --panel-bottom: rgba(23, 18, 13, 0.95);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0c0a08;
  color: var(--ink);
  font-family: Georgia, "Palatino Linotype", "Times New Roman", serif;
  -webkit-font-smoothing: antialiased;
}

#screen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  z-index: 0;
}

.panel {
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(176, 139, 79, 0.13);
}

.hidden { display: none !important; }

#hero-card {
  position: fixed;
  top: 14px;
  left: 14px;
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  width: 292px;
  z-index: 10;
}

.portrait {
  width: 54px;
  height: 66px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 26px;
  color: var(--gold);
  background:
    radial-gradient(circle at 50% 35%, rgba(176, 139, 79, 0.28), transparent 62%),
    #17120d;
  border: 1px solid var(--gold-dim);
}

.hero-lines { flex: 1 1 auto; min-width: 0; }

.hero-name {
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f0e3c6;
  margin-bottom: 5px;
}

.bar {
  position: relative;
  height: 13px;
  margin-bottom: 4px;
  background: #14100b;
  border: 1px solid #3b3122;
  overflow: hidden;
}

.bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  transition: width 0.25s linear;
}

.bar-hp span { background: linear-gradient(180deg, #a8472f, #6e2418); }
.bar-ft span { background: linear-gradient(180deg, #4c6a7d, #2a3f4c); }

.bar em {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-style: normal;
  letter-spacing: 0.06em;
  color: #efe3c8;
  text-shadow: 0 1px 2px #000;
}

.apt {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.apt-end { flex: 0 0 auto; }

.apt-track {
  position: relative;
  flex: 1 1 auto;
  height: 6px;
  background: linear-gradient(90deg, #6b3f7a, #3a3a3a 50%, #6d5731);
  border: 1px solid #3b3122;
}

.apt-track i {
  position: absolute;
  top: -3px;
  left: 0;
  width: 3px;
  height: 10px;
  background: #f2e6c8;
  box-shadow: 0 0 6px rgba(242, 230, 200, 0.7);
  transition: left 0.3s ease;
}

.apt b { color: #f0e3c6; font-weight: normal; min-width: 22px; text-align: right; }

#side-panel {
  position: fixed;
  top: 14px;
  right: 14px;
  width: 268px;
  padding: 10px 12px 12px;
  max-height: calc(100vh - 130px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}

.side-head {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 1px solid rgba(176, 139, 79, 0.25);
  padding-bottom: 3px;
}

.log {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  max-height: 30vh;
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink-dim);
}

.log li { padding: 2px 0; border-bottom: 1px dotted rgba(176, 139, 79, 0.12); }
.log li b { color: #f0e3c6; font-weight: normal; }
.log li.hit { color: #d5a08a; }
.log li.good { color: #b9c792; }
.log li.warn { color: #dcc07a; }

.quest { margin: 0; font-size: 12px; line-height: 1.4; color: #ded0b0; }

.party { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.party li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.party li span { color: var(--ink-dim); }
.party li.dead { opacity: 0.45; text-decoration: line-through; }

#action-bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  z-index: 22;
}

#action-bar button,
.sheet-close {
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink);
  background: linear-gradient(180deg, #33291e, #201811);
  border: 1px solid #4a3c28;
  border-radius: 2px;
  padding: 7px 11px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

#action-bar button b { font-weight: normal; color: var(--gold); }
#action-bar button:hover { border-color: var(--gold); color: #fff3d6; }
#action-bar button.on { background: linear-gradient(180deg, #4b3a24, #2a2117); border-color: var(--gold); color: #fff3d6; }
#action-bar button:disabled { opacity: 0.4; cursor: default; border-color: #3a3024; }

.bar-sep { width: 1px; height: 24px; background: rgba(176, 139, 79, 0.3); margin: 0 3px; }

#dialogue {
  position: fixed;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 40px));
  padding: 14px 16px 12px;
  z-index: 24;
}

.dlg-speaker {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}

.dlg-text { margin: 0 0 10px; font-size: 15px; line-height: 1.45; color: #f0e5ca; }
.dlg-options { display: flex; flex-direction: column; gap: 6px; }

.dlg-options button {
  font: inherit;
  font-size: 13px;
  text-align: left;
  color: #e4d6b4;
  background: rgba(20, 16, 11, 0.6);
  border: 1px solid #4a3c28;
  padding: 7px 10px;
  cursor: pointer;
  width: 100%;
}

.dlg-options button:hover { border-color: var(--gold); color: #fff3d6; background: rgba(60, 45, 28, 0.6); }
.dlg-options button.chosen { border-color: var(--gold); color: #fff3d6; }


.tooltip {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  padding: 4px 7px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: #f0e3c6;
  background: rgba(16, 13, 9, 0.92);
  border: 1px solid var(--gold-dim);
  white-space: nowrap;
}
/* ---------- оригинальные ресурсы ---------- */
.originals-btn {
  position: fixed;
  left: 14px;
  bottom: 16px;
  z-index: 23;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(180deg, #33291e, #201811);
  border: 1px solid #4a3c28;
  border-radius: 2px;
  padding: 7px 12px;
  cursor: pointer;
}

.originals-btn:hover { border-color: var(--gold); color: #fff3d6; }

#originals {
  position: fixed;
  inset: 24px;
  z-index: 36;
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
}

.originals-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.originals-body { overflow: auto; }
.originals-body img { display: block; width: 100%; height: auto; }

.originals-note {
  margin: 6px 0 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-dim);
  max-width: 780px;
}

.originals-note code { color: #f0e3c6; }

.originals-sub {
  margin: 16px 0 6px;
  font-size: 12px;
  font-weight: normal;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.originals-body img + .originals-sub { margin-top: 20px; }



.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 40%, rgba(10, 8, 6, 0.55), rgba(6, 5, 4, 0.92));
  z-index: 40;
}

.overlay-card { width: min(680px, 100%); padding: 26px 28px; }

.overlay-kicker {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}

.overlay-card h1 {
  margin: 0 0 12px;
  font-size: 34px;
  font-weight: normal;
  letter-spacing: 0.06em;
  color: #f5ead0;
}

.overlay-lead { margin: 0 0 12px; font-size: 14px; line-height: 1.5; color: #ded0b0; }
.overlay-note { margin: 0 0 14px; font-size: 12px; line-height: 1.45; color: #a9997c; }
.overlay-keys { margin: 0 0 18px; padding-left: 18px; font-size: 12px; line-height: 1.6; color: #bda98a; }
.overlay-keys b { color: #f0e3c6; font-weight: normal; }

button.big {
  font: inherit;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1a140d;
  background: linear-gradient(180deg, #d0b078, #9a7b46);
  border: 1px solid #e0c493;
  padding: 11px 26px;
  cursor: pointer;
}

button.big:hover { background: linear-gradient(180deg, #e0c48e, #ac8a50); }

#sheet {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 32px));
  padding: 16px 18px;
  z-index: 35;
}

.stats { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 10px 0 14px; font-size: 13px; }
.stats dt { color: var(--ink-dim); }
.stats dd { margin: 0; text-align: right; color: #f0e3c6; }

.noscript { color: #e8dbc0; padding: 24px; }

@media (max-width: 980px) {
  #side-panel { display: none; }
  #hero-card { width: 232px; }
  .overlay-card h1 { font-size: 26px; }
  #action-bar { flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 24px); }
}

