:root {
  --bg: #efe2d4;
  --text: #2f1f18;
  --muted: #6d5448;
  --accent: #a65230;
  --accent-deep: #6b311b;
  --line: rgba(84, 52, 38, 0.12);
  --card: rgba(255, 249, 242, 0.82);
  --success-bg: rgba(220, 241, 234, 0.92);
  --success-line: rgba(88, 154, 126, 0.38);
  --good-bg: rgba(239, 245, 233, 0.92);
  --good-line: rgba(128, 156, 92, 0.34);
  --warn-bg: rgba(255, 244, 232, 0.94);
  --warn-line: rgba(217, 163, 109, 0.34);
  --danger-bg: rgba(255, 237, 232, 0.94);
  --danger-line: rgba(214, 123, 95, 0.32);
  --shadow: 0 22px 70px rgba(51, 26, 18, 0.12);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.72), transparent 26%),
    linear-gradient(135deg, #f4e8dc 0%, #ead7c3 50%, #e1cab8 100%);
  color: var(--text);
  font-family: "Manrope", sans-serif;
}

body {
  position: relative;
  overflow-x: hidden;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(40, 23, 17, 0.36);
  backdrop-filter: blur(16px);
}

.auth-card {
  width: min(480px, 100%);
  padding: 28px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  background:
    linear-gradient(165deg, rgba(255, 252, 248, 0.97), rgba(245, 233, 223, 0.96));
  box-shadow: var(--shadow);
}

.auth-card h2 {
  margin: 10px 0 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.auth-copy,
.auth-note {
  color: var(--muted);
  line-height: 1.68;
}

.auth-form {
  margin-top: 20px;
  display: grid;
  gap: 14px;
}

.auth-field {
  display: grid;
  gap: 8px;
  color: var(--accent-deep);
  font-size: 0.92rem;
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
}

.auth-field input:focus {
  outline: 2px solid rgba(166, 82, 48, 0.18);
  border-color: rgba(166, 82, 48, 0.24);
}

.auth-actions {
  display: flex;
  justify-content: flex-start;
}

.auth-error {
  margin: 0;
  color: #a14a2e;
  font-size: 0.92rem;
  line-height: 1.6;
}

.ambient {
  position: fixed;
  width: 34rem;
  height: 34rem;
  border-radius: 999px;
  filter: blur(54px);
  opacity: 0.3;
  pointer-events: none;
}

.ambient-left {
  top: -10rem;
  left: -10rem;
  background: rgba(166, 82, 48, 0.28);
}

.ambient-right {
  right: -10rem;
  bottom: -12rem;
  background: rgba(107, 49, 27, 0.2);
}

.grain {
  position: fixed;
  inset: 0;
  opacity: 0.16;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.08)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='%23422a20' fill-opacity='0.18'%3E%3Ccircle cx='12' cy='18' r='1'/%3E%3Ccircle cx='54' cy='42' r='1'/%3E%3Ccircle cx='104' cy='26' r='1'/%3E%3Ccircle cx='146' cy='54' r='1'/%3E%3Ccircle cx='36' cy='112' r='1'/%3E%3Ccircle cx='90' cy='88' r='1'/%3E%3Ccircle cx='130' cy='126' r='1'/%3E%3Ccircle cx='164' cy='150' r='1'/%3E%3C/g%3E%3C/svg%3E");
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 18px auto 28px;
}

.hero,
.stage-strip,
.scenario-card,
.playbook-card,
.answer-card,
.reason-card,
.feedback-card,
.result-card {
  border: 1px solid rgba(255, 255, 255, 0.58);
  background: var(--card);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.hero,
.stage-strip,
.scenario-card,
.playbook-card,
.answer-card,
.reason-card,
.feedback-card,
.result-card {
  border-radius: var(--radius-xl);
}

.hero {
  padding: 24px 28px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.stage-strip {
  margin-top: 16px;
  padding: 14px;
}

.eyebrow,
.panel-label,
.bubble-name,
.badge,
.card-topline span,
.card-topline strong {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
}

.eyebrow,
.panel-label {
  color: var(--accent-deep);
  font-weight: 800;
}

.hero h1,
.scenario-top h2,
.feedback-head h3,
.result-card h3 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.hero h1 {
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  margin-top: 12px;
}

.scenario-top h2,
.feedback-head h3,
.result-card h3 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  margin-top: 8px;
}

.hero-copy,
.body-copy,
.scenario-context,
.reason-hint {
  color: var(--muted);
  line-height: 1.68;
}

.scenario-progress {
  margin-top: 18px;
}

.scenario-progress-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--accent-deep);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scenario-progress-track {
  margin-top: 10px;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(107, 49, 27, 0.1);
  overflow: hidden;
  border: 1px solid rgba(84, 52, 38, 0.08);
}

