:root {
  --bg: #14161c;
  --panel: #1e212b;
  --panel-2: #262a37;
  --border: #343a4a;
  --text: #eef0f5;
  --text-dim: #9aa1b4;
  --accent: #ff8a3d;
  --accent-2: #4fc3f7;
  --good: #4caf7d;
  --warn: #e0b03e;
  --bad: #e0563e;
  --radius: 10px;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden { display: none !important; }

.screen { display: none; }
.screen.active { display: block; }

.btn {
  border: none;
  border-radius: var(--radius);
  padding: 0.6em 1.2em;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #1a1200; }
.btn-secondary { background: var(--accent-2); color: #001521; }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn.small { padding: 0.35em 0.8em; font-size: 0.85em; }

/* ---------- Title screen ---------- */
#screen-title {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(to bottom, rgba(10, 12, 18, 0.03) 52%, rgba(10, 12, 18, 0.94) 100%),
    url("../assets/images/splash.webp") center center / cover no-repeat;
}
#screen-title.active { display: flex; }
.title-card {
  text-align: center;
  width: 100%;
  min-height: 100vh;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}
.title-card h1 {
  font-size: 3.2rem;
  margin-bottom: 0.1em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tagline {
  color: var(--text);
  margin: 0 0 0.7em;
  padding: 0.35em 0.8em;
  border-radius: 999px;
  background: rgba(20, 22, 28, 0.86);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}
.title-actions {
  display: flex;
  gap: 0.75em;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.75em;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: calc(var(--radius) + 4px);
  background: rgba(20, 22, 28, 0.88);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}
#license-panel, #dev-panel {
  margin-top: 1.5em;
  display: flex;
  gap: 0.5em;
  justify-content: center;
  flex-wrap: wrap;
}
#license-panel input, #dev-panel input {
  padding: 0.55em 0.8em;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  min-width: 220px;
}
.status-line { width: 100%; font-size: 0.85em; color: var(--text-dim); min-height: 1.2em; }
.plan-badge {
  margin-top: 1.5em;
  display: inline-block;
  padding: 0.3em 0.9em;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 0.8em;
  letter-spacing: 0.03em;
}

.music-controls {
  position: fixed;
  bottom: 0.75rem;
  right: 0.75rem;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.45em 0.55em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(20, 22, 28, 0.9);
  backdrop-filter: blur(8px);
}
.music-controls label {
  color: var(--text-dim);
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.music-controls select {
  max-width: 120px;
  padding: 0.35em;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
}

/* ---------- HUD ---------- */
#hud {
  display: flex;
  align-items: center;
  gap: 1.5em;
  padding: 0.75em 1.5em;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 5;
}
.hud-block { display: flex; flex-direction: column; min-width: 90px; }
.hud-label { font-size: 0.7em; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.hud-value { font-size: 1.1em; font-weight: 700; }
.hud-sub { font-size: 0.7em; color: var(--text-dim); }
.hud-meter { flex: 1; max-width: 180px; }
.meter {
  height: 8px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
  margin-top: 2px;
}
.meter-fill { height: 100%; width: 0%; transition: width 0.3s ease, background 0.3s ease; }
.budget-fill { background: var(--good); }
.scope-fill { background: var(--warn); }
.mood-fill { background: var(--accent-2); }
#btn-menu { margin-left: auto; }

/* ---------- Phase panels ---------- */
#phase-root { padding: 1.5rem; max-width: 1200px; margin: 0 auto; }
.phase-panel h2 { margin-top: 0; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1em 1.2em;
  margin-bottom: 1em;
}
.hint { color: var(--text-dim); font-size: 0.85em; }

#client-brief-card {
  display: grid;
  grid-template-columns: minmax(150px, 230px) 1fr;
  gap: 1.2em;
  align-items: center;
  overflow: hidden;
}
.client-portrait {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.client-brief-copy h3 { margin-top: 0; }

.chat-log { max-height: 240px; overflow-y: auto; margin-bottom: 0.75em; }
.chat-line { padding: 0.4em 0; border-bottom: 1px solid var(--border); font-size: 0.92em; }
.chat-line .who { font-weight: 700; margin-right: 0.4em; }
.chat-line.client .who { color: var(--accent); }
.chat-line.you .who { color: var(--accent-2); }
.chat-input-row { display: flex; gap: 0.5em; margin-bottom: 1.2em; }
.chat-input-row input {
  flex: 1;
  padding: 0.6em 0.8em;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}

.planning-grid, .exec-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 1em;
  align-items: start;
}
@media (max-width: 900px) {
  .planning-grid, .exec-grid { grid-template-columns: 1fr; }
}

.task-pool, .team-pool, .risk-list, .stakeholder-list { list-style: none; margin: 0; padding: 0; }
.task-pool li, .team-pool li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5em 0.6em;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.4em;
  font-size: 0.9em;
}
.task-pool li button, .team-pool li button { font-size: 0.8em; padding: 0.3em 0.6em; }
.task-pool li.added { opacity: 0.45; }

