/* NEXSIS — Mahabat Lhikma palette (teal / violet / amber on warm paper #fcfbf7) */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&family=Amiri:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --bg: #FCFBF7;
  --surface: #FFFFFF;
  --surface-2: #F6F3EB;
  --border: #E5E7EB;
  --border-strong: #D1D5DB;
  --ink: #0F172A;
  --ink-2: #334155;
  --muted: #64748B;
  --primary: #0F766E;
  --primary-dark: #0D5F58;
  --primary-light: #14B8A6;
  --primary-soft: #F0FDFA;
  --primary-ring: rgba(15, 118, 110, .18);
  --primary-border: #99F6E4;
  --secondary: #7C3AED;
  --secondary-dark: #5B21B6;
  --emerald: #059669;
  --emerald-soft: #ECFDF5;
  --amber: #B45309;
  --accent: #D97706;
  --amber-soft: #FFFBEB;
  --danger: #DC2626;
  --danger-soft: #FEF2F2;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 10px 30px rgba(15,23,42,.07);
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --font: 'Tajawal', system-ui, sans-serif;
  --display: 'Tajawal', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
  min-height: 100vh;
  line-height: 1.8;
  background-image:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(15,118,110,0.12), transparent),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(124,58,237,0.08), transparent),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(217,119,6,0.05), transparent);
  background-repeat: no-repeat;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hidden { display: none !important; }
#bg-veil { display: none; }

