:root {
  --page-background: #20242a;
  --page-text: #f4f4f4;
  --muted-text: #c6cbd1;
  --open-hex-border: #777d85;
  --open-hex-background: #f4f4f2;
  --closed-hex-border: #555d66;
  --closed-hex-background: #343a41;
  --player-one: #4f91df;
  --player-two: #e38b3d;
  --stick-colour: #17191c;
  --stick-outline: #a6abb1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  color: var(--page-text);
  background: var(--page-background);
}

button,
select {
  font: inherit;
}

.game {
  width: min(96%, 900px);
  margin: 24px auto 40px;
  text-align: center;
}

h1 {
  margin: 0 0 10px;
  font-size: 42px;
}

.mode-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto 12px;
}

.mode-panel label {
  font-weight: bold;
}

.mode-panel select {
  padding: 8px 10px;
  border: 1px solid #8b9199;
  border-radius: 6px;
  color: var(--page-text);
  background: #343a41;
}

.playtest-panel {
  width: min(100%, 760px);
  margin: 0 auto 16px;
}

.playtest-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
}

.playtest-controls label {
  font-weight: bold;
}

.playtest-controls input {
  width: 92px;
  padding: 8px 10px;
  border: 1px solid #8b9199;
  border-radius: 6px;
  color: var(--page-text);
  background: #343a41;
}

.playtest-controls button {
  padding: 9px 14px;
  border: 1px solid #8b9199;
  border-radius: 6px;
  color: var(--page-text);
  background: #343a41;
  cursor: pointer;
}

.playtest-controls button:hover:not(:disabled) {
  background: #4a5159;
}

.playtest-controls button:disabled,
.playtest-controls input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.playtest-description {
  width: min(100%, 690px);
  margin: 8px auto 0;
  color: var(--muted-text);
  font-size: 13px;
  line-height: 1.4;
}

.playtest-progress {
  margin: 10px 0 0;
  color: var(--muted-text);
  font-size: 14px;
}

.playtest-results {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #626a73;
  border-radius: 10px;
  background: #292e34;
  text-align: left;
}

.playtest-results h2 {
  margin: 0 0 12px;
  text-align: center;
  font-size: 20px;
}

.playtest-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.playtest-metric {
  padding: 9px;
  border: 1px solid #4f565e;
  border-radius: 8px;
  background: #22272d;
  text-align: center;
}

.playtest-metric strong {
  display: block;
  margin-top: 3px;
  font-size: 19px;
}

.playtest-section-title {
  margin: 14px 0 6px;
  font-size: 15px;
  font-weight: bold;
}

.playtest-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.playtest-table th,
.playtest-table td {
  padding: 6px 7px;
  border-bottom: 1px solid #444b53;
  text-align: right;
}

.playtest-table th:first-child,
.playtest-table td:first-child {
  text-align: left;
}

.playtest-note {
  margin: 10px 0 0;
  color: var(--muted-text);
  font-size: 13px;
}

#turn-display {
  margin: 6px 0;
  font-size: 23px;
  font-weight: bold;
}

#action-display {
  margin: 6px 0 14px;
  font-size: 18px;
}

.player-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(100%, 650px);
  margin: 0 auto 12px;
}

.player-card {
  padding: 12px;
  border: 2px solid #555c64;
  border-radius: 10px;
  background: #2b3036;
  text-align: left;
  opacity: 0.78;
}

.player-card.active-player {
  opacity: 1;
  box-shadow: 0 0 0 2px rgb(255 255 255 / 18%);
}

.player-one-card.active-player {
  border-color: var(--player-one);
}

.player-two-card.active-player {
  border-color: var(--player-two);
}

.player-card h2 {
  margin: 0 0 6px;
  font-size: 19px;
}

.player-card p {
  margin: 4px 0;
}

.status-label {
  margin-right: 6px;
}

.subdivision-row,
.claims-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-height: 27px;
  margin-top: 4px;
}

.subdivision-sticks {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 18px;
}

.subdivision-stick {
  display: inline-block;
  width: 34px;
  height: 9px;
  border: 1px solid var(--stick-outline);
  border-radius: 999px;
  background: var(--stick-colour);
  box-shadow: 0 1px 2px rgb(0 0 0 / 55%);
}

.claim-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  vertical-align: middle;
}

.claim-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid #777d85;
  border-radius: 999px;
  background: #20242a;
  font-size: 12px;
  text-transform: capitalize;
}

.claim-dot {
  width: 12px;
  height: 12px;
  border: 1px solid #111111;
  border-radius: 50%;
}

