/* Echoklinge admin panel: the game's palette and names (src/style.css) */
:root {
  color-scheme: dark;
  --night: #0b1014;
  --panel: #10171c;
  --panel-2: #151e24;
  --field: #0b1115;
  --raised: #121a1f;
  --hover: #151f25;
  --selected: #1d1a16;
  --line: rgba(239, 228, 204, 0.11);
  --line-2: rgba(239, 228, 204, 0.24);
  --parchment: #efe4cc;
  --ash: #a2aba5;
  --ash-2: #6f7a76;
  --ember: #ff9a3c;
  --ember-light: #ffcf8a;
  --echo: #74d3c6;
  --blood: #e0484e;
  --blood-light: #ffb3b5;
  --good: #8fe39a;
  --display: "Grenze Gotisch", Georgia, serif;
  --ui: "Signika", "Trebuchet MS", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--night); color: var(--parchment); font: 14px/1.4 var(--ui); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---- login ---- */
.login {
  height: 100%;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 30%, #17232b, var(--night) 70%);
}
.login form {
  width: 340px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 26px 26px 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.login h1 { margin: 0 0 4px; font: 700 30px var(--display); color: var(--ember-light); display: flex; align-items: center; gap: 10px; }
.login h1 img { width: 34px; height: 34px; }
.login p { margin: 0 0 18px; color: var(--ash); font-size: 13px; }
.login label { display: block; font-size: 12px; color: var(--ash); margin: 12px 0 4px; }
.login input { width: 100%; height: 38px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--field); padding: 0 12px; }
.login .btn { width: 100%; justify-content: center; margin-top: 18px; height: 40px; }
.login .error { color: var(--blood-light); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ---- shell ---- */
#app { height: 100%; }
.shell { display: grid; grid-template-columns: 208px minmax(0, 1fr); grid-template-rows: 54px minmax(0, 1fr); height: 100%; }
header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: linear-gradient(#131b21, #0f161a);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 28px; height: 28px; }
.brand b { font: 700 22px/1 var(--display); color: var(--ember-light); }
.brand small { display: block; font-size: 11px; color: var(--ash); }
.spacer { flex: 1; }
.chip {
  font-size: 12px;
  background: var(--field);
  border: 1px solid var(--line-2);
  border-radius: 20px;
  padding: 3px 10px;
  color: var(--ash);
  white-space: nowrap;
}
.chip b { color: var(--parchment); font-weight: 600; }
.chip.live::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 6px var(--good);
  margin-right: 6px;
  vertical-align: 1px;
}
.chip.off::before { background: var(--ash-2); box-shadow: none; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  background: #172128;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
}
.btn:hover { border-color: rgba(239, 228, 204, 0.4); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: linear-gradient(#ffb562, #e2802b); border-color: #ffc27a; color: #1d1006; font-weight: 700; }
.btn.danger { background: #3a171a; border-color: rgba(224, 72, 78, 0.7); color: #ffc6c8; }
.btn.ghost { background: none; }
.btn.small { height: 26px; padding: 0 9px; font-size: 12px; }
.btn svg { width: 15px; height: 15px; }
nav { background: var(--panel); border-right: 1px solid var(--line); padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; }
nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: none;
  color: var(--ash);
  padding: 9px 12px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}
nav button:hover { background: var(--hover); color: var(--parchment); }
nav button.on { background: var(--selected); color: var(--ember-light); box-shadow: inset 3px 0 0 var(--ember); }
nav button svg { width: 18px; height: 18px; flex: none; }
nav .foot { margin-top: auto; font-size: 11px; color: var(--ash-2); padding: 8px 12px; line-height: 1.5; }
main { min-width: 0; min-height: 0; overflow: hidden; position: relative; }
.page { height: 100%; overflow: auto; padding: 18px 20px 26px; }
.page h2 { margin: 0 0 4px; font: 700 26px var(--display); color: var(--ember-light); }
.page .intro { color: var(--ash); font-size: 13px; margin-bottom: 14px; }

/* ---- world ---- */
.world { display: grid; grid-template-columns: minmax(0, 1fr) 330px; height: 100%; }
.world .map-column { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; }
.town-tabs { display: flex; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #0d1418; overflow-x: auto; }
.town-tabs button {
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--ash);
  border-radius: 9px;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
}
.town-tabs button.on { border-color: var(--ember); color: var(--parchment); background: var(--selected); }
.town-tabs button i { font: 11px var(--mono); margin-left: 6px; color: var(--ember-light); }
.town-tabs button.empty i { color: var(--ash-2); }
.map-frame { position: relative; min-height: 0; }
.map-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-frame .legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  font-size: 12px;
  color: var(--ash);
  background: rgba(11, 16, 20, 0.85);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  display: flex;
  gap: 14px;
  pointer-events: none;
}
.map-frame .pick-banner {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  background: rgba(29, 26, 22, 0.95);
  border: 1px solid var(--ember);
  color: var(--ember-light);
  border-radius: 10px;
  padding: 7px 14px;
  font-weight: 600;
  display: flex;
  gap: 10px;
  align-items: center;
}
.map-frame .map-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ash);
  font-size: 14px;
  pointer-events: none;
}
.world-side { border-left: 1px solid var(--line); background: var(--panel); overflow: auto; min-height: 0; }
.world-side h3, .drawer-section h3 {
  margin: 0;
  padding: 12px 14px 6px;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ash-2);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}