.kanban-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75em; }
.kanban-col { background: var(--panel-2); border-radius: 8px; padding: 0.6em; min-height: 180px; }
.kanban-col h4 { margin: 0 0 0.5em; font-size: 0.8em; text-transform: uppercase; color: var(--text-dim); }
.kanban-list { list-style: none; margin: 0; padding: 0; min-height: 40px; }
.kanban-card-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5em 0.6em;
  margin-bottom: 0.5em;
  cursor: grab;
  font-size: 0.85em;
}
.kanban-card-item.dragging { opacity: 0.4; }
.kanban-col.drag-over { outline: 2px dashed var(--accent); }

.risk-list li, .stakeholder-list li {
  padding: 0.5em 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85em;
}
.risk-list li:last-child, .stakeholder-list li:last-child { border-bottom: none; }
.risk-badge {
  display: inline-block;
  padding: 0.1em 0.5em;
  border-radius: 999px;
  font-size: 0.75em;
  margin-right: 0.4em;
}
.risk-badge.low { background: var(--good); color: #04160c; }
.risk-badge.medium { background: var(--warn); color: #221a02; }
.risk-badge.high { background: var(--bad); color: #200602; }

.stakeholder-list li .name { font-weight: 600; }
.stakeholder-mood { height: 6px; border-radius: 999px; background: var(--panel-2); margin-top: 3px; overflow: hidden; }
.stakeholder-mood-fill { height: 100%; background: var(--accent-2); }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5em;
  max-width: 620px;
  width: 90%;
  max-height: 92vh;
  overflow-y: auto;
}
.event-art {
  display: block;
  width: calc(100% + 3em);
  max-height: 280px;
  margin: -1.5em -1.5em 1.2em;
  border-radius: var(--radius) var(--radius) 0 0;
  object-fit: cover;
}
.event-choices { display: flex; flex-direction: column; gap: 0.5em; margin-top: 1em; }
.event-choices button { text-align: left; }

#scorecard dl, #lessons-learned ul { margin: 0; }
.closure-art {
  display: block;
  width: calc(100% + 2.4em);
  max-height: 460px;
  margin: -1em -1.2em 1em;
  border-radius: var(--radius) var(--radius) 0 0;
  object-fit: cover;
}
#scorecard dt { color: var(--text-dim); font-size: 0.8em; margin-top: 0.6em; }
#scorecard dd { margin: 0; font-size: 1.2em; font-weight: 700; }

.locked-banner {
  background: var(--panel-2);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  padding: 1em;
  text-align: center;
  margin-bottom: 1em;
}

@media (max-width: 680px) {
  .title-card { padding: 1rem; }
  .tagline { font-size: 0.82em; }
  .music-controls label { display: none; }
  #screen-game { padding-bottom: 4.5rem; }
  #client-brief-card { grid-template-columns: 1fr; }
  .client-portrait { max-height: 280px; }
}
