:root {
  --bg: #1a1a2e;
  --panel: #16213e;
  --panel2: #0f3460;
  --text: #eaeaea;
  --muted: #a8b5c0;
  --accent: #e94560;
  --accent2: #ff6b35;
  --good: #4cff7a;
  --warn: #ffb700;
  --bad: #ff3d3d;
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(
      800px 600px at 20% 0%,
      rgba(233, 69, 96, 0.6),
      transparent 50%
    ),
    radial-gradient(
      1000px 800px at 80% 100%,
      rgba(255, 107, 53, 0.5),
      transparent 60%
    ),
    linear-gradient(135deg, rgba(233, 69, 96, 0.1), rgba(255, 107, 53, 0.1)),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Space Mono", monospace;
  line-height: 1.35;
}

/* Page Management */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* Language Switch */
.lang-switch {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  padding: 6px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.lang-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.lang-btn.active {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Back Button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(10px);
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(-4px);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Landing Page */
.landing {
  max-width: 720px;
  margin: 80px auto 40px;
  padding: 32px;
  text-align: center;
}

.landing h1 {
  font-size: 42px;
  margin: 0 0 12px;
  letter-spacing: 0.5px;
}

.landing .subtitle {
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 36px;
  font-style: italic;
}

.action-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.action-cards.single-card {
  grid-template-columns: 1fr;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.action-card {
  text-align: left;
  padding: 24px;
}

.action-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
  letter-spacing: 0.3px;
  color: var(--accent);
}

.action-card p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin: 0 0 20px;
}

.action-card button {
  width: 100%;
}

/* Input & Forms */
.input-field {
  width: 100%;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 14px;
  font-weight: 800;
  font-size: 14px;
  outline: none;
  margin-bottom: 12px;
  font-family: inherit;
}

.input-field:focus {
  border-color: rgba(233, 69, 96, 0.5);
  box-shadow: 0 0 12px rgba(233, 69, 96, 0.2);
}

.input-field::placeholder {
  color: rgba(231, 238, 247, 0.3);
}

/* Buttons */
button {
  appearance: none;
  border: 1px solid var(--border);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.02)
  );
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 900;
  font-size: 13px;
  transition:
    transform 0.05s ease,
    border-color 0.2s ease,
    background 0.2s ease;
  user-select: none;
  white-space: nowrap;
  font-family: inherit;
}

button:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

button:active {
  transform: translateY(1px) scale(0.99);
}

button.primary {
  border-color: rgba(233, 69, 96, 0.35);
  background: linear-gradient(
    180deg,
    rgba(233, 69, 96, 0.28),
    rgba(233, 69, 96, 0.1)
  );
}

button.primary:hover {
  box-shadow: 0 0 12px rgba(233, 69, 96, 0.3);
}

button.primary.large {
  padding: 16px 24px;
  font-size: 16px;
  width: 100%;
}

button.secondary {
  border-color: rgba(255, 107, 53, 0.35);
  background: linear-gradient(
    180deg,
    rgba(255, 107, 53, 0.18),
    rgba(255, 107, 53, 0.05)
  );
}

button.secondary:hover {
  box-shadow: 0 0 12px rgba(255, 107, 53, 0.3);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Panel */
.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 60%),
    var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
}

/* Planning Page */
.planning-container {
  max-width: 800px;
  margin: 40px auto;
  padding: 20px;
}

.planning-header {
  margin-bottom: 40px;
}

.planning-header h1 {
  font-size: 32px;
  margin: 0;
}

.config-section h2,
.backlog-section h2 {
  color: var(--accent);
  margin-top: 0;
}

.config-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  align-items: center;
  margin-bottom: 20px;
}

.config-row label {
  font-weight: 800;
  color: var(--muted);
}

.item-input-group {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 10px;
  margin-bottom: 20px;
}

.item-input-group button {
  align-self: flex-end;
  margin-bottom: 12px;
}

.backlog-list {
  margin-bottom: 20px;
}

.backlog-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--panel2);
  border-radius: 8px;
  margin-bottom: 10px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.backlog-item-info {
  flex: 1;
}

.backlog-item-title {
  font-weight: 800;
  margin-bottom: 4px;
}

.backlog-item-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.backlog-item-points {
  background: var(--accent);
  color: white;
  padding: 4px 12px;
  border-radius: 6px;
  font-weight: 800;
  min-width: 45px;
  text-align: center;
  margin: 0 10px;
}