.scenario-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(166, 82, 48, 0.9), rgba(201, 134, 91, 0.9));
  box-shadow: 0 6px 18px rgba(166, 82, 48, 0.28);
  transition: width 220ms ease;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 160px));
  gap: 12px;
}

.stat-card {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--line);
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.2rem;
}

.muted {
  color: var(--muted);
}

.workspace {
  margin-top: 16px;
  display: grid;
  gap: 16px;
}

.session-bar,
.insight-card {
  border: 1px solid rgba(255, 255, 255, 0.58);
  background: var(--card);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
}

.session-bar {
  margin-top: 16px;
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.session-card {
  min-width: 0;
}

.session-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.session-main strong {
  display: block;
  font-size: 1.05rem;
}

.session-main p {
  margin: 8px 0 0;
}

.session-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.insights-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.insight-card {
  padding: 22px 24px;
}

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

.insight-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.insight-head h3 {
  margin: 8px 0 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.7rem, 2.4vw, 2.2rem);
  line-height: 1;
  letter-spacing: -0.03em;
}

.leaderboard-table-wrap {
  margin-top: 18px;
  overflow-x: auto;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.leaderboard-table th {
  color: var(--accent-deep);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.leaderboard-table td {
  color: var(--text);
  line-height: 1.5;
}

.leaderboard-table tbody tr:last-child td {
  border-bottom: 0;
}

.leaderboard-empty,
.activity-empty {
  color: var(--muted);
  line-height: 1.6;
}

.user-admin-copy {
  margin: 16px 0 0;
}

.user-admin-form {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.user-admin-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.user-admin-field {
  display: grid;
  gap: 8px;
  color: var(--accent-deep);
  font-size: 0.9rem;
  font-weight: 700;
}

.user-admin-field input,
.user-admin-field select {
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
}

.user-admin-field input:focus,
.user-admin-field select:focus {
  outline: 2px solid rgba(166, 82, 48, 0.18);
  border-color: rgba(166, 82, 48, 0.24);
}

.user-admin-actions {
  display: flex;
  justify-content: flex-start;
}

.user-admin-notice {
  margin: 0;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid transparent;
  line-height: 1.6;
}

.user-admin-notice.info {
  background: rgba(255, 255, 255, 0.54);
  border-color: var(--line);
  color: var(--muted);
}

.user-admin-notice.success {
  background: var(--success-bg);
  border-color: var(--success-line);
  color: #295f47;
}

.user-admin-notice.error {
  background: var(--danger-bg);
  border-color: var(--danger-line);
  color: #a14a2e;
}

.activity-list,
.activity-feed {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.activity-item,
.feed-item {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
}

.activity-item-top,
.feed-item-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.activity-item-top strong,
.feed-item-top strong {
  font-size: 0.96rem;
}

.activity-meta,
.feed-meta {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.feed-meta {
  font-size: 0.94rem;
}

.stage-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stage-pill {
  appearance: none;
  width: 100%;
  padding: 18px 20px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 248, 0.68);
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.stage-pill:hover {
  transform: translateY(-2px);
  border-color: rgba(166, 82, 48, 0.22);
  box-shadow: 0 12px 28px rgba(51, 26, 18, 0.08);
}

.stage-pill:focus-visible {
  outline: 2px solid rgba(166, 82, 48, 0.18);
  outline-offset: 2px;
}

.stage-pill.active {
  background: rgba(241, 221, 207, 0.9);
  border-color: rgba(166, 82, 48, 0.28);
  box-shadow: 0 12px 28px rgba(51, 26, 18, 0.08);
}

.stage-pill.done {
  background: rgba(255, 250, 246, 0.88);
}

.stage-pill-title {
  font-weight: 800;
  font-size: 0.96rem;
  line-height: 1.35;
}

.stage-pill-copy {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.scenario-card,
.playbook-card,
.answer-card,
.reason-card,
.feedback-card,
.result-card {
  padding: 22px 24px;
}

.scenario-card,
.feedback-card,
.result-card,
.after-feedback-actions {
  scroll-margin-top: 18px;
}

.scenario-top,
.feedback-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.playbook-card {
  background:
    linear-gradient(165deg, rgba(255, 251, 247, 0.96), rgba(247, 236, 226, 0.92));
}

.playbook-section + .playbook-section {
  margin-top: 18px;
}

.playbook-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.playbook-step {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
}

.playbook-step-index {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(107, 49, 27, 0.08);
  color: var(--accent-deep);
  font-size: 0.86rem;
  font-weight: 800;
}

.playbook-step-title {
  margin-top: 12px;
  font-weight: 800;
}

.playbook-step-copy {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.95rem;
}

.playbook-examples {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.example-item {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.6);
  overflow: hidden;
}

.example-item summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  font-weight: 700;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.example-item summary::-webkit-details-marker {
  display: none;
}

.example-index {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(166, 82, 48, 0.1);
  color: var(--accent-deep);
  font-size: 0.82rem;
  font-weight: 800;
}

.example-question {
  line-height: 1.5;
}

.example-body {
  padding: 0 18px 18px;
  display: grid;
  gap: 12px;
}

.example-copy {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}

.example-copy strong {
  color: var(--accent-deep);
}

.scenario-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(166, 82, 48, 0.1);
  color: var(--accent-deep);
  border: 1px solid rgba(166, 82, 48, 0.14);
}

.badge-dark {
  background: #221814;
  color: #fff5ee;
  border-color: transparent;
}

.bubble {
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 24px 24px 24px 10px;
  background:
    linear-gradient(150deg, rgba(242, 225, 211, 0.98), rgba(253, 245, 238, 0.98));
  border: 1px solid var(--line);
}

.bubble-name {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent-deep);
  font-weight: 800;
}

.bubble p {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.56;
}

.card-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-topline span,
.card-topline strong {
  color: var(--accent-deep);
}

.options {
  display: grid;
  gap: 12px;
}

.option-button {
  position: relative;
  width: 100%;
  padding: 18px 18px 18px 76px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 248, 0.92);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.option-button::before {
  content: attr(data-label);
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(107, 49, 27, 0.08);
  color: var(--accent-deep);
  font-size: 0.92rem;
  font-weight: 800;
}

.option-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(51, 26, 18, 0.08);
}

.option-button.selected {
  background: rgba(245, 235, 226, 0.96);
  border-color: rgba(166, 82, 48, 0.22);
  box-shadow: 0 12px 24px rgba(51, 26, 18, 0.08);
}

.option-button.selected::before {
  background: rgba(166, 82, 48, 0.16);
  color: var(--accent-deep);
}

.reason-input {
  width: 100%;
  min-height: 108px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.54);
  padding: 16px 18px;
  font: inherit;
  color: var(--text);
  resize: vertical;
}

.reason-input:focus {
  outline: 2px solid rgba(166, 82, 48, 0.18);
  border-color: rgba(166, 82, 48, 0.24);
}

.reason-hint {
  margin: 10px 0 0;
  font-size: 0.92rem;
}

.reason-hint.warning {
  color: #b25d39;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 15px 22px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(51, 26, 18, 0.12);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent-deep), var(--accent));
  color: #fff5ee;
}

.btn-secondary {
  background: rgba(107, 49, 27, 0.08);
  color: var(--accent-deep);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.48);
  color: var(--muted);
  border: 1px solid var(--line);
}

.table-action-button {
  padding: 10px 14px;
  font-size: 0.88rem;
  white-space: nowrap;
}

.feedback-card,
.result-card {
  background:
    linear-gradient(165deg, rgba(255, 250, 246, 0.98), rgba(250, 239, 230, 0.96));
}

.feedback-card,
.result-card,
.after-feedback-actions {
  scroll-margin-top: 18px;
}

.grade-badge {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 800;
}

.grade-badge.grade-ideal {
  background: var(--success-bg);
  border-color: var(--success-line);
  color: #295f47;
}

.grade-badge.grade-good {
  background: var(--good-bg);
  border-color: var(--good-line);
  color: #506736;
}

.grade-badge.grade-weak {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  color: #8f621f;
}

.grade-badge.grade-bad {
  background: var(--danger-bg);
  border-color: var(--danger-line);
  color: #a14a2e;
}

.feedback-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.feedback-panel {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid var(--line);
}

.feedback-panel-danger {
  background: rgba(255, 243, 238, 0.78);
  border-color: rgba(177, 74, 46, 0.18);
}

.feedback-panel-wide {
  grid-column: 1 / -1;
}

.after-feedback-actions {
  display: flex;
  justify-content: flex-end;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .hero,
  .scenario-top,
  .feedback-head,
  .session-bar,
  .insight-head {
    flex-direction: column;
  }

  .hero-stats,
  .feedback-grid,
  .playbook-steps,
  .playbook-examples,
  .insights-grid {
    grid-template-columns: 1fr;
  }

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

  .user-admin-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 16px, 100%);
    margin: 10px auto 22px;
  }

  .hero,
  .stage-strip,
  .scenario-card,
  .playbook-card,
  .answer-card,
  .reason-card,
  .feedback-card,
  .result-card,
  .session-bar,
  .insight-card,
  .auth-card {
    padding: 18px;
    border-radius: 24px;
  }

  .option-button {
    padding-left: 68px;
  }

  .stage-list {
    grid-template-columns: 1fr;
  }

  .leaderboard-table {
    min-width: 560px;
  }

  .user-admin-fields {
    grid-template-columns: 1fr;
  }
}