.world-side h3 span, .drawer-section h3 span { text-transform: none; letter-spacing: 0; font-weight: 400; }
.player-row { display: flex; align-items: center; gap: 10px; padding: 6px 14px; cursor: pointer; border-left: 3px solid transparent; }
.player-row:hover { background: var(--hover); }
.player-row.on { background: var(--selected); border-left-color: var(--ember); }
.player-row > div { min-width: 0; flex: 1; }
.player-row .name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-row .detail { font-size: 11.5px; color: var(--ash); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex: none;
  border: 2px solid var(--night);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.tag { font-size: 10.5px; border: 1px solid var(--line-2); border-radius: 9px; padding: 0 6px; color: var(--ash); white-space: nowrap; }
.tag.warn { color: var(--ember-light); border-color: rgba(255, 154, 60, 0.5); }
.tag.bad { color: var(--blood-light); border-color: rgba(224, 72, 78, 0.6); }
.tag.good { color: var(--good); border-color: rgba(143, 227, 154, 0.45); }
.tag.gm { color: var(--echo); border-color: rgba(116, 211, 198, 0.5); }
.none { color: var(--ash-2); font-size: 12.5px; padding: 6px 14px 10px; }
.none.flush { padding-left: 0; }
.run-card { margin: 4px 10px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); padding: 8px 10px; cursor: pointer; }
.run-card:hover { border-color: var(--line-2); }
.run-card.flush { margin: 4px 0 8px; }
.run-card .title { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 13px; }
.run-card .title span { font: 11px var(--mono); color: var(--ash-2); font-weight: 400; }
.run-card .meta { font-size: 12px; color: var(--ash); margin-top: 3px; }

/* ---- tables ---- */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar input, .field input, .field select, .field textarea {
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--field);
  padding: 0 11px;
}
.toolbar input { width: 320px; }
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ash-2);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-2);
  position: sticky;
  top: 0;
  background: var(--night);
}
table.list td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--raised); }
table.list tr.on td { background: var(--selected); }
.mono { font-family: var(--mono); font-size: 12px; color: var(--ash); }
.ok { color: var(--good); }
.bad { color: var(--blood-light); }
.hero-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1px 8px 1px 4px;
  background: var(--raised);
  white-space: nowrap;
}
.hero-chip .dot { width: 9px; height: 9px; border-width: 1px; }
.section-title { margin: 0; padding: 12px 0 6px; color: var(--ash-2); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; }