/* ===== Header ===== */
.app-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1180px; margin: 0 auto; padding: .8rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.logo-group { display: flex; align-items: center; gap: .75rem; }
.logo-mark {
  width: 42px; height: 42px; border-radius: 13px;
  background: linear-gradient(135deg, #0F766E 0%, #7C3AED 55%, #D97706 130%);
  color: #fff; font-weight: 900; font-size: 1.3rem;
  display: grid; place-items: center; box-shadow: var(--shadow-sm);
  font-family: var(--display);
}
.logo-title { font-family: var(--display); font-size: 1.08rem; font-weight: 800; line-height: 1.3; }
.logo-sub { font-size: .78rem; color: var(--muted); line-height: 1.4; }

.steps { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--muted); }
.step { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border-radius: 999px; border: 1px solid transparent; font-weight: 700; }
.step i { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-style: normal; font-size: .75rem; }
.step.is-active { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary-dark); }
.step.is-active i { background: var(--primary); border-color: var(--primary); color: #fff; }
.step.is-done { color: var(--emerald); }
.step.is-done i { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.step-sep { width: 22px; height: 1px; background: var(--border-strong); }

.header-controls { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.turn-counter {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--amber-soft); border: 1px solid #FDE68A; color: var(--amber);
  font-weight: 800; font-size: .85rem; padding: .42rem .8rem; border-radius: 999px;
}
.turn-counter.final { background: var(--danger-soft); border-color: #FECACA; color: var(--danger); }
.icon-btn {
  background: #fff; border: 1px solid var(--border); color: var(--ink-2);
  border-radius: 10px; padding: .45rem .8rem; font-family: var(--font);
  font-size: .84rem; font-weight: 700; cursor: pointer; transition: all .18s ease;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-soft); }

/* ===== Layout ===== */
.phase-container { display: none; max-width: 1180px; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }
.phase-container.active { display: block; animation: fadeUp .4s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ===== Mission briefing ===== */
#phase-intro { max-width: 1540px; padding-top: 1rem; }
.mission-header {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .8rem 1.5rem;
  margin-bottom: .9rem;
}
.mission-eyebrow {
  display: inline-flex; align-items: center; gap: .5rem; color: var(--primary-dark);
  font-size: .74rem; font-weight: 900; letter-spacing: .04em;
}
.mission-signal, .feed-live-dot {
  width: .54rem; height: .54rem; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 .22rem rgba(5,150,105,.12);
}
.mission-title { font-family: var(--display); font-size: clamp(1.28rem, 2.1vw, 1.7rem); font-weight: 900; line-height: 1.35; margin-top: .15rem; }
.mission-summary { color: var(--muted); font-size: .88rem; max-width: 36ch; line-height: 1.6; padding-bottom: .15rem; }
.resume-banner {
  grid-column: 1 / -1; margin-top: .2rem; background: var(--surface); border: 1.5px dashed var(--primary-border); border-radius: var(--radius-sm);
  padding: .85rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap;
  text-align: right;
}
.resume-info { display: flex; align-items: center; gap: .6rem; font-weight: 800; color: var(--primary-dark); }
.resume-actions { display: flex; gap: .5rem; }
.btn-resume-main { background: var(--primary); color: #fff; border: none; border-radius: 10px; padding: .55rem 1.1rem; font-family: var(--font); font-weight: 800; cursor: pointer; }
.btn-resume-main:hover { background: var(--primary-dark); }
.btn-resume-discard { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: .55rem .9rem; cursor: pointer; font-family: var(--font); font-weight: 700; color: var(--muted); }
.btn-resume-discard:hover { color: var(--danger); border-color: #FECACA; }

.mission-layout {
  display: grid; grid-template-columns: minmax(15.5rem, .27fr) minmax(0, .73fr); gap: 1rem;
  align-items: stretch; min-height: clamp(32rem, calc(100svh - 12rem), 48rem);
}
.mission-brief, .video-command {
  background: #111a2b; background: oklch(18% .026 262); border: 1px solid rgba(183,207,232,.2); border-radius: 20px;
  box-shadow: 0 18px 42px rgba(15,23,42,.16); overflow: hidden;
}
.mission-brief { color: #e8eef7; padding: clamp(1.15rem, 2vw, 1.75rem); display: flex; flex-direction: column; }
.brief-label { color: #88e0d1; font-size: .72rem; font-weight: 900; letter-spacing: .08em; }
.mission-brief h3 { font-family: var(--display); font-size: clamp(1.28rem, 1.9vw, 1.7rem); line-height: 1.35; margin: .25rem 0 .6rem; }
.brief-copy { color: #bac8da; font-size: .9rem; line-height: 1.75; }
.mission-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin: 1.15rem 0; }
.mission-metrics div { background: rgba(255,255,255,.055); border: 1px solid rgba(183,207,232,.14); border-radius: 12px; padding: .55rem .65rem; }
.mission-metrics dt { color: #9caec3; font-size: .7rem; font-weight: 700; }
.mission-metrics dd { color: #f4f7fb; font-family: var(--display); font-size: 1.4rem; font-weight: 900; line-height: 1.1; margin-top: .2rem; }
.mission-metrics dd span { color: #aab9c9; font-family: var(--font); font-size: .72rem; font-weight: 700; }
.mission-checklist { list-style: none; display: grid; gap: .7rem; }
.mission-checklist li { display: grid; grid-template-columns: 1.9rem minmax(0, 1fr); align-items: start; gap: .55rem; color: #d2dce8; font-size: .83rem; line-height: 1.65; }
.mission-checklist span { color: #88e0d1; font-size: .69rem; font-weight: 900; letter-spacing: .04em; padding-top: .12rem; }
.cta-wrapper { margin-top: auto; padding-top: 1.25rem; text-align: center; }
.btn-primary-glow {
  background: linear-gradient(to right, var(--primary), var(--primary-dark)); color: #f7fffe; border: none;
  font-family: var(--display); font-weight: 800; font-size: 1.02rem;
  padding: .9rem 2rem; border-radius: 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: .6rem;
  box-shadow: 0 10px 24px rgba(15,118,110,.32); transition: transform .16s ease, box-shadow .16s ease;
}
.mission-brief .btn-primary-glow { background: var(--primary); }
.btn-primary-glow:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(15,118,110,.4); }
.mission-brief .btn-primary-glow:hover { background: var(--primary-dark); }
.btn-primary-glow:active { transform: none; }
.btn-primary-glow:focus-visible, .video-wrapper video:focus-visible { outline: 3px solid #88e0d1; outline-offset: 3px; }
.cta-hint { color: #9caec3; font-size: .75rem; line-height: 1.55; margin-top: .65rem; }

.video-command { display: flex; flex-direction: column; min-width: 0; }
.feed-topline, .feed-caption { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 1rem; }
.feed-topline { border-bottom: 1px solid rgba(183,207,232,.14); }
.feed-topline h3 { color: #e8eef7; font-family: var(--display); font-size: .92rem; font-weight: 800; }
.feed-topline p { display: inline-flex; align-items: center; gap: .4rem; color: #9caec3; font-size: .7rem; font-weight: 700; white-space: nowrap; }
.feed-live-dot { width: .42rem; height: .42rem; box-shadow: none; }
.video-wrapper { flex: 1; min-height: 0; background: #09111c; display: grid; place-items: center; }
.video-wrapper video { display: block; width: 100%; height: 100%; min-height: 0; background: #09111c; object-fit: contain; }
.feed-caption { color: #aab9c9; font-size: .8rem; line-height: 1.55; }
.feed-caption span { color: #88e0d1; font-size: .68rem; font-weight: 900; letter-spacing: .07em; white-space: nowrap; }

/* ===== Shared panels ===== */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.4rem;
}

/* ===== Debate ===== */
.debate-arena { display: grid; grid-template-columns: 340px 1fr; gap: 1.25rem; align-items: start; }
.speaker-panel { position: sticky; top: 86px; }
.speaker-top { display: flex; gap: .9rem; align-items: center; }
.speaker-frame-container { position: relative; flex: none; }
.speaker-glow-ring { display: none; }
.speaker-avatar { width: 76px; height: 76px; border-radius: 22px; object-fit: cover; border: 3px solid #CCFBF1; background: var(--surface-2); }
.speaker-panel.user-active .speaker-avatar { border-color: #A7F3D0; }
.speaker-panel.stage-2 .speaker-avatar { border-color: #FDE68A; }
.speaker-panel.stage-3 .speaker-avatar { border-color: #FCD34D; }
.speaker-panel.stage-4 .speaker-avatar { border-color: #6EE7B7; }
.speaker-role-tag { font-size: .72rem; font-weight: 800; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); padding: .15rem .6rem; border-radius: 999px; }
.boss-active .speaker-role-tag { color: var(--primary-dark); background: var(--primary-soft); border-color: var(--primary-border); }
.user-active .speaker-role-tag { color: #065F46; background: var(--emerald-soft); border-color: #A7F3D0; }
.speaker-name { font-family: var(--display); font-size: 1.05rem; font-weight: 800; line-height: 1.4; }
.speaker-status { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--emerald); animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.stage-indicator { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 800; color: var(--amber); background: var(--amber-soft); border: 1px solid #FDE68A; border-radius: 999px; padding: .15rem .7rem; margin-top: .4rem; }
.speaker-panel.stage-4 .stage-indicator { color: #065F46; background: var(--emerald-soft); border-color: #A7F3D0; }

.conviction-box { position: relative; margin-top: 1.1rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .95rem; overflow: visible; }
.conviction-header { display: flex; justify-content: space-between; align-items: center; font-size: .86rem; font-weight: 800; margin-bottom: .55rem; }
.conviction-value { background: var(--ink); color: #fff; border-radius: 8px; padding: .1rem .55rem; font-variant-numeric: tabular-nums; }
.conviction-value.pulse { animation: pulse .5s ease; }
@keyframes pulse { 0% { transform: scale(1.18); } 100% { transform: scale(1); } }
.progress-track { position: relative; height: 12px; background: #E2E8F0; border-radius: 999px; overflow: hidden; }
.progress-ticks { display: none; }
.progress-fill { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 55%, var(--accent) 100%); transition: width .8s cubic-bezier(.16,1,.3,1); }
.gain-float { position: absolute; top: 6px; left: 14px; font-weight: 900; color: var(--primary-dark); animation: floatUp 1.8s ease forwards; }
.gain-float.strong { color: var(--emerald); }
.gain-float.weak { color: var(--muted); }
@keyframes floatUp { to { transform: translateY(-26px); opacity: 0; } }
.conviction-status-text { font-size: .84rem; color: var(--ink-2); margin-top: .6rem; }
.turns-visual { display: flex; align-items: center; gap: .6rem; margin-top: .6rem; }
.turns-label { font-size: .8rem; color: var(--muted); font-weight: 700; }
.turns-dots { display: flex; gap: 6px; }
.turns-dots i { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--primary-border); display: block; }
.turns-dots i.spent { background: var(--primary); border-color: var(--primary); }

.coach-box { margin-top: 1rem; background: #fff; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: .85rem 1rem; }
.coach-box h4 { font-size: .86rem; font-weight: 800; margin-bottom: .4rem; }
.coach-box ul { padding-right: 1.1rem; font-size: .83rem; color: var(--ink-2); }
.coach-box li { margin-bottom: .2rem; }

.terminal-panel { padding: 0; overflow: hidden; display: flex; flex-direction: column; min-height: 640px; }
.terminal-header { display: flex; align-items: center; justify-content: space-between; gap: .7rem; flex-wrap: wrap; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); background: #fff; }
.terminal-title { font-family: var(--display); font-weight: 800; font-size: 1rem; }
.terminal-header-side { display: flex; align-items: center; gap: .6rem; }
.terminal-stage-chip { font-size: .78rem; font-weight: 800; background: var(--primary-soft); color: var(--primary-dark); border: 1px solid var(--primary-border); border-radius: 999px; padding: .25rem .8rem; }
.skip-btn { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: .3rem .7rem; font-family: var(--font); font-size: .78rem; font-weight: 700; cursor: pointer; color: var(--muted); }
.skip-btn:hover { color: var(--primary-dark); border-color: var(--primary); }

.messages-container { flex: 1; padding: 1.25rem; display: flex; flex-direction: column; gap: .9rem; max-height: 560px; overflow-y: auto; background: linear-gradient(#FDFCF9, #FCFBF7); }
.message-bubble { display: flex; gap: .7rem; align-items: flex-start; }
.msg-mini-avatar { width: 38px; height: 38px; border-radius: 12px; object-fit: cover; flex: none; border: 2px solid var(--border); background: #fff; }
.boss .msg-mini-avatar { border-color: var(--primary-border); }
.user .msg-mini-avatar { border-color: #A7F3D0; }
.msg-content-wrapper { flex: 1; min-width: 0; }
.msg-author { font-size: .76rem; font-weight: 800; color: var(--muted); margin-bottom: .3rem; }
.boss .msg-author { color: var(--primary-dark); }
.user .msg-author { color: #065F46; }
.msg-bubble-box { background: #fff; border: 1px solid var(--border); border-radius: 4px 16px 16px 16px; padding: .9rem 1.05rem; font-size: .94rem; color: var(--ink-2); white-space: pre-wrap; box-shadow: var(--shadow-sm); }
.user .msg-bubble-box { background: var(--primary); border-color: var(--primary); color: #fff; border-radius: 16px 4px 16px 16px; }
.boss .msg-bubble-box { border-right: 3px solid var(--primary); }

.typing-dots { display: inline-flex; gap: 4px; margin-left: .5rem; }
.typing-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); animation: tb 1s infinite; display: block; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes tb { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
.thinking-label { font-size: .84rem; color: var(--muted); }
.typing-indicator { display: inline-block; width: 2px; height: 1.1em; background: var(--primary); vertical-align: middle; animation: blink 1s infinite; margin-right: 2px; }

.stage-banner { text-align: center; font-size: .82rem; font-weight: 800; background: var(--amber-soft); border: 1px solid #FDE68A; color: var(--amber); border-radius: 999px; padding: .4rem 1rem; align-self: center; }
.stage-banner.stage-4 { background: var(--emerald-soft); border-color: #A7F3D0; color: #065F46; }

/* Feedback card */
.feedback-entry { display: block; }
.fb-card { background: #fff; border: 1px solid var(--border); border-right: 4px solid var(--emerald); border-radius: var(--radius-sm); padding: .95rem 1.05rem; box-shadow: var(--shadow-sm); }
.fb-card::before { display: none; }
.fb-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.fb-title { font-weight: 800; font-size: .88rem; }
.fb-stars { color: #F59E0B; letter-spacing: 1px; font-size: .95rem; }
.fb-dims { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .9rem; margin-bottom: .6rem; }
.fb-dim { display: flex; align-items: center; justify-content: space-between; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: .3rem .6rem; font-size: .78rem; }
.fb-dim-label { font-weight: 700; color: var(--ink-2); }
.fb-dim-dots { color: var(--primary); letter-spacing: 1px; font-size: .72rem; }
.fb-gain { display: inline-block; font-weight: 900; background: var(--primary-soft); color: var(--primary-dark); border-radius: 8px; padding: .2rem .7rem; font-size: .86rem; margin-bottom: .5rem; }
.fb-gain.strong { background: var(--emerald-soft); color: #065F46; }
.fb-gain.weak { background: var(--surface-2); color: var(--muted); }
.fb-tip { font-size: .84rem; background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; border-radius: 8px; padding: .55rem .75rem; }

/* Input dock */
.input-dock { border-top: 1px solid var(--border); background: #fff; padding: 1rem 1.25rem 1.1rem; }
.input-dock.locked .argument-textarea, .input-dock.locked .btn-send { opacity: .55; }
.input-lock-badge { display: none; font-size: .82rem; font-weight: 700; color: var(--amber); background: var(--amber-soft); border: 1px solid #FDE68A; border-radius: 10px; padding: .5rem .8rem; margin-bottom: .8rem; }
.input-dock.locked .input-lock-badge { display: block; }

.input-row { display: flex; gap: .7rem; align-items: flex-end; }
.textarea-wrap { flex: 1; }
.argument-textarea {
  width: 100%; resize: none; font-family: var(--font); font-size: .94rem; line-height: 1.7;
  border: 1.5px solid var(--border-strong); border-radius: 12px; padding: .75rem .9rem;
  min-height: 56px; max-height: 160px; background: #fff; color: var(--ink);
}
.argument-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.argument-textarea:disabled { background: var(--surface-2); }
.input-footer { display: flex; justify-content: space-between; font-size: .74rem; color: var(--muted); margin-top: .3rem; }
.btn-send {
  background: var(--ink); color: #fff; border: none; border-radius: 12px;
  padding: .8rem 1.3rem; font-family: var(--font); font-weight: 800; font-size: .9rem;
  cursor: pointer; display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap;
}
.btn-send:hover:not(:disabled) { background: var(--primary-dark); }
.btn-send:disabled { cursor: not-allowed; }

/* Modals */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: 1rem; z-index: 100; }
.modal-backdrop.active { display: flex; animation: fadeUp .25s ease both; }
.modal-card { background: #fff; border-radius: 20px; max-width: 620px; width: 100%; padding: 1.8rem; box-shadow: 0 24px 60px rgba(15,23,42,.25); max-height: 90vh; overflow-y: auto; text-align: center; }
.modal-card.victory { border-top: 6px solid var(--emerald); }
.modal-card.defeat { border-top: 6px solid var(--amber); }
.victory-badge, .defeat-badge { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; font-size: 1.8rem; margin: 0 auto 1rem; }
.victory-badge { background: var(--emerald-soft); }
.defeat-badge { background: var(--amber-soft); }
.modal-title { font-family: var(--display); font-size: 1.35rem; font-weight: 900; margin-bottom: .5rem; }
.victory .modal-title { color: #065F46; }
.defeat .modal-title { color: #92400E; }
.modal-desc { color: var(--ink-2); font-size: .94rem; margin-bottom: 1.1rem; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.stat-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: .7rem .5rem; display: flex; flex-direction: column; gap: .15rem; }
.stat-value { font-weight: 900; font-size: 1rem; }
.victory .stat-value { color: #065F46; }
.defeat .stat-value { color: #92400E; }
.stat-label { font-size: .76rem; color: var(--muted); }
.rank-row { display: flex; align-items: center; justify-content: center; gap: .8rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: .8rem; margin-bottom: 1.1rem; text-align: right; }
.rank-badge { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; font-size: 1.3rem; color: #fff; flex: none; }
.rank-badge.rank-s { background: linear-gradient(135deg, var(--primary), var(--secondary)); }
.rank-badge.rank-a { background: var(--emerald); }
.rank-badge.rank-b { background: var(--primary); }
.rank-badge.rank-c { background: var(--amber); }
.rank-info { display: flex; flex-direction: column; }
.rank-info b { font-size: 1rem; }
.rank-info span { font-size: .82rem; color: var(--muted); }
.themes-missed { margin-bottom: 1.1rem; }
.themes-missed-title { font-size: .88rem; font-weight: 800; color: var(--amber); margin-bottom: .6rem; }
.themes-missed-list { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: center; }
.missed-pill { background: var(--amber-soft); border: 1px dashed #F59E0B; color: #92400E; font-size: .8rem; font-weight: 700; padding: .3rem .8rem; border-radius: 999px; }
.decree-box { background: var(--emerald-soft); border: 1px dashed #6EE7B7; border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: 1.2rem; text-align: right; font-size: .92rem; color: #065F46; }
.decree-title { font-weight: 800; margin-bottom: .4rem; }
.modal-actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.modal-actions .btn-primary-glow { width: auto; padding: .8rem 1.6rem; font-size: .94rem; }
.btn-secondary { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: .7rem 1.3rem; font-family: var(--font); font-weight: 700; cursor: pointer; color: var(--ink-2); }
.btn-secondary:hover { border-color: var(--border-strong); }
.btn-danger-confirm { background: var(--danger); color: #fff; border: none; padding: .7rem 1.4rem; border-radius: 10px; cursor: pointer; font-family: var(--font); font-weight: 800; }
.btn-danger-confirm:hover { background: #B91C1C; }
.btn-modal-primary { background: var(--primary); color: #fff; border: none; padding: .7rem 1.4rem; border-radius: 10px; cursor: pointer; font-family: var(--font); font-weight: 800; }
.btn-modal-primary:hover { background: var(--primary-dark); }
.settings-form { text-align: right; margin: 1rem 0; }
.input-group { display: flex; flex-direction: column; gap: .45rem; }
.input-group label { font-size: .86rem; font-weight: 700; color: var(--ink-2); }
.input-group input { border: 1.5px solid var(--border-strong); border-radius: 10px; padding: .7rem .9rem; font-family: var(--font); font-size: .9rem; direction: ltr; text-align: left; }
.input-group input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }

/* Toast */
.toast-area { position: fixed; bottom: 1.2rem; right: 50%; transform: translateX(50%); z-index: 200; display: flex; flex-direction: column; gap: .5rem; align-items: center; }
.toast { background: var(--ink); color: #fff; border-radius: 12px; padding: .65rem 1.1rem; font-size: .85rem; font-weight: 700; opacity: 0; transform: translateY(8px); transition: all .3s ease; box-shadow: var(--shadow); max-width: 90vw; }
.toast.show { opacity: 1; transform: none; }

.app-footer { text-align: center; font-size: .78rem; color: var(--muted); padding: 0 1rem 2rem; }

/* Responsive */
@media (max-width: 980px) {
  #phase-intro { padding-top: .8rem; }
  .mission-layout { grid-template-columns: 1fr; min-height: 0; }
  .video-command { order: -1; min-height: 0; }
  .video-command .video-wrapper { flex: none; aspect-ratio: 16 / 9; }
  .debate-arena { grid-template-columns: 1fr; }
  .speaker-panel { position: static; }
  .speaker-top { flex-direction: row; }
  .steps { display: none; }
  .messages-container { max-height: 480px; }
  .fb-dims { grid-template-columns: 1fr; }
  .input-row { flex-direction: column; align-items: stretch; }
  .btn-send { justify-content: center; }
}
@media (max-width: 640px) {
  #phase-intro { padding-inline: .8rem; }
  .mission-header { grid-template-columns: 1fr; align-items: start; margin-bottom: .7rem; }
  .mission-summary { display: none; }
  .mission-title { font-size: 1.25rem; }
  .mission-brief { border-radius: 16px; padding: 1.1rem; }
  .video-command { border-radius: 16px; }
  .feed-topline, .feed-caption { padding-inline: .8rem; }
  .feed-topline p { font-size: .64rem; }
  .btn-primary-glow { width: 100%; justify-content: center; padding-inline: 1rem; }
  .resume-actions { width: 100%; }
  .resume-actions button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