#region-display {
  margin: 8px 0;
  color: var(--muted-text);
  font-size: 15px;
}

#message-display {
  min-height: 25px;
  margin: 8px 0 12px;
  font-size: 16px;
}

.action-controls,
.game-controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
}

.action-controls button,
.game-controls button {
  padding: 11px 17px;
  border: 1px solid #8b9199;
  border-radius: 6px;
  color: var(--page-text);
  background: #343a41;
  cursor: pointer;
}

.action-controls button:hover:not(:disabled),
.game-controls button:hover:not(:disabled) {
  background: #4a5159;
}

.action-controls button:disabled,
.game-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.action-mode.active {
  border-color: #ffffff;
  background: #59616a;
  box-shadow: 0 0 0 2px rgb(255 255 255 / 12%);
}

#board {
  position: relative;
  width: 560px;
  height: 540px;
  margin: 12px auto 16px;
}

.hex {
  position: absolute;
  z-index: 1;
  width: 90px;
  height: 78px;
  padding: 3px;
  border: 0;
  background: var(--open-hex-border);
  cursor: default;
  clip-path: polygon(
    25% 0%,
    75% 0%,
    100% 50%,
    75% 100%,
    25% 100%,
    0% 50%
  );
}

.hex-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--open-hex-background);
  clip-path: polygon(
    25% 0%,
    75% 0%,
    100% 50%,
    75% 100%,
    25% 100%,
    0% 50%
  );
}

.hex.blocked {
  background: var(--page-background);
}

.hex.blocked .hex-inner {
  background: var(--page-background);
}

.hex.closed {
  background: var(--closed-hex-border);
}

.hex.closed .hex-inner {
  background: var(--closed-hex-background);
}

.hex.claim-eligible {
  cursor: pointer;
}

.hex.claim-eligible .disc {
  box-shadow:
    0 0 0 4px rgb(255 255 255 / 38%),
    0 2px 4px rgb(0 0 0 / 55%);
}

.hex.claim-eligible:hover .hex-inner {
  background: #48515a;
}

.hex.choice-one,
.hex.choice-two {
  cursor: pointer;
}

.hex.choice-one {
  background: #4f91df;
}

.hex.choice-two {
  background: #e38b3d;
}

.hex.choice-one .hex-inner,
.hex.choice-two .hex-inner {
  box-shadow: inset 0 0 0 5px rgb(255 255 255 / 34%);
}

.hex.choice-one:hover .hex-inner,
.hex.choice-two:hover .hex-inner {
  background: #ffffff;
}

/* Final scoring: show which player won each region. */
.hex.final-winner-one {
  background: #b9c0c8;
}

.hex.final-winner-one .hex-inner {
  background: #d8dde3;
}

.hex.final-winner-two {
  background: #2a3036;
}

.hex.final-winner-two .hex-inner {
  background: #1c2126;
}

.hex.final-tied {
  background: #626a74;
}

.hex.final-tied .hex-inner {
  background: #454c55;
}

/* Region IDs are useful internally, but hidden from players. */
.region-tag {
  display: none;
}

.disc {
  display: block;
  width: 48px;
  height: 48px;
  border: 3px solid #202225;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgb(0 0 0 / 48%);
  pointer-events: none;
}

.empty-marker {
  display: block;
  width: 34px;
  height: 34px;
  border: 2px dashed #7c838b;
  border-radius: 50%;
  opacity: 0.72;
  pointer-events: none;
}

.disc-red,
.claim-dot.red {
  background: #d94141;
}

.disc-blue,
.claim-dot.blue {
  background: #4384d8;
}

.disc-yellow,
.claim-dot.yellow {
  background: #f2d64b;
}

.disc-green,
.claim-dot.green {
  background: #55a85b;
}

.disc-purple,
.claim-dot.purple {
  background: #8b5bb7;
}

.disc-orange,
.claim-dot.orange {
  background: #e58a3b;
}

.edge {
  position: absolute;
  z-index: 5;
  width: 48px;
  height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform-origin: center;
}

.edge::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 8px;
  height: 4px;
  border-radius: 4px;
  background: #a3a7ac;
  opacity: 0.5;
}

.edge:hover::before {
  top: 5px;
  height: 10px;
  background: #ffffff;
  opacity: 0.9;
}

.edge.placed {
  cursor: not-allowed;
}

.edge.placed::before {
  top: 4px;
  height: 12px;
  background: var(--stick-colour);
  opacity: 1;
  box-shadow: 0 0 0 1px var(--stick-outline);
}