/* ---- drawer (player detail) ---- */
.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 460px;
  background: var(--panel-2);
  border-left: 1px solid var(--line-2);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.45);
  overflow: auto;
  z-index: 5;
}
.drawer .head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel-2); z-index: 1; }
.drawer .head h2 { margin: 0; font: 700 24px var(--display); color: var(--ember-light); }
.drawer .head .close { position: absolute; right: 12px; top: 12px; }
.drawer .head .meta { color: var(--ash); font-size: 12.5px; margin-top: 2px; }
.drawer .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.drawer-section { border-bottom: 1px solid var(--line); padding: 0 0 10px; }
.drawer-section .body { padding: 2px 18px; }
.facts { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; font-size: 13px; }
.facts span { color: var(--ash); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 18px 6px; }
.hero-card { border: 1px solid var(--line); border-radius: 10px; background: var(--raised); padding: 9px 11px; margin: 6px 18px; }
.hero-card .title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.hero-card .title span { color: var(--ash); font-weight: 400; font-size: 12px; }
.hero-card .goods { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--ash); margin-top: 5px; }
.hero-card .goods b { color: var(--parchment); font-weight: 600; }
.hero-card .equipment { display: grid; grid-template-columns: 70px 1fr; gap: 2px 8px; font-size: 12px; margin-top: 6px; }
.hero-card .equipment span { color: var(--ash-2); }
.rarity-gew { color: #d8d2c4; }
.rarity-sel { color: #74b6ff; }
.rarity-epi { color: #c79cff; }
.rarity-leg { color: #ffb561; }
.log-line { font-size: 12px; padding: 3px 18px; display: grid; grid-template-columns: 88px 1fr; gap: 8px; }
.log-line > span { color: var(--ash-2); font-family: var(--mono); font-size: 11px; }

/* ---- maps ---- */
.maps { display: grid; grid-template-columns: 290px minmax(0, 1fr); height: 100%; }
.map-list { border-right: 1px solid var(--line); background: var(--panel); overflow: auto; }
.map-list .region {
  padding: 10px 14px 4px;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ash-2);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}
.map-row { display: flex; align-items: center; gap: 8px; padding: 5px 14px; cursor: pointer; font-size: 13px; border-left: 3px solid transparent; }
.map-row:hover { background: var(--hover); }
.map-row.on { background: var(--selected); border-left-color: var(--ember); }
.map-row.town { font-weight: 600; }
.map-row .level { margin-left: auto; font: 11px var(--mono); color: var(--ash-2); }
.map-row .live { font: 11px var(--mono); color: var(--ember-light); }
.map-detail { overflow: auto; padding: 18px 20px 26px; }
.map-detail h2 { margin: 0 0 4px; font: 700 26px var(--display); color: var(--ember-light); }
.map-detail .intro { color: var(--ash); font-size: 13px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 10px 0 16px; }
.card { border: 1px solid var(--line); border-radius: 12px; background: #11191e; padding: 10px 12px; }
.card b { display: block; font-size: 22px; font-weight: 600; }
.card span { font-size: 12px; color: var(--ash); }
.room-view { border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; background: #0d1418; margin: 10px 0 14px; }
.room-view .bar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.room-view .bar select { height: 30px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--field); padding: 0 8px; }
.room-view canvas { display: block; width: 100%; height: 230px; cursor: crosshair; }
.room-view .hint { font-size: 12px; color: var(--ash); padding: 6px 12px 8px; }
.note {
  font-size: 12.5px;
  color: var(--ash);
  background: rgba(116, 211, 198, 0.07);
  border: 1px solid rgba(116, 211, 198, 0.25);
  border-radius: 8px;
  padding: 8px 11px;
  margin: 8px 0;
}
.note b { color: var(--echo); font-weight: 600; }
.note.warn { background: rgba(255, 154, 60, 0.07); border-color: rgba(255, 154, 60, 0.3); }
.note.warn b { color: var(--ember-light); }

/* ---- modal, toast ---- */
#modal { position: fixed; inset: 0; background: rgba(4, 7, 9, 0.7); display: grid; place-items: center; z-index: 20; }
#modal .box {
  width: 440px;
  max-width: calc(100vw - 30px);
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
#modal h3 { margin: 0 0 4px; font: 700 22px var(--display); color: var(--ember-light); }
#modal p { color: var(--ash); margin: 0 0 10px; font-size: 13px; }
.field { margin-top: 10px; }
.field label { display: block; font-size: 12px; color: var(--ash); margin-bottom: 4px; }
.field input, .field select { width: 100%; }
.field textarea { width: 100%; height: 80px; padding: 8px 11px; resize: vertical; }
.presets { display: flex; flex-wrap: wrap; gap: 5px; }
.presets button.on { border-color: var(--ember); color: var(--ember-light); background: var(--selected); }
.field-row { display: flex; gap: 8px; }
.field-row > * { flex: 1; }
.buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.buttons.start { justify-content: flex-start; margin: 0 0 10px; }
#toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: #1b252c;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 30;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  max-width: 70vw;
}
#toast.on { opacity: 1; }
#toast.error { border-color: rgba(224, 72, 78, 0.7); color: #ffc6c8; }
