/* Chirality hotseat MVP styles */

#chirality-root {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5em 1em;
  font-family: var(--font-sans, system-ui, sans-serif);
}

#chirality-root h1 {
  margin: 0 0 0.4em;
  font-size: 2rem;
  font-weight: 700;
}

#chirality-root .chirality-subtitle {
  margin: 0 0 1.5em;
  font-size: 1rem;
  opacity: 0.75;
  line-height: 1.5;
}

#chirality-hud {
  margin-bottom: 1em;
  padding: 1.2em 1.4em;
  background: var(--mpe-card-bg, #f7f6f2);
  border: 1px solid var(--mpe-card-border, #e5e3da);
  border-radius: 10px;
}

/* Game setup config row (player count, setup mode, blitz) */
.chirality-config-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4em;
  align-items: flex-end;
  padding-bottom: 1em;
  margin-bottom: 1em;
  border-bottom: 1px solid var(--mpe-card-border, #e5e3da);
}

.chirality-config-group {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
}

.chirality-config-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
}

.chirality-stepper {
  display: inline-flex;
  align-items: stretch;
  border: 2px solid #555;
  border-radius: 6px;
  overflow: hidden;
}

.chirality-stepper button {
  padding: 0.5em 0.9em;
  font-size: 1.05rem;
  font-weight: 700;
  background: white;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: #15171a;
  transition: background 0.1s;
}

.chirality-stepper button:hover:not(:disabled) {
  background: #f0f0f0;
}

.chirality-stepper button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chirality-stepper-value {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5em;
  font-size: 1.1rem;
  font-weight: 800;
  background: #f7f6f2;
  font-variant-numeric: tabular-nums;
}

.chirality-setup-modes {
  display: inline-flex;
  border: 2px solid #555;
  border-radius: 6px;
  overflow: hidden;
}

.chirality-setup-modes button {
  padding: 0.5em 1em;
  font-size: 0.95rem;
  font-weight: 700;
  background: white;
  border: none;
  border-right: 1px solid #ccc;
  cursor: pointer;
  font-family: inherit;
  color: #15171a;
  transition: background 0.1s;
}

.chirality-setup-modes button:last-child { border-right: none; }
.chirality-setup-modes button:hover:not(:disabled) { background: #f0f0f0; }
.chirality-setup-modes button:disabled { opacity: 0.4; cursor: not-allowed; }
.chirality-setup-modes button.on {
  background: #EEC643;
  color: #15171a;
}

.chirality-config-group #btn-blitz {
  padding: 0.55em 1em;
  font-size: 0.95rem;
  font-weight: 700;
  background: white;
  border: 2px solid #555;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  color: #15171a;
}
.chirality-config-group #btn-blitz.on {
  background: #EEC643;
}

.chirality-hud-players {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.7em;
}

.chirality-hud-row {
  display: flex;
  gap: 1em;
  margin-bottom: 1em;
  flex-wrap: wrap;
}

.chirality-hud-player {
  padding: 0.7em 0.9em;
  border-radius: 8px;
  background: rgba(255,255,255,0.5);
  border: 2px solid transparent;
  transition: all 0.15s;
}

/* Persistent player theming (5 players supported) */
.chirality-hud-player.p1 { background: rgba(238, 198, 67, 0.15); border-color: rgba(238, 198, 67, 0.4); }
.chirality-hud-player.p2 { background: rgba(152, 251, 152, 0.18); border-color: rgba(120, 200, 120, 0.5); }
.chirality-hud-player.p3 { background: rgba(231, 76, 60, 0.15);  border-color: rgba(231, 76, 60, 0.45); }
.chirality-hud-player.p4 { background: rgba(52, 152, 219, 0.15); border-color: rgba(52, 152, 219, 0.5); }
.chirality-hud-player.p5 { background: rgba(155, 89, 182, 0.15); border-color: rgba(155, 89, 182, 0.5); }

