* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Georgia, 'Times New Roman', serif;
  background: #efe9da;
  color: #2b2b26;
}
#hud {
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f7f2e5;
  border-bottom: 2px solid #2b2b26;
}
.hud-title h1 { font-size: 20px; margin: 0; letter-spacing: .5px; }
.hud-title span { font-size: 12px; font-style: italic; color: #6b6455; }
.hud-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 16px; }
.hud-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hud-actions button, .hud-actions select {
  font: inherit; font-size: 14px; padding: 8px 10px;
  background: #fffdf6; border: 1.5px solid #2b2b26; border-radius: 6px; cursor: pointer;
}
.hud-actions button:active { background: #e8dfc8; }

#layout { display: flex; gap: 10px; padding: 10px; align-items: flex-start; }
#board-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
#board {
  width: 100%; height: auto; display: block;
  background: #f4efe1;
  border: 2px solid #2b2b26; border-radius: 4px;
  touch-action: none;
}
#zoom-controls { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 6px; }
#zoom-controls button {
  width: 44px; height: 44px; font-size: 20px; cursor: pointer;
  background: #fffdf6; border: 1.5px solid #2b2b26; border-radius: 8px;
}
#message { font-style: italic; font-size: 14px; margin: 8px 2px 0; min-height: 20px; }

#toolbar {
  display: flex; flex-direction: column; gap: 8px;
  flex: 0 0 150px;
}
.tool {
  display: flex; align-items: center; gap: 8px;
  font: inherit; font-size: 22px; text-align: left;
  min-height: 56px; padding: 8px 10px; cursor: pointer;
  background: #fffdf6; border: 1.5px solid #2b2b26; border-radius: 8px;
}
.tool span { font-size: 14px; line-height: 1.15; }
.tool span small { color: #6b6455; font-size: 11px; }
.tool.selected { background: #2b2b26; color: #f7f2e5; }
.tool.selected span small { color: #cfc6ae; }
.tool.danger { border-color: #8a3b2e; }

#info-panel {
  margin: 0 10px 14px; padding: 10px 14px;
  background: #f7f2e5; border: 1.5px solid #2b2b26; border-radius: 8px;
}
#info-panel h2 { margin: 0 0 4px; font-size: 17px; }
#info-panel p { margin: 0 0 6px; font-size: 14px; line-height: 1.45; }
#info-sources { font-size: 12px !important; color: #6b6455; font-style: italic; }

#end-overlay {
  position: fixed; inset: 0; background: rgba(43,43,38,.55);
  display: flex; align-items: center; justify-content: center; z-index: 10; padding: 16px;
}
#end-overlay[hidden] { display: none; }
#end-card {
  background: #f7f2e5; border: 2px solid #2b2b26; border-radius: 10px;
  padding: 22px; max-width: 420px; width: 100%; text-align: center;
}
#end-card button {
  font: inherit; margin: 6px; padding: 10px 14px; cursor: pointer;
  background: #fffdf6; border: 1.5px solid #2b2b26; border-radius: 6px;
}

@media (max-width: 720px) {
  #layout { flex-direction: column; padding: 6px; }
  #toolbar {
    flex-direction: row; flex-wrap: wrap; flex: none; width: 100%;
    position: sticky; bottom: 0; background: #efe9da; padding: 6px 0; z-index: 5;
  }
  .tool { flex: 1 1 30%; min-height: 60px; font-size: 20px; }
  .hud-title h1 { font-size: 17px; }
}
