:root {
  color-scheme: dark;
  --ink: #0b0d0c;
  --panel: #111512;
  --panel-high: #171d18;
  --line: #2b332d;
  --line-bright: #405047;
  --text: #f1f5ed;
  --muted: #929d95;
  --green: #79d67d;
  --cyan: #65c9d7;
  --amber: #e7b95c;
  --red: #ed726b;
  --blue: #7ca9ec;
  --shadow: rgba(0, 0, 0, .34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; background: var(--ink); color: var(--text); }

body { overflow: hidden; }

body::before {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  content: "";
  opacity: .045;
  background-image: repeating-linear-gradient(0deg, transparent 0 3px, #ffffff 4px);
  mix-blend-mode: soft-light;
}

button, input { font: inherit; letter-spacing: 0; }
button { color: inherit; }

.shell {
  display: grid;
  grid-template-columns: minmax(350px, 410px) minmax(0, 1fr);
  width: 100vw;
  height: 100dvh;
}

.dashboard {
  position: relative;
  z-index: 2;
  display: flex;
  min-width: 0;
  height: 100dvh;
  flex-direction: column;
  overflow: auto;
  scrollbar-color: var(--line-bright) var(--panel);
  background: var(--panel);
  border-right: 1px solid var(--line-bright);
  box-shadow: 18px 0 40px var(--shadow);
}

.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 26px 22px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1, h2, p { margin-top: 0; }
h1, h2 { letter-spacing: 0; }

h1 {
  margin-bottom: 0;
  color: var(--text);
  font-size: 30px;
  line-height: 1;
  font-weight: 850;
}

h1 span { color: var(--green); }

h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  font-weight: 720;
}

.server-state {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  min-height: 28px;
  padding: 6px 9px;
  color: var(--muted);
  border: 1px solid var(--line-bright);
  border-radius: 4px;
  background: #0d100e;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  text-transform: uppercase;
}

.state-light {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(231, 185, 92, .1);
}

.server-state.is-online { color: var(--green); border-color: rgba(121, 214, 125, .38); }
.server-state.is-online .state-light { background: var(--green); box-shadow: 0 0 12px rgba(121, 214, 125, .8); animation: pulse 2.2s ease-in-out infinite; }
.server-state.is-offline { color: var(--red); border-color: rgba(237, 114, 107, .4); }
.server-state.is-offline .state-light { background: var(--red); }

@keyframes pulse { 50% { opacity: .46; box-shadow: 0 0 4px rgba(121, 214, 125, .3); } }

.connect-strip {
  display: flex;
  width: 100%;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 26px;
  cursor: pointer;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #4d452b;
  background: #211e15;
  transition: background .18s ease, border-color .18s ease;
}

.connect-strip:hover, .connect-strip:focus-visible { background: #292419; border-color: var(--amber); outline: 0; }
.connect-strip small { display: block; margin-bottom: 3px; color: var(--amber); font-size: 11px; text-transform: uppercase; }
.connect-strip strong { display: block; max-width: 290px; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }
.copy-symbol { color: var(--amber); font-size: 24px; }

.metric-band {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.metric { min-width: 0; padding: 16px 26px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric:nth-child(2n) { border-right: 0; }
.metric:nth-last-child(-n + 2) { border-bottom: 0; }
.metric span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.metric strong { display: block; overflow: hidden; color: var(--cyan); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }

.world-band, .chat-band { padding: 22px 26px; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.section-heading.compact { align-items: center; margin-bottom: 14px; }
.normal-badge { padding: 5px 8px; color: var(--blue); border: 1px solid rgba(124, 169, 236, .34); border-radius: 3px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; text-transform: uppercase; }

.world-facts { display: grid; grid-template-columns: 1fr 1fr; margin: 18px 0 0; border-top: 1px solid var(--line); }
.world-facts div { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; padding: 10px 0; border-bottom: 1px solid var(--line); }
.world-facts div:nth-child(odd) { padding-right: 14px; }
.world-facts div:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--line); }
.world-facts dt { color: var(--muted); font-size: 11px; }
.world-facts dd { margin: 0; overflow: hidden; color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.live-label { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; text-transform: uppercase; }
.live-label i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 9px rgba(121, 214, 125, .8); }

.chat-band { display: flex; min-height: 335px; flex: 1 0 335px; flex-direction: column; }
.chat-log { min-height: 150px; flex: 1; overflow-y: auto; padding: 2px 5px 10px 0; scrollbar-color: var(--line-bright) transparent; }
.chat-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; margin: 0 0 7px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; line-height: 1.45; }
.chat-time { color: #68726b; }
.chat-content { min-width: 0; overflow-wrap: anywhere; color: #cfd6d0; }
.chat-content strong { color: var(--cyan); font-weight: 650; }
.chat-row.web .chat-content strong { color: var(--amber); }
.chat-row.presence .chat-content { color: var(--green); }
.chat-row.advancement .chat-content { color: var(--amber); }
.chat-row.death .chat-content { color: var(--red); }
.empty-state { margin: 36px 0; color: #657068; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; text-align: center; }

.chat-form { display: grid; grid-template-columns: 98px minmax(0, 1fr) 38px; gap: 7px; margin-top: auto; }
.chat-form label { min-width: 0; }
.chat-form input { width: 100%; height: 38px; padding: 0 10px; color: var(--text); border: 1px solid var(--line-bright); border-radius: 3px; outline: 0; background: #0c0f0d; font-size: 12px; }
.chat-form input:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(101, 201, 215, .11); }
.send-button { width: 38px; height: 38px; cursor: pointer; border: 1px solid #4c704f; border-radius: 3px; background: #1b3520; color: var(--green); font-size: 20px; transition: background .18s ease; }
.send-button:hover, .send-button:focus-visible { background: #25482b; outline: 0; }
.send-button:disabled { cursor: wait; opacity: .45; }
.form-status { min-height: 16px; margin: 6px 0 -10px; color: var(--muted); font-size: 10px; }
.form-status.error { color: var(--red); }

footer { display: flex; min-height: 40px; align-items: center; justify-content: space-between; padding: 8px 14px 8px 26px; color: #5e6861; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 9px; text-transform: uppercase; }
.admin-trigger { width: 28px; height: 28px; cursor: pointer; opacity: .09; border: 0; background: transparent; color: var(--text); font-size: 16px; transition: opacity .2s ease; }
.admin-trigger:hover, .admin-trigger:focus-visible { opacity: .75; outline: 1px solid var(--line-bright); }

.map-panel { position: relative; min-width: 0; height: 100dvh; overflow: hidden; background: #090b0a; }
.map-panel iframe { display: block; width: 100%; height: 100%; border: 0; background: #090b0a; }

.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: min(340px, calc(100vw - 40px)); padding: 10px 13px; pointer-events: none; opacity: 0; transform: translateY(8px); color: var(--text); border: 1px solid var(--line-bright); border-radius: 4px; background: #151a16; box-shadow: 0 14px 34px rgba(0, 0, 0, .4); font-size: 12px; transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { border-color: rgba(237, 114, 107, .55); color: #ffc0bc; }

.mobile-tabs { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

@media (max-width: 760px) {
  body { overflow: hidden; }
  .mobile-tabs { position: fixed; z-index: 9; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr 1fr; width: 190px; padding: 3px; border: 1px solid var(--line-bright); border-radius: 5px; background: rgba(12, 15, 13, .94); box-shadow: 0 12px 30px rgba(0, 0, 0, .42); backdrop-filter: blur(10px); }
  .mobile-tab { min-height: 36px; cursor: pointer; border: 0; border-radius: 3px; background: transparent; color: var(--muted); font-size: 11px; }
  .mobile-tab.is-active { background: #263129; color: var(--text); }
  .shell { display: block; height: 100dvh; }
  .dashboard, .map-panel { width: 100%; height: 100dvh; border: 0; }
  .shell[data-mobile-view="dashboard"] .map-panel { display: none; }
  .shell[data-mobile-view="map"] .dashboard { display: none; }
  .masthead { padding: 24px 20px 19px; }
  h1 { font-size: 27px; }
  .connect-strip, .metric, .world-band, .chat-band { padding-left: 20px; padding-right: 20px; }
  .chat-band { padding-bottom: 76px; }
  .chat-form { grid-template-columns: 92px minmax(0, 1fr) 38px; }
  footer { padding-left: 20px; padding-bottom: 68px; }
  .admin-trigger { opacity: .12; }
  .toast { right: 14px; bottom: 66px; }
}

@media (max-width: 410px) {
  .masthead { gap: 12px; }
  .server-state { padding: 6px; }
  h1 { font-size: 24px; }
  .connect-strip strong { font-size: 12px; }
  .chat-form { grid-template-columns: 1fr 38px; }
  .chat-form label:first-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
