/* Layout: header bar, full-bleed map with floating panels, timeline docked at the bottom.
   Look: Azeroth UI. Dark leather panels, gold double borders, Cinzel capitals, parchment map.
   One committed dark theme, so no light tokens. */
:root {
  --ink: #0e0a06;
  --leather: #1c150d;
  --leather-2: #2a1f13;
  --bronze: #6b5420;
  --gold: #ffd100;
  --gold-soft: #e7c46a;
  --text: #eadcb4;
  --muted: #a99a72;
  --red: #8f1d12;
  --red-hi: #b8301f;
  --blue: #4a90ff;
  --epic: #a335ee;
  --rare: #0070dd;
  --good: #1eff00;
  --bad: #ff4b3a;
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --body: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ink); color: var(--text); font: 15px/1.4 var(--body);
  overflow: hidden;
}
button, input, label { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); margin: 0; font-weight: 700; }
.sub { color: var(--muted); font-size: 0.85rem; margin: 0; }

#app { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }

.panel {
  background: linear-gradient(180deg, #211810 0%, #140e08 100%);
  border: 1px solid var(--bronze);
  box-shadow: inset 0 0 0 1px #000, inset 0 0 0 2px #3a2c14, 0 6px 22px #000b;
}

/* header */
.bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(180deg, #2b2013, #150f09);
  border-bottom: 2px solid var(--bronze); box-shadow: 0 2px 0 #000;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #ffe27a, #a8730f 60%, #4a3206);
  border: 2px solid #3a2800; box-shadow: 0 0 0 1px var(--gold-soft), 0 0 12px #ffd10055;
}
h1 { font-size: 1.25rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); text-shadow: 0 2px 0 #000; }
.bar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-block; cursor: pointer; padding: 6px 16px; font-family: var(--display); font-weight: 700; font-size: 0.8rem;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold); text-shadow: 0 1px 0 #000;
  background: linear-gradient(180deg, #8a2417, #3d0c07); border: 1px solid #c9a24a; border-radius: 3px;
  box-shadow: inset 0 1px 0 #ffffff30, 0 2px 0 #000;
}
.btn:hover { background: linear-gradient(180deg, #a82e1e, #4c100a); }
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* stage */
#stage { position: relative; min-height: 0; overflow: hidden; background: #0d1a24; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#map.drag { cursor: grabbing; }
#flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
#flash.go { animation: flash 0.5s ease-out; }
@keyframes flash { 0% { opacity: 0.85; } 100% { opacity: 0; } }

.plate { position: absolute; left: 16px; top: 16px; width: 250px; max-height: calc(100% - 32px); padding: 12px; display: grid; gap: 10px; grid-template-rows: auto auto auto minmax(0, 1fr); }
.plate-head { display: flex; gap: 10px; align-items: center; }
.portrait {
  width: 48px; height: 48px; flex: none; border-radius: 50%; border: 2px solid var(--gold-soft);
  background: radial-gradient(circle at 40% 35%, #c0392b, #5b0f08); box-shadow: 0 0 0 1px #000, inset 0 0 8px #000;
  display: grid; place-items: center; font: 700 1.2rem var(--display); color: var(--gold);
}
.plate h2 { font-size: 1.05rem; color: var(--gold); }
.plate h3 { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-soft); border-bottom: 1px solid var(--bronze); padding-bottom: 4px; }
.feed { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 0; max-height: 280px; font-size: 0.88rem; }
.feed li { display: grid; grid-template-columns: 4.2em 1fr; gap: 6px; padding: 4px 0; border-bottom: 1px solid #ffffff10; cursor: pointer; }
.feed li:hover { background: #ffffff0d; }
.feed .t { color: var(--muted); font-variant-numeric: tabular-nums; }

.banner { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); text-align: center; pointer-events: none; opacity: 0; transition: opacity 0.6s; }
.banner.show { opacity: 1; }
#bZone { font: 700 clamp(1.4rem, 3.4vw, 2.2rem) var(--display); color: var(--gold); letter-spacing: 0.12em; text-transform: uppercase; text-shadow: 0 0 10px #000, 0 2px 0 #000, 0 0 24px #000; }
#bSub { font: 500 1rem var(--display); color: #fff1c0; text-shadow: 0 0 8px #000, 0 1px 0 #000; letter-spacing: 0.1em; }

.toasts { position: absolute; left: 50%; top: 96px; transform: translateX(-50%); display: grid; gap: 6px; justify-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast {
  padding: 6px 18px; background: linear-gradient(180deg, #000d, #000a); border: 1px solid var(--bronze); border-left: 4px solid var(--c, var(--gold));
  font: 700 0.95rem var(--display); color: var(--c, var(--gold)); letter-spacing: 0.04em; text-shadow: 0 1px 0 #000;
  animation: toast 3.4s ease-out forwards;
}
@keyframes toast { 0% { opacity: 0; transform: translateY(-8px); } 8% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }

.tools { position: absolute; right: 16px; top: 16px; width: 150px; padding: 10px; display: grid; gap: 8px; justify-items: stretch; }
.zlevel { text-align: center; font: 700 0.8rem var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-soft); }
.icon-btn {
  cursor: pointer; width: 100%; min-height: 32px; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 1.2rem; color: var(--gold);
  background: linear-gradient(180deg, #4a3818, #21170a); border: 1px solid #c9a24a; border-radius: 3px; box-shadow: inset 0 1px 0 #ffffff22, 0 2px 0 #000;
}
.icon-btn:hover { background: linear-gradient(180deg, #6a5022, #2c1f0d); }
.chip {
  cursor: pointer; padding: 4px 10px; font: 700 0.75rem var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  background: #1a130b; border: 1px solid var(--bronze); border-radius: 3px;
}
.chip.on { color: var(--gold); background: linear-gradient(180deg, #5a1a10, #2d0a05); border-color: #c9a24a; }
.filters { border: 1px solid var(--bronze); margin: 4px 0 0; padding: 4px 8px 8px; display: grid; gap: 4px; font-size: 0.85rem; min-width: 0; }
.filters legend { font: 700 0.65rem var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-soft); padding: 0 4px; }
.filters label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.filters input { accent-color: var(--gold); margin: 0; }
.sw { width: 10px; height: 10px; border-radius: 2px; background: var(--c); border: 1px solid #000; flex: none; }

/* WoW-style tooltip */
.tip {
  position: absolute; z-index: 5; pointer-events: none; max-width: 280px; padding: 8px 10px;
  background: linear-gradient(180deg, #0b1020f2, #05060af2); border: 1px solid #8a7a50; border-radius: 4px; box-shadow: 0 0 0 1px #000, 0 6px 18px #000c;
}
.tip b { display: block; font: 700 1rem var(--display); color: var(--c, var(--gold)); }
.tip div { font-size: 0.88rem; }
.tip .dim { color: var(--muted); }

/* timeline */
.timeline { border-width: 2px 0 0; padding: 10px max(16px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 8px; }
.transport { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.transport .icon-btn { width: 38px; }
.transport .icon-btn.big { width: 52px; min-height: 40px; font-size: 1.3rem; border-width: 2px; }
.speeds { display: flex; gap: 4px; }
.readout { margin-left: auto; text-align: right; min-width: 0; }
.time { font: 700 1.3rem var(--display); color: var(--gold); font-variant-numeric: tabular-nums; letter-spacing: 0.06em; }
.track-wrap { height: 244px; position: relative; }
#tl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; touch-action: none; }

@media (max-width: 760px) {
  .plate { display: none; }
  .tools { width: 118px; padding: 8px; }
  .filters { display: none; }
  .readout { margin-left: 0; text-align: left; flex-basis: 100%; }
  h1 { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .toast { animation-duration: 0.01s; animation-delay: 3s; }
  #flash.go { animation: none; }
}

/* purse */
.coins { display: inline-flex; align-items: center; gap: 3px; font: 700 0.95rem var(--display); font-variant-numeric: tabular-nums; color: var(--text); justify-content: flex-end; }
.coins b { font-weight: 700; margin-left: 4px; }
.coins i { width: 11px; height: 11px; border-radius: 50%; border: 1px solid #000; display: inline-block; }
.cg { background: radial-gradient(circle at 35% 30%, #fff0a0, #e0a800 70%); }
.cs { background: radial-gradient(circle at 35% 30%, #fff, #a9b0b8 70%); }
.cc { background: radial-gradient(circle at 35% 30%, #ffd2a0, #b8652a 70%); }
.purse { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--bronze); background: #0004; padding: 4px 8px; }
#rGold { margin-top: 2px; }
.readout { display: grid; justify-items: end; }

.legal { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); margin: 0; max-width: min(92%, 760px); padding: 3px 10px; text-align: center;
  font-size: 0.72rem; line-height: 1.3; color: #d8cba4; background: #000a; border: 1px solid #ffffff1f; border-radius: 3px; pointer-events: none; }
