.spiral-game {
  display: grid;
  gap: 12px;
}

.spiral-prompt,
.spiral-status,
.spiral-route {
  min-width: 0;
  border: 1px solid #d2dae6;
  border-radius: 8px;
  background: #f8fafc;
  color: #344054;
  padding: 10px 12px;
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.spiral-status-good {
  border-color: #0f766e;
  background: #d7f4ef;
  color: #0f514b;
}

.spiral-status-warn {
  border-color: #b45309;
  background: #fff7ed;
  color: #8a3b07;
}

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

.spiral-stat {
  min-width: 0;
  border: 1px solid #d2dae6;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 9px;
  box-shadow: 0 8px 18px rgba(20, 31, 50, 0.05);
}

.spiral-stat span {
  display: block;
  color: #667085;
  font-size: 12px;
  line-height: 1.2;
}

.spiral-stat strong {
  display: block;
  margin-top: 3px;
  color: #17202a;
  font-size: 20px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.spiral-stat-hot {
  border-color: #0f766e;
  background: #e9fbf7;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.spiral-stat-crossed {
  color: #667085;
  background: #eef2f6;
}

.spiral-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(184px, 0.55fr);
  gap: 12px;
  align-items: stretch;
}

.spiral-matrix-panel,
.spiral-control-panel {
  min-width: 0;
  border: 1px solid #d2dae6;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(20, 31, 50, 0.06);
}

.spiral-matrix-panel {
  padding: 12px;
}

.spiral-grid {
  width: min(100%, 344px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(44px, 1fr));
  grid-template-rows: repeat(4, minmax(44px, 1fr));
  gap: 7px;
  aspect-ratio: 1;
  border-radius: 8px;
  padding: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 248, 251, 0.92)),
    repeating-linear-gradient(135deg, rgba(15, 118, 110, 0.05) 0, rgba(15, 118, 110, 0.05) 1px, transparent 1px, transparent 15px);
  box-shadow: inset 0 0 0 1px #e1e7ef;
}

.spiral-cell {
  min-width: 0;
  min-height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  display: grid;
  place-items: center;
  color: #17202a;
  font-weight: 850;
  font-size: 17px;
  line-height: 1;
  box-shadow: 0 5px 12px rgba(20, 31, 50, 0.06);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.spiral-cell span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.spiral-cell-boundary {
  border-color: #8eb7ae;
  box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.12), 0 5px 12px rgba(20, 31, 50, 0.06);
}

.spiral-cell-active {
  border-color: #d97706;
  background: #fff7ed;
  transform: scale(0.96);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18);
}

.spiral-cell-last,
.spiral-cell-visited {
  border-color: #0f766e;
  background: #d7f4ef;
  color: #0f514b;
}

.spiral-cell-done {
  box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.14);
}

.spiral-control-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  padding: 12px;
}

.spiral-heading {
  min-height: 54px;
  border: 1px solid #d2dae6;
  border-radius: 8px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
}

.spiral-heading span {
  color: #667085;
  font-size: 13px;
  font-weight: 800;
}

.spiral-heading strong {
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #17202a;
  color: #ffffff;
  font-size: 26px;
  line-height: 1;
}

.spiral-compass {
  display: grid;
  grid-template-columns: repeat(3, minmax(52px, 1fr));
  grid-template-rows: repeat(3, minmax(52px, 1fr));
  gap: 8px;
  align-content: center;
}

.spiral-choice {
  min-width: 52px;
  min-height: 52px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
  padding: 5px;
  cursor: pointer;
  touch-action: manipulation;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 4px;
  box-shadow: 0 7px 14px rgba(20, 31, 50, 0.07);
}

.spiral-choice:disabled {
  cursor: default;
  opacity: 0.72;
}

.spiral-choice:active {
  transform: scale(0.96);
}

.spiral-choice-up {
  grid-column: 2;
  grid-row: 1;
}

.spiral-choice-left {
  grid-column: 1;
  grid-row: 2;
}

.spiral-choice-right {
  grid-column: 3;
  grid-row: 2;
}

.spiral-choice-down {
  grid-column: 2;
  grid-row: 3;
}

.spiral-choice-expected {
  border-color: #0f766e;
  background: #e9fbf7;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14), 0 7px 14px rgba(20, 31, 50, 0.07);
}

.spiral-choice-wrong {
  border-color: #b42318;
  background: #fff1f0;
  animation: spiral-shake 0.34s ease;
}

.spiral-route-icon {
  width: 28px;
  height: 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 2px;
}

.spiral-mini-cell {
  border-radius: 2px;
  background: #e6ecf4;
}

.spiral-mini-cell-on {
  background: #0f766e;
}

.spiral-choice-arrow {
  display: grid;
  place-items: center;
  color: #17202a;
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
}

.spiral-route {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 50px;
}

.spiral-route-chip {
  min-width: 32px;
  min-height: 32px;
  border-radius: 999px;
  background: #eef2f6;
  color: #344054;
  display: grid;
  place-items: center;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.spiral-route-chip-new {
  background: #0f766e;
  color: #ffffff;
}

.spiral-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.spiral-button {
  min-height: 46px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.spiral-button-primary {
  border-color: #0f766e;
  background: #0f766e;
  color: #ffffff;
}

@keyframes spiral-shake {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
}

@media (max-width: 720px) {
  .spiral-stage {
    grid-template-columns: 1fr;
  }

  .spiral-control-panel {
    grid-template-columns: minmax(0, 0.7fr) minmax(160px, 1fr);
    grid-template-rows: auto;
    align-items: center;
  }

  .spiral-compass {
    grid-template-columns: repeat(3, minmax(48px, 1fr));
    grid-template-rows: repeat(3, minmax(48px, 1fr));
  }
}

@media (max-width: 430px) {
  .spiral-game {
    gap: 10px;
  }

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

  .spiral-stage,
  .spiral-matrix-panel,
  .spiral-control-panel {
    gap: 10px;
  }

  .spiral-matrix-panel,
  .spiral-control-panel {
    padding: 10px;
  }

  .spiral-grid {
    grid-template-columns: repeat(4, minmax(44px, 1fr));
    grid-template-rows: repeat(4, minmax(44px, 1fr));
    gap: 5px;
    padding: 6px;
  }

  .spiral-cell {
    font-size: 15px;
  }

  .spiral-control-panel {
    grid-template-columns: 1fr;
  }

  .spiral-heading {
    min-height: 48px;
  }

  .spiral-heading strong {
    min-width: 44px;
    min-height: 44px;
    font-size: 24px;
  }

  .spiral-choice {
    min-height: 54px;
  }

  .spiral-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}
