:root {
  --wood: #6b4423;
  --wood-mid: #5a381c;
  --wood-dark: #2a160c;
  --wood-light: #c08950;
  --carved: #3d2412;
  --parchment: #f3e2c7;
  --parchment-deep: #e4c79a;
  --ink: #2a1b10;
  --ink-soft: #5a3a20;
  --slot: #7a5230;
  --chat: #1c140c;
  --gold: #e6c15a;
  --btn: #c4a36a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background:
    radial-gradient(ellipse at 50% 0%, #3a2a1c 0%, transparent 55%),
    #1a120c url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12'><rect fill='%231a120c' width='12' height='12'/><path d='M0 6h12M6 0v12' stroke='%23241810' stroke-width='1'/></svg>");
  color: var(--ink);
  font-family: Georgia, "Palatino Linotype", "Times New Roman", serif;
}

#frame {
  max-width: 1120px;
  margin: 18px auto;
  padding: 11px;
  background:
    repeating-linear-gradient(90deg, #5c3a1e 0 3px, #6e4524 3px 7px, #4d3118 7px 10px),
    linear-gradient(#8a5a32, #4a2e18);
  border: 5px solid #1a0e08;
  box-shadow:
    inset 0 0 0 2px #2a160c,
    inset 0 0 0 5px #c08950,
    inset 0 0 0 7px #3d2412,
    10px 12px 0 #0e0906;
}

#frame-inner {
  background:
    linear-gradient(180deg, rgba(243,226,199,0.16), transparent 28%),
    repeating-linear-gradient(180deg, rgba(26,16,8,0.08) 0 2px, transparent 2px 7px);
  padding: 8px 8px 10px;
  border: 2px solid #2a160c;
}

#topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 6px 10px 12px;
  margin-bottom: 8px;
  color: var(--parchment);
  text-shadow: 1px 1px 0 #1a1008;
  background:
    linear-gradient(#4a2e18, #3d2412 70%, #2a160c);
  border: 3px solid #1a0e08;
  box-shadow: inset 0 1px 0 #c08950, inset 0 -2px 0 #1a0e08;
}

.brand h1, .scroll h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 1.5px;
  color: var(--gold);
  font-weight: 700;
}

.tag { margin: 3px 0 0; font-size: 13px; font-style: italic; opacity: 0.92; }

#status { font-size: 12px; text-align: right; font-family: "Trebuchet MS", Verdana, sans-serif; }
.lamp {
  padding: 3px 10px;
  border: 2px solid #2a160c;
  box-shadow: inset 0 1px 0 #f0d9a8, 0 1px 0 #1a0e08;
  background: #6a3;
  color: #14200a;
  font-weight: bold;
}
.lamp.off { background: #a63; color: #2a1008; }
.lamp.wait { background: #ca3; }

#desk { display: flex; gap: 12px; }
#stagewrap {
  flex: 1;
  background: #2a160c;
  border: 3px solid #1a0e08;
  padding: 7px 7px 6px;
  box-shadow: inset 0 0 0 2px #c08950, inset 0 0 0 4px #3d2412;
}
.bevel {
  background: #1a140e;
  border: 3px inset #3d2412;
  padding: 3px;
}
#stage { display: block; image-rendering: pixelated; background: #3d5a28; cursor: crosshair; width: 100%; height: auto; }
#hint {
  color: #f3e2c7;
  font-size: 12px;
  line-height: 1.4;
  padding: 7px 4px 2px;
  text-shadow: 1px 1px 0 #1a1008;
}

