:root {
  --bg: #ece6dc;
  --bg-glow-gold: rgba(166, 124, 66, 0.1);
  --bg-glow-teal: rgba(30, 77, 69, 0.08);
  --surface: #fffcf7;
  --surface-warm: #f7f1e8;
  --ink: #1c1814;
  --ink-muted: #6a635a;
  --ink-faint: #948b80;
  --line: #e6ddd2;
  --line-strong: #d3c7b8;
  --accent: #1e4d45;
  --accent-hover: #163832;
  --accent-soft: #e8f1ee;
  --gold: #a67c42;
  --gold-soft: #f3ead8;
  --ok: #1f6b45;
  --ok-soft: #e4f2ea;
  --warn: #8a4b12;
  --warn-soft: #f6eadc;
  --client: #2d4a6c;
  --shadow: 0 1px 1px rgba(28, 24, 20, 0.03), 0 10px 28px rgba(28, 24, 20, 0.05);
  --radius: 18px;
  --radius-sm: 12px;
  --header-h: 72px;
  --footer-h: 48px;
  --font-ui: "Manrope", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --space: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  background:
    radial-gradient(1100px 420px at 8% -8%, var(--bg-glow-gold), transparent 55%),
    radial-gradient(900px 380px at 100% 0%, var(--bg-glow-teal), transparent 50%),
    var(--bg);
  color-scheme: light;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

/* -------------------------------------------------------------------------- */
/* Header                                                                     */
/* -------------------------------------------------------------------------- */

.header {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 28px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.header__tools {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.scenario-picker {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
}

.scenario-picker__label {
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.scenario-picker__select {
  max-width: 320px;
  padding: 6px 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
}

.header__kicker {
  margin: 0 0 2px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.header__title {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 1.1rem + 0.7vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stepper {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  flex-shrink: 0;
}

.stepper__item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-faint);
}

.stepper__item:not(:last-child)::after {
  content: "";
  width: 28px;
  height: 1px;
  margin: 0 10px 0 12px;
  background: var(--line-strong);
}

.stepper__num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface);
}

.stepper__label {
  font-size: 13px;
  font-weight: 600;
}

.stepper__item.is-done {
  color: var(--ink-muted);
}

.stepper__item.is-skipped {
  color: var(--ink-faint);
}

.stepper__item.is-skipped .stepper__num {
  border-style: dashed;
  background: transparent;
  color: var(--ink-faint);
}

.stepper__item.is-skipped .stepper__label {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.stepper__item.is-current {
  color: var(--ink);
}

.stepper__item.is-current .stepper__num {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.stepper__item.is-current .stepper__label {
  font-weight: 700;
}

/* -------------------------------------------------------------------------- */
/* Workspace                                                                  */
/* -------------------------------------------------------------------------- */

.workspace {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr) minmax(240px, 300px);
  grid-template-areas: "mentor chat session";
  gap: var(--space);
  min-height: 0;
  padding: var(--space) 16px;
  overflow: hidden;
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

#mentor-panel { grid-area: mentor; }
#chat-panel { grid-area: chat; }
#session-panel { grid-area: session; }

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.panel__heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.panel__title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel__subtitle {
  color: var(--ink-muted);
  font-size: 13px;
}

.panel__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 18px;
}

.panel--chat .panel__body {
  display: flex;
  flex-direction: column;
}

.panel__body::-webkit-scrollbar {
  width: 8px;
}

.panel__body::-webkit-scrollbar-thumb {
  background: #d8cdbf;
  border-radius: 99px;
}

/* -------------------------------------------------------------------------- */
/* Mentor                                                                     */
/* -------------------------------------------------------------------------- */

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px 5px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.live-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.tips {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tip {
  padding: 14px 14px 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 12px;
  background: var(--surface-warm);
}

.tip:first-child {
  border-left-color: var(--accent);
  background: #fbf8f3;
}

.tip__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.tip__tag {
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tip:first-child .tip__tag {
  color: var(--accent);
}

.tip__title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
}

.tip__body {
  margin: 0;
  color: var(--ink-muted);
  font-size: 13.5px;
  line-height: 1.55;
}

/* -------------------------------------------------------------------------- */
/* Chat                                                                       */
/* -------------------------------------------------------------------------- */

.panel--chat {
  background:
    linear-gradient(180deg, #fffcf7 0%, #fbf7f1 100%);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ok);
  font-size: 12px;
  font-weight: 600;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}

.transcript {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  margin-top: auto;
  padding-bottom: 8px;
}

.message {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  max-width: min(100%, 640px);
}

.message--user {
  grid-template-columns: minmax(0, 1fr) 36px;
  margin-left: auto;
  text-align: right;
}

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.avatar--client {
  background: #e7eef6;
  color: var(--client);
}

.avatar--user {
  background: var(--accent);
  color: #fff;
}

.message__meta {
  margin: 0 0 4px;
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 600;
}

.bubble {
  display: inline-block;
  padding: 12px 14px;
  border-radius: 16px;
  text-align: left;
  font-size: 14.5px;
  line-height: 1.5;
}

.message--client .bubble {
  background: #fff;
  border: 1px solid var(--line);
  border-top-left-radius: 6px;
}

.message--user .bubble {
  background: var(--accent);
  color: #fff;
  border-top-right-radius: 6px;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px 18px 16px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, #fff);
}

.composer__error {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--warn);
  font-size: 13px;
  font-weight: 600;
}

.composer__error[hidden] {
  display: none;
}

.composer__input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
  resize: none;
}

.composer__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.composer__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 48px;
  height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.composer__send:hover {
  background: var(--accent-hover);
}

.composer__send:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.composer__send svg {
  width: 16px;
  height: 16px;
}

.composer__input:disabled,
.composer__send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.bubble--typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 18px;
}

.bubble--typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  animation: typing 1.2s infinite ease-in-out;
}

.bubble--typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.bubble--typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

/* -------------------------------------------------------------------------- */
/* Session                                                                    */
/* -------------------------------------------------------------------------- */

.timer {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-warm);
}

