/* ==========================================================================
   Phone layout — Figma "Roleplay playable on mobile".
   Loaded only at max-width 600px (see the <link media> in index.html), so
   nothing here can reach the web layout. Phone-only markup carries .m-only
   (hidden on the web by app.css); web-only bits carry .w-only (hidden here).
   ========================================================================== */

:root {
  --m-bg: #fafaf9;
  --m-fg-bold: #000;
  --m-fg: #454854;
  --m-fg-subtle: #5c6070;
  --m-border: #c7c9d1;
  --m-ai: linear-gradient(135deg, #0c52df 8.6%, #8f4be7 100%);
  --m-ai-subtle: linear-gradient(135deg, #e2ebfd 0%, #e3d2f9 100%);
  --m-shadow: 0 0 4px rgba(0, 0, 0, 0.08);
  --m-glass-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
  --m-top: max(env(safe-area-inset-top), 12px);
  --m-bottom: max(env(safe-area-inset-bottom), 16px);
  --m-screen-h: var(--m-vh, 100dvh);
}

.w-only { display: none !important; }
body { background: var(--m-bg); }
#app { min-height: 0; }
/* Prototype notice: the phone screens have no free corner for it. */

/* --------------------------------------------------------------------------
   Shared pieces
   -------------------------------------------------------------------------- */

.m-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

/* Frosted "liquid glass" pill (Figma navigation bar buttons). */
.m-glass-button,
.chat-topbar,
.chat-countdown {
  background: rgba(255, 255, 255, 0.65);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: var(--m-glass-shadow);
}

.m-navbar {
  position: absolute; z-index: 5; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--m-top) + 10px) 16px 10px;
  background: rgba(250, 250, 249, 0.88);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.m-navbar-title {
  font-size: 16px; line-height: 44px; font-weight: 600; color: var(--m-fg-bold);
  max-width: calc(100% - 120px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.m-glass-button {
  position: absolute; left: 16px; bottom: 10px;
  width: 44px; height: 44px; border: 0; border-radius: 999px; padding: 0;
  display: flex; align-items: center; justify-content: center; color: var(--m-fg-bold); cursor: pointer;
}
.m-icon-button {
  width: 44px; height: 44px; border: 0; border-radius: 999px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--grey-100); color: var(--m-fg-bold); cursor: pointer;
}

.m-grabber { display: block; width: 36px; height: 5px; border-radius: 100px; background: var(--grey-200); }

.m-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.m-badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 16px;
  font-size: 12px; line-height: 16px; font-weight: 600; white-space: nowrap;
}
.m-badge-beta { background: #e3d2f9; color: #5b18b4; }
.m-badge-outline { background: #fff; border: 1px solid var(--m-border); color: var(--m-fg); }
.m-badge-success { background: #d9f2e5; color: #26734d; }
.m-badge-critical { background: var(--red-100); color: var(--red-600); }

.m-ai-disclaimer {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-size: 12px; line-height: 20px; color: var(--m-fg-subtle);
}

.m-button {
  flex: 1; min-width: 0; height: 44px; padding: 0 16px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 14px; line-height: 20px; font-weight: 600; cursor: pointer;
}
.m-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-button svg { flex-shrink: 0; }
.m-button-ai { border: 0; background: var(--m-ai); color: #fff; }
.m-button-brand { border: 0; background: var(--bg-brand); color: #fff; }
.m-button-ai-secondary { border: 1px solid #0c52df; background: #fff; color: #0c52df; }
/* Two side-by-side labels ("Discuter avec Alicia") don't fit with icons on
   narrower phones: the label wins. */
@media (max-width: 419px) {
  .m-button svg { display: none; }
  .m-button { padding: 0 8px; }
}
.m-button[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.m-button-ai-secondary span {
  background: var(--m-ai); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Bottom action bar (Figma "Bottom nav" / "EndSessionBanner"). */
.m-action-bar {
  flex-shrink: 0; display: flex; gap: 12px;
  padding: 16px 16px var(--m-bottom);
  border-top: 1px solid var(--m-border); background: var(--m-bg);
}

/* Avatar inside its four soft rings (Figma "animated RP Avatar"). */
.m-avatar-rings { position: relative; width: 298px; height: 298px; flex-shrink: 0; }
.m-ring { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.m-ring-4 { width: 93.3%; }
.m-ring-3 { width: 83.9%; }
.m-ring-2 { width: 75.8%; }
.m-ring-1 { width: 68.7%; }
.m-avatar {
  position: absolute; top: 50%; left: 50%; width: 68.7%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; background: var(--m-ai-subtle) center bottom / auto 100% no-repeat;
}
@keyframes m-ring-breathe {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1.035); opacity: 0.7; }
}
.m-ring-4 { animation: m-ring-breathe 3.2s ease-in-out infinite; }
.m-ring-3 { animation: m-ring-breathe 3.2s ease-in-out 0.25s infinite; }
.m-ring-2 { animation: m-ring-breathe 3.2s ease-in-out 0.5s infinite; }
@media (prefers-reduced-motion: reduce) { .m-ring { animation: none !important; } }

/* --------------------------------------------------------------------------
   Roleplay overview (briefing)
   -------------------------------------------------------------------------- */

.briefing-screen { display: block; min-height: 0; }
.briefing-screen > :not(.m-overview) { display: none; }
.m-overview {
  position: relative; display: flex; flex-direction: column;
  height: var(--m-screen-h); background: var(--m-bg);
}
.m-overview-content {
  flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 32px;
  padding: calc(var(--m-top) + 70px) 16px 32px;
}
.m-hero { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.m-hero-speaker { display: flex; align-items: center; gap: 8px; }
.m-online-dot { width: 12px; height: 12px; border-radius: 50%; background: #26734d; box-shadow: 0 0 0 2px #fff; }
.m-hero-name { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--m-fg); }
.m-hero-role { font-size: 14px; line-height: 20px; color: var(--m-fg-subtle); }
.m-hero-visual { position: relative; display: flex; flex-direction: column; align-items: center; margin-bottom: 4px; }
.m-hero-visual .m-avatar-rings { margin-top: 4px; }
.m-greeting {
  position: relative; margin-top: -28px; width: 262px; box-sizing: border-box; padding: 16px;
  border-radius: 16px; background: #fff; box-shadow: 0 0 2px rgba(0, 0, 0, 0.08);
  font-size: 14px; line-height: 20px; color: var(--m-fg);
}
.m-title-block { display: flex; flex-direction: column; gap: 12px; margin-top: -8px; }
.m-title { margin: 0; font-size: 18px; line-height: 28px; font-weight: 600; color: var(--m-fg-bold); }
.m-stats { display: flex; flex-direction: column; gap: 12px; margin-top: -8px; }
.m-stat-row { display: flex; gap: 8px; }
.m-stat-card {
  flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 12px 16px;
  border-radius: 16px; background: #fff; box-shadow: var(--m-shadow);
}
.m-stat-value {
  display: flex; align-items: center; gap: 8px;
  font-size: 20px; line-height: 32px; font-weight: 600; color: var(--m-fg-bold);
}
.m-stat-critical { color: var(--red-600); }
.m-stat-label { font-size: 12px; line-height: 16px; color: var(--m-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-last-attempt {
  display: flex; align-items: center; gap: 16px; height: 52px; padding: 8px 16px; border: 0;
  border-radius: 16px; background: #fff; box-shadow: 0 0 2px rgba(0, 0, 0, 0.12);
  font: inherit; text-align: left; cursor: pointer;
}
.m-last-attempt-text { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 12px; line-height: 16px; color: var(--m-fg); }
.m-last-attempt-text strong { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--m-fg-bold); }
.m-dot-sep { width: 4px; height: 4px; border-radius: 50%; background: var(--m-fg-subtle); }
.m-see { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--m-fg-subtle); }
.m-section { display: flex; flex-direction: column; gap: 4px; }
.m-section h2 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; color: var(--m-fg-bold); }
.m-section p { margin: 0; font-size: 14px; line-height: 20px; color: var(--m-fg); }
.m-criteria-list { display: flex; flex-direction: column; margin-top: 4px; }
.m-criteria { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; font-size: 14px; line-height: 20px; color: var(--m-fg); }
.m-criteria-icon {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--m-ai-subtle);
  display: flex; align-items: center; justify-content: center;
}
.m-overview .voice-testing-badge { margin: 0; text-align: center; }

/* --------------------------------------------------------------------------
   Chat and call: shared top controls, overview bar, bottom sheet
   -------------------------------------------------------------------------- */

.chat-screen, .voice-screen { position: relative; height: var(--m-screen-h); overflow: hidden; }
.chat-screen { background: var(--m-bg); }

/* Top-left pill: close + retry. Everything else in the web topbar is hidden. */
.chat-topbar {
  position: absolute; z-index: 6; top: var(--m-top); left: 16px;
  height: 44px; padding: 4px; gap: 16px; border: 0; border-radius: 296px;
}
.chat-topbar > :not(.chat-close):not(.voice-close):not(.m-topbar-retry) { display: none; }
.chat-topbar .icon-button { width: 36px; height: 36px; background: transparent; color: var(--m-fg-bold); }
.chat-topbar .m-topbar-retry { display: flex; }
.chat-topbar .m-topbar-retry svg { stroke: currentColor; width: 20px; height: 20px; }

/* Top-right pill: time left. */
.chat-countdown-row, .chat-countdown-row-center {
  position: absolute; z-index: 6; top: var(--m-top); right: 16px; padding: 0; justify-content: flex-end;
}
.chat-countdown {
  height: 44px; padding: 4px 16px 4px 12px; gap: 8px; border: 0; border-radius: 16px;
  color: var(--m-fg-bold); font-size: 14px; line-height: 20px;
}
.chat-countdown .chat-countdown-icon { display: none; }
.m-countdown-clock { display: block; }
.m-countdown-time { display: inline; min-width: 38px; font-variant-numeric: tabular-nums; }
.chat-countdown-dot { background: var(--grey-900); }
.chat-countdown-warning { color: var(--yellow-700); }
.chat-countdown-warning .chat-countdown-dot { background: var(--yellow-500); }
.chat-countdown-critical { color: var(--red-600); }
.chat-countdown-critical .chat-countdown-dot { background: var(--red-500); }

.brief-panel-toggle, .brief-tab-wrap { display: none; }

.m-overview-bar {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 60px; flex-shrink: 0; box-sizing: border-box; padding: 20px; border: 0; border-radius: 16px;
  background: #fff; box-shadow: var(--m-shadow); font: inherit; cursor: pointer;
}
.m-overview-bar .m-grabber { position: absolute; top: 5px; left: 50%; transform: translateX(-50%); }
.m-overview-bar-title {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 14px; line-height: 20px; font-weight: 600; color: var(--m-fg);
}

/* The brief panel becomes a bottom sheet. */
.chat-body, .voice-body { position: static; display: block; height: 100%; }
.chat-brief-panel {
  position: fixed; z-index: 120; left: 0; right: 0; bottom: 0; width: auto;
  max-height: calc(var(--m-screen-h) - var(--m-top) - 8px);
  border-radius: 24px 24px 0 0; border-left: 0; box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.16);
  transform: translateY(105%); visibility: hidden;
  transition: transform 320ms cubic-bezier(0.32, 0.72, 0, 1), visibility 0s linear 320ms;
}
.m-sheet-open .chat-brief-panel {
  transform: none; visibility: visible;
  transition: transform 320ms cubic-bezier(0.32, 0.72, 0, 1), visibility 0s;
}
.m-sheet-backdrop {
  display: block; position: fixed; inset: 0; z-index: 110; background: rgba(0, 0, 0, 0.72);
  opacity: 0; pointer-events: none; transition: opacity 320ms ease;
}
.m-sheet-open .m-sheet-backdrop { opacity: 1; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) {
  .chat-brief-panel, .m-sheet-backdrop { transition: none !important; }
}
.m-sheet-head {
  position: relative; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; min-height: 44px; padding: 16px 16px 8px; touch-action: none;
}
.m-sheet-head .m-grabber { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); }
.m-sheet-head .m-icon-button { position: absolute; left: 12px; top: 14px; }
.m-sheet-title { font-size: 16px; line-height: 24px; font-weight: 600; color: var(--m-fg-bold); }
.brief-panel-header { gap: 12px; margin: 0 16px 24px; padding: 16px 0; }
.brief-panel-header .chat-avatar-xl { width: 76px; height: 76px; }
.brief-panel-name { font-size: 18px; line-height: 28px; }
.brief-panel-role { font-size: 14px; line-height: 20px; }
.brief-panel-header .m-ai-disclaimer { display: flex; justify-content: flex-start; margin-top: 4px; }
.brief-panel-body { padding: 0 16px calc(var(--m-bottom) + 8px); }
.brief-panel-footer { display: none; }
.brief-panel-body .brief-title { font-size: 18px; line-height: 28px; }
.brief-panel-body .brief-chips .pill { height: 24px; border-radius: 16px; font-size: 12px; }
.brief-panel-body .brief-chips .pill-timelimit { background: #fff; border: 1px solid var(--m-border); color: var(--m-fg); }
.brief-panel-body .brief-block-title { font-size: 16px; line-height: 24px; color: var(--m-fg-bold); }
.m-end-now {
  display: block; width: 100%; height: 44px; margin-top: 24px; border: 1px solid var(--m-border); border-radius: 8px;
  background: #fff; color: var(--m-fg-bold); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}

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

.chat-main {
  height: 100%; box-sizing: border-box; padding: 0 16px var(--m-bottom);
}
.chat-messages {
  padding: calc(var(--m-top) + 60px) 0 24px; gap: 24px;
  /* Messages blur away under the top controls (Figma "Conversation scrolled"). */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent calc(var(--m-top) + 8px), #000 calc(var(--m-top) + 60px));
  mask-image: linear-gradient(to bottom, transparent 0, transparent calc(var(--m-top) + 8px), #000 calc(var(--m-top) + 60px));
}
.chat-messages-measure { max-width: none; margin-top: auto; }
.chat-row { gap: 12px; }
.chat-row-ai .chat-avatar-msg { width: 32px; height: 32px; flex-shrink: 0; background-color: #e2ebfd; }
.chat-msg-col { gap: 0; }
.chat-msg-name { color: var(--m-fg); }
.chat-bubble { line-height: 20px; }
.chat-bubble-ai { color: var(--m-fg); }
.chat-row-learner { max-width: none; padding-left: 32px; }
.chat-bubble-learner { padding: 12px; border-radius: 16px; background: #e2ebfd; color: var(--m-fg); }
.chat-typing { gap: 4px; height: 20px; }
.chat-typing span { width: 4px; height: 4px; background: #2e3038; }
.chat-row-ai:has(.chat-typing) { align-items: flex-start; }

.chat-composer { border: 0; padding: 12px 0; }
.chat-composer-measure { max-width: none; }
.chat-composer-box {
  align-items: flex-end; gap: 16px; padding: 8px 8px 8px 12px; border: 0; border-radius: 16px; background: #f1f1f3;
}
.chat-composer-box:focus-within { box-shadow: none; }
.chat-input { font-size: 16px; line-height: 20px; padding: 6px 0; max-height: 113px; height: 32px; box-sizing: border-box; }
.chat-input::placeholder { color: var(--m-fg-subtle); }
.chat-composer-meta { display: none; }
.chat-send { width: 32px; height: 32px; border-radius: 16px; background: var(--m-ai); }
.chat-send:hover { background: var(--m-ai); }
.chat-send svg { width: 18px; height: 18px; }
.chat-send:disabled { opacity: 1; background: var(--grey-300); }
.chat-error-card { flex-wrap: wrap; }

/* End banner: replaces the composer and the overview bar. */
.chat-screen:has([data-end-banner]) .m-overview-bar { display: none; }
.chat-composer:has(.end-banner) { padding: 0; }
.end-banner {
  max-width: none; gap: 8px; padding: 12px; border-radius: 16px; background: #fff; box-shadow: var(--m-shadow);
}
.chat-composer .end-banner { background: #fff; box-shadow: var(--m-shadow); }
.end-banner-icon svg { width: 40px; height: 40px; stroke-width: 1.2; }
.end-banner-completed .end-banner-icon { color: var(--m-fg); }
.end-banner-text strong { font-size: 14px; line-height: 20px; }
.end-banner-text strong.m-only { display: block; }
.end-banner-text span { font-size: 14px; line-height: 20px; color: var(--m-fg-subtle); }
.end-banner-cta { height: 44px; padding: 0 16px; border: 0; border-radius: 8px; background: var(--m-ai); font-size: 14px; }

/* --------------------------------------------------------------------------
   Voice player
   -------------------------------------------------------------------------- */

.voice-screen { background: linear-gradient(115deg, #e2ebfd 0%, #e3d2f9 100%); }
.voice-main {
  position: relative; height: 100%; box-sizing: border-box; background: none;
  padding: calc(var(--m-top) + 56px) 16px var(--m-bottom);
}
.voice-center { flex: 1; padding: 0; gap: 0; justify-content: center; }
.voice-tiles { flex-direction: column; align-items: center; max-width: none; gap: 0; }
.voice-tile-learner { display: none; }
.voice-tile-ai {
  position: relative; display: flex; flex-direction: column; align-items: center;
  padding: 36px 0 44px; background: none; border: 0; box-shadow: none !important; width: auto;
}
.voice-tile-ai .voice-tile-name {
  order: -1; margin-bottom: 4px; font-size: 18px; line-height: 28px; font-weight: 600; color: var(--m-fg-bold);
}
.voice-tile-ai .voice-tile-ring {
  position: relative; width: 298px; height: 298px; padding: 0; background: none; box-shadow: none;
  display: flex; align-items: center; justify-content: center;
}
.voice-tile-ai .voice-tile-ring::before {
  content: ""; position: absolute; inset: 10px; border-radius: 50%;
  background:
    url("../assets/mobile/ring-1.svg") center / 73.6% no-repeat,
    url("../assets/mobile/ring-2.svg") center / 81.2% no-repeat,
    url("../assets/mobile/ring-3.svg") center / 89.9% no-repeat,
    url("../assets/mobile/ring-4.svg") center / 100% no-repeat;
  transition: transform 400ms ease;
}
.voice-tile-ai.voice-tile-active .voice-tile-ring::before { transform: scale(1.04); }
.voice-tile-ai .voice-tile-avatar {
  position: relative; width: 205px; height: 205px; border-radius: 50%;
  background-color: transparent; background-image: var(--m-ai-subtle);
}
.voice-tile-ai .voice-tile-avatar[style] { background-color: #e3e0fb; }
.voice-tile-ai .voice-waveform { position: absolute; bottom: 0; height: 32px; gap: 3.5px; }
.voice-tile-ai .voice-waveform span { width: 2px; height: 4px; background: var(--m-fg); }
.voice-tile-ai.voice-tile-active .voice-waveform span:nth-child(1) { height: 13px; }
.voice-tile-ai.voice-tile-active .voice-waveform span:nth-child(2) { height: 22px; }
.voice-tile-ai.voice-tile-active .voice-waveform span:nth-child(3) { height: 15px; }
.voice-tile-ai.voice-tile-active .voice-waveform span:nth-child(4) { height: 9px; }

.voice-caption {
  width: auto; max-width: 100%; max-height: 30vh; padding: 0 12px; border-top-width: 12px; border-bottom-width: 12px;
  border-radius: 8px; background: rgba(0, 0, 0, 0.72); color: #fff; text-align: left;
}
.voice-caption-ai, .voice-caption-learner { background: rgba(0, 0, 0, 0.72); }
.voice-status {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: 999px;
  background: #fff; color: var(--m-fg-subtle); font-size: 12px; font-style: italic;
}
.voice-status::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--grey-900); }
.voice-status:empty { display: none; }
.voice-center:has(.voice-caption:not([hidden])) .voice-status { display: none; }
.voice-timing { margin-top: 8px; }

/* Bottom row: mic/CC toolbar + overview bar (the toolbar is moved here by app.js). */
.m-voice-bottom { display: flex; gap: 8px; align-items: stretch; flex-shrink: 0; padding-top: 24px; }
.m-voice-bottom .voice-controls { padding: 0; }
.voice-control-bar { gap: 12px; padding: 8px; border-radius: 16px; box-shadow: none; }
.voice-ctrl { width: 44px; height: 44px; border-radius: 8px; }
.voice-mic-toggle, .voice-mute-button { order: -1; }
.voice-settings-wrap { display: none; }
.voice-talk-button { height: 44px; padding: 0 14px; font-size: 13px; }
.voice-mute-button { height: 44px; padding: 0 12px; font-size: 13px; }
.m-voice-bottom .m-overview-bar { flex: 1; width: auto; min-width: 0; }
.voice-screen:has([data-end-banner]) .m-voice-bottom { display: none; }
.voice-center .end-banner {
  position: absolute; left: 16px; right: 16px; bottom: var(--m-bottom); width: auto;
}
.voice-fallback-card { margin: 0 8px; }

/* --------------------------------------------------------------------------
   Dialogs (Figma "When leaving / retrying, a dialog is displayed")
   -------------------------------------------------------------------------- */

.modal-backdrop { padding: 16px; background: rgba(0, 0, 0, 0.24); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal {
  width: 100%; max-height: calc(var(--m-screen-h) - 64px); overflow: auto;
  border-radius: 28px; background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: var(--m-glass-shadow);
}
.modal:has([data-confirm-lose], [data-confirm-end]) { width: min(300px, 100%); }
.modal-title { padding: 24px 18px 8px; font-size: 15px; line-height: 20px; font-weight: 600; color: var(--m-fg-bold); }
.modal-body { padding: 0 18px 8px; font-size: 13px; line-height: 18px; color: var(--m-fg-subtle); }
.modal-actions { border: 0; padding: 16px 12px 12px; gap: 10px; }
.modal-actions > button { flex: 1; height: 40px; border: 0; border-radius: 999px; background: #f1f1f3; color: var(--m-fg-bold); font-size: 14px; font-weight: 600; }
.modal-actions > .m-danger { color: var(--red-600); }
.modal-spaces .space-row-actions > .field-input { flex: 1 1 100%; }
.modal-actions:has([data-sync-publish]) { flex-wrap: wrap; }
.modal-actions:has([data-sync-publish]) > button { flex: 1 1 100%; }
.modal-spaces .modal-actions > button, .modal .button-compact { height: 32px; font-size: 13px; }
.modal-spaces .space-row-actions > .button-compact { flex: none; padding: 0 14px; }

/* --------------------------------------------------------------------------
   Results (outcome)
   -------------------------------------------------------------------------- */

.outcome-screen { height: var(--m-screen-h); background: var(--m-bg); }
.outcome-screen:has(.m-results) > :not(.m-results) { display: none; }
.outcome-body { padding: calc(var(--m-top) + 16px) 16px 24px; }
.m-results { position: relative; display: flex; flex-direction: column; height: 100%; }
.m-results-content {
  flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 24px;
  padding: calc(var(--m-top) + 80px) 16px 24px;
}
.m-results-status { display: flex; flex-direction: column; align-items: center; gap: 24px; padding-bottom: 0; }
.m-results-title { display: flex; flex-direction: column; gap: 4px; text-align: center; }
.m-results-title strong { font-size: 18px; line-height: 28px; font-weight: 600; color: var(--m-fg-bold); }
.m-results-title span { font-size: 14px; line-height: 20px; color: var(--m-fg-subtle); }
.m-results-illustration { margin-bottom: -4px; }
.m-user-progress { display: flex; align-items: center; gap: 32px; }
.m-score-ring { position: relative; width: 88px; height: 88px; flex-shrink: 0; }
.m-score-ring svg { display: block; }
.m-score-avatar {
  position: absolute; top: 12px; left: 12px; width: 64px; height: 64px; box-sizing: border-box;
  border-radius: 50%; border: 1px solid #fff; background: center / cover no-repeat;
}
.m-score { display: flex; flex-direction: column; gap: 4px; font-weight: 600; color: var(--m-fg-subtle); white-space: nowrap; }
.m-score span { font-size: 14px; line-height: 20px; }
.m-score strong { font-size: 24px; line-height: 36px; font-weight: 600; }
.m-score-passed { color: #26734d; }
.m-score-failed { color: var(--red-600); }
.m-badges-center { justify-content: center; }

/* Feedback / Transcript tabs, pinned at the top while scrolling (Figma). */
.m-segmented-wrap {
  position: sticky; top: calc(var(--m-top) + 64px); z-index: 4; flex-shrink: 0;
  margin: -12px -16px; padding: 12px 16px; background: var(--m-bg);
}
.m-segmented {
  display: flex; gap: 4px; height: 32px; padding: 2px; box-sizing: border-box; border-radius: 100px;
  background: #ececee;
}
.m-segmented button {
  flex: 1; border: 0; border-radius: 20px; background: transparent; cursor: pointer;
  font: inherit; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--m-fg-bold);
}
.m-segmented button.is-active { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.m-results-panel { display: flex; flex-direction: column; gap: 24px; }
.m-transcript { gap: 24px; margin: 0; }

.m-card { border-radius: 16px; background: #fff; box-shadow: 0 0 2px rgba(0, 0, 0, 0.12); overflow: hidden; }
.m-card-head {
  display: flex; align-items: center; gap: 12px; margin: 0 16px; padding: 24px 0;
  border-bottom: 1px solid var(--m-border); font-size: 14px; line-height: 20px; font-weight: 600; color: var(--m-fg-bold);
}
.m-card-head-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.m-card-head-icon-improve { background: #fff2cc; }
.m-card-head-icon-well { background: #d9f2e5; color: #26734d; }
.m-card-head:has(.m-card-head-icon) { padding: 16px 0; }
.m-card-text { margin: 0; padding: 24px; font-size: 14px; line-height: 20px; color: var(--m-fg-subtle); }
.m-card-list > * + * { border-top: 1px solid var(--grey-200); }
.m-card-list > * { margin: 0 24px; }
.m-empty { padding: 24px 0; font-size: 14px; color: var(--m-fg-subtle); }
.m-accordion summary {
  display: flex; align-items: flex-start; gap: 8px; padding: 24px 0; list-style: none; cursor: pointer;
  font-size: 14px; line-height: 20px; font-weight: 600; color: var(--m-fg-bold);
}
.m-accordion summary::-webkit-details-marker { display: none; }
.m-accordion-label { flex: 1; min-width: 0; }
.m-accordion-chevron { flex-shrink: 0; display: flex; color: var(--m-fg); transition: transform 200ms ease; }
.m-accordion[open] .m-accordion-chevron { transform: rotate(180deg); }
.m-accordion-body { display: flex; flex-direction: column; gap: 16px; padding: 0 0 24px; font-size: 14px; line-height: 20px; color: var(--m-fg-subtle); }
.m-accordion-body p { margin: 0; }
.m-criteria-icon-well { background: #e2ebfd; color: var(--bg-brand); }
.m-note { display: flex; flex-direction: column; gap: 4px; padding: 4px 12px; border-left: 2px solid #997200; }
.m-note-well { border-left-color: #26734d; }
.m-note strong { font-weight: 600; }
.m-results-links { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.m-results-links .link-button { font-size: 13px; }

/* --------------------------------------------------------------------------
   Home (360Learning app home)
   -------------------------------------------------------------------------- */

.home-screen:has(.m-home) { display: block; height: var(--m-screen-h); }
.home-screen:has(.m-home) > :not(.m-home) { display: none; }
.m-home { position: relative; display: flex; flex-direction: column; height: 100%; background: var(--m-bg); }
.m-home-content {
  flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px;
  padding: calc(var(--m-top) + 8px) 16px calc(var(--m-bottom) + 96px);
}
.m-home-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.m-glass-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.8); box-shadow: var(--m-glass-shadow);
  font-size: 14px; font-weight: 600; color: var(--m-fg-bold);
}
.m-home-actions { gap: 18px; padding: 0 16px; }
.m-bell { position: relative; display: flex; }
.m-bell i { position: absolute; top: -2px; right: -2px; width: 7px; height: 7px; border-radius: 50%; background: var(--red-600); }
.m-home-heading {
  display: flex; align-items: center; gap: 4px; margin: 12px 0 0;
  font-size: 18px; line-height: 28px; font-weight: 600; color: var(--m-fg-bold);
}
.m-list-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  background: #fff; box-shadow: 0 0 2px rgba(0, 0, 0, 0.16); color: var(--m-fg);
}
.m-list-icon { width: 32px; height: 32px; border-radius: 8px; background: #e2ebfd; color: var(--bg-brand); display: flex; align-items: center; justify-content: center; }
.m-list-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-list-text strong { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--m-fg-bold); }
.m-list-text small { font-size: 12px; line-height: 16px; color: var(--m-fg-subtle); }
.m-warning-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 16px;
  background: #fff2cc; color: #6b4f05; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.m-work-row { display: flex; gap: 8px; }
.m-work-card {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px;
  border-radius: 12px; background: #fff; box-shadow: 0 0 2px rgba(0, 0, 0, 0.16);
}
.m-work-value { display: flex; align-items: center; gap: 8px; font-size: 18px; line-height: 24px; font-weight: 600; color: var(--m-fg-bold); }
.m-work-value svg { color: var(--m-fg); }
.m-work-label { font-size: 12px; line-height: 16px; color: var(--m-fg-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-ask-ai {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px;
  background: linear-gradient(90deg, #e9e7fd, #ece2fb); border: 1px solid #d8cdf7;
}
.m-ask-ai-icon { width: 24px; height: 24px; border-radius: 50%; background: var(--m-ai); display: flex; align-items: center; justify-content: center; }
.m-ask-ai-text { flex: 1; font-size: 14px; font-weight: 600; color: var(--m-fg-bold); }
.m-ask-ai-cta { font-size: 14px; font-weight: 600; color: #5b18b4; }
.m-home-banner {
  height: 112px; margin-top: 8px; border-radius: 12px;
  background: url("../assets/photos/hero.jpg") center / cover no-repeat;
}
.m-rp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-rp-card {
  display: flex; flex-direction: column; padding: 0; border: 0; border-radius: 12px; overflow: hidden; text-align: left;
  background: #fff; box-shadow: 0 0 2px rgba(0, 0, 0, 0.16); font: inherit; cursor: pointer;
}
.m-rp-card-top { display: flex; justify-content: center; align-items: center; height: 80px; background: var(--m-ai-subtle); }
.m-rp-card-avatar {
  width: 52px; height: 52px; border-radius: 50%; border: 1px solid #b9c3f5;
  background: #fff center bottom / cover no-repeat; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.5);
}
.m-rp-card-title {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 60px; padding: 12px 10px 14px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--m-fg-bold);
}

/* Floating tab bar (Figma). */
.m-tabbar {
  position: absolute; left: 16px; right: 16px; bottom: max(env(safe-area-inset-bottom), 12px);
  display: flex; gap: 2px; padding: 4px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.75); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: var(--m-glass-shadow);
}
.m-tab {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px 6px; border: 0; border-radius: 999px; background: transparent; cursor: pointer;
  font: inherit; font-size: 10px; line-height: 12px; font-weight: 600; color: var(--m-fg-bold);
}
.m-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-tab.is-active { background: rgba(0, 0, 0, 0.07); color: var(--bg-brand); }
.m-tab-ai { color: #5b18b4; }

/* --------------------------------------------------------------------------
   Learning path page
   -------------------------------------------------------------------------- */

.home-screen:has(.m-path) { display: block; height: var(--m-screen-h); }
.home-screen:has(.m-path) > :not(.m-path) { display: none; }
.m-path { display: flex; flex-direction: column; height: 100%; background: var(--m-bg); }
.m-path-content { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding-bottom: calc(var(--m-bottom) + 16px); }
.m-path-hero {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: calc(var(--m-top) + 96px) 24px 36px; margin-bottom: 16px; text-align: center; color: #fff;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.7)), url("../assets/photos/hero.jpg") center / cover no-repeat;
}
.m-path-hero .m-path-back { top: calc(var(--m-top) + 8px); bottom: auto; background: rgba(255, 255, 255, 0.3); color: #fff; }
.m-path-hero h1 { margin: 0; font-size: 20px; line-height: 28px; font-weight: 600; }
.m-path-session {
  display: flex; flex-direction: column; gap: 2px; width: 100%; box-sizing: border-box; padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.8); border-radius: 8px; font-size: 12px;
}
.m-path-session strong { font-size: 14px; font-weight: 600; }
.m-path-go {
  position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%);
  width: 48px; height: 36px; border-radius: 8px; background: var(--bg-brand); display: flex; align-items: center; justify-content: center;
}
.m-path-description { margin: 0; padding: 0 16px; font-size: 13px; line-height: 18px; color: var(--m-fg); }
.m-path .m-home-heading { padding: 0 16px; }
.m-step-list { display: flex; flex-direction: column; gap: 10px; padding: 0 16px; }
.m-step { display: flex; min-height: 88px; border-radius: 8px; overflow: hidden; background: #fff; box-shadow: 0 0 2px rgba(0, 0, 0, 0.16); }
.m-step-thumb { position: relative; width: 104px; flex-shrink: 0; background: var(--grey-200) center / cover no-repeat; }
.m-step-thumb-rp { display: flex; align-items: center; justify-content: center; background: var(--m-ai-subtle); }
.m-step-thumb-avatar { width: 52px; height: 52px; border-radius: 50%; background: #fff center bottom / cover no-repeat; }
.m-step-thumb-badge {
  position: absolute; top: 6px; left: 6px; display: inline-flex; align-items: center; gap: 2px; height: 18px; padding: 0 5px;
  border-radius: 4px; background: #fff; font-size: 10px; font-weight: 600; color: var(--m-fg);
}
.m-step-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 10px 12px; }
.m-step-kicker { font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; color: #5b18b4; font-weight: 600; }
.m-step-title { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--m-fg-bold); }
.m-step-status { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--m-fg-subtle); }
.m-step-done { color: #26734d; }
.m-step .m-badge { align-self: flex-start; height: 20px; font-size: 11px; }

/* --------------------------------------------------------------------------
   Team roleplays on the home + log-out row
   -------------------------------------------------------------------------- */

.m-rp-card-team { position: relative; }
.m-rp-card-team.is-loading { opacity: 0.6; cursor: progress; }
.m-rp-card-team-tag {
  position: absolute; top: 6px; left: 6px; height: 18px; padding: 0 7px; border-radius: 9px;
  background: #fff; color: var(--m-fg); font-size: 10px; line-height: 18px; font-weight: 600;
}
.m-logout-link { width: 100%; border: 0; font: inherit; text-align: left; cursor: pointer; margin-top: 12px; }

/* feature/demo-feedback L5 */
.m-section .m-natural-end { color: var(--m-fg-subtle); font-size: 13px; line-height: 18px; }
.m-results-title .m-required-missed { color: var(--red-600); font-size: 13px; line-height: 18px; margin-top: 4px; }
.m-ind-tags { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: middle; }
.m-ind-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 9px; font-size: 11px; font-weight: 600; background: #e3d2f9; color: #5b18b4; }
.m-ind-tag-weight { background: #eef0f3; color: var(--m-fg); font-weight: 500; }