.chirality-hud-player.p1.active { background: rgba(238, 198, 67, 0.32); border-color: #EEC643; box-shadow: 0 0 0 3px rgba(238, 198, 67, 0.18); }
.chirality-hud-player.p2.active { background: rgba(152, 251, 152, 0.38); border-color: #6cce6c; box-shadow: 0 0 0 3px rgba(120, 200, 120, 0.22); }
.chirality-hud-player.p3.active { background: rgba(231, 76, 60, 0.32); border-color: #c0392b; box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2); }
.chirality-hud-player.p4.active { background: rgba(52, 152, 219, 0.32); border-color: #2980b9; box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2); }
.chirality-hud-player.p5.active { background: rgba(155, 89, 182, 0.32); border-color: #8e44ad; box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.2); }

.chirality-hud-player.eliminated {
  opacity: 0.45;
  filter: grayscale(0.6);
}

.chirality-player-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #15171a;
  vertical-align: middle;
  margin-right: 0.4em;
}

.chirality-elim-tag {
  display: inline-block;
  margin-left: 0.5em;
  padding: 0.05em 0.45em;
  background: #15171a;
  color: #fff;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.chirality-hud-player .chirality-hud-label {
  font-weight: 800;
  font-size: 1.1rem;
  margin-bottom: 0.3em;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
}

.chirality-hud-player .chirality-hud-stats {
  font-size: 0.95rem;
  opacity: 0.9;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.chirality-actions-left {
  display: inline-block;
  margin-left: 0.6em;
  padding: 0.15em 0.5em;
  background: #15171a;
  color: #fff;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 700;
}

.chirality-hud-message {
  padding: 0.9em 1.1em;
  background: rgba(0,0,0,0.06);
  border-radius: 6px;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.45;
  min-height: 1.5em;
  margin-bottom: 1em;
}

.chirality-hud-actions {
  display: flex;
  gap: 0.7em;
  flex-wrap: wrap;
}

.chirality-hud-actions button {
  padding: 0.85em 1.6em;
  background: white;
  border: 2px solid #555;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  font-family: inherit;
  color: #15171a;
  transition: all 0.1s;
  min-width: 110px;
}

.chirality-hud-actions button:hover:not(:disabled) {
  background: #f0f0f0;
  transform: translateY(-1px);
}

.chirality-hud-actions button:active:not(:disabled) {
  transform: translateY(0);
}

.chirality-hud-actions button.on {
  background: #EEC643;
  border-color: #15171a;
  color: #15171a;
  box-shadow: 0 2px 0 #15171a;
}

.chirality-hud-actions button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#chirality-board-wrap {
  background: var(--mpe-card-bg, #f7f6f2);
  border: 1px solid var(--mpe-card-border, #e5e3da);
  border-radius: 10px;
  padding: 1em;
}

#chirality-board {
  display: block;
  width: 100%;
  height: auto;
  max-height: 80vh;
  user-select: none;
  -webkit-user-select: none;
}

.chirality-tile {
  stroke: #000;
  stroke-width: 0.04;
  stroke-linejoin: round;
  cursor: pointer;
  transition: filter 0.1s;
}

.chirality-tile.thick { fill: #EEC643; }
.chirality-tile.thin  { fill: #98FB98; }

.chirality-tile:hover { filter: brightness(0.92); }

/* Gate tiles get a subtle persistent outline so players can see them */
.chirality-tile.gate {
  stroke: #15171a;
  stroke-width: 0.08;
}

/* Setup phase: glow the Gate tiles strongly */
.chirality-tile.setup-legal {
  stroke: #0066cc;
  stroke-width: 0.18;
  filter: brightness(1.12) saturate(1.2);
  animation: chirality-pulse 1.6s ease-in-out infinite;
}

@keyframes chirality-pulse {
  0%, 100% { filter: brightness(1.12) saturate(1.2); }
  50% { filter: brightness(1.25) saturate(1.4); }
}

.chirality-tile.throne {
  stroke: #d4a017;
  stroke-width: 0.16;
}

.chirality-tile.selected {
  stroke: #0066cc;
  stroke-width: 0.18;
  filter: brightness(1.1);
}

.chirality-tile.legal-target {
  stroke: #0066cc;
  stroke-width: 0.14;
  filter: brightness(1.2) saturate(1.3);
}

.chirality-tile.last-from {
  filter: brightness(0.82);
}

.chirality-tile.last-to {
  stroke: #c0392b;
  stroke-width: 0.1;
}

/* Garrison tile highlight: subtle player-colored glow ring */
.chirality-tile.garrison-p1 { stroke: #b8860b; stroke-width: 0.14; filter: brightness(0.95) saturate(1.3); }
.chirality-tile.garrison-p2 { stroke: #2e8b57; stroke-width: 0.14; filter: brightness(0.95) saturate(1.3); }
.chirality-tile.garrison-p3 { stroke: #962d22; stroke-width: 0.14; filter: brightness(0.95) saturate(1.3); }
.chirality-tile.garrison-p4 { stroke: #1d6196; stroke-width: 0.14; filter: brightness(0.95) saturate(1.3); }
.chirality-tile.garrison-p5 { stroke: #5e3c70; stroke-width: 0.14; filter: brightness(0.95) saturate(1.3); }

/* Moat tiles attacked by an active Garrison get a faint warning tint */
.chirality-tile.moat-p1 { stroke: rgba(184, 134, 11, 0.5); stroke-width: 0.06; }
.chirality-tile.moat-p2 { stroke: rgba(46, 139, 87, 0.5);  stroke-width: 0.06; }
.chirality-tile.moat-p3 { stroke: rgba(150, 45, 34, 0.5);  stroke-width: 0.06; }
.chirality-tile.moat-p4 { stroke: rgba(29, 97, 150, 0.5);  stroke-width: 0.06; }
.chirality-tile.moat-p5 { stroke: rgba(94, 60, 112, 0.5);  stroke-width: 0.06; }

/* Piece rendering: two concentric circles. Outer = dark contrast ring, inner = player color. */
.chirality-piece-group {
  pointer-events: none;
}

.chirality-piece-outer {
  fill: #15171a;
  stroke: #fff;
  stroke-width: 0.04;
}

.chirality-piece-inner {
  stroke: none;
}

.chirality-piece-group.p1 .chirality-piece-inner { fill: #EEC643; }
.chirality-piece-group.p2 .chirality-piece-inner { fill: #98FB98; }

/* Garrison members get a slight outer-ring color shift to signal immunity */
.chirality-piece-group.in-garrison .chirality-piece-outer {
  stroke: #fff;
  stroke-width: 0.08;
}
.chirality-piece-group.p1.in-garrison .chirality-piece-outer { fill: #b8860b; }
.chirality-piece-group.p2.in-garrison .chirality-piece-outer { fill: #2e8b57; }

#chirality-legend {
  margin-top: 1.5em;
  padding: 1.6em 1.8em;
  background: var(--mpe-card-bg, #f7f6f2);
  border: 1px solid var(--mpe-card-border, #e5e3da);
  border-radius: 10px;
  font-size: 1rem;
  line-height: 1.6;
}

.chirality-legend-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 1em;
  padding-bottom: 0.6em;
  border-bottom: 1px solid var(--mpe-card-border, #e5e3da);
}

.chirality-legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.6em 2em;
  margin-bottom: 1.4em;
}

.chirality-legend-section h3 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 0 0 0.4em;
  opacity: 0.92;
}

.chirality-legend-section p {
  margin: 0 0 0.5em;
  font-size: 0.96rem;
  line-height: 1.55;
}

.chirality-legend-section ul,
.chirality-setup-list {
  margin: 0.3em 0 0.6em;
  padding-left: 1.2em;
  list-style: disc;
}

.chirality-legend-section li {
  font-size: 0.94rem;
  line-height: 1.55;
  margin-bottom: 0.3em;
}

/* In-text accent terms */
.thick-term { color: #b8860b; }
.thin-term  { color: #2e8b57; }
.throne-term { color: #d4a017; }

#chirality-legend strong {
  font-weight: 700;
}

.chirality-legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5em;
  padding-top: 1em;
  border-top: 1px solid var(--mpe-card-border, #e5e3da);
  font-size: 0.95rem;
}

.chirality-legend-row > div {
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.chirality-legend-row .swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 1px solid #555;
  vertical-align: middle;
}

.chirality-legend-row .swatch.thick { background: #EEC643; }
.chirality-legend-row .swatch.thin  { background: #98FB98; }
.chirality-legend-row .swatch.p1    { background: #EEC643; border-radius: 50%; border-color: #15171a; }
.chirality-legend-row .swatch.p2    { background: #98FB98; border-radius: 50%; border-color: #15171a; }

.chirality-rules-footer {
  margin-top: 1em;
  opacity: 0.75;
  font-size: 0.9rem;
}

@media (prefers-color-scheme: dark) {
  body.dark-mode .chirality-hud-player {
    background: rgba(255,255,255,0.05);
  }
  body.dark-mode .chirality-hud-message {
    background: rgba(255,255,255,0.05);
  }
  body.dark-mode .chirality-hud-actions button {
    background: #2a2c33;
    border-color: #555;
    color: #f2f4f8;
  }
  body.dark-mode .chirality-hud-actions button:hover:not(:disabled) {
    background: #3a3c43;
  }
}

/* === New for v2.12: board selector, player type, Inner Garrison setup === */

.chirality-select {
  padding: 0.55em 0.7em;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  background: white;
  border: 2px solid #555;
  border-radius: 6px;
  cursor: pointer;
  color: #15171a;
  min-width: 180px;
}

.chirality-select:hover {
  background: #f0f0f0;
}

.chirality-toggle {
  padding: 0.55em 1em;
  font-size: 0.95rem;
  font-weight: 700;
  background: white;
  border: 2px solid #555;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  color: #15171a;
  min-width: 70px;
}
.chirality-toggle.on {
  background: #EEC643;
}

.chirality-player-type {
  margin-top: 0.5em;
  padding: 0.35em 0.5em;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  background: white;
  border: 1.5px solid #888;
  border-radius: 5px;
  cursor: pointer;
  color: #15171a;
  width: 100%;
}

.chirality-player-type:hover { background: #f0f0f0; }

/* Inner Garrison setup highlight: green-tinted pulse on Thick tiles of unclaimed Inner Ring Stars */
.chirality-tile.inner-star-legal {
  stroke: #2e8b57;
  stroke-width: 0.18;
  filter: brightness(1.1) saturate(1.25);
  animation: chirality-pulse-green 1.6s ease-in-out infinite;
}

@keyframes chirality-pulse-green {
  0%, 100% { filter: brightness(1.08) saturate(1.2); }
  50%      { filter: brightness(1.22) saturate(1.4); }
}

@media (prefers-color-scheme: dark) {
  body.dark-mode .chirality-select,
  body.dark-mode .chirality-toggle,
  body.dark-mode .chirality-player-type {
    background: #2a2c33;
    border-color: #555;
    color: #f2f4f8;
  }
  body.dark-mode .chirality-select:hover,
  body.dark-mode .chirality-player-type:hover {
    background: #3a3c43;
  }
}

/* === Game log panel === */

.chirality-log {
  margin-top: 1.2em;
  margin-bottom: 1.2em;
  padding: 1em 1.2em;
  background: var(--mpe-card-bg, #f7f6f2);
  border: 1px solid var(--mpe-card-border, #e5e3da);
  border-radius: 10px;
}

.chirality-log-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 0 0 0.7em;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--mpe-card-border, #e5e3da);
  opacity: 0.9;
}

.chirality-log-entries {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
  font-size: 0.92rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.chirality-log-empty {
  opacity: 0.5;
  font-style: italic;
  padding: 0.3em 0;
}

.chirality-log-entry {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.32em 0;
  border-bottom: 1px solid rgba(229, 227, 218, 0.5);
}

.chirality-log-entry:last-child { border-bottom: none; }

.chirality-log-turn {
  font-weight: 700;
  opacity: 0.55;
  min-width: 2.5em;
  font-size: 0.85rem;
}

.chirality-log-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid #15171a;
  flex-shrink: 0;
}

.chirality-log-dot-none {
  background: transparent;
  border-style: dashed;
}

.chirality-log-player {
  font-weight: 700;
  min-width: 1.8em;
}

.chirality-log-tag {
  display: inline-block;
  padding: 0.04em 0.45em;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chirality-log-tag.setup { background: #c9a82a; color: #15171a; }
.chirality-log-tag.auto  { background: #888; color: white; }
.chirality-log-tag.end   { background: #15171a; color: #EEC643; }

.chirality-log-text {
  flex: 1;
}

.chirality-log-cap {
  display: inline-block;
  padding: 0.04em 0.5em;
  background: #c0392b;
  color: white;
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 700;
}

@media (prefers-color-scheme: dark) {
  body.dark-mode .chirality-log-entry {
    border-bottom-color: rgba(255, 255, 255, 0.06);
  }
}
