/* GAIA-7 · design system */

:root {
  --bg: #05060d;
  --panel: rgba(13, 18, 33, 0.92);
  --panel-solid: #0d1221;
  --line: rgba(148, 163, 184, 0.14);
  --text: #e2e8f0;
  --muted: #8b95ab;
  --accent: #34d399;
  --accent-dim: rgba(52, 211, 153, 0.14);
  --danger: #f87171;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Space Grotesk", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

button { font-family: inherit; }

/* ---------------------------------------------------------- horní lišta */

#topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: linear-gradient(to bottom, rgba(7, 10, 20, 0.95), rgba(7, 10, 20, 0.78));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  width: 26px; height: 26px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 38%, #065f46 0 26%, transparent 27%),
    radial-gradient(circle at 66% 62%, #065f46 0 18%, transparent 19%),
    radial-gradient(circle at 50% 50%, #34d399, #10b981);
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.5);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-size: 15px; letter-spacing: 0.16em; }
.brand-text span { font-size: 10px; color: var(--muted); letter-spacing: 0.1em; }

.turn-chip {
  font-family: var(--mono);
  font-size: 12px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  white-space: nowrap;
}
.turn-chip b { color: var(--text); }

.players { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }

.player-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.02);
}
.player-chip .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.player-chip .greens { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.player-chip .ready-dot { font-size: 10px; color: var(--muted); }
.player-chip.is-ready .ready-dot { color: var(--accent); }
.player-chip.is-you { border-color: rgba(52, 211, 153, 0.45); }

.spacer { flex: 1; }

/* ------------------------------------------------------------- tlačítka */

.btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn:hover { border-color: rgba(148, 163, 184, 0.4); background: rgba(255, 255, 255, 0.06); }
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #052e21;
  font-weight: 700;
  box-shadow: 0 0 18px rgba(52, 211, 153, 0.35);
}
.btn.primary:hover { background: #47dea7; }
.btn.primary.armed { background: #1c2b3f; color: var(--accent); border: 1px solid var(--accent); box-shadow: none; }

.btn.big { font-size: 15px; padding: 12px 22px; width: 100%; }
.btn.link { background: none; border: none; color: var(--muted); font-size: 12.5px; }
.btn.link:hover { color: var(--text); }
.btn.ghost { color: #b7c1d4; }
.btn:disabled { opacity: 0.45; cursor: default; }

.icon-btn {
  border: none; background: none; color: var(--muted);
  font-size: 14px; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

/* ---------------------------------------------------------------- plátno */

main { position: fixed; inset: 58px 0 0 0; }

#map {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#map:active { cursor: grabbing; }

#replay-badge {
  position: absolute;
  top: 14px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  background: var(--panel);
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: 999px;
  padding: 6px 14px;
  z-index: 10;
}

/* --------------------------------------------------------------- panel */

#panel {
  position: absolute;
  top: 14px; right: 14px; bottom: 14px;
  width: 360px;
  max-width: calc(100vw - 28px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  backdrop-filter: blur(14px);
  z-index: 15;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}
.panel-title { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.panel-title .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.panel-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

.panel-body { flex: 1; overflow-y: auto; padding: 14px 16px 16px; }

.stat-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.stat {
  font-family: var(--mono); font-size: 11.5px;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 9px; color: var(--muted);
}
.stat b { color: var(--text); font-weight: 500; }
.stat.warn { border-color: rgba(248, 113, 113, 0.5); color: var(--danger); }

.section-label {
  font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin: 16px 0 8px;
}

.editor {
  width: 100%;
  min-height: 170px;
  resize: vertical;
  background: #080b16;
  color: #d7e2f4;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  padding: 10px 12px;
  outline: none;
  tab-size: 2;
}
.editor:focus { border-color: rgba(52, 211, 153, 0.5); }
.editor[readonly] { opacity: 0.75; }

.editor-actions { display: flex; gap: 8px; margin-top: 8px; align-items: center; }

.compile-error {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--danger);
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 8px;
  padding: 8px 10px;
  white-space: pre-wrap;
}
.compile-ok { color: var(--accent); font-size: 12px; margin-top: 8px; }

select.tpl {
  background: #0b1020; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 12px; padding: 7px 8px; font-family: inherit;
}

.unit-log {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  background: #080b16;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  max-height: 180px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.build-grid { display: flex; flex-direction: column; gap: 8px; }
.build-card {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: border-color 0.15s;
  width: 100%;
}
.build-card:hover:not(:disabled) { border-color: rgba(52, 211, 153, 0.5); }
.build-card:disabled { opacity: 0.45; cursor: default; }
.build-card .glyph { font-size: 20px; width: 30px; text-align: center; }
.build-card .info { flex: 1; }
.build-card .info b { font-size: 13.5px; display: block; }
.build-card .info span { font-size: 11.5px; color: var(--muted); }
.build-card .cost { font-family: var(--mono); font-size: 12.5px; color: #67e8f9; white-space: nowrap; }

.owner-note {
  font-size: 12px; color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  margin-bottom: 12px;
}

/* --------------------------------------------------------------- modály */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(3, 4, 9, 0.78);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal {
  width: 430px;
  max-width: 100%;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.modal.wide { width: 760px; text-align: left; padding: 22px 26px; }

.modal h1 { font-size: 30px; letter-spacing: 0.18em; margin: 14px 0 6px; }
.modal h2 { font-size: 18px; }
.modal-lead { color: var(--muted); font-size: 13.5px; line-height: 1.6; margin-bottom: 20px; }

.modal-glyph {
  width: 54px; height: 54px; margin: 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 38%, #065f46 0 26%, transparent 27%),
    radial-gradient(circle at 66% 62%, #065f46 0 18%, transparent 19%),
    radial-gradient(circle at 50% 50%, #34d399, #0d9668);
  box-shadow: 0 0 34px rgba(52, 211, 153, 0.5);
}

.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}

.modal-scroll { overflow-y: auto; font-size: 13.5px; line-height: 1.65; }

#join-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
#join-form input {
  background: #080b16;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  padding: 12px 14px;
  text-align: center;
  outline: none;
}
#join-form input:focus { border-color: rgba(52, 211, 153, 0.5); }

.modal-error { color: var(--danger); font-size: 12.5px; margin-top: 10px; }

.winner-glyph { font-size: 44px; }
#winner-scores { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.score-row {
  display: flex; justify-content: space-between;
  font-size: 14px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 10px;
}
.score-row.first { border-color: rgba(52, 211, 153, 0.5); background: var(--accent-dim); }
.score-row .g { font-family: var(--mono); }

/* MCP modal */
.mcp-step { margin-bottom: 18px; }
.mcp-step h3 { font-size: 13px; margin-bottom: 6px; color: var(--accent); }
.mcp-step p { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; line-height: 1.55; }

.codebox {
  position: relative;
  background: #080b16;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 40px 10px 12px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: #c9d6ee;
  white-space: pre-wrap;
  word-break: break-all;
}
.codebox .copy {
  position: absolute; top: 6px; right: 6px;
  border: none; background: rgba(255, 255, 255, 0.06);
  color: var(--muted); border-radius: 6px;
  font-size: 11px; cursor: pointer; padding: 4px 8px;
}
.codebox .copy:hover { color: var(--text); }

/* --------------------------------------------------------------- toasty */

#toasts {
  position: fixed;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 60;
  align-items: center;
}
.toast {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  padding: 10px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.2s ease;
  max-width: 90vw;
}
.toast.error { border-color: rgba(248, 113, 113, 0.5); color: #fecaca; }
.toast.ok { border-color: rgba(52, 211, 153, 0.5); color: #a7f3d0; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------- markdown */

.markdown h1 { font-size: 20px; margin: 4px 0 12px; }
.markdown h2 { font-size: 16px; margin: 20px 0 8px; color: var(--accent); }
.markdown h3 { font-size: 13.5px; margin: 16px 0 6px; }
.markdown p { margin: 8px 0; color: #c4cee0; }
.markdown li { margin: 4px 0 4px 20px; color: #c4cee0; }
.markdown code {
  font-family: var(--mono); font-size: 12px;
  background: rgba(148, 163, 184, 0.12);
  border-radius: 5px; padding: 1px 5px;
}
.markdown pre {
  background: #080b16;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 10px 0;
}
.markdown pre code { background: none; padding: 0; font-size: 12px; line-height: 1.6; }
.markdown strong { color: var(--text); }

.hidden { display: none !important; }

/* ---------------------------------------------------------- responsive */

@media (max-width: 760px) {
  .brand-text span, .turn-chip { display: none; }
  #topbar { gap: 8px; padding: 0 10px; }
  .btn { padding: 7px 10px; font-size: 12px; }
  #panel { top: auto; height: 62vh; }
}
