:root {
  --steel: #16181c;
  --steel-2: #1e2228;
  --brass: #c4a574;
  --brass-d: #8a6a3e;
  --cyan: #3ecfff;
  --ink: #e8e0d4;
  --dim: #9a9184;
  --fail: #e07050;
  --ok: #7dcea0;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  background: radial-gradient(1200px 800px at 50% 20%, #242830, var(--steel));
  color: var(--ink);
  overflow: hidden;
  user-select: none;
}
.shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
  padding: 10px;
  gap: 8px;
}
.hud, .dock {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 14px;
  background: linear-gradient(#2a2e36, #16181c);
  border: 1px solid #3a3428;
  border-radius: 10px;
  box-shadow: inset 0 1px 0 #4a4030, 0 8px 24px #0008;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-family: Cinzel, Palatino, serif;
  letter-spacing: 0.12em;
  color: var(--brass);
  text-decoration: none;
}
.brand img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }
.stat { display: flex; flex-direction: column; min-width: 56px; }
.stat b { font-variant-numeric: tabular-nums; font-size: 1.05rem; color: var(--cyan); }
.stat span { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.grow { flex: 1; }
.level-title { font-family: Cinzel, Palatino, serif; }
.level-title small { display: block; color: var(--dim); font-family: "Source Sans 3", sans-serif; letter-spacing: 0.06em; }
#view-wrap {
  position: relative;
  border: 2px solid var(--brass-d);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 0 4px #0c0c0e, inset 0 0 40px #0006;
  background: #0a0c10;
}
#view { width: 100%; height: 100%; display: block; cursor: pointer; touch-action: none; }
.brief {
  position: absolute; left: 16px; top: 16px; max-width: 280px;
  background: #1c1812ee; border: 1px solid var(--brass-d); border-radius: 10px;
  padding: 10px 12px; pointer-events: none; font-size: 0.85rem; color: var(--ink);
  box-shadow: 0 8px 24px #0008;
}
.brief b { color: var(--brass); font-family: Cinzel, Palatino, serif; display: block; margin-bottom: 4px; }
.brief.fade { opacity: 0.35; }
.teach {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: auto;
  touch-action: none;
  padding: 10px 12px 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: linear-gradient(180deg, #0c0a08d8 0%, #0c0a0866 26%, transparent 46%);
}
.teach[hidden] { display: none !important; }
.teach-card {
  pointer-events: none;
  max-width: min(34rem, 92vw);
  background: #1c1812f2;
  border: 1px solid var(--brass);
  border-radius: 10px;
  padding: 10px 14px 8px;
  box-shadow: 0 12px 32px #000a;
  user-select: none;
}
.teach-card h2 {
  font-family: Cinzel, Palatino, serif;
  color: var(--brass);
  margin: 0 0 6px;
  font-size: 1.05rem;
}
.teach-card ol {
  margin: 0 0 8px;
  padding-left: 1.2rem;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.45;
}
.teach-card li { margin: 2px 0; }
body.teaching .hud #sel,
body.teaching .hud #btn-end,
body.teaching .hud #btn-pause,
body.teaching .hud #btn-fame {
  opacity: 0.4;
  pointer-events: none;
}
.modal {
  position: absolute; inset: 0; display: grid; place-items: center; background: #121418cc;
  z-index: 8;
}
.modal[hidden] { display: none !important; }
.panel {
  background: linear-gradient(#2a241c, #16141a);
  border: 1px solid var(--brass);
  border-radius: 12px;
  padding: 22px 24px;
  min-width: min(420px, 92vw);
  max-width: 520px;
  box-shadow: 0 20px 50px #000a;
}
.panel h2 { font-family: Cinzel, Palatino, serif; margin: 0 0 8px; color: var(--brass); }
.panel p { margin: 8px 0; color: var(--dim); }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
button, select, input {
  font: inherit; color: var(--ink);
  background: #2a241c; border: 1px solid var(--brass-d); border-radius: 8px;
  padding: 6px 10px; cursor: pointer;
}
button:hover { border-color: var(--brass); color: var(--brass); }
button.primary { background: #3a3428; border-color: var(--brass); color: var(--brass); }
button.on { background: var(--brass); color: #1c1612; }
button:disabled { opacity: 0.4; cursor: default; }
.act {
  min-width: 84px; text-align: left;
}
.act b { display: block; font-size: 0.82rem; }
.act span { font-size: 0.7rem; opacity: 0.8; }
.hint { font-size: 0.78rem; opacity: 0.75; }
.ad-slot {
  min-height: 0;
  margin-top: 12px;
  background: #141210;
  border: 1px dashed #3a3428;
  border-radius: 8px;
  overflow: hidden;
}
.ad-slot[hidden], .ad-slot[data-ad-state="off"] { display: none !important; }
.who { font-size: 0.75rem; letter-spacing: 0.08em; color: var(--dim); }
#file-hint[hidden] { display: none !important; }
