:root {
  --ink: #202235;
  --muted: #6d7188;
  --line: #e4e6ef;
  --surface: #ffffff;
  --surface-soft: #f7f8fc;
  --primary: #6557e8;
  --primary-dark: #5143d1;
  --primary-soft: #eeecff;
  --teal: #1597a8;
  --teal-soft: #e4f7f8;
  --orange: #f07846;
  --danger: #d54656;
  --danger-soft: #fff0f2;
  --success: #19865d;
  --shadow: 0 24px 70px rgba(48, 45, 89, 0.12);
  --shadow-soft: 0 10px 35px rgba(48, 45, 89, 0.08);
  --radius: 24px;
  --radius-small: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--surface-soft);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--surface-soft); }
body { min-height: 100vh; margin: 0; background: var(--surface-soft); color: var(--ink); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.shell { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.shell-narrow { width: min(680px, calc(100% - 32px)); margin-inline: auto; }
.site-header, .student-header { height: 82px; display: flex; align-items: center; justify-content: space-between; }
.compact-header { position: absolute; inset: 0 0 auto; z-index: 2; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; letter-spacing: -0.025em; font-size: 20px; }
.brand-mark { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; color: white; background: linear-gradient(135deg, var(--primary), #2bb5c5); box-shadow: 0 8px 20px rgba(101,87,232,.22); font-size: 21px; line-height: 1; }
.quiet-link { color: var(--muted); text-decoration: none; font-weight: 700; }
.quiet-link:hover { color: var(--primary); }

.landing-page { overflow-x: hidden; background:
  radial-gradient(circle at 82% 4%, rgba(101,87,232,.14), transparent 31rem),
  radial-gradient(circle at 5% 92%, rgba(34,184,207,.12), transparent 28rem),
  var(--surface-soft);
}
.landing-main { padding: 70px 0 90px; display: grid; grid-template-columns: minmax(0, .9fr) minmax(560px, 1.15fr); align-items: center; gap: 70px; }
.eyebrow, .card-kicker { display: inline-flex; align-items: center; min-height: 30px; padding: 6px 11px; border-radius: 999px; color: var(--primary-dark); background: var(--primary-soft); font-size: 12px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.hero-copy h1 { margin: 20px 0 18px; font-size: clamp(48px, 5.5vw, 76px); line-height: .98; letter-spacing: -.065em; max-width: 680px; }
.hero-lead { margin: 0; max-width: 610px; color: var(--muted); font-size: 20px; line-height: 1.55; }
.feature-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.feature-row span { padding: 9px 13px; background: rgba(255,255,255,.7); border: 1px solid rgba(228,230,239,.9); border-radius: 999px; color: #53566d; font-weight: 700; font-size: 13px; box-shadow: 0 5px 18px rgba(48,45,89,.04); }
.action-grid { display: grid; grid-template-columns: 1.16fr .84fr; gap: 18px; align-items: stretch; }
.card { background: rgba(255,255,255,.94); border: 1px solid rgba(228,230,239,.92); border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.create-card, .join-card { padding: 30px; }
.create-card { box-shadow: var(--shadow); }
.card h2 { margin: 15px 0 24px; font-size: 28px; letter-spacing: -.035em; }
label { display: block; color: #4c5068; font-weight: 750; font-size: 14px; }
textarea, input { width: 100%; border: 1px solid #dcdfea; background: #fff; color: var(--ink); border-radius: var(--radius-small); outline: none; transition: border-color .18s, box-shadow .18s, transform .18s; }
textarea { min-height: 128px; padding: 16px; margin-top: 9px; resize: vertical; line-height: 1.45; }
input { height: 54px; padding: 0 15px; }
textarea:focus, input:focus { border-color: rgba(101,87,232,.75); box-shadow: 0 0 0 4px rgba(101,87,232,.11); }
textarea::placeholder, input::placeholder { color: #afb2c1; }
.field-meta { display: flex; justify-content: space-between; gap: 15px; margin: 8px 2px 20px; color: #8a8da0; font-size: 12px; }
.button { border: 0; border-radius: 13px; min-height: 46px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; font-weight: 820; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s, opacity .15s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button-large { width: 100%; min-height: 54px; }
.button-primary { color: white; background: linear-gradient(135deg, var(--primary), #7569ef); box-shadow: 0 12px 25px rgba(101,87,232,.22); }
.button-primary:hover:not(:disabled) { box-shadow: 0 15px 31px rgba(101,87,232,.3); }
.button-secondary { color: var(--primary-dark); background: var(--primary-soft); }
.button-ghost { color: var(--muted); background: #f2f3f7; }
.button-danger { color: white; background: var(--danger); }
.code-input { margin: 9px 0 16px; text-align: center; letter-spacing: .2em; font-weight: 900; font-variant-numeric: tabular-nums; font-size: 24px; }
.privacy-note { margin: 20px 2px 0; color: #8a8da0; font-size: 12px; line-height: 1.5; }

.center-page { background:
  radial-gradient(circle at 50% 0%, rgba(101,87,232,.16), transparent 34rem),
  var(--surface-soft); }
.center-wrap { min-height: 100vh; display: grid; place-items: center; padding: 110px 20px 40px; }
.join-focus-card { width: min(510px, 100%); padding: 40px; text-align: center; box-shadow: var(--shadow); }
.join-focus-card h1 { margin: 17px 0 8px; font-size: 40px; letter-spacing: -.05em; }
.join-focus-card > p { color: var(--muted); margin: 0 0 28px; }
.code-input-large { height: 74px; font-size: 34px; border-radius: 18px; }
.back-link { display: inline-block; margin-top: 25px; font-size: 14px; }

.student-page { background:
  radial-gradient(circle at 12% 0%, rgba(34,184,207,.12), transparent 30rem),
  radial-gradient(circle at 100% 70%, rgba(101,87,232,.11), transparent 30rem),
  var(--surface-soft); }
.student-header { height: 74px; }
.room-code-chip { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.8); color: var(--muted); font-size: 13px; }
.room-code-chip strong { color: var(--ink); margin-left: 4px; letter-spacing: .08em; }
.student-main { padding: 40px 0 80px; }
.loading-card { min-height: 270px; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #e1e3ec; border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.response-card { padding: clamp(24px, 5vw, 42px); box-shadow: var(--shadow); }
.status-line { display: flex; align-items: center; justify-content: space-between; gap: 15px; color: var(--muted); font-size: 13px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; font-weight: 800; }
.status-open { color: #147450; background: #e9f7f1; }
.status-freezing { color: #986018; background: #fff4df; }
.status-frozen { color: #315a9a; background: #edf4ff; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.response-card h1 { margin: 26px 0 8px; font-size: clamp(29px, 5.2vw, 43px); line-height: 1.12; letter-spacing: -.045em; }
.response-instruction { margin: 0 0 26px; color: var(--muted); }
.response-fields { display: grid; gap: 14px; margin-bottom: 20px; }
.response-fields label span { display: block; margin: 0 0 7px 2px; font-size: 12px; color: #777b8f; }
.response-fields input { height: 58px; font-size: 16px; }
.sent-panel { margin-top: 22px; padding: 15px; display: flex; align-items: center; gap: 13px; border-radius: 15px; background: #edf9f4; color: #146a4b; }
.success-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: white; background: var(--success); font-weight: 900; flex: none; }
.sent-panel p { margin: 3px 0 0; color: #40816a; font-size: 13px; }
.error-card { max-width: 560px; padding: 42px; margin-inline: auto; text-align: center; }
.error-icon { width: 48px; height: 48px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 50%; color: var(--danger); background: var(--danger-soft); font-size: 25px; font-weight: 900; }
.error-card h1 { margin: 0 0 10px; letter-spacing: -.035em; }
.error-card p { color: var(--muted); margin: 0 0 24px; line-height: 1.55; }
.freeze-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(27,30,54,.56); backdrop-filter: blur(12px); }
.freeze-card { width: min(330px, 90vw); padding: 34px; border-radius: 28px; text-align: center; color: white; background: linear-gradient(155deg, #394a8f, #6557e8); box-shadow: 0 30px 80px rgba(20,22,48,.4); }
.snowflake { font-size: 36px; }
.freeze-count { margin: 5px 0 -2px; font-size: 92px; line-height: 1; font-weight: 900; font-variant-numeric: tabular-nums; }
.freeze-card p { margin: 8px 0 0; font-weight: 750; }

.host-page { overflow: hidden; background: #f3f4f9; }
.host-app { height: 100vh; min-height: 620px; display: grid; grid-template-rows: 66px minmax(0, 1fr); }
.host-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); z-index: 5; }
.host-toolbar .brand { font-size: 18px; }
.host-toolbar .brand-mark { width: 32px; height: 32px; border-radius: 10px; font-size: 18px; }
.host-toolbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-button { min-height: 39px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; display: inline-flex; align-items: center; gap: 7px; color: #555970; background: white; font-weight: 760; cursor: pointer; }
.icon-button:hover { color: var(--primary); border-color: #cbc7f7; background: #faf9ff; }
.host-main { min-height: 0; }
.host-loading { height: 100%; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.host-content { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 14px; padding: 18px 24px 20px; }
.presentation-heading { text-align: center; }
.join-instruction { color: var(--muted); font-size: 14px; font-weight: 650; }
.join-instruction strong { margin-left: 4px; padding: 5px 9px; border-radius: 8px; color: var(--primary-dark); background: var(--primary-soft); letter-spacing: .09em; font-size: 16px; }
.presentation-heading h1 { margin: 11px auto 0; max-width: 1000px; font-size: clamp(27px, 3vw, 44px); line-height: 1.12; letter-spacing: -.045em; }
.cloud-frame { position: relative; min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: var(--shadow-soft); }
#word-cloud { width: 100%; height: 100%; display: block; }
.cloud-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; pointer-events: none; color: var(--muted); }
.empty-cloud-icon { font-size: 60px; color: #d9d6f7; line-height: 1; }
.cloud-empty strong { margin-top: 12px; color: #4d5066; font-size: 18px; }
.cloud-empty p { margin: 6px 0 0; font-size: 14px; }
.host-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; }
.live-stats { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.live-stats strong { color: var(--ink); font-size: 18px; }
.stat-divider { width: 1px; height: 24px; background: var(--line); }
.moderation-hint { margin: 0; color: #8a8da0; font-size: 13px; text-align: center; }
.button-freeze { justify-self: end; min-width: 205px; color: white; background: linear-gradient(135deg, #3e64bb, #6557e8); box-shadow: 0 10px 24px rgba(76,85,184,.22); }
.button-freeze.is-frozen { color: #315a9a; background: #e9f2ff; box-shadow: none; }
.host-freeze-overlay { position: absolute; inset: 0; z-index: 3; display: grid; place-content: center; justify-items: center; color: white; background: rgba(39,50,96,.68); backdrop-filter: blur(8px); font-size: 22px; font-weight: 820; }
.host-countdown-number { font-size: clamp(90px, 15vw, 170px); line-height: .9; font-weight: 950; font-variant-numeric: tabular-nums; }
.frozen-stamp { position: absolute; top: 16px; right: 16px; z-index: 2; padding: 9px 12px; border: 1px solid #c9dcff; border-radius: 999px; color: #315a9a; background: rgba(237,244,255,.94); font-size: 13px; font-weight: 820; }
.hover-tip { position: absolute; z-index: 4; transform: translate(-50%, -125%); padding: 7px 10px; border-radius: 9px; color: white; background: rgba(32,34,53,.9); font-size: 12px; pointer-events: none; white-space: nowrap; }
.host-error { height: 100%; display: grid; place-items: center; padding: 30px; }

.moderation-dialog { width: min(460px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 22px; color: var(--ink); box-shadow: 0 30px 90px rgba(24,25,49,.32); }
.moderation-dialog::backdrop { background: rgba(28,30,52,.5); backdrop-filter: blur(6px); }
.moderation-dialog form { padding: 30px; text-align: center; }
.dialog-icon { width: 44px; height: 44px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; color: var(--danger); background: var(--danger-soft); font-size: 27px; }
.moderation-dialog h2 { margin: 0 0 10px; letter-spacing: -.035em; }
.moderation-dialog p { color: var(--muted); line-height: 1.55; }
.moderation-dialog p strong { color: var(--ink); }
.dialog-actions { display: grid; grid-template-columns: 1fr 1.25fr; gap: 10px; margin-top: 24px; }

.toast-region { position: fixed; z-index: 100; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100% - 30px)); pointer-events: none; }
.toast { padding: 13px 15px; border: 1px solid rgba(228,230,239,.95); border-radius: 13px; color: var(--ink); background: rgba(255,255,255,.97); box-shadow: 0 14px 36px rgba(33,34,60,.18); font-weight: 700; font-size: 14px; text-align: center; animation: toast-in .2s ease-out; }
.toast.toast-error { color: #a52e3b; background: #fff5f6; border-color: #ffd7dc; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

:fullscreen .host-toolbar { display: none; }
:fullscreen .host-app { grid-template-rows: minmax(0, 1fr); }
:fullscreen .host-content { padding: 18px 24px 22px; }
:fullscreen .cloud-frame { border-radius: 18px; }

@media (max-width: 1040px) {
  .landing-main { grid-template-columns: 1fr; padding-top: 35px; gap: 45px; }
  .hero-copy { text-align: center; }
  .hero-copy h1, .hero-lead { margin-inline: auto; }
  .feature-row { justify-content: center; }
}
@media (max-width: 720px) {
  .shell { width: min(100% - 28px, 1180px); }
  .landing-main { padding-bottom: 45px; }
  .hero-copy h1 { font-size: clamp(43px, 13vw, 62px); }
  .hero-lead { font-size: 17px; }
  .action-grid { grid-template-columns: 1fr; }
  .join-card { order: -1; }
  .create-card, .join-card { padding: 24px; }
  .join-focus-card { padding: 30px 22px; }
  .student-main { padding-top: 22px; }
  .response-card { border-radius: 20px; }
  .host-toolbar { padding: 0 12px; }
  .button-label { display: none; }
  .icon-button { width: 40px; justify-content: center; padding: 0; }
  .host-content { padding: 12px; gap: 10px; }
  .host-controls { grid-template-columns: 1fr auto; }
  .moderation-hint { display: none; }
  .button-freeze { min-width: 170px; }
  .presentation-heading h1 { font-size: 25px; }
}
@media (max-width: 500px) {
  .site-header { height: 70px; }
  .quiet-link { font-size: 13px; }
  .feature-row { display: none; }
  .status-line { align-items: flex-start; }
  .student-header .brand span:last-child { display: none; }
  .host-controls { grid-template-columns: 1fr; }
  .button-freeze { justify-self: stretch; width: 100%; }
  .live-stats { justify-content: center; }
  .dialog-actions { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
