:root {
  --navy: #1c2b4a;
  --blue: #2d5fb3;
  --blue-light: #e8f0fd;
  --green: #1f8a5e;
  --red: #c0392b;
  --amber: #b8860b;
  --gray-bg: #f5f6f8;
  --gray-border: #dfe3e8;
  --text-main: #1c2230;
  --text-muted: #5b6472;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--gray-bg);
  color: var(--text-main);
}

#app {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 10px;
}

.app-header h1 {
  font-size: 1.5rem;
  margin: 0;
  color: var(--navy);
}

.timer {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 1.1rem;
  background: var(--navy);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
}

.hidden { display: none !important; }

.screen { display: none; }
.screen.active { display: block; animation: fadeIn 0.2s ease; }

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

.lede {
  color: var(--text-muted);
  font-size: 1.02rem;
  max-width: 760px;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.scenario-card {
  background: white;
  border: 1px solid var(--gray-border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}

.scenario-card:hover {
  box-shadow: 0 6px 18px rgba(28, 43, 74, 0.12);
  transform: translateY(-2px);
}

.scenario-card h3 {
  margin: 0 0 8px;
  color: var(--navy);
}

.badge-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.scenario-card .badge {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--blue-light);
  color: var(--blue);
  padding: 3px 8px;
  border-radius: 4px;
}
.badge-row .badge { margin-bottom: 0; }

.badge.difficulty.beginner { background: #e3f6ec; color: var(--green); }
.badge.difficulty.intermediate { background: #fdf3e3; color: var(--amber); }
.badge.difficulty.advanced { background: #fbe9e7; color: var(--red); }

.prep-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.prep-title-row h2 { margin: 0; }

.difficulty-card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.scenario-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0;
}

.link-back {
  background: none;
  border: none;
  color: var(--blue);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  margin-bottom: 14px;
}

.prep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 18px 0;
}

.card {
  background: white;
  border: 1px solid var(--gray-border);
  border-radius: var(--radius);
  padding: 18px;
}

.card.wide { grid-column: 1 / -1; }

.card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: var(--navy);
}

.card.private {
  border-color: var(--blue);
  background: var(--blue-light);
}

.tag {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: normal;
  letter-spacing: 0.03em;
  display: block;
  margin-top: 2px;
}

.numbers-list, .bullet-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.92rem;
  line-height: 1.6;
}

.numbers-list { list-style: none; padding-left: 0; }
.numbers-list li { margin-bottom: 4px; }

.notes-card textarea {
  width: 100%;
  min-height: 90px;
  border: 1px solid var(--gray-border);
  border-radius: 6px;
  padding: 10px;
  font-family: inherit;
  font-size: 0.92rem;
  resize: vertical;
}

.btn-primary, .btn-secondary, .btn-danger {
  font-size: 0.95rem;
  padding: 10px 18px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary {
  background: var(--blue);
  color: white;
}
.btn-primary:hover { background: #24488c; }

.btn-secondary {
  background: white;
  color: var(--navy);
  border: 1px solid var(--gray-border);
}
.btn-secondary:hover { background: #eef1f5; }

.btn-danger {
  background: white;
  color: var(--red);
  border: 1px solid #e8c6c1;
}
.btn-danger:hover { background: #fbecea; }

.negotiate-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 780px) {
  .negotiate-layout { grid-template-columns: 1fr; }
}

.range-bar { margin: 40px 0 20px; }

.range-track {
  position: relative;
  height: 34px;
  background: #eceff3;
  border-radius: 17px;
  border: 1px solid var(--gray-border);
}

.range-zone {
  position: absolute;
  top: 0; bottom: 0;
  background: rgba(31, 138, 94, 0.18);
  border-left: 2px dashed var(--green);
  border-right: 2px dashed var(--green);
}

.range-marker {
  position: absolute;
  top: -26px;
  transform: translateX(-50%);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.range-marker::after {
  content: "";
  position: absolute;
  bottom: -18px;
  left: 50%;
  width: 2px;
  height: 16px;
  background: currentColor;
}
.range-marker.you { color: var(--blue); background: var(--blue-light); }
.range-marker.them { color: var(--navy); background: #eceff3; }

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.offer-log {
  border: 1px solid var(--gray-border);
  border-radius: var(--radius);
  background: white;
  min-height: 160px;
  max-height: 320px;
  overflow-y: auto;
  padding: 12px;
  margin-bottom: 16px;
}

.log-entry {
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 0.92rem;
  max-width: 80%;
}

.log-entry.them {
  background: #eceff3;
}
.log-entry.you {
  background: var(--blue-light);
  margin-left: auto;
  text-align: right;
}
.log-entry.system {
  background: none;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  max-width: 100%;
  font-size: 0.85rem;
}

.chat-log { display: flex; flex-direction: column; }

.bubble-name {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.log-entry.you .bubble-name { text-align: right; }

.log-entry.typing {
  background: #eceff3;
  color: var(--text-muted);
  font-style: italic;
}
.typing-dots span {
  display: inline-block;
  width: 5px; height: 5px;
  margin-right: 3px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: blink 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }

.neg-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mode-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  background: #eceff3;
  color: var(--text-muted);
}
.mode-badge.live {
  background: #e3f6ec;
  color: var(--green);
}
.mode-badge.offline {
  background: #fdf3e3;
  color: var(--amber);
}

.offer-controls label {
  font-size: 0.88rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.offer-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.offer-prefix {
  font-weight: 600;
  color: var(--text-muted);
}

.offer-input-row input {
  flex: 1;
  padding: 10px;
  font-size: 1rem;
  border: 1px solid var(--gray-border);
  border-radius: 7px;
}

.parse-hint {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  min-height: 1.1em;
}

.action-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

#liveNotes {
  width: 100%;
  margin-top: 12px;
  min-height: 70px;
  border: 1px solid var(--gray-border);
  border-radius: 6px;
  padding: 10px;
  font-family: inherit;
}

.negotiate-side .card { margin-bottom: 14px; }

.score-gauge {
  height: 14px;
  background: #eceff3;
  border-radius: 7px;
  overflow: hidden;
  margin-bottom: 8px;
}
.score-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--amber), var(--green));
  width: 0%;
  transition: width 0.4s ease;
}
.score-label {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 4px 0;
}

.chart-container svg { width: 100%; height: 220px; }

.feedback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.feedback-header h3 { margin: 0; }

.feedback-body {
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--text-main);
  margin-top: 10px;
}
.feedback-body p { margin: 0 0 10px; }
.feedback-body p:last-child { margin-bottom: 0; }
.feedback-body strong { color: var(--navy); }

.feedback-loading {
  color: var(--text-muted);
  font-style: italic;
}

.result-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
