/* Only styles Tailwind can't express or that apply to dynamically created elements */

:root {
  --forest: #2d5a27;
  --hills: #b85c38;
  --pasture: #7ec850;
  --fields: #e8b430;
  --mountains: #7a7a7a;
  --desert: #d4c088;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

.is-hidden {
  display: none !important;
}

.auth-active {
  min-height: 100vh;
  overflow: auto;
}

.login-page {
  min-height: 100vh;
  width: 100%;
  padding: 32px;
  background: #101827;
  color: #e5edf7;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 440px);
  gap: 32px;
  width: min(1180px, 100%);
  min-height: calc(100vh - 64px);
  margin: 0 auto;
  align-items: center;
}

.login-copy {
  min-width: 0;
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 42px;
  color: #f8fafc;
  font-size: 0.95rem;
  font-weight: 700;
}

.login-mark {
  width: 28px;
  height: 28px;
  background: #2d5a27;
  clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0 50%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    0 8px 20px rgba(45, 90, 39, 0.3);
}

.login-copy h1 {
  max-width: 100%;
  margin-bottom: 18px;
  color: #ffffff;
  font-size: 3.65rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.login-copy p {
  max-width: 560px;
  margin-bottom: 28px;
  color: #b9c7d8;
  font-size: 1.05rem;
  line-height: 1.65;
}

.login-preview {
  width: min(640px, 100%);
  display: flex;
  justify-content: center;
  overflow: visible;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  background: #16213e;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
}

.login-preview img {
  display: block;
  width: 50%;
  height: auto;
}

.login-panel {
  width: 100%;
  padding: 28px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.28);
}

.login-panel-header {
  margin-bottom: 18px;
}

.login-eyebrow {
  margin-bottom: 6px;
  color: #b85c38;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.login-panel h2 {
  color: #0f172a;
  font-size: 1.6rem;
  font-weight: 800;
}

.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid #dbe4ee;
  border-radius: 6px;
  background: #e9eef5;
}

.login-tab {
  min-height: 36px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #475569;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}

.login-tab.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.clerk-auth-mount {
  min-height: 440px;
}

.login-status {
  min-height: 20px;
  margin-top: 14px;
  color: #64748b;
  font-size: 0.78rem;
}

@media (max-width: 900px) {
  .login-page {
    padding: 18px;
  }

  .login-shell {
    grid-template-columns: 1fr;
    gap: 22px;
    min-height: auto;
  }

  .login-brand {
    margin-bottom: 26px;
  }

  .login-copy h1 {
    font-size: 2.1rem;
  }

  .login-copy p {
    font-size: 0.95rem;
  }

  .login-panel {
    padding: 20px;
  }
}

@media (max-width: 420px) {
  .login-copy h1 {
    font-size: 1.75rem;
  }
}

/* Active player highlight */
.player-card {
  position: relative;
}

.player-card.active {
  border-color: #e94560 !important;
}

.player-card-header {
  min-height: 22px;
  padding-right: 30px;
}

.vp-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  display: inline-flex;
  box-sizing: border-box;
  width: 24px;
  min-width: 24px;
  height: 22px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid currentColor;
  border-radius: 5px;
  background: rgba(15, 52, 96, 0.55);
  padding: 0;
  font-family: inherit;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

#player-0 .vp-badge {
  color: #4a9eff;
}

#player-1 .vp-badge {
  color: #ff6b6b;
}

.ad-card {
  width: 100%;
  min-height: 110px;
  overflow: hidden;
}

#left-ad-panel {
  width: 11rem;
  min-width: 11rem;
}

#board-play-area {
  min-width: 0;
  min-height: 0;
}

.analysis-bar-panel {
  position: absolute;
  z-index: 9;
  top: var(--board-content-top);
  bottom: var(--board-content-bottom);
  left: max(0px, calc(var(--board-content-left) - var(--analysis-bar-width)));
  width: var(--analysis-bar-width);
  min-width: var(--analysis-bar-width);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  overflow: hidden;
}

.analysis-bar-track {
  position: relative;
  width: 32px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #374151;
  border-radius: 5px;
  background: #1f2937;
}

.analysis-bar-fill {
  position: absolute;
  left: 0;
  right: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: height 0.18s ease;
}

.analysis-bar-p1 {
  top: 0;
  background: #4a9eff;
}

.analysis-bar-p2 {
  bottom: 0;
  background: #ff6b6b;
}

.analysis-bar-midline {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(255, 255, 255, 0.45);
}

.analysis-bar-label {
  color: #ffffff;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
}

#action-panel,
#action-list {
  min-height: 0;
}