#panels { width: 272px; display: flex; flex-direction: column; gap: 10px; }
.panel {
  background:
    linear-gradient(180deg, #f8ead0 0%, #e8c99a 100%);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.85  0 0 0 0 0.72  0 0 0 0 0.5  0 0 0 0.08 0'/></filter><rect width='80' height='80' filter='url(%23n)'/></svg>"),
    linear-gradient(180deg, #f6e6c6, #e0bf8e);
  border: 3px solid #3d2412;
  padding: 10px 11px 11px;
  box-shadow:
    inset 0 0 0 1px #fbf3e0,
    inset 0 0 0 3px #c9a36d,
    3px 4px 0 #1a1008;
}

.panel h2 {
  margin: 0 0 6px;
  font-size: 15px;
  letter-spacing: 0.4px;
  border-bottom: 2px solid #6b4423;
  padding-bottom: 4px;
  color: #3d2412;
}
.panel .sub, .panel p.sub { font-weight: normal; font-size: 11px; color: var(--ink-soft); margin: 0 0 8px; font-family: "Trebuchet MS", Verdana, sans-serif; }
.panel h2 .sub { font-family: Georgia, serif; }
.slim { padding: 8px 11px; }
.credit { margin: 0; font-size: 12px; }
.muted { color: var(--ink-soft); font-size: 11px; }

.loop ol {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
}
.loop em { font-style: italic; color: #4a2e18; }

.skill { margin-bottom: 9px; }
.skill .row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-family: "Trebuchet MS", Verdana, sans-serif;
}
.bar {
  height: 11px;
  background: #3d2412;
  border: 2px solid #2a160c;
  box-shadow: inset 1px 1px 0 #1a0e08, 0 1px 0 #f6e2c0;
  margin-top: 4px;
}
.bar > i { display: block; height: 100%; background: linear-gradient(#a8d86a, #4a8a28); }

.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.slot {
  min-height: 50px;
  background:
    linear-gradient(#5a381c, #3d2412);
  border: 2px solid #1a0e08;
  box-shadow: inset 0 2px 4px #1a0e08, inset 0 0 0 1px #c08950;
  font-size: 11px;
  text-align: center;
  padding: 6px 2px 4px;
  cursor: pointer;
  color: #f3e2c7;
  font-family: "Trebuchet MS", Verdana, sans-serif;
}
.slot.empty {
  opacity: 0.45;
  cursor: default;
  box-shadow: inset 0 2px 5px #1a0e08;
}
.slot .qty { font-weight: bold; color: var(--gold); }

#chatbox {
  margin-top: 12px;
  background: var(--chat);
  border: 3px solid #1a0e08;
  box-shadow: inset 0 0 0 2px #c08950, inset 0 0 0 4px #3d2412;
  color: #3d2412;
}
#log {
  height: 118px;
  overflow-y: auto;
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.4;
  background:
    linear-gradient(180deg, #f7ead0, #edd6aa);
  color: var(--ink);
}
#log .say .who { color: #6b3e10; font-weight: bold; }
#log .evt { color: #245218; }
#log .sys { color: #6a5340; font-style: italic; }
#chatform { display: flex; border-top: 2px solid #3d2412; background: #2a1d12; }
#chat {
  flex: 1;
  border: 0;
  background: #2a1d12;
  color: #f5e6c8;
  padding: 9px 10px;
  font: 14px Georgia, serif;
}
#chatform button, #enter, .scroll button {
  background: linear-gradient(#d4b27a, #b08950);
  border: 3px solid #3d2412;
  box-shadow: inset 0 1px 0 #f6e2c0, 2px 2px 0 #1a1008;
  color: var(--ink);
  font-weight: bold;
  font-family: Georgia, serif;
  padding: 7px 16px;
  cursor: pointer;
}
#chatform button:active, #enter:active {
  transform: translate(1px, 1px);
  box-shadow: inset 0 1px 0 #1a1008;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 10, 6, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
}
.overlay.hidden { display: none; }
.scroll {
  width: 440px;
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.9  0 0 0 0 0.78  0 0 0 0 0.55  0 0 0 0.07 0'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>"),
    linear-gradient(#f7ead2, #e8c99a);
  border: 8px solid #5a381c;
  outline: 3px solid #1a0e08;
  padding: 24px 26px;
  box-shadow: 10px 12px 0 #0e0906, inset 0 0 0 2px #fbf3e0;
}
.scroll .seal {
  margin: 0 0 4px;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #8a6238;
}
.scroll label { display: block; font-size: 14px; margin: 16px 0 12px; }
.scroll input {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 9px;
  border: 3px solid #6b4423;
  background: #fff8e8;
  font: 16px Georgia, serif;
  box-shadow: inset 1px 1px 0 #c9a36d;
}
#enter { width: 100%; padding: 11px; font-size: 17px; }
.fine { font-size: 12px; color: var(--ink-soft); margin: 14px 0 0; line-height: 1.4; }

@media (max-width: 980px) {
  #desk { flex-direction: column; }
  #panels { width: auto; }
}
