:root {
  --hex-width: 90px;
  --hex-height: 78px;
  --hex-scale: 1.0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #000000;
  color: #e5e7eb;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
}

header {
  padding: 0.6rem 1.5rem;
  background: #020617cc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  z-index: 10;
  border-bottom: 1px solid #111827;
}

header h1 {
  font-size: 0.95rem;
  font-weight: 600;
}

.layout-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: #9ca3af;
}

.layout-toggle select {
  border-radius: 999px;
  border: 1px solid #374151;
  padding: 0.25rem 0.6rem;
  background: #020617;
  color: #e5e7eb;
  font-size: 0.8rem;
}

main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* LEFT: background + hexes */
.board-wrap {
  flex: 3;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
  padding: 0.5rem;
}

.board-image {
  position: relative;
  width: 100%;
  max-width: 1300px;
  aspect-ratio: 16 / 9;
  background-image: url("background-plain.png");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  border: 1px solid #1f2937;
  overflow: hidden;
}

/* Slide overlay (title + category labels) */
.slide-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.slide-title {
  margin-top: 1.4rem;
  font-size: 2.6rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #f9fafb;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
}

/* Subheads fill the board; individual spans positioned via JS */
.slide-subheads {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.slide-subheads span {
  position: absolute;
  transform: translateX(-50%);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
}

/* Only colors are fixed here; positions come from JS */
.subhead-govern  { color: #79B657; }
.subhead-identify{ color: #41BAA5; }
.subhead-protect { color: #2590E5; }
.subhead-detect  { color: #DA7726; }
.subhead-respond { color: #9870D2; }
.subhead-recover { color: #E36667; }

/* ========= HEXES WITH BORDER RING (animated between modes) ========= */
.hex {
  position: absolute;
  width: var(--hex-width);
  height: var(--hex-height);
  --hex-border-color: #ffffff;
  background-color: var(--hex-border-color);
  cursor: pointer;
  user-select: none;
  z-index: 1;
  transition:
    left 0.45s ease,
    top 0.45s ease,
    clip-path 0.45s ease,
    transform 0.45s ease,
    box-shadow 0.12s ease;
}

/* Inner hex */
.hex::after {
  content: "";
  position: absolute;
  inset: 4px;
  background-color: #404040;
  pointer-events: none;
  box-sizing: border-box;
  z-index: 1;
  transition: clip-path 0.45s ease, background-color 0.12s ease;
}

/* MODE: SLIDE (pointy-top) */
.mode-slide .hex,
.mode-slide .hex::after {
  clip-path: polygon(
    50% 0%,
    93% 25%,
    93% 75%,
    50% 100%,
    7% 75%,
    7% 25%
  );
}

/* MODE: WALL (flat-top) */
.mode-wall .hex,
.mode-wall .hex::after {
  clip-path: polygon(
    25% 0%,
    75% 0%,
    100% 50%,
    75% 100%,
    25% 100%,
    0% 50%
  );
}

.hex:hover {
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.hex.selected {
  box-shadow: 0 0 0 2px #facc15, 0 0 16px rgba(250, 204, 21, 0.55);
}

/* fill colors applied to the INNER hex */
.hex.fill-red::after {
  background-color: #ef4444;
}
.hex.fill-green::after {
  background-color: #22c55e;
}
.hex.fill-yellow::after {
  background-color: #eab308;
}
.hex.fill-none::after {
  background-color: #404040;
}

/* LABEL INSIDE HEX */
.hex-label {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 64%;
  height: 70%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: "Nunito", -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.68rem;
  line-height: 1.2;
  padding: 0.1em;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: normal;
  hyphens: none;
  pointer-events: none;
  color: #f9fafb;
}

.hex-label--small {
  font-size: 0.60rem;
  line-height: 1.1;
}

/* RIGHT: control panel */
.side-panel {
  flex: 1.0;
  background: #020617f0;
  padding: 0.9rem;
  border-left: 1px solid #111827;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  overflow-y: auto;
}

.panel-section {
  border: 1px solid #111827;
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  background: #020617;
}

.panel-section h2 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.field {
  margin-bottom: 0.5rem;
}

.field label {
  font-size: 0.75rem;
  color: #9ca3af;
  display: block;
  margin-bottom: 0.25rem;
}

.field .value {
  font-size: 0.9rem;
  font-weight: 500;
}

textarea {
  width: 100%;
  min-height: 70px;
  resize: vertical;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  border: 1px solid #1f2937;
  background: #020617;
  color: #e5e7eb;
  font-size: 0.85rem;
}

textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.4);
}

.color-buttons {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.btn {
  border-radius: 999px;
  border: 1px solid #374151;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  background: #111827;
  color: #e5e7eb;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: background 0.12s ease, transform 0.05s ease, border-color 0.12s ease;
}

.btn:hover {
  background: #1f2937;
  border-color: #4b5563;
}

.btn:active {
  transform: scale(0.97);
}

.badge {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.badge-red { background: #ef4444; }
.badge-green { background: #22c55e; }
.badge-yellow { background: #eab308; }

.btn-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

select,
input[type="text"] {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #1f2937;
  background: #020617;
  color: #e5e7eb;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
}

select:focus,
input[type="text"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.4);
}

footer {
  font-size: 0.7rem;
  color: #6b7280;
  padding: 0.35rem 1rem;
  background: #020617;
  border-top: 1px solid #111827;
}
