:root {
  font-family: system-ui, sans-serif;
}

body {
  margin: 0;
  background: #14171c;
  color: #e8e6df;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #2a2f38;
  position: relative;
}

header h1 {
  margin: 0;
  letter-spacing: 0.05em;
}

header p {
  margin: 0.25rem 0 0;
  color: #9aa3b2;
  font-size: 0.9rem;
}

#scale-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1.5rem;
  background: #1a1e25;
  border-bottom: 1px solid #2a2f38;
  font-size: 0.85rem;
}

#scale-bar label {
  color: #9aa3b2;
}

#scale-bar select {
  background: #1c2027;
  color: inherit;
  border: 1px solid #333a45;
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
}

#scale-status {
  color: #d4af37;
}

main {
  display: flex;
  flex: 1;
  min-height: 0;
}

#scene {
  position: relative;
  flex: 1;
  background: radial-gradient(circle at 50% 40%, #1b2028, #0e1116 72%);
  border-right: 1px solid #2a2f38;
  overflow: hidden;
}

#scene-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

#scale-legend[hidden] {
  display: none;
}

#scale-legend {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  max-width: 75%;
  padding: 0.5rem 0.7rem;
  background: rgba(14, 17, 22, 0.6);
  border-radius: 6px;
  font-size: 0.72rem;
  color: #9aa3b2;
}

#scale-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 0.3rem;
  vertical-align: middle;
}

#scale-stats {
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  color: #cfd4dc;
}

#panel {
  width: 340px;
  padding: 1rem;
  overflow-y: auto;
}

#panel h2 {
  margin-top: 0;
  font-size: 1rem;
  color: #d4af37;
}

#panel h3 {
  font-size: 0.85rem;
  margin: 1rem 0 0.25rem;
  color: #d4af37;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.panel-hint {
  font-size: 0.75rem;
  color: #7d8592;
  margin: 0 0 0.5rem;
  line-height: 1.3;
}

#chain-log {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #2a2f38;
  border-radius: 4px;
  background: #171b21;
  margin-bottom: 1rem;
}

.chain-entry {
  padding: 0.4rem 0.6rem;
  font-size: 0.78rem;
  line-height: 1.35;
  border-bottom: 1px solid #23272f;
}

.chain-entry:last-child {
  border-bottom: none;
}

.chain-empty {
  padding: 0.6rem;
  font-size: 0.78rem;
  color: #7d8592;
  font-style: italic;
  margin: 0;
}

#selected-info {
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
  margin-bottom: 1rem;
}

#ask-form {
  display: flex;
  gap: 0.5rem;
}

#ask-input {
  flex: 1;
  padding: 0.4rem;
  background: #1c2027;
  border: 1px solid #333a45;
  color: inherit;
  border-radius: 4px;
}

#ask-form button {
  padding: 0.4rem 0.8rem;
  background: #d4af37;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

#ask-answer {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.4;
  white-space: pre-wrap;
  color: #cfd4dc;
}

#console-btn {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: #1c2027;
  color: #d4af37;
  border: 1px solid #d4af37;
  border-radius: 3px;
  padding: 0.5rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

#console-btn:hover {
  background: #d4af37;
  color: #14171c;
}

/* --- console page --- */

body.console-page {
  height: auto;
  min-height: 100vh;
}

.console-main {
  padding: 1.5rem;
  max-width: 1100px;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
}

.card {
  background: #1a1e25;
  border: 1px solid #2a2f38;
  border-radius: 5px;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}

.card > h2 {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #d4af37;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pill {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: none;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  border: 1px solid #3f7a52;
  color: #7fd39a;
  background: #16241b;
}

.pill.warn {
  border-color: #7a6a2f;
  color: #d4af37;
  background: #241f12;
}

.kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.4rem 1.5rem;
  font-size: 0.82rem;
}

.kv div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px dotted #262b33;
  padding-bottom: 0.25rem;
}

.kv span:first-child {
  color: #9aa3b2;
}

.kv span:last-child {
  color: #e8e6df;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: right;
  overflow-wrap: anywhere;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.tags code {
  background: #1c2027;
  border: 1px solid #2a2f38;
  border-radius: 3px;
  padding: 0.15rem 0.45rem;
  font-size: 0.74rem;
  color: #7fd4c8;
}

table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

table.grid th {
  text-align: left;
  color: #9aa3b2;
  font-weight: 500;
  border-bottom: 1px solid #2a2f38;
  padding: 0.3rem 0.7rem 0.3rem 0;
}

table.grid td {
  padding: 0.32rem 0.7rem 0.32rem 0;
  border-bottom: 1px solid #1e222a;
  color: #cfd4dc;
  vertical-align: top;
}

table.grid td.num {
  text-align: right;
  color: #d4af37;
}

.console-foot {
  color: #9aa3b2;
  font-size: 0.78rem;
  margin: 0 0 1.5rem;
}
