* { box-sizing: border-box; }

:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --navy: #10243e;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --muted: #64748b;
  --border: #d8e0ea;
  --soft: #f7f9fc;
  --danger: #b91c1c;
  --success: #15803d;
  --shadow: 0 14px 40px rgba(15, 35, 60, .10);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--navy);
  background: linear-gradient(135deg, #f6f9fc, var(--bg));
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { width: min(1440px, calc(100% - 32px)); margin: 16px auto; }
.topbar {
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px 18px 0 0;
  padding: 22px 26px; display: flex; justify-content: space-between; align-items: center; gap: 20px; box-shadow: var(--shadow);
}
.eyebrow { font-size: 11px; letter-spacing: .14em; font-weight: 800; color: var(--blue); margin-bottom: 6px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(24px, 3vw, 36px); }
h2 { font-size: 25px; margin-bottom: 8px; }
h3 { font-size: 17px; }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.primary, .secondary, .icon-btn { border: 0; border-radius: 10px; padding: 11px 15px; font-weight: 700; }
.primary { background: var(--blue); color: white; }
.primary:hover { background: var(--blue-dark); }
.secondary { background: #e9eff8; color: var(--navy); }
.icon-btn { background: transparent; font-size: 25px; padding: 2px 8px; }
.full { width: 100%; }

.tabs { display: flex; gap: 7px; overflow-x: auto; padding: 9px; background: #dfe8f3; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.tab { flex: 0 0 auto; border: 1px solid transparent; background: transparent; color: #53657a; border-radius: 9px; padding: 10px 15px; font-weight: 700; }
.tab.active { background: white; color: var(--blue); border-color: var(--border); }

.workspace { background: var(--panel); min-height: 670px; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 18px 18px; box-shadow: var(--shadow); padding: 28px; }
.hero { background: linear-gradient(135deg, #f5f8fd, #eaf2ff); border: 1px solid #d8e6fb; border-radius: 16px; padding: 25px; margin-bottom: 22px; }
.problem-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 20px; }
.card { background: white; border: 1px solid var(--border); border-radius: 14px; padding: 21px; box-shadow: 0 5px 18px rgba(15,35,60,.04); }
.problem-text { line-height: 1.7; white-space: pre-line; }
.key-box { text-align: center; background: #0f2744; color: white; border-radius: 14px; padding: 23px; }
.key-box input { width: 100%; border: 0; border-radius: 9px; padding: 13px; margin: 12px 0 9px; text-align: center; letter-spacing: .12em; text-transform: uppercase; }
.lock { font-size: 38px; margin-bottom: 7px; }
.hidden { display: none !important; }

.participant-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, .85fr); gap: 20px; margin-top: 22px; align-items: start; }
.position-card { border: 1px solid #cfe0ff; background: #f8fbff; }
.position-card .role-title { font-size: 27px; margin-bottom: 12px; }
.position-card ul { line-height: 1.65; }
.participant-tools { display: grid; gap: 20px; position: sticky; top: 14px; }
.workspace-tool { background: #fff; }
.workspace-tool h3 { margin-bottom: 7px; }
.notes-area { min-height: 260px; line-height: 1.55; }
.save-hint { color: var(--muted); font-size: 12px; margin-top: 7px; min-height: 18px; }

.vocab { margin-top: 22px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading h3 { margin-bottom: 0; }
.badge { background: #e5efff; color: #2456a6; border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.badge-business { background: #edf7ef; color: #24733a; }
.small-note { margin: 7px 0 10px; font-size: 13px; }
.vocab-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.vocab-item:last-child { border-bottom: 0; }
.term { font-weight: 800; font-size: 15px; }
.definition { color: #526277; font-size: 13px; margin-top: 3px; }
.example { color: #334155; margin-top: 5px; line-height: 1.5; }
.business-upgrade { border-top: 1px solid var(--border); padding-top: 22px; }
.upgrade-list { display: grid; gap: 10px; }
.upgrade-item { display: grid; grid-template-columns: 1fr 30px 1.2fr; grid-template-rows: auto auto; column-gap: 10px; padding: 12px; background: #fbfcfe; border: 1px solid var(--border); border-radius: 10px; align-items: center; }
.regular-label, .business-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--muted); }
.regular { grid-column: 1; color: #475569; }
.business { grid-column: 3; font-weight: 750; color: #153e2b; }
.arrow { grid-column: 2; grid-row: 1 / span 2; text-align: center; color: var(--blue); font-size: 20px; font-weight: 800; }

.summary-fields { display: grid; gap: 10px; }
.summary-field { margin: 0; font-size: 13px; }
.summary-field textarea { min-height: 70px; }

.status { font-size: 13px; margin-top: 6px; min-height: 18px; }
.status.error { color: var(--danger); }
.status.success { color: var(--success); }
.event-bar { margin-top: 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 17px; border-radius: 12px; background: #fff8e8; border: 1px solid #f1dfaa; }
.empty { text-align: center; padding: 90px 20px; color: var(--muted); }

dialog { width: min(1050px, calc(100% - 28px)); border: 0; border-radius: 18px; padding: 0; box-shadow: 0 30px 100px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(7, 20, 36, .55); }
.teacher-panel { padding: 25px; max-height: 90vh; overflow: auto; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; }
.teacher-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.control-card { border: 1px solid var(--border); border-radius: 14px; padding: 18px; margin-top: 16px; }
label { display: block; font-weight: 700; margin-bottom: 13px; }
input, textarea { display: block; width: 100%; margin-top: 7px; border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; background: white; color: var(--navy); }
textarea { resize: vertical; }
.key-row, .event-row { display: grid; grid-template-columns: 150px 1fr 1fr auto; gap: 8px; align-items: start; margin-bottom: 9px; }
.event-row { grid-template-columns: 180px 1fr auto; }
.mini-btn { border: 1px solid var(--border); background: #f4f7fb; border-radius: 8px; padding: 9px 10px; }
.delete-btn { color: var(--danger); }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--danger); min-height: 20px; }
.event-modal { padding: 30px; }
.event-modal p { line-height: 1.7; font-size: 17px; }

@media (max-width: 1050px) {
  .participant-layout { grid-template-columns: 1fr; }
  .participant-tools { position: static; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .problem-grid, .teacher-grid, .participant-tools { grid-template-columns: 1fr; }
  .key-row, .event-row { grid-template-columns: 1fr; }
  .workspace { padding: 18px; }
  .upgrade-item { grid-template-columns: 1fr; }
  .regular, .business, .arrow { grid-column: 1; }
  .arrow { grid-row: auto; transform: rotate(90deg); text-align: left; }
}

.auth-wrap{min-height:720px;display:grid;place-items:center;background:var(--panel);border:1px solid var(--border);border-top:0;border-radius:0 0 18px 18px;box-shadow:var(--shadow);padding:30px}.auth-card{width:min(560px,100%);background:#fff;border:1px solid var(--border);border-radius:18px;padding:30px;box-shadow:var(--shadow)}.auth-tabs{display:flex;gap:6px;margin:22px 0 18px;background:#eef3f8;padding:5px;border-radius:10px}.auth-tab{flex:1;border:0;background:transparent;padding:10px;border-radius:8px;font-weight:800;color:var(--muted)}.auth-tab.active{background:#fff;color:var(--blue);box-shadow:0 2px 8px rgba(15,35,60,.08)}.hint{font-size:11px;color:var(--muted);font-weight:500}.account-pill{background:#eef3f8;border:1px solid var(--border);border-radius:999px;padding:9px 13px;font-size:12px;font-weight:800}.join-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px}.history{margin-top:20px}.history-row,.member-row{display:flex;justify-content:space-between;gap:12px;padding:11px 0;border-bottom:1px solid var(--border)}.history-row:last-child,.member-row:last-child{border-bottom:0}.role-identity{background:#f8fbff;border-color:#cfe0ff}.live-grid{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(320px,.8fr);gap:20px;margin-top:20px}.chat-card{min-height:390px}.chat-messages{height:290px;overflow:auto;background:#f7f9fc;border:1px solid var(--border);border-radius:10px;padding:10px}.chat-message{background:#fff;border:1px solid var(--border);border-radius:10px;padding:9px 11px;margin-bottom:8px;line-height:1.45}.chat-code,.chat-time{font-size:11px;color:var(--muted);margin-left:8px}.chat-compose{display:grid;grid-template-columns:1fr auto;gap:8px;margin-top:9px}.badge-live{background:#fff0f0;color:#a33}.revealed-event{background:#fff8e8;border:1px solid #f1dfaa;border-radius:10px;padding:12px;margin-bottom:10px}.revealed-event p{margin:5px 0 0;line-height:1.5}.session-select{width:100%;display:flex;justify-content:space-between;gap:12px;text-align:left;border:1px solid var(--border);background:#fff;border-radius:10px;padding:12px;margin-bottom:8px}.session-select:hover{border-color:#a9c2e8;background:#f8fbff}.session-select span{color:var(--muted);font-size:12px}.danger{border:0;border-radius:10px;padding:11px 15px;font-weight:700;background:#fee2e2;color:#991b1b}.danger:hover{background:#fecaca}.control-card h4{margin-bottom:8px}
@media(max-width:1050px){.join-grid,.live-grid{grid-template-columns:1fr}.chat-card{min-height:0}}
/* Observer console */
.observer-console{display:grid;gap:16px}.observer-header{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;padding:4px 0 8px}.observer-stats{display:flex;gap:8px;flex-wrap:wrap}.observer-stats span{background:#eef3f8;border:1px solid var(--border);border-radius:10px;padding:9px 11px;font-size:12px}.observer-grid{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(320px,.8fr);gap:16px}.observer-member{align-items:center}.small-btn{padding:8px 12px;font-size:12px}.occupied{color:#9a3412}.available{color:#15803d}.removed-list{margin-top:12px}.removed-list summary{cursor:pointer;color:var(--muted);font-size:13px}.observer-vocab{border-top:1px solid var(--border);padding-top:22px}.observer-added{background:#f5fbff;border:1px solid #d6e7f7;border-radius:10px;padding:12px;margin-bottom:8px}.observer-tag{display:inline-block;margin-left:7px;padding:2px 6px;border-radius:999px;background:#e8eef8;color:#31557e;font-size:9px;font-weight:900;letter-spacing:.08em}.observer-chat{height:270px}.waiting-wrap{min-height:620px;display:grid;place-items:center}.waiting-card{max-width:650px;width:100%;text-align:center;padding:42px}.waiting-status{display:inline-flex;align-items:center;gap:9px;margin:22px 0;padding:12px 17px;border-radius:999px;background:#f4f7fb;border:1px solid var(--border)}.pulse-dot{width:10px;height:10px;border-radius:50%;background:#d97706;box-shadow:0 0 0 5px rgba(217,119,6,.12)}.role-pill{background:#eaf2ff;color:#2456a6}.observer-intro{padding:4px 0 8px}.observer-intro h2{margin-bottom:5px}
@media(max-width:900px){.observer-grid{grid-template-columns:1fr}.observer-header{flex-direction:column}}
.success-note{padding:10px 12px;border-radius:9px;background:#eef8f1;border:1px solid #cce8d4;color:#24613a;font-size:13px}