.timer__label {
  margin: 0 0 6px;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.timer__value {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.task__goal {
  margin: 0 0 12px;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.45;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  background: var(--surface-warm);
  color: var(--ink-muted);
}

.task.is-done {
  background: var(--ok-soft);
  color: var(--ok);
}

.task__mark {
  flex: 0 0 16px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
}

.workbench {
  border-top: 1px solid var(--line);
  background: #1c242e;
  color: #d7e0ea;
}

.workbench[hidden] {
  display: none;
}

.workbench__bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px 0;
}

.workbench__title,
.workbench__hint {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workbench__hint {
  color: #8ea0b3;
}

.workbench__out {
  margin: 8px 14px;
  max-height: 140px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  color: #c5d4e2;
}

.workbench__form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 0 14px 12px;
}

.workbench__prompt {
  font-family: var(--font-mono);
  color: #6ee7b7;
}

.workbench__input {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: #12181f;
  color: #e8eef4;
  font-family: var(--font-mono);
  font-size: 13px;
}

.workbench__run {
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  background: #2f6fed;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.score-block + .score-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.score-block__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.score-block__title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.score-block__count {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 12px;
}

.score-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.score-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
}

.score-item--ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.score-item--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.task svg,
.score-item svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

/* -------------------------------------------------------------------------- */
/* Footer                                                                     */
/* -------------------------------------------------------------------------- */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--footer-h);
  padding: 8px 28px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, var(--surface));
  color: var(--ink-muted);
  font-size: 13px;
  z-index: 1;
}

.footer__user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.footer__avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.footer__name {
  color: var(--ink);
  font-weight: 700;
}

.footer__role {
  color: var(--ink-faint);
}

.footer__role::before {
  content: "·";
  margin: 0 7px 0 6px;
  color: var(--line-strong);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

/* -------------------------------------------------------------------------- */
/* Tablet                                                                     */
/* -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .header,
  .footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .workspace {
    grid-template-columns: minmax(220px, 250px) minmax(0, 1fr) minmax(220px, 250px);
  }

  .stepper__item:not(:last-child)::after {
    width: 18px;
    margin: 0 8px 0 10px;
  }
}

@media (max-width: 960px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
    min-height: 0;
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 8px;
  }

  .header__title {
    white-space: normal;
  }

  .header__tools {
    width: 100%;
    flex-wrap: wrap;
  }

  .stepper {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .workspace {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1.35fr) minmax(0, 1fr);
    grid-template-areas:
      "chat chat"
      "mentor session";
    padding: 10px 12px;
  }

  .timer {
    margin-bottom: 14px;
    padding: 12px;
  }

  .timer__value {
    font-size: 28px;
  }

  .composer {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .composer__send-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
}

@media (max-width: 820px) and (orientation: portrait) {
  .workspace {
    grid-template-rows: minmax(0, 1fr) minmax(210px, 30vh);
  }

  .panel__header,
  .panel__body,
  .composer {
    padding-left: 14px;
    padding-right: 14px;
  }
}
