.hex-app-page {
  min-height: 100vh;
}

.hex-app-header {
  display: flex;
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 0;
}

.hex-app-header h1 {
  font-size: clamp(2rem, 8vw, 4rem);
}

.hex-app-main {
  display: grid;
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 48px;
}

.hex-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(16px, 4vw, 28px);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

.hex-info {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.hex-info h2 {
  margin-bottom: 6px;
  font-size: 1.25rem;
}

.hex-status {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.6;
}

.hex-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.pie-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--paper);
  font-weight: 900;
}

.hex-board-wrap {
  position: relative;
  overflow: auto;
  padding: 44px 52px;
}

.hex-board {
  display: grid;
  gap: 4px;
  width: min(680px, 92vw);
  min-width: 420px;
  margin: 0 auto;
}

.hex-row {
  display: flex;
  gap: 4px;
  margin-left: calc(var(--row) * 22px);
}

.hex-cell {
  display: grid;
  width: 46px;
  height: 40px;
  place-items: center;
  border: 2px solid #d3d8d0;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  background: #ffffff;
  cursor: pointer;
  transition:
    transform 120ms ease,
    background 120ms ease,
    border-color 120ms ease;
}

.hex-cell:hover:not(:disabled),
.hex-cell:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  outline: none;
}

.hex-cell:disabled {
  cursor: default;
}

.hex-cell.red {
  border-color: #a92220;
  background: #d83b36;
}

.hex-cell.blue {
  border-color: #244f9f;
  background: #3867c8;
}

.hex-cell.win {
  box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--gold);
  z-index: 1;
}

.edge {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 28px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
}

.edge-top,
.edge-bottom {
  left: 50%;
  background: #d83b36;
  transform: translateX(-50%);
}

.edge-top {
  top: 4px;
}

.edge-bottom {
  bottom: 4px;
}

.edge-left,
.edge-right {
  top: 50%;
  background: #3867c8;
  transform: translateY(-50%);
}

.edge-left {
  left: 4px;
}

.edge-right {
  right: 4px;
}

@media (max-width: 720px) {
  .hex-app-header,
  .hex-info {
    align-items: stretch;
    flex-direction: column;
  }

  .hex-actions {
    justify-content: flex-start;
  }

  .hex-board-wrap {
    padding-right: 20px;
    padding-left: 20px;
  }
}
