/* Player Risk Console — executive dark theme */

:root {
  --bg: #0d1421;
  --panel: #141d2e;
  --panel-border: #22304a;
  --text: #e8edf5;
  --text-dim: #8b99b0;
  --accent: #4da3ff;
  --green: #2fbf71;
  --amber: #f5a623;
  --red: #e5484d;
  --track: #22304a;
  --radius: 14px;
  font-size: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Amazon Ember", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  border-bottom: 1px solid var(--panel-border);
  background: linear-gradient(180deg, #101a2c 0%, var(--bg) 100%);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.4rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: 0.01em; }
.subtitle { color: var(--text-dim); font-size: 0.9rem; margin-top: 0.25rem; }

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-live { background: rgba(47, 191, 113, 0.15); color: var(--green); border: 1px solid rgba(47, 191, 113, 0.4); }
.badge-sim { background: rgba(245, 166, 35, 0.12); color: var(--amber); border: 1px solid rgba(245, 166, 35, 0.4); }

/* Layout */
.layout {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 2rem 2rem;
  display: grid;
  grid-template-columns: minmax(320px, 5fr) minmax(380px, 7fr);
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 1.4rem;
}
.panel-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.9rem;
}
.panel-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-dim);
  opacity: 0.75;
}

/* Persona cards */
.persona-cards { display: flex; flex-direction: column; gap: 0.7rem; }
.persona-card {
  width: 100%;
  text-align: left;
  background: #0f1726;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.persona-card:hover { border-color: var(--accent); }
.persona-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.persona-card.active {
  border-color: var(--accent);
  background: rgba(77, 163, 255, 0.08);
}
.persona-card .persona-name {
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.persona-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.persona-card .persona-tagline { color: var(--text-dim); font-size: 0.82rem; margin-top: 0.3rem; }

/* Sliders */
.sliders-title { margin-top: 1.5rem; }
.sliders { display: flex; flex-direction: column; gap: 1.1rem; }
.slider-row label {
  display: flex;
  justify-content: space-between;
  font-size: 0.86rem;
  margin-bottom: 0.35rem;
}
.slider-row .slider-value { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 600; }
input[type="range"] {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--track);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0d1421;
  box-shadow: 0 0 0 1px var(--accent);
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0d1421;
  box-shadow: 0 0 0 1px var(--accent);
}
input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* Gauge */
.gauge-panel { display: flex; flex-direction: column; align-items: center; }
.gauge-wrap { position: relative; width: 100%; max-width: 460px; }
#gauge { width: 100%; height: auto; display: block; }

.gauge-readout {
  position: absolute;
  left: 50%;
  top: 62%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.score-value {
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: color 0.4s ease;
}
.score-label {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  margin-top: 0.3rem;
}
.risk-band {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  min-height: 1.2em;
  transition: color 0.4s ease;
}

.loading {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.75rem;
  color: var(--text-dim);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* Intervention banner */
.intervention-banner {
  width: 100%;
  margin-top: 0.5rem;
  background: rgba(229, 72, 77, 0.12);
  border: 1px solid rgba(229, 72, 77, 0.55);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  animation: banner-in 0.35s ease;
}
@keyframes banner-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.intervention-title { color: var(--red); font-weight: 800; font-size: 1.05rem; }
.intervention-next { color: var(--text-dim); font-size: 0.85rem; margin-top: 0.3rem; }

/* Error banner */
.error-banner {
  width: 100%;
  margin-top: 0.5rem;
  background: rgba(245, 166, 35, 0.1);
  border: 1px solid rgba(245, 166, 35, 0.45);
  border-radius: 10px;
  padding: 0.7rem 1.1rem;
  color: var(--amber);
  font-size: 0.85rem;
}
.retry-btn {
  margin-left: 0.6rem;
  background: transparent;
  border: 1px solid var(--amber);
  color: var(--amber);
  border-radius: 6px;
  padding: 0.2rem 0.7rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.retry-btn:hover { background: rgba(245, 166, 35, 0.15); }

.threshold-note {
  margin-top: 0.9rem;
  color: var(--text-dim);
  font-size: 0.82rem;
}
#threshold-value { color: var(--text); font-weight: 600; }

/* Raw feature panel */
.raw-panel {
  width: 100%;
  margin-top: 1rem;
  border-top: 1px solid var(--panel-border);
  padding-top: 0.8rem;
}
.raw-panel summary {
  cursor: pointer;
  color: var(--text-dim);
  font-size: 0.82rem;
  user-select: none;
}
.raw-panel summary:hover { color: var(--text); }
.raw-panel pre {
  margin-top: 0.6rem;
  background: #0a101c;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.9rem;
  font-size: 0.74rem;
  line-height: 1.5;
  overflow-x: auto;
  color: #a9c1e0;
}

.footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.75rem;
  padding: 0.7rem 2rem;
  /* Legal disclaimer must stay visible at all times */
  position: sticky;
  bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--panel-border);
}

.hidden { display: none !important; }

/* Player journey timeline */
.journey {
  width: 100%;
  margin-top: 0.6rem;
  background: #0f1726;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0.8rem 1rem 0.5rem;
}
.journey-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.4rem;
}
.journey-play {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: rgba(77, 163, 255, 0.12);
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.journey-play:hover { background: rgba(77, 163, 255, 0.25); }
.journey-play:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.journey-controls input[type="range"] { flex: 1; }
.journey-week {
  min-width: 4.2em;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
#trend-chart { width: 100%; height: auto; display: block; }

/* Journey chip on persona cards */
.journey-chip {
  margin-left: auto;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: rgba(77, 163, 255, 0.12);
  border: 1px solid rgba(77, 163, 255, 0.35);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  white-space: nowrap;
}

/* Persona grid handles 7 cards */
@media (min-width: 901px) {
  .persona-cards { display: grid; grid-template-columns: 1fr; gap: 0.55rem; }
  .persona-card { padding: 0.7rem 0.9rem; }
  .persona-card .persona-tagline { font-size: 0.78rem; margin-top: 0.2rem; }
}