.edge.subdivision-edge::before {
  background: var(--stick-colour);
  opacity: 0.7;
  box-shadow: 0 0 0 2px rgb(255 255 255 / 28%);
}

.final-summary {
  width: min(100%, 650px);
  margin: 8px auto 14px;
  padding: 14px;
  border: 1px solid #8b9199;
  border-radius: 10px;
  background: #2b3036;
}

.final-summary h2 {
  margin: 0 0 8px;
}

.final-summary p {
  margin: 5px 0;
}

@media (max-width: 650px) {
  .mode-panel {
    align-items: stretch;
    flex-direction: column;
    width: min(100%, 320px);
  }

  .player-status {
    grid-template-columns: 1fr;
  }

  .playtest-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #board {
    transform: scale(0.72);
    transform-origin: top center;
    margin-bottom: -140px;
  }
}


/* Partition v0.8 playtest build */
.version-label {
  margin: -4px 0 14px;
  color: var(--muted-text);
  font-size: 14px;
  font-weight: bold;
}

.rules-panel,
.playtest-log-panel,
.game-report {
  width: min(100%, 760px);
  margin: 0 auto 16px;
  border: 1px solid #555d66;
  border-radius: 10px;
  background: #292e34;
  text-align: left;
}

.rules-panel summary,
.playtest-log-panel summary {
  padding: 11px 14px;
  cursor: pointer;
  font-weight: bold;
}

.rules-content {
  padding: 0 14px 12px;
  color: var(--muted-text);
  font-size: 14px;
  line-height: 1.45;
}

.rules-content p {
  margin: 7px 0;
}

.game-report {
  padding: 14px;
}

.game-report h2 {
  margin: 0 0 10px;
  text-align: center;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
}

.report-item {
  padding: 7px 0;
  border-bottom: 1px solid #444b53;
}

.report-item strong {
  display: block;
  margin-bottom: 2px;
  color: var(--muted-text);
  font-size: 12px;
  text-transform: uppercase;
}

.report-wide {
  grid-column: 1 / -1;
}

.report-controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.report-controls button {
  padding: 9px 13px;
  border: 1px solid #8b9199;
  border-radius: 6px;
  color: var(--page-text);
  background: #343a41;
  cursor: pointer;
}

.report-controls button:hover:not(:disabled) {
  background: #4a5159;
}

.log-note {
  margin: 0;
  padding: 0 14px 8px;
  color: var(--muted-text);
  font-size: 13px;
}

#playtest-history {
  padding: 0 14px 4px;
  overflow-x: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.history-table th,
.history-table td {
  padding: 6px;
  border-bottom: 1px solid #444b53;
  text-align: left;
  white-space: nowrap;
}

.history-empty {
  padding: 8px 0 12px;
  color: var(--muted-text);
  text-align: center;
}

.copy-success {
  border-color: #76b981 !important;
}

@media (max-width: 650px) {
  .report-grid {
    grid-template-columns: 1fr;
  }

  .report-wide {
    grid-column: auto;
  }
}

/* Tester-facing polish for Partition v0.8 */
.playtest-header {
  margin: 0 auto 16px;
}

.playtest-header h1 {
  margin-bottom: 6px;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.08;
}

.playtest-tagline {
  width: min(100%, 680px);
  margin: 0 auto;
  color: var(--muted-text);
  font-size: 14px;
  line-height: 1.4;
}

.rules-panel {
  overflow: hidden;
}

.rules-panel summary {
  background: #30363d;
}

.rules-panel[open] summary {
  border-bottom: 1px solid #444b53;
}

.rules-intro {
  margin: 12px 0 10px !important;
  color: var(--page-text);
}

.how-to-steps {
  margin: 8px 0 12px 22px;
  padding: 0;
}

.how-to-steps li {
  margin: 7px 0;
  padding-left: 3px;
}

.rules-scoring {
  padding-top: 3px;
  border-top: 1px solid #444b53;
}

.rules-scoring p:first-child {
  margin-top: 11px;
}

.report-share-box {
  margin: 14px 0 4px;
  padding: 11px 12px;
  border: 1px solid #686f78;
  border-radius: 8px;
  background: #22272d;
  text-align: left;
}

.report-share-box p {
  margin: 0;
  line-height: 1.4;
}

.report-feedback-prompt {
  margin-top: 6px !important;
  color: var(--muted-text);
  font-size: 13px;
}

@media (max-width: 650px) {
  .playtest-header {
    margin-bottom: 12px;
  }

  .playtest-tagline {
    font-size: 13px;
  }

  .rules-content {
    font-size: 13px;
  }
}