.backlog-item-remove {
  background: var(--bad);
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.capacity-indicator {
  margin-top: 20px;
}

.capacity-bar {
  width: 100%;
  height: 24px;
  background: var(--panel2);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.capacity-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  width: 0%;
  transition: width 0.3s ease;
}

.capacity-text {
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.action-section {
  text-align: center;
  margin-top: 30px;
}

.action-section .hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 12px;
  font-style: italic;
}

/* Game Page */
.game-container {
  max-width: 1000px;
  margin: 20px auto;
  padding: 20px;
}

.sprint-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.sprint-header h1 {
  margin: 0;
  font-size: 28px;
}

.sprint-timer {
  color: var(--muted);
  font-size: 14px;
  margin-top: 8px;
}

.sprint-stats {
  display: flex;
  gap: 30px;
}

.stat {
  text-align: center;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 24px;
  font-weight: 900;
  color: var(--accent);
}

.phase-stepper {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.phase-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  font-weight: 800;
}

.phase-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.phase-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
}

.phase-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.phase-step.active {
  color: var(--text);
  border-color: rgba(233, 69, 96, 0.4);
  background: rgba(233, 69, 96, 0.12);
}

.phase-step.active .phase-dot {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(233, 69, 96, 0.6);
}

.phase-step.complete {
  color: var(--text);
  background: rgba(76, 255, 122, 0.08);
  border-color: rgba(76, 255, 122, 0.3);
}

.phase-step.complete .phase-dot {
  background: var(--good);
}

.health-panel {
  margin-bottom: 18px;
}

.health-header {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 800;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.health-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 6px;
}

.health-value {
  color: var(--text);
  font-weight: 900;
}

.health-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.health-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width 0.3s ease;
  background: linear-gradient(
    90deg,
    rgba(233, 69, 96, 0.8),
    rgba(255, 107, 53, 0.9)
  );
}

.health-fill.good {
  background: linear-gradient(
    90deg,
    rgba(76, 255, 122, 0.7),
    rgba(0, 210, 122, 0.9)
  );
}

.health-fill.warn {
  background: linear-gradient(
    90deg,
    rgba(255, 183, 0, 0.7),
    rgba(255, 107, 53, 0.9)
  );
}

.health-fill.bad {
  background: linear-gradient(
    90deg,
    rgba(255, 61, 61, 0.7),
    rgba(233, 69, 96, 0.9)
  );
}

.day-goal {
  margin-bottom: 20px;
}

.goal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  font-weight: 800;
}