/* Resource cards — always-visible colored rectangles with count */
.resource-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 20px;
  border-radius: 3px;
  margin: 1px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
}
.resource-card.lumber { background: var(--forest); }
.resource-card.brick { background: var(--hills); }
.resource-card.wool { background: var(--pasture); color: #1a3a10; }
.resource-card.grain { background: var(--fields); color: #5a4000; }
.resource-card.ore { background: var(--mountains); }

.board-resource-legend {
  position: absolute;
  z-index: 10;
  left: var(--board-content-left);
  right: var(--board-content-right);
  bottom: var(--board-content-bottom);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  pointer-events: none;
}

.board-resource-legend.hidden {
  display: none;
}

.board-resource-card {
  flex: 0 0 74px;
  width: 74px;
  height: 36px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.36);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.38);
  font-size: 0.7rem;
  letter-spacing: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
}

.board-resource-card.wool,
.board-resource-card.grain {
  text-shadow: none;
}

.resource-animation-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: visible;
  pointer-events: none;
}

.resource-production-chip {
  position: absolute;
  width: 38px;
  height: 24px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  font-size: 0.75rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
  transform: translate(-50%, -50%) scale(0.75);
  opacity: 0;
  animation: resource-production-flight 900ms cubic-bezier(0.22, 0.85, 0.26, 1) forwards;
}

.resource-production-chip.wool,
.resource-production-chip.grain {
  text-shadow: none;
}

@keyframes resource-production-flight {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.75);
  }
  16% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  72% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--resource-dx) - 50%), calc(var(--resource-dy) - 50%)) scale(0.55);
  }
}

/* Dev card chips */
.dev-chip {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin: 0.1rem;
  font-size: 0.7rem;
  background: #4a3060;
  color: #dcc;
}
.dev-chip.bought-this-turn {
  background: #3a2848;
  color: #aa99aa;
}
.dev-chip.hidden-dev {
  background: #3a3a3a;
  color: #999;
  font-style: italic;
}
.dev-chip.dev-estimate {
  background: #2a2a3a;
  color: #8888aa;
  font-style: italic;
  font-size: 0.65rem;
}

/* Instant SVG tooltip (replaces browser-native <title> delay) */
#svg-tooltip {
  position: fixed;
  pointer-events: none;
  padding: 2px 6px;
  border-radius: 3px;
  background: #222;
  color: #ddd;
  font-size: 11px;
  white-space: nowrap;
  z-index: 1000;
  display: none;
}

.roll-badge {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  background: rgba(15, 52, 96, 0.88);
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.roll-badge.hidden {
  display: none;
}

#board-shell {
  --analysis-bar-width: 40px;
  --board-content-left: 0px;
  --board-content-top: 0px;
  --board-content-right: 0px;
  --board-content-bottom: 0px;
  --board-content-center-x: 50%;
  padding-left: var(--analysis-bar-width);
}

#board-shell:has(#analysis-bar-panel.hidden) {
  --analysis-bar-width: 0px;
}

#btn-rotate-left {
  left: var(--board-content-left);
  top: var(--board-content-top);
}

#btn-rotate-right {
  right: var(--board-content-right);
  top: var(--board-content-top);
}

#btn-mirror-board {
  left: var(--board-content-center-x);
  top: var(--board-content-top);
}

#roll-badge {
  right: var(--board-content-right);
  bottom: var(--board-content-bottom);
}

#board-history-controls {
  left: var(--board-content-left);
  bottom: var(--board-content-bottom);
}

.editor-terrain-btn,
.editor-number-btn,
.editor-port-btn {
  appearance: none;
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  border: 1px solid #374151;
  border-radius: 5px;
  background: #0f3460;
  color: #e5e7eb;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.editor-terrain-btn:hover,
.editor-number-btn:hover,
.editor-port-btn:hover,
.editor-terrain-btn.active,
.editor-number-btn.active,
.editor-port-btn.active {
  border-color: #e94560;
  background: #223b68;
}

.editor-terrain-btn:disabled,
.editor-number-btn:disabled,
.editor-port-btn:disabled {
  cursor: default;
  opacity: 0.42;
}

.editor-swatch {
  display: inline-block;
  width: 14px;
  min-width: 14px;
  height: 14px;
  min-height: 14px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 3px;
}

.editor-number-btn,
.editor-port-btn {
  justify-content: space-between;
}

.editor-number-label,
.editor-port-label {
  min-width: 18px;
  font-weight: 700;
}

.editor-number-pips {
  display: inline-flex;
  min-width: 34px;
  justify-content: flex-end;
  gap: 2px;
}

.editor-number-pips span {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
}

.editor-random-btn {
  min-height: 34px;
  border: 1px solid #374151;
  border-radius: 5px;
  background: #0f3460;
  color: #e5e7eb;
  padding: 7px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.editor-random-btn:hover {
  border-color: #e94560;
  background: #223b68;
}

/* Tree explorer toggle */
.tree-children { display: none; }
.tree-children.open { display: block; }
