:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #080b10;
  color: #eef3f8;
}
* { box-sizing: border-box; }
body { margin: 0; background: #080b10; color: #eef3f8; }
header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 22px 28px;
  border-bottom: 1px solid #202733;
  background: #0d121a;
  position: sticky;
  top: 0;
  z-index: 10;
}
h1, h2, p { margin: 0; }
h1 { font-size: 1.35rem; }
header p, .panel-heading p { margin-top: 4px; color: #8f9baa; font-size: .9rem; }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }
button, a {
  border: 1px solid #303a48;
  background: #151c26;
  color: #eef3f8;
  border-radius: 8px;
  padding: 9px 12px;
  text-decoration: none;
  cursor: pointer;
}
button:hover, a:hover { background: #1d2734; }
button:disabled { opacity: .4; cursor: not-allowed; }
main { padding: 24px; display: grid; gap: 20px; }
.status-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.status-grid article, .panel {
  background: #0f151e;
  border: 1px solid #202936;
  border-radius: 12px;
}
.status-grid article { padding: 16px; min-width: 0; }
.status-grid span, .status-grid small { display: block; color: #8390a0; }
.status-grid strong { display: block; font-size: 1.45rem; margin: 6px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel { overflow: hidden; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid #202936; gap: 14px; }
.game-controls { display: flex; gap: 12px; flex-wrap: wrap; padding: 18px; }
.game-controls button { min-width: 150px; min-height: 48px; font-weight: 700; }
.control-start { border-color: #3a8b52; background: #173622; }
.control-start:hover { background: #20492e; }
.control-end { border-color: #9a4444; background: #411d1d; }
.control-end:hover { background: #572626; }
.control-reset { border-color: #9b7b37; background: #3d3118; }
.control-reset:hover { background: #514121; }
#controlStatus { color: #9aa6b5; font-size: .85rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid #1d2530; font-size: .9rem; white-space: nowrap; }
th { color: #8e9bab; font-weight: 600; background: #0c1118; }
.empty { color: #7f8a98; text-align: center; padding: 24px; }
.console-panel { min-height: 430px; }
#console {
  margin: 0;
  min-height: 380px;
  max-height: 58vh;
  overflow: auto;
  padding: 16px;
  background: #06090d;
  color: #c9d6e2;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.log-error { color: #ff8b8b; }
.log-warn { color: #ffd479; }
.log-log { color: #c9d6e2; }
#logStatus { color: #8f9baa; font-size: .85rem; }
.ok { color: #70db91; }
.bad { color: #ff7d7d; }
@media (max-width: 1000px) { .status-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 650px) {
  header { align-items: flex-start; flex-direction: column; }
  main { padding: 14px; }
  .status-grid { grid-template-columns: repeat(2, 1fr); }
  .game-controls { display: grid; grid-template-columns: 1fr; }
  .game-controls button { width: 100%; }
}
