:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #23332d;
  background: #f5f2eb;
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
a { color: #285d48; }
button, select { font: inherit; }
button, select { min-height: 44px; }
button {
  border: 1px solid #315247;
  border-radius: 8px;
  padding: 9px 16px;
  background: #315247;
  color: white;
  cursor: pointer;
}
button:focus-visible, select:focus-visible, a:focus-visible, .board-scroll:focus-visible {
  outline: 3px solid #c57d2f;
  outline-offset: 2px;
}
button:disabled { cursor: default; }
select {
  max-width: 100%;
  border: 1px solid #aeb9af;
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
  color: #23332d;
}
[hidden] { display: none !important; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px max(16px, calc((100% - 1100px) / 2));
  background: #315247;
  color: white;
}
.brand { color: white; font-size: 1.35rem; font-weight: 750; text-decoration: none; }
.header-link { color: white; }
.secondary { border-color: #edf3ee; background: transparent; }
.home, .game { width: min(1100px, 100%); margin: auto; padding: 20px 16px 40px; }
.home { display: grid; gap: 16px; }
.intro, .card {
  padding: clamp(18px, 4vw, 32px);
  border: 1px solid #ded9cb;
  border-radius: 14px;
  background: #fffdf9;
}
.intro { background: #e8ede5; }
h1, h2, h3 { line-height: 1.2; }
h1 { margin: 0 0 12px; font-size: clamp(1.7rem, 4vw, 2.5rem); }
h2 { font-size: 1.3rem; }
.eyebrow { margin: 0 0 6px; color: #536e5d; font-weight: 700; }
.start-form, .game-controls, .game-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.start-form { margin-top: 20px; }
.start-form label, .game-controls label, .game-tools label { font-weight: 650; }
.offline-status, .install-hint { color: #4a5d51; font-size: 0.9rem; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 0; list-style: none; }
.dot { display: inline-block; width: 14px; height: 14px; border: 1px solid #78857a; border-radius: 50%; }
.acid { background: #b13d34; }
.neutral { background: white; }
.basic { background: #4077b4; }
.game-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.game-tools { margin: 16px 0; }
.clue-history {
  position: relative;
  padding: 10px 14px;
  border: 1px solid #aeb9af;
  border-radius: 8px;
  background: white;
}
.clue-history summary { cursor: pointer; font-weight: 650; }
.clue-history ol { margin-bottom: 0; padding-left: 22px; }
.message {
  padding: 12px 14px;
  border-left: 4px solid #bc8545;
  border-radius: 6px;
  background: #fff7e8;
}
.message.emphasized { font-weight: 700; }
.board-scroll {
  max-width: 100%;
  max-height: 70vh;
  max-height: 70dvh;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #d5d9d0;
  border-radius: 10px;
  background: white;
}
.board {
  display: grid;
  grid-template-columns: repeat(var(--board-side), 144px);
  width: max-content;
}
.profile {
  display: grid;
  place-items: center;
  width: 144px;
  height: 161px;
  min-height: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 0;
  background: white;
}
.profile:not(:disabled):hover, .profile:focus-visible { border-color: #315247; }
.profile:disabled { opacity: 1; }

dialog {
  width: min(1100px, calc(100% - 24px));
  height: min(850px, calc(100% - 24px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 10px;
}
dialog::backdrop { background: rgba(15, 25, 20, 0.7); }
dialog[open] { display: flex; flex-direction: column; }
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #e8ede5;
}
dialog iframe { flex: 1; width: 100%; min-height: 0; border: 0; background: white; }
.help-page { background: #fffdf9; }
.help-content { padding: 12px 18px 30px; overflow-x: auto; }
.help-content table { border-spacing: 8px; }
.help-page.embedded .app-header { display: none; }

@media (max-width: 600px) {
  .home, .game { padding: 12px 10px 30px; }
  .game-controls, .start-form { align-items: stretch; }
  .game-controls label, .start-form label { width: 100%; }
  .game-controls select, .start-form select { flex: 1; }
  dialog { width: calc(100% - 12px); height: calc(100% - 12px); }
}