.goal-status {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.goal-status.complete {
  background: rgba(76, 255, 122, 0.15);
  color: var(--good);
}

.goal-text {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.goal-capacity,
.goal-events {
  margin-top: 8px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.goal-selection {
  margin-top: 8px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.goal-impact {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

/* Sprint Board */
.game-instructions {
  background: linear-gradient(
    135deg,
    rgba(255, 107, 53, 0.1),
    rgba(233, 69, 96, 0.05)
  );
  border-left: 4px solid var(--accent2);
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.5;
}

.game-instructions p {
  margin: 0;
  color: var(--text);
}

.sprint-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.board-section h3 {
  color: var(--accent2);
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 16px;
}

.items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100px;
}

.item-card {
  padding: 12px;
  background: var(--panel2);
  border-left: 4px solid var(--accent2);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  animation: popIn 0.3s ease;
}

.item-card:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(233, 69, 96, 0.2);
}

.item-card.selected {
  background: linear-gradient(
    90deg,
    rgba(255, 107, 53, 0.2),
    rgba(233, 69, 96, 0.15)
  );
  border-left: 4px solid var(--accent);
  box-shadow:
    0 4px 16px rgba(233, 69, 96, 0.3),
    inset 0 0 12px rgba(255, 107, 53, 0.1);
}

.item-card.day-selected {
  border-left-color: var(--good);
  background: linear-gradient(
    90deg,
    rgba(76, 255, 122, 0.12),
    rgba(255, 255, 255, 0.02)
  );
}

.priority-badge {
  margin-left: auto;
  background: rgba(76, 255, 122, 0.16);
  color: var(--good);
  border: 1px solid rgba(76, 255, 122, 0.4);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 800;
}

.item-card.completed {
  opacity: 0.6;
  border-left-color: var(--good);
  text-decoration: line-through;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.item-title {
  font-weight: 800;
  margin-bottom: 4px;
}

.item-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.item-points {
  background: var(--accent);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 800;
}

.items-list.done .item-card {
  border-left-color: var(--good);
}

.items-list.in-progress .item-card {
  border-left-color: var(--warn);
}

/* Chaos Modal */
.chaos-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.chaos-modal.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.chaos-content {
  background: var(--panel);
  border: 2px solid var(--bad);
  border-radius: 20px;
  padding: 40px;
  max-width: 500px;
  text-align: center;
  animation: chaosShake 0.5s ease;
  box-shadow: 0 0 40px rgba(255, 61, 61, 0.4);
}

@keyframes chaosShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

.chaos-emoji {
  font-size: 80px;
  margin-bottom: 20px;
  animation: chaosFloat 2s ease-in-out infinite;
}

@keyframes chaosFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

.chaos-content h2 {
  font-size: 28px;
  margin: 0 0 16px;
  color: var(--bad);
}

.chaos-content p {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 20px;
}

.chaos-impact {
  background: var(--panel2);
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 24px;
  border-left: 4px solid var(--warn);
}

.chaos-impact span {
  color: var(--warn);
  font-weight: 800;
  display: block;
  margin-bottom: 8px;
}

.chaos-impact p {
  margin: 0;
  color: var(--text);
}

/* Decision Modal */
.decision-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.decision-modal.hidden {
  display: none;
}

.decision-content {
  background: var(--panel);
  border: 2px solid var(--accent);
  border-radius: 20px;
  padding: 40px;
  max-width: 600px;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.decision-content h2 {
  font-size: 24px;
  margin: 0 0 12px;
  color: var(--accent2);
}

.decision-content > p {
  font-size: 16px;
  margin: 0 0 24px;
  color: var(--muted);
}

.decision-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.decision-option {
  padding: 16px;
  background: var(--panel2);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.decision-option:hover {
  border-color: var(--accent);
  background: rgba(233, 69, 96, 0.1);
  transform: translateX(4px);
}

.decision-option-title {
  font-weight: 800;
  color: var(--accent2);
  margin-bottom: 6px;
}

.decision-option-description {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.decision-note {
  background: rgba(255, 183, 0, 0.1);
  border-left: 4px solid var(--warn);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 20px;
}

.decision-note p {
  margin: 0;
}

/* Game Controls */
.game-controls {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 15px;
  margin-top: 30px;
}

/* Results Page */
.results-container {
  max-width: 900px;
  margin: 40px auto;
  padding: 20px;
}

.results-header {
  text-align: center;
  margin-bottom: 40px;
}

.results-header h1 {
  font-size: 36px;
  margin: 0 0 12px;
  color: var(--good);
}

.tagline {
  color: var(--muted);
  font-size: 16px;
  font-style: italic;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.result-card {
  padding: 24px;
  text-align: center;
  animation: slideUp 0.4s ease;
}

.result-card.panel {
  padding: 24px;
}

.result-emoji {
  font-size: 48px;
  margin-bottom: 16px;
}

.result-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

.result-value {
  font-size: 32px;
  font-weight: 900;
  color: var(--accent);
}

.reflection-section {
  margin-bottom: 40px;
}

.reflection-section h2 {
  color: var(--accent2);
  margin-top: 0;
}

.reflection-questions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.reflection-question {
  padding: 16px;
  background: var(--panel2);
  border-left: 4px solid var(--warn);
  border-radius: 8px;
  animation: slideIn 0.3s ease;
}

.reflection-question p {
  margin: 0;
  line-height: 1.6;
}

.results-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.results-actions a {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* Responsive */
@media (max-width: 768px) {
  .sprint-board {
    grid-template-columns: 1fr;
  }

  .game-controls {
    grid-template-columns: 1fr;
  }

  .item-input-group {
    grid-template-columns: 1fr;
  }

  .config-row {
    grid-template-columns: 1fr;
  }

  .sprint-header {
    flex-direction: column;
    gap: 20px;
  }

  .sprint-stats {
    width: 100%;
    justify-content: space-around;
  }

  .chaos-content,
  .decision-content {
    margin: 20px;
    max-width: calc(100% - 40px);
  }
}
