:root {
  --bg: #0b0f0d;
  --panel: #10160f;
  --panel-raised: #141b12;
  --border: #2a3327;
  --text: #d9a441;
  --text-bright: #f0c169;
  --text-dim: #7a8a76;
  --bad: #c1524e;
  --good: #7fae74;
  --warn: #cf9a4a;
  --font: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

#crt {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
}

#crt::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.12) 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.5;
}

#app {
  width: 100%;
  max-width: 980px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#app-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.title {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  color: var(--text-bright);
  text-shadow: 0 0 8px rgba(240, 193, 105, 0.35);
}

.subtitle {
  color: var(--text-dim);
  font-size: 0.85rem;
}

#main {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 12px;
  min-height: 0;
}

#log-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  height: 58vh;
  overflow: hidden;
}

#log {
  height: 100%;
  overflow-y: auto;
  font-size: 0.92rem;
  line-height: 1.55;
  padding-right: 6px;
}

#log::-webkit-scrollbar,
#sidebar::-webkit-scrollbar { width: 8px; }
#log::-webkit-scrollbar-thumb,
#sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.entry { white-space: pre-wrap; margin-bottom: 2px; }
.entry.echo { color: var(--text-dim); }
.entry.good { color: var(--good); }
.entry.bad { color: var(--bad); }
.entry.warn { color: var(--warn); font-weight: 600; }
.entry.flavor { color: var(--text-dim); font-style: italic; }

#sidebar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px;
  height: 58vh;
  overflow-y: auto;
  font-size: 0.85rem;
}

.sheet-block {
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}
.sheet-block:last-child { border-bottom: none; }

.sheet-name { color: var(--text-bright); font-weight: 700; font-size: 1rem; }
.sheet-sub { color: var(--text-dim); margin-top: 3px; }

.bar-label { margin-top: 8px; margin-bottom: 3px; color: var(--text-dim); font-size: 0.8rem; }
.bar {
  height: 8px;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.bar-fill { height: 100%; }
.bar-fill.hp { background: var(--bad); }
.bar-fill.mp { background: #5b8bb0; }

.inv {
  font-family: var(--font);
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: pre-wrap;
  margin: 4px 0 0;
}

#chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: var(--panel-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 5px 10px;
  border-radius: 3px;
  cursor: pointer;
}
.chip:hover { border-color: var(--text); color: var(--text-bright); }

#input-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
}

.prompt { color: var(--text-bright); font-weight: 700; }

#input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-family: var(--font);
  font-size: 0.95rem;
}
#input::placeholder { color: var(--text-dim); }

#input-form button {
  background: var(--panel-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  padding: 7px 14px;
  border-radius: 3px;
  cursor: pointer;
}
#input-form button:hover { border-color: var(--text); color: var(--text-bright); }

@media (max-width: 720px) {
  #main { grid-template-columns: 1fr; }
  #log-panel, #sidebar { height: auto; }
  #log { height: 46vh; }
  #sidebar { max-height: 26vh; }
}
