/* ==========================================================================
   Class Connect — space theme
   ========================================================================== */
:root {
  --bg: #03020a;
  --panel: rgba(18, 13, 48, 0.62);
  --panel-2: rgba(28, 20, 72, 0.55);
  --border: rgba(150, 130, 255, 0.18);
  --border-strong: rgba(170, 150, 255, 0.38);
  --text: #ecebff;
  --muted: #b3afdc;
  --faint: #8f8ac2;
  --accent: #7c5cff;
  --accent-2: #00d4ff;
  --accent-3: #ff4fd8;
  --gold: #ffcf6b;
  --ok: #3dffa8;
  --ko: #ff5f7a;
  --radius: 20px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --font-display: 'Orbitron', 'Segoe UI', sans-serif;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
body.no-webgl {
  background:
    radial-gradient(1200px 700px at 80% 90%, rgba(124, 92, 255, 0.35), transparent 60%),
    radial-gradient(900px 600px at 10% 10%, rgba(255, 79, 216, 0.18), transparent 60%),
    radial-gradient(700px 500px at 60% 30%, rgba(0, 212, 255, 0.12), transparent 60%), var(--bg);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-2); }
code { font-family: ui-monospace, Consolas, monospace; background: rgba(255,255,255,.08); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
[hidden] { display: none !important; }
::selection { background: rgba(124, 92, 255, 0.5); }
* { scrollbar-width: thin; scrollbar-color: rgba(150, 130, 255, 0.35) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(150, 130, 255, 0.3); border-radius: 8px; }

#space { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; opacity: 0; transition: opacity 1.4s ease; }
body.space-ready #space { opacity: 1; }
body:not(.space-ready) {
  background:
    radial-gradient(1000px 600px at 85% 90%, rgba(124, 92, 255, 0.28), transparent 60%),
    radial-gradient(800px 500px at 10% 10%, rgba(255, 79, 216, 0.14), transparent 60%), var(--bg);
}
.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(3, 2, 10, 0.75) 100%);
}

/* --------------------------------------------------------------- icons */
.ico {
  display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none;
  background: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat;
}
.ico-lock { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='11' width='18' height='11' rx='2'/><path d='M7 11V7a5 5 0 0 1 10 0v4'/></svg>"); }
.ico-image { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='18' height='18' rx='2'/><circle cx='9' cy='9' r='2'/><path d='m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21'/></svg>"); }
.ico-vote { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m9 12 2 2 4-4'/><path d='M5 7c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v12H5V7Z'/><path d='M22 19H2'/></svg>"); }
.ico-star { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/></svg>"); }
.ico-chat { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/></svg>"); }
.ico-calendar { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='18' rx='2'/><path d='M16 2v4M8 2v4M3 10h18'/></svg>"); }
.ico-users { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/><circle cx='9' cy='7' r='4'/><path d='M22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75'/></svg>"); }
.ico-logout { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/><path d='m16 17 5-5-5-5M21 12H9'/></svg>"); }
.ico-smile { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01'/></svg>"); }
.ico-send { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m22 2-7 20-4-9-9-4Z'/><path d='M22 2 11 13'/></svg>"); }
.ico-rocket { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z'/><path d='m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z'/><path d='M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5'/></svg>"); }
.ico-pin { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 17v5'/><path d='M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z'/></svg>"); }
.ico-trash { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'/></svg>"); }
.ico-clock { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M12 6v6l4 2'/></svg>"); }
.ico-plus { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M12 5v14M5 12h14'/></svg>"); }
.ico-edit { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 20h9'/><path d='M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z'/></svg>"); }

/* --------------------------------------------------------------- views (3D transitions) */
.view {
  position: fixed; inset: 0; z-index: 2;
  display: grid; place-items: center;
  padding: 24px 16px;
  overflow-y: auto;
  opacity: 0; pointer-events: none; visibility: hidden;
  transform: perspective(1400px) translateZ(-260px) rotateX(10deg);
  filter: blur(8px);
  transition: opacity .7s var(--ease), transform .9s var(--ease), filter .7s var(--ease), visibility 0s .9s;
}
.view.active {
  opacity: 1; pointer-events: auto; visibility: visible;
  transform: none; filter: none;
  transition: opacity .8s var(--ease) .1s, transform 1s var(--ease) .1s, filter .8s var(--ease) .1s, visibility 0s;
}
#view-app { padding: 0; display: block; place-items: normal; overflow: hidden; }

/* boot loader */
.boot-orbit { position: relative; width: 90px; height: 90px; }
.boot-orbit span {
  position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent;
  border-top-color: var(--accent-2); animation: spin 1.1s linear infinite;
}
.boot-orbit span:nth-child(2) { inset: 12px; border-top-color: var(--accent); animation-duration: 1.6s; animation-direction: reverse; }
.boot-orbit span:nth-child(3) { inset: 26px; border-top-color: var(--accent-3); animation-duration: .8s; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------- cards & tilt */
.card {
  position: relative;
  background: linear-gradient(160deg, rgba(30, 22, 80, 0.72), rgba(10, 8, 32, 0.66));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.card::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(140, 120, 255, 0.16), transparent 45%);
  opacity: 0; transition: opacity .4s;
}
.card:hover::before { opacity: 1; }
.tilt {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform .35s var(--ease), box-shadow .35s, border-color .35s;
  will-change: transform;
}
.tilt:hover { border-color: var(--border-strong); }

/* --------------------------------------------------------------- auth */
.auth-layout {
  width: min(1100px, 100%);
  display: grid; grid-template-columns: 1.1fr 420px; gap: 48px; align-items: center;
}
.hero { padding: 16px; }
.logo-3d {
  position: relative; width: 120px; height: 120px; margin-bottom: 24px;
  transform-style: preserve-3d; perspective: 600px;
  animation: float 6s ease-in-out infinite;
}
.logo-core {
  position: absolute; inset: 34px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, #b9a8ff 18%, #7c5cff 45%, #2a1470 80%);
  box-shadow: 0 0 40px 6px rgba(124, 92, 255, 0.7), 0 0 90px rgba(0, 212, 255, 0.35);
}
.logo-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(0, 212, 255, 0.8);
  box-shadow: 0 0 18px rgba(0, 212, 255, 0.6), inset 0 0 18px rgba(0, 212, 255, 0.3);
  transform-style: preserve-3d;
}
.logo-ring.r1 { animation: ring1 7s linear infinite; }
.logo-ring.r2 { inset: 8px; border-color: rgba(255, 79, 216, 0.8); box-shadow: 0 0 18px rgba(255, 79, 216, .6); animation: ring2 9s linear infinite; }
.logo-ring.r3 { inset: 16px; border-color: rgba(255, 207, 107, 0.7); box-shadow: 0 0 14px rgba(255, 207, 107, .5); animation: ring3 5s linear infinite; }
@keyframes ring1 { from { transform: rotateX(70deg) rotateZ(0); } to { transform: rotateX(70deg) rotateZ(360deg); } }
@keyframes ring2 { from { transform: rotateY(65deg) rotateZ(0); } to { transform: rotateY(65deg) rotateZ(-360deg); } }
@keyframes ring3 { from { transform: rotateX(-50deg) rotateY(30deg) rotateZ(0); } to { transform: rotateX(-50deg) rotateY(30deg) rotateZ(360deg); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.brand {
  margin: 0; font-family: var(--font-display); font-weight: 900; line-height: .95;
  font-size: clamp(44px, 7vw, 84px); letter-spacing: .04em;
  display: flex; flex-direction: column; perspective: 800px;
}
.brand span {
  background: linear-gradient(90deg, #fff 0%, #c9bbff 30%, var(--accent-2) 60%, var(--accent-3) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 22px rgba(124, 92, 255, 0.55));
  animation: brandIn 1.4s var(--ease) both, shimmer 6s linear infinite;
  transform-origin: 50% 100%;
}
.brand span:nth-child(2) { animation-delay: .15s, 0s; }
@keyframes brandIn { from { opacity: 0; transform: rotateX(-90deg) translateZ(40px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { background-position: -200% 0; } }
.tagline { font-size: 20px; color: var(--muted); margin: 14px 0 26px; }
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.features li {
  display: flex; align-items: center; gap: 12px; color: #d6d2ff;
  animation: slideIn .9s var(--ease) both;
}
.features li:nth-child(1) { animation-delay: .35s; } .features li:nth-child(2) { animation-delay: .45s; }
.features li:nth-child(3) { animation-delay: .55s; } .features li:nth-child(4) { animation-delay: .65s; }
.features .ico {
  width: 34px; height: 34px; padding: 8px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-mask: none; mask: none; position: relative;
}
.features .ico::after {
  content: ''; position: absolute; inset: 8px; background: #fff;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(-30px) rotateY(30deg); } to { opacity: 1; transform: none; } }

.auth-card { padding: 0 28px 24px; overflow: hidden; animation: cardIn 1.1s var(--ease) .2s both; }
.auth-card.locked .steps { pointer-events: none; }
.auth-card.launching .steps,
.auth-card.launching > .form-info,
.auth-card.launching > .form-error {
  display: none;
}
@keyframes cardIn { from { opacity: 0; transform: perspective(900px) rotateY(-25deg) translateX(60px); } }
.tabs {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 22px;
  background: rgba(0, 0, 0, 0.3); border-radius: 12px; padding: 4px;
}
.tab {
  position: relative; z-index: 1; background: none; border: 0; padding: 10px; border-radius: 9px;
  color: var(--muted); font-weight: 600; transition: color .3s;
}
.tab.active { color: #fff; }
.tab-glider {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #5a3dff);
  box-shadow: 0 6px 20px -4px rgba(124, 92, 255, .7);
  transition: transform .45s var(--spring);
}
.tabs[data-active="register"] .tab-glider { transform: translateX(100%); }
.auth-form { display: none; flex-direction: column; gap: 14px; }
.auth-form.active { display: flex; animation: fadeUp .5s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } }

/* --------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
input, textarea, select {
  width: 100%;
  background: rgba(5, 3, 20, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  outline: none;
  transition: border-color .25s, box-shadow .25s, background .25s;
}
select option { background: #140e38; }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.25), 0 0 24px rgba(124, 92, 255, 0.25);
  background: rgba(10, 6, 34, 0.75);
}
input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.6); }
textarea { resize: vertical; }
.code-input { font-family: var(--font-display); letter-spacing: .2em; text-transform: uppercase; text-align: center; font-size: 18px; }
.hint { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.45; }
.hint .ico { color: var(--accent-2); }
.form-error { color: var(--ko); min-height: 1.2em; margin: 12px 0 0; font-size: 14px; text-align: center; }
.form-error.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.strength { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: -6px; }
.strength i { display: block; height: 100%; width: calc(var(--s, 0) * 100%); background: var(--ko); transition: width .4s var(--ease), background .4s; }
.strength[data-level="ok"] i { background: var(--gold); }
.strength[data-level="strong"] i { background: var(--ok); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; }

/* --------------------------------------------------------------- buttons */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; white-space: nowrap;
  transition: transform .2s var(--spring), box-shadow .3s, background .3s, border-color .3s, opacity .2s;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, #6647f0 0%, #4c2fe6 50%, #1f6fd6 100%);
  box-shadow: 0 10px 30px -10px rgba(124, 92, 255, .9), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn-primary:hover { box-shadow: 0 14px 40px -8px rgba(124, 92, 255, 1), 0 0 30px rgba(0, 212, 255, .35); }
.btn-secondary {
  background: linear-gradient(135deg, #b0309a, #7a3df0);
  box-shadow: 0 10px 30px -10px rgba(255, 79, 216, .8), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn-primary::after, .btn-secondary::after {
  content: ''; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent);
  transform: skewX(-20deg); transition: left .7s var(--ease);
}
.btn-primary:hover::after, .btn-secondary:hover::after { left: 130%; }
.btn-ghost { background: rgba(255, 255, 255, .04); border-color: var(--border); color: #d8d4ff; }
.btn-ghost:hover { background: rgba(124, 92, 255, .14); border-color: var(--border-strong); }
.btn-danger { background: rgba(255, 95, 122, .12); border-color: rgba(255, 95, 122, .4); color: #ff9aac; }
.btn-danger:hover { background: rgba(255, 95, 122, .25); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading > * { opacity: 0; }
.btn.loading::before {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite;
}
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  transition: background .2s, color .2s, transform .2s var(--spring);
}
.icon-btn:hover { background: rgba(124, 92, 255, .16); color: #fff; transform: translateY(-1px); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* --------------------------------------------------------------- misc views */
.center-card { width: min(440px, 100%); padding: 32px; text-align: center; display: flex; flex-direction: column; gap: 14px; }
.center-card.wide { width: min(620px, 100%); text-align: left; }
.center-card h2, .choice-card h3 { font-family: var(--font-display); margin: 0; letter-spacing: .03em; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 13px; }
.big-icon {
  width: 64px; height: 64px; margin: 0 auto 4px; display: grid; place-items: center; border-radius: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 34px -8px rgba(124, 92, 255, .8);
  animation: float 5s ease-in-out infinite; transform-style: preserve-3d;
}
.big-icon .ico { width: 30px; height: 30px; color: #fff; }
.center-card.wide .big-icon { margin: 0; }
.setup-steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; color: #d6d2ff; }
.section-title { font-family: var(--font-display); text-align: center; font-size: clamp(22px, 3.5vw, 34px); margin: 0 0 28px; }
.class-choice { width: min(860px, 100%); display: flex; flex-direction: column; align-items: center; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; width: 100%; }
.choice-card { padding: 28px; display: flex; flex-direction: column; gap: 14px; text-align: center; animation: cardIn 1s var(--ease) both; }
.choice-card:nth-child(2) { animation-delay: .12s; }
.choice-card .field { text-align: left; }

.orbit-wait { position: relative; width: 140px; height: 140px; margin: 0 auto 8px; transform-style: preserve-3d; transform: rotateX(62deg); }
.planet-mini {
  position: absolute; inset: 44px; border-radius: 50%; transform: rotateX(-62deg);
  background: radial-gradient(circle at 35% 30%, #d9ceff, #7c5cff 45%, #20105a 80%);
  box-shadow: 0 0 40px rgba(124, 92, 255, .8);
}
.orbit-wait::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 1px dashed rgba(0, 212, 255, .5); }
.sat { position: absolute; inset: 0; animation: spin 3s linear infinite; }
.sat::after {
  content: ''; position: absolute; top: -6px; left: 50%; width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent-2); box-shadow: 0 0 16px var(--accent-2);
}

/* --------------------------------------------------------------- app shell */
.app-shell {
  height: 100dvh; display: grid; grid-template-columns: 270px 1fr; gap: 16px; padding: 16px;
  position: relative; z-index: 2;
}
.sidebar {
  display: flex; flex-direction: column; gap: 18px; padding: 18px 14px;
  background: linear-gradient(180deg, rgba(24, 17, 64, .72), rgba(8, 6, 26, .7));
  border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  animation: sideIn 1s var(--ease) .15s both;
}
@keyframes sideIn { from { opacity: 0; transform: perspective(900px) rotateY(30deg) translateX(-40px); } }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px; }
.logo-mini {
  position: relative; width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #9a82ff 25%, #5a3dff 55%, #1b0c50);
  box-shadow: 0 0 22px rgba(124, 92, 255, .8);
}
.logo-mini span {
  position: absolute; inset: -6px -10px; border-radius: 50%; border: 2px solid rgba(0, 212, 255, .8);
  transform: rotateX(72deg) rotateZ(-20deg); animation: ringSpin 6s linear infinite;
}
@keyframes ringSpin { to { transform: rotateX(72deg) rotateZ(340deg); } }
.side-title { font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: .12em; }
.side-class { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.nav-items { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px; border: 0; background: transparent;
  color: var(--muted); font-weight: 600; text-align: left;
  transition: background .25s, color .25s, transform .25s var(--spring);
}
.nav-item:hover { background: rgba(124, 92, 255, .1); color: #fff; transform: translateX(3px); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(124, 92, 255, .42), rgba(0, 212, 255, .08));
  box-shadow: inset 0 0 0 1px rgba(150, 130, 255, .25);
}
.nav-item.active::before {
  content: ''; position: absolute; left: -14px; top: 22%; bottom: 22%; width: 4px; border-radius: 4px;
  background: linear-gradient(var(--accent-2), var(--accent)); box-shadow: 0 0 14px var(--accent-2);
}
.nav-item .ico { width: 20px; height: 20px; }
.badge:empty { display: none; }
.badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent-3), #ff4f7e); box-shadow: 0 0 12px rgba(255, 79, 216, .7);
  animation: pop .4s var(--spring);
}
@keyframes pop { from { transform: scale(0); } }
.delegate-only { display: none; }
body.is-delegate .delegate-only { display: flex; }
.side-footer { display: flex; flex-direction: column; gap: 12px; }
.e2ee-status {
  display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600;
  padding: 8px 12px; border-radius: 10px; color: var(--ok);
  background: rgba(61, 255, 168, .08); border: 1px solid rgba(61, 255, 168, .22);
}
.e2ee-status.waiting { color: var(--gold); background: rgba(255, 207, 107, .08); border-color: rgba(255, 207, 107, .25); }
.e2ee-status.waiting .ico { animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.me-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 14px; background: rgba(0, 0, 0, .25); }
.me-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.me-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-info small { color: var(--muted); font-size: 12px; }

.avatar {
  --c: #7c5cff;
  width: 36px; height: 36px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; color: #fff; letter-spacing: .02em;
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--c) 40%, white), var(--c) 55%, color-mix(in srgb, var(--c) 40%, black));
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .08), 0 4px 14px -4px var(--c);
}

/* --------------------------------------------------------------- panels (3D swap) */
.panels { position: relative; min-width: 0; min-height: 0; perspective: 1600px; }
.panel {
  position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0;
  padding: 22px 24px 18px;
  background: linear-gradient(165deg, rgba(22, 16, 60, .62), rgba(6, 5, 22, .6));
  border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(16px) saturate(130%); -webkit-backdrop-filter: blur(16px) saturate(130%);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: rotateY(-14deg) translateX(60px) translateZ(-120px);
  transform-origin: left center;
  transition: opacity .45s var(--ease), transform .7s var(--ease), visibility 0s .7s;
}
.panel.active {
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  transition: opacity .55s var(--ease) .05s, transform .8s var(--ease) .05s, visibility 0s;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { font-family: var(--font-display); margin: 0; font-size: 22px; letter-spacing: .04em; }
.panel-head p { margin: 4px 0 0; font-size: 13px; }
.panel > :not(.panel-head):not(.chat-scroll):not(.composer):not(.drop-overlay):not(.pinned-bar):not(.typing) { overflow-y: auto; }
.e2ee-line { color: var(--ok); display: flex; align-items: center; gap: 6px; }
.online-stack { display: flex; }
.online-stack .avatar { margin-left: -8px; box-shadow: 0 0 0 2px #0d0a26, 0 0 12px var(--c); font-size: 11px !important; }

/* --------------------------------------------------------------- chat */
#panel-chat { padding-bottom: 14px; }
.pinned-bar {
  display: flex; gap: 8px; align-items: center; overflow-x: auto; padding: 8px 10px; margin-bottom: 10px;
  background: rgba(255, 207, 107, .06); border: 1px solid rgba(255, 207, 107, .22); border-radius: 12px; flex: none;
}
.pinned-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); flex: none; }
.pinned-item {
  display: flex; align-items: center; gap: 6px; max-width: 320px; flex: none; padding: 5px 10px; border-radius: 8px;
  background: rgba(0, 0, 0, .25); border: 0; font-size: 13px; color: #eee;
}
.pinned-item .ico { color: var(--gold); }
.pinned-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.chat-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 6px 12px; margin: 0 -6px; min-height: 0; perspective: 900px; }
.load-more { text-align: center; margin-bottom: 10px; }
.messages { display: flex; flex-direction: column; }
.day-sep { display: flex; align-items: center; gap: 12px; margin: 18px 0 10px; color: var(--faint); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.day-sep::before, .day-sep::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--border), transparent); }

.msg {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; position: relative;
  animation: msgIn .6s var(--spring) both; transform-origin: 0 100%;
}
.msg.mine { flex-direction: row-reverse; transform-origin: 100% 100%; }
@keyframes msgIn { from { opacity: 0; transform: rotateX(-50deg) translateY(24px) scale(.9); } }
.msg.cont { margin-top: 3px; }
.msg.cont .msg-avatar { visibility: hidden; height: 0; }
.msg.cont .msg-head { display: none; }
.msg-avatar { width: 36px; flex: none; }
.msg-body { display: flex; flex-direction: column; max-width: min(620px, 78%); min-width: 0; }
.msg.mine .msg-body { align-items: flex-end; }
.msg-head { display: flex; align-items: baseline; gap: 8px; margin: 0 4px 4px; font-size: 13px; }
.msg-head time { color: var(--faint); font-size: 11px; }
.msg.mine .msg-head { flex-direction: row-reverse; }
.role-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px;
  color: var(--gold); background: rgba(255, 207, 107, .1); border: 1px solid rgba(255, 207, 107, .3); white-space: nowrap;
}
.role-badge.student { color: var(--muted); background: rgba(255, 255, 255, .04); border-color: var(--border); }
.bubble {
  padding: 10px 14px; border-radius: 18px 18px 18px 6px;
  background: rgba(40, 32, 96, .72); border: 1px solid rgba(150, 130, 255, .16);
  box-shadow: 0 8px 22px -12px rgba(0, 0, 0, .8);
  overflow-wrap: anywhere; white-space: pre-wrap;
}
.msg.cont:not(.mine) .bubble { border-top-left-radius: 6px; }
.msg.mine .bubble {
  border-radius: 18px 18px 6px 18px;
  background: linear-gradient(135deg, #6647f0, #3a4ee8 60%, #1f6fd6);
  border-color: rgba(255, 255, 255, .15);
  box-shadow: 0 10px 26px -12px rgba(90, 80, 255, .9);
}
.msg.mine.cont .bubble { border-top-right-radius: 6px; }
.bubble.has-media { padding: 6px; }
.bubble.has-media .text { padding: 6px 8px 2px; }
.bubble.jumbo { background: none !important; border: 0; box-shadow: none; font-size: 42px; line-height: 1.1; padding: 0 4px; }
.bubble a { color: #9ee9ff; }
.msg.mine .bubble a { color: #fff; }
.decrypting, .locked-text { color: var(--muted); font-size: 13px; font-style: italic; display: inline-flex; gap: 6px; align-items: center; }
.msg.pinned .bubble { box-shadow: 0 0 0 1px rgba(255, 207, 107, .5), 0 0 22px -4px rgba(255, 207, 107, .5); }
.msg.flash .bubble { animation: flash 1.4s; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 3px var(--accent-2), 0 0 30px var(--accent-2); } }
.msg.removing { animation: msgOut .35s var(--ease) forwards; }
@keyframes msgOut { to { opacity: 0; transform: rotateX(60deg) scale(.8); height: 0; margin: 0; } }
.msg-actions {
  display: flex; gap: 2px; align-self: center; opacity: 0; transform: scale(.8);
  transition: opacity .2s, transform .2s var(--spring);
}
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; transform: none; }
.msg-actions .icon-btn { width: 30px; height: 30px; }
.msg.pending { opacity: .8; }
.upload { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); border-top-color: #fff; animation: spin .7s linear infinite; flex: none; }
.gif-grid .spinner { margin: 30px auto; }

.media {
  position: relative; max-width: 100%; width: 280px; aspect-ratio: 4 / 3; border-radius: 13px; overflow: hidden;
  background: rgba(0, 0, 0, .35); max-height: 420px;
}
.media img, .media video { display: block; width: 100%; height: 100%; object-fit: cover; }
.media img { cursor: zoom-in; animation: fadeIn .5s; }
.media video { object-fit: contain; background: #000; }
.media.loading::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(150, 130, 255, .18) 50%, transparent 80%);
  background-size: 200% 100%; animation: shimmerBg 1.4s linear infinite;
}
@keyframes shimmerBg { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes fadeIn { from { opacity: 0; } }
.media-lock { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; color: var(--muted); text-align: center; padding: 10px; }
.media-lock .ico { width: 26px; height: 26px; color: var(--accent-2); }
.media-tag {
  position: absolute; left: 8px; bottom: 8px; font-size: 10px; font-weight: 800; letter-spacing: .08em; padding: 2px 6px; border-radius: 5px;
  background: rgba(0, 0, 0, .6); color: #fff;
}

.typing { min-height: 20px; font-size: 12px; color: var(--muted); padding: 0 6px 4px; flex: none; }
.dots { display: inline-flex; gap: 3px; margin-right: 4px; }
.dots b { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-2); animation: bounce 1s infinite; }
.dots b:nth-child(2) { animation-delay: .15s; } .dots b:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.composer {
  position: relative; flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 8px;
  background: rgba(5, 3, 20, .6); border: 1px solid var(--border); border-radius: 18px;
  transition: border-color .25s, box-shadow .25s;
}
.composer:focus-within { border-color: rgba(124, 92, 255, .6); box-shadow: 0 0 0 3px rgba(124, 92, 255, .15), 0 0 40px -10px rgba(124, 92, 255, .6); }
.composer-tools { display: flex; gap: 2px; }
.gif-btn { font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.composer textarea {
  flex: 1; resize: none; border: 0; background: transparent; box-shadow: none !important; padding: 8px 6px;
  max-height: 160px; line-height: 1.45; min-height: 36px;
}
.send-btn {
  width: 42px; height: 42px; flex: none; border-radius: 13px; border: 0; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #6647f0, #1f6fd6);
  box-shadow: 0 8px 22px -6px rgba(124, 92, 255, .9);
  transition: transform .25s var(--spring), box-shadow .25s;
}
.send-btn:hover { transform: translateY(-2px) rotate(-8deg) scale(1.05); box-shadow: 0 10px 30px -4px rgba(0, 212, 255, .8); }
.send-btn:active { transform: translateX(6px) translateY(-6px) scale(.9); }
.popover {
  position: absolute; bottom: calc(100% + 10px); left: 0; z-index: 10;
  width: min(380px, calc(100vw - 48px)); padding: 12px;
  background: linear-gradient(160deg, rgba(34, 26, 88, .96), rgba(12, 9, 36, .97));
  border: 1px solid var(--border-strong); border-radius: 16px;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .8);
  animation: popIn .35s var(--spring); transform-origin: 10% 100%;
}
@keyframes popIn { from { opacity: 0; transform: perspective(600px) rotateX(-25deg) scale(.9) translateY(10px); } }
.gif-pop { display: flex; flex-direction: column; gap: 10px; }
.gif-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 280px; overflow-y: auto; }
.gif-grid p { grid-column: 1 / -1; margin: 8px 0; }
.gif-item { padding: 0; border: 0; border-radius: 8px; overflow: hidden; aspect-ratio: 1; background: rgba(0, 0, 0, .3); transition: transform .2s var(--spring); }
.gif-item:hover { transform: scale(1.06); position: relative; z-index: 1; box-shadow: 0 0 0 2px var(--accent-2); }
.gif-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.emoji-pop { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; width: min(340px, calc(100vw - 48px)); left: 80px; }
.emoji-pop button { border: 0; background: none; font-size: 22px; padding: 4px; border-radius: 8px; transition: transform .15s var(--spring), background .15s; }
.emoji-pop button:hover { background: rgba(124, 92, 255, .2); transform: scale(1.25); }
.drop-overlay {
  position: absolute; inset: 0; border-radius: inherit; z-index: 20; display: grid; place-items: center; text-align: center;
  background: rgba(10, 6, 34, .82); border: 2px dashed var(--accent-2);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.drop-overlay .ico { width: 48px; height: 48px; color: var(--accent-2); }
#panel-chat.dragging .drop-overlay { opacity: 1; }

/* --------------------------------------------------------------- timetable */
.timetable-wrap { flex: 1; overflow: auto; min-height: 0; margin: 0 -8px; padding: 0 8px 8px; }
.timetable { min-width: 680px; position: relative; }
.tt-head, .tt-body { display: grid; grid-template-columns: 52px; grid-auto-columns: minmax(110px, 1fr); grid-auto-flow: column; gap: 8px; }
.tt-head { position: sticky; top: 0; z-index: 3; padding-bottom: 8px; background: linear-gradient(rgba(14, 10, 40, .95) 70%, transparent); }
.tt-day {
  text-align: center; font-family: var(--font-display); font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  padding: 10px 0; border-radius: 10px; background: rgba(255, 255, 255, .03); color: var(--muted);
}
.tt-day.today { color: #fff; background: linear-gradient(135deg, rgba(124, 92, 255, .4), rgba(0, 212, 255, .2)); box-shadow: 0 0 20px -4px rgba(124, 92, 255, .8); }
.tt-times { position: relative; }
.tt-times span { position: absolute; right: 6px; transform: translateY(-50%); font-size: 11px; color: var(--faint); }
.tt-col {
  position: relative; border-radius: 12px; perspective: 800px;
  background: repeating-linear-gradient(to bottom, rgba(150, 130, 255, .1) 0 1px, transparent 1px var(--hour)), rgba(255, 255, 255, .015);
}
.tt-col.today { background: repeating-linear-gradient(to bottom, rgba(150, 130, 255, .14) 0 1px, transparent 1px var(--hour)), rgba(124, 92, 255, .05); }
.slot {
  --c: #7c5cff;
  position: absolute; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; overflow: hidden;
  padding: 6px 9px; border-radius: 10px; text-align: left; color: #fff;
  border: 1px solid color-mix(in srgb, var(--c) 60%, transparent);
  background: linear-gradient(145deg, color-mix(in srgb, var(--c) 55%, transparent), color-mix(in srgb, var(--c) 22%, rgba(8, 6, 26, .8)));
  box-shadow: 0 8px 20px -10px var(--c), inset 0 1px 0 rgba(255, 255, 255, .18);
  animation: slotIn .6s var(--spring) both;
}
.slot:hover { box-shadow: 0 14px 34px -8px var(--c), 0 0 0 1px var(--c); z-index: 2; }
.slot b { font-size: 13px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.slot small { font-size: 11px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@keyframes slotIn { from { opacity: 0; transform: perspective(600px) rotateX(-60deg) translateY(-10px); } }
.now-line { position: absolute; left: -4px; right: 0; height: 2px; background: var(--accent-3); box-shadow: 0 0 12px var(--accent-3); z-index: 3; pointer-events: none; }
.now-line::before { content: ''; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-3); box-shadow: 0 0 12px var(--accent-3); }
.tt-empty, .empty { text-align: center; color: var(--muted); padding: 40px 16px; display: grid; justify-items: center; gap: 8px; }
.tt-empty { position: absolute; left: 60px; right: 0; top: 30%; }
.tt-empty .ico, .empty .ico { width: 40px; height: 40px; color: var(--accent); opacity: .7; }
.slot-detail { display: grid; gap: 8px; }
.slot-detail p { margin: 0; display: flex; gap: 8px; align-items: center; color: #d8d4ff; }
.slot-detail-bar { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--c), transparent); margin-bottom: 6px; }
.slot-form { display: grid; gap: 14px; }
.slot-fields { display: grid; gap: 14px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; background: var(--c);
  box-shadow: 0 0 12px -2px var(--c); transition: transform .2s var(--spring);
}
.swatch:hover { transform: scale(1.12); }
.swatch.active { border-color: #fff; transform: scale(1.15); }

/* --------------------------------------------------------------- segmented control */
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 12px; background: rgba(0, 0, 0, .3); margin-bottom: 16px; align-self: flex-start; flex: none; }
.seg button { border: 0; background: none; padding: 7px 16px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 13px; transition: background .25s, color .25s; }
.seg button.active { background: rgba(124, 92, 255, .35); color: #fff; box-shadow: inset 0 0 0 1px rgba(150, 130, 255, .35); }
.seg-sm { margin: 0; }

/* --------------------------------------------------------------- votes */
.proposals { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; align-content: start; padding: 4px 4px 12px; flex: 1; min-height: 0; }
.proposals .empty { grid-column: 1 / -1; }
.proposal { padding: 20px; display: flex; flex-direction: column; gap: 12px; animation: propIn .7s var(--ease) both; }
.proposal:nth-child(2) { animation-delay: .06s; } .proposal:nth-child(3) { animation-delay: .12s; } .proposal:nth-child(4) { animation-delay: .18s; }
@keyframes propIn { from { opacity: 0; transform: perspective(900px) rotateY(-35deg) translateZ(-80px); } }
.proposal.live { border-color: rgba(0, 212, 255, .3); }
.proposal.live::after {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background: conic-gradient(from var(--angle, 0deg), transparent 0 70%, rgba(0, 212, 255, .7) 85%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  padding: 1px; animation: rotateAngle 4s linear infinite;
}
@property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes rotateAngle { to { --angle: 360deg; } }
.proposal h3 { margin: 0; font-size: 18px; line-height: 1.3; }
.proposal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.action-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 4px 9px; border-radius: 8px; }
.a-add { color: var(--ok); background: rgba(61, 255, 168, .1); }
.a-modify { color: var(--accent-2); background: rgba(0, 212, 255, .1); }
.a-delete { color: var(--ko); background: rgba(255, 95, 122, .1); }
.countdown { font-size: 12px; color: var(--accent-2); display: inline-flex; gap: 4px; align-items: center; font-weight: 600; }
.countdown.ended { color: var(--gold); }
.proposal-author { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.change { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.change-tag { font-size: 22px; font-weight: 800; color: var(--ok); }
.arrow { font-size: 20px; color: var(--accent-2); animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(4px); } }
.mini-slot {
  --c: #7c5cff;
  display: flex; flex-direction: column; padding: 8px 12px; border-radius: 10px; min-width: 120px; flex: 1;
  border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 16%, rgba(0, 0, 0, .3));
}
.mini-slot small { font-size: 12px; color: var(--muted); }
.mini-slot.old { opacity: .6; }
.mini-slot.strike b { text-decoration: line-through; text-decoration-color: var(--ko); text-decoration-thickness: 2px; }
.mini-slot.gone { color: var(--faint); font-style: italic; font-size: 13px; border-left-color: var(--faint); }
blockquote { margin: 0; padding: 8px 12px; border-left: 2px solid var(--border-strong); color: #cfcbf5; font-size: 14px; background: rgba(255, 255, 255, .02); border-radius: 0 8px 8px 0; white-space: pre-wrap; }
.results { display: grid; gap: 6px; }
.bar { display: flex; height: 10px; border-radius: 10px; overflow: hidden; background: rgba(255, 255, 255, .06); }
.bar i { display: block; height: 100%; transition: width 1s var(--ease); }
.bar .yes { background: linear-gradient(90deg, #2de59a, var(--ok)); box-shadow: 0 0 12px rgba(61, 255, 168, .6); }
.bar .no { background: linear-gradient(90deg, #ff4f6d, var(--ko)); }
.bar .abs { background: rgba(255, 255, 255, .25); }
.legend { display: flex; gap: 12px; font-size: 12px; flex-wrap: wrap; }
.l-yes { color: var(--ok); } .l-no { color: var(--ko); } .l-abs { color: var(--muted); }
.participation { margin-left: auto; color: var(--faint); }
.vote-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.vote-btn {
  padding: 9px 6px; border-radius: 10px; font-weight: 700; font-size: 13px; border: 1px solid var(--border);
  background: rgba(255, 255, 255, .03); color: var(--muted); transition: all .25s var(--spring);
}
.vote-btn:not(:disabled):hover { transform: translateY(-2px); color: #fff; }
.vote-btn.v-yes:hover, .vote-btn.v-yes.active { border-color: var(--ok); color: var(--ok); background: rgba(61, 255, 168, .12); }
.vote-btn.v-no:hover, .vote-btn.v-no.active { border-color: var(--ko); color: var(--ko); background: rgba(255, 95, 122, .12); }
.vote-btn.v-abs:hover, .vote-btn.v-abs.active { border-color: var(--muted); color: #fff; background: rgba(255, 255, 255, .08); }
.vote-btn.active { box-shadow: 0 0 20px -4px currentColor; }
.vote-btn.boom { animation: boom .5s var(--spring); }
@keyframes boom { 40% { transform: scale(1.12) rotateX(20deg); } }
.vote-btn:disabled { opacity: .45; cursor: not-allowed; }
.proposal-foot { display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.proposal-foot:empty { display: none; }
.delegate-hint { margin-right: auto; font-size: 12px; color: var(--gold); display: inline-flex; gap: 4px; align-items: center; }
.stamp {
  font-family: var(--font-display); font-weight: 900; font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  padding: 4px 10px; border: 2px solid; border-radius: 8px; transform: rotate(-6deg);
  animation: stamp .6s var(--spring) both;
}
.stamp.ok { color: var(--ok); box-shadow: 0 0 16px -4px var(--ok); }
.stamp.ko { color: var(--ko); }
@keyframes stamp { from { opacity: 0; transform: scale(2.2) rotate(-18deg); } }

/* --------------------------------------------------------------- members */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; align-content: start; padding: 4px; }
.member { display: flex; align-items: center; gap: 14px; padding: 14px 16px; flex-wrap: wrap; animation: propIn .6s var(--ease) both; }
.member-avatar { position: relative; flex: none; }
.member .orbit { position: absolute; inset: -7px; border-radius: 50%; border: 1px dashed rgba(150, 130, 255, .25); }
.member.online .orbit { border-color: rgba(61, 255, 168, .4); animation: spin 8s linear infinite; }
.member.online .orbit::after {
  content: ''; position: absolute; top: -4px; left: 50%; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 10px var(--ok);
}
.member-info { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.member-info small { color: var(--muted); }
.member-info .you { color: var(--faint); font-weight: 400; }
.member > .btn { margin-left: auto; }
.danger-zone { margin-top: auto; padding-top: 18px; display: flex; gap: 10px; justify-content: flex-end; flex: none; }
.fingerprint { display: grid; gap: 12px; }
.fp-code {
  --c: var(--accent);
  font-family: ui-monospace, Consolas, monospace; font-size: 22px; letter-spacing: .08em; text-align: center; line-height: 1.6;
  padding: 16px; border-radius: 14px; word-spacing: 8px;
  background: color-mix(in srgb, var(--c) 12%, rgba(0, 0, 0, .35)); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  box-shadow: 0 0 30px -10px var(--c);
}
.fp-code.small { font-size: 15px; padding: 10px; }

/* --------------------------------------------------------------- delegate console */
.admin-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; align-content: start; padding: 4px; }
.admin-card { padding: 20px; display: flex; flex-direction: column; gap: 12px; animation: propIn .6s var(--ease) both; }
.admin-card h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.admin-card h3 .ico { color: var(--accent-2); }
.span-2 { grid-column: span 2; }
.count { font-size: 12px; background: var(--accent-3); padding: 1px 8px; border-radius: 10px; }
.invite-code {
  font-family: var(--font-display); font-size: clamp(28px, 5vw, 44px); font-weight: 900; letter-spacing: .2em; text-align: center;
  padding: 14px; border-radius: 16px; user-select: all;
  background: rgba(0, 0, 0, .3); border: 1px dashed var(--border-strong);
  color: transparent; -webkit-background-clip: text; background-clip: text;
  background-image: linear-gradient(90deg, #fff, var(--accent-2), var(--accent-3), #fff);
  background-size: 200% 100%; animation: shimmer 5s linear infinite;
  filter: drop-shadow(0 0 14px rgba(0, 212, 255, .4));
}
.pending-list, .crew-list { display: grid; gap: 8px; }
.pending-item, .crew-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; flex-wrap: wrap;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--border);
  animation: fadeUp .5s var(--ease) both;
}
.pending-item { border-color: rgba(255, 207, 107, .3); background: rgba(255, 207, 107, .04); }
.pi-info { flex: 1; min-width: 120px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.pi-info small { color: var(--muted); }

/* --------------------------------------------------------------- modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(3, 2, 10, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fadeIn .3s; perspective: 1200px; overflow-y: auto;
}
.modal-backdrop.out { animation: fadeOut .28s forwards; }
@keyframes fadeOut { to { opacity: 0; } }
.modal { width: min(460px, 100%); padding: 22px; display: flex; flex-direction: column; gap: 16px; animation: modalIn .55s var(--spring); max-height: calc(100dvh - 32px); }
.modal.wide { width: min(620px, 100%); }
.modal.out { animation: modalOut .28s var(--ease) forwards; }
@keyframes modalIn { from { opacity: 0; transform: rotateX(28deg) translateY(50px) scale(.9); } }
@keyframes modalOut { to { opacity: 0; transform: rotateX(-18deg) translateY(30px) scale(.94); } }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-head h3 { margin: 0; font-family: var(--font-display); font-size: 18px; letter-spacing: .03em; }
.modal-body { overflow-y: auto; margin: 0 -6px; padding: 2px 6px; }
.modal-body > p { margin: 0; color: #d6d2ff; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
/* Welcome video (welcome-video.js): 16:9 frame, thumbnail until the viewer presses play */
.welcome-video { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; margin: 12px 0; }
.welcome-video iframe, .welcome-video-play { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.welcome-video-play { padding: 0; background: #000; cursor: pointer; display: grid; place-items: center; }
.welcome-video-play img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .8; transition: opacity .2s; }
.welcome-video-play:hover img, .welcome-video-play:focus-visible img { opacity: 1; }
.welcome-video-icon { position: relative; width: 68px; height: 48px; border-radius: 14px; background: #e62117; color: #fff; display: grid; place-items: center; font-size: 22px; box-shadow: 0 6px 20px rgba(0, 0, 0, .5); }

/* --------------------------------------------------------------- toasts & lightbox */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; perspective: 800px; }
.toast {
  max-width: min(380px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 14px; font-size: 14px; pointer-events: auto;
  background: linear-gradient(135deg, rgba(40, 30, 100, .95), rgba(16, 12, 44, .95));
  border: 1px solid var(--border-strong); box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .8);
  animation: toastIn .5s var(--spring);
}
.toast-success { border-color: rgba(61, 255, 168, .5); box-shadow: 0 0 30px -10px var(--ok); }
.toast-error { border-color: rgba(255, 95, 122, .6); box-shadow: 0 0 30px -10px var(--ko); }
.toast.out { animation: toastOut .4s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: rotateY(-50deg) translateX(80px); } }
@keyframes toastOut { to { opacity: 0; transform: rotateY(40deg) translateX(60px); } }
.lightbox {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px;
  background: rgba(3, 2, 10, .9); opacity: 0; transition: opacity .25s; cursor: zoom-out;
}
.lightbox.open { opacity: 1; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, .8); transform: scale(.9); transition: transform .4s var(--spring); }
.lightbox.open img { transform: none; }
.lb-close { position: absolute; top: 16px; right: 16px; color: #fff; }

/* --------------------------------------------------------------- responsive */
@media (max-width: 960px) {
  .auth-layout { grid-template-columns: 1fr; gap: 24px; max-width: 460px; }
  .hero { text-align: center; padding: 0; }
  .logo-3d { margin: 0 auto 16px; width: 90px; height: 90px; }
  .logo-core { inset: 25px; }
  .features { display: none; }
  .tagline { margin-bottom: 0; }
  .choice-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: 1fr auto; padding: 10px 10px 0; gap: 10px; }
  .sidebar {
    order: 2; flex-direction: row; padding: 6px; gap: 0; border-radius: 18px 18px 0 0; border-bottom: 0;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
  .side-brand, .side-footer { display: none; }
  .nav-items { flex-direction: row; gap: 2px; }
  .nav-item { flex: 1; flex-direction: column; gap: 3px; padding: 8px 2px; font-size: 10px; text-align: center; }
  .nav-item:hover { transform: none; }
  .nav-item.active::before { left: 25%; right: 25%; top: -6px; bottom: auto; width: auto; height: 3px; }
  .nav-item .badge { position: absolute; top: 2px; right: calc(50% - 22px); margin: 0; }
  .nav-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  body.is-delegate .delegate-only { display: flex; }
  .panel { padding: 16px 14px 12px; transform: translateY(30px) rotateX(-10deg) scale(.97); transform-origin: center top; }
  .panel-head h2 { font-size: 18px; }
  .msg-body { max-width: 84%; }
  .msg-actions { opacity: 1; transform: none; flex-direction: column; }
  .msg:not(:hover) .msg-actions { opacity: .5; }
  .proposals { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .emoji-pop { left: 0; }
  .online-stack { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Launch mission (auth) — rocket, Earth, Mars
   ========================================================================== */
.stage {
  --thrust: 0;
  position: relative; height: 210px; margin: 0 -28px 20px; overflow: hidden;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(120% 90% at 50% 115%, rgba(124, 92, 255, .32), transparent 60%),
    linear-gradient(180deg, #04021a, #120a3a);
}
.stage-stars {
  position: absolute; left: 0; right: 0; top: -220px; bottom: 0;
  background-image:
    radial-gradient(1.6px 1.6px at 12px 18px, #fff, transparent),
    radial-gradient(1.2px 1.2px at 64px 80px, #cfd8ff, transparent),
    radial-gradient(1.4px 1.4px at 98px 34px, #fff, transparent),
    radial-gradient(1px 1px at 40px 110px, #ffe7c4, transparent),
    radial-gradient(1.3px 1.3px at 118px 96px, #bfefff, transparent);
  background-size: 130px 130px;
  animation: starsDrift 40s linear infinite;
}
.stage-stars.far { background-size: 74px 74px; opacity: .45; animation-duration: 70s; }
@keyframes starsDrift { to { transform: translateY(220px); } }
.stage.streak .stage-stars { animation-duration: .5s; filter: blur(.4px); }
.stage.streak .stage-stars.far { animation-duration: .8s; }
.stage.cruise .stage-stars { animation-duration: 6s; }
.stage.streak::before {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 41px, rgba(170, 200, 255, .28) 41px 42px, transparent 42px 83px, rgba(255, 180, 240, .2) 83px 84px);
  -webkit-mask: linear-gradient(transparent, #000 25%, #000 75%, transparent);
  mask: linear-gradient(transparent, #000 25%, #000 75%, transparent);
  animation: streakLines .18s linear infinite;
}
@keyframes streakLines { from { background-position: 0 0; } to { background-position: 0 0; transform: translateY(12px); } }

.earth-ground, .mars-ground { position: absolute; inset: 0; pointer-events: none; }
.mars-ground { transform: translateY(240px); }
.earth, .mars { position: absolute; left: 50%; bottom: -300px; width: 560px; height: 340px; margin-left: -280px; border-radius: 50%; }
.earth {
  background:
    radial-gradient(70px 28px at 34% 11%, rgba(61, 255, 168, .55), transparent 70%),
    radial-gradient(90px 34px at 70% 15%, rgba(61, 255, 168, .4), transparent 70%),
    radial-gradient(50px 20px at 52% 6%, rgba(255, 255, 255, .5), transparent 70%),
    radial-gradient(circle at 50% 0%, #74dcff 0%, #2a7ad8 26%, #0f327f 60%, #06163d 100%);
  box-shadow: 0 -8px 34px rgba(111, 216, 255, .55), inset 0 12px 24px rgba(255, 255, 255, .22);
}
.mars {
  background:
    radial-gradient(38px 13px at 30% 12%, rgba(110, 28, 8, .6), transparent 70%),
    radial-gradient(24px 9px at 61% 8%, rgba(110, 28, 8, .55), transparent 70%),
    radial-gradient(52px 16px at 78% 20%, rgba(255, 205, 160, .28), transparent 70%),
    radial-gradient(18px 7px at 45% 5%, rgba(90, 20, 5, .6), transparent 70%),
    radial-gradient(circle at 50% 0%, #ffb183 0%, #e35d2d 28%, #9e2f14 60%, #4a1206 100%);
  box-shadow: 0 -8px 38px rgba(255, 120, 70, .55), inset 0 10px 22px rgba(255, 220, 190, .25);
}
.pad {
  position: absolute; left: 50%; bottom: 36px; width: 66px; height: 6px; margin-left: -33px; border-radius: 3px;
  background: linear-gradient(#d6d9ff, #6b6fa8); box-shadow: 0 0 12px rgba(124, 92, 255, .7);
}
.pad i { position: absolute; bottom: 6px; width: 3px; height: 38px; background: linear-gradient(#9aa0d8, #5a5f8f); border-radius: 2px; }
.pad i:first-child { left: 2px; } .pad i:last-child { right: 2px; }
.flag {
  position: absolute; left: calc(50% + 44px); bottom: 38px; width: 2px; height: 30px; background: #e8e6ff;
  transform: scaleY(0); transform-origin: bottom;
}
.flag::after {
  content: ''; position: absolute; left: 2px; top: 0; width: 18px; height: 11px; border-radius: 0 3px 3px 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  animation: wave 1.2s ease-in-out infinite alternate; transform-origin: left;
}
@keyframes wave { to { transform: skewY(-8deg) scaleX(.9); } }
.stage.landed .flag { animation: plant .6s var(--spring) .35s forwards; }
@keyframes plant { to { transform: scaleY(1); } }

.rocket-wrap { position: absolute; left: 50%; bottom: 42px; width: 40px; height: 90px; margin-left: -20px; z-index: 3; }
.rocket-inner { position: relative; width: 100%; height: 100%; }
.rocket { display: block; width: 40px; height: 90px; position: relative; z-index: 1; filter: drop-shadow(0 0 8px rgba(124, 92, 255, .55)); }
.stage.idle .rocket-inner { animation: idleBob 3.2s ease-in-out infinite; }
.stage.shake .rocket-inner { animation: rshake .07s linear infinite; }
.stage.hovering .rocket-inner { animation: hoverBob 1.3s ease-in-out infinite; }
@keyframes idleBob { 50% { transform: translateY(-1.5px); } }
@keyframes rshake { 25% { transform: translate(-1px, .5px); } 75% { transform: translate(1px, -.5px); } }
@keyframes hoverBob { 50% { transform: translateY(-5px); } }
.flame {
  position: absolute; left: 50%; top: 68px; width: 15px; height: 46px; margin-left: -7.5px;
  border-radius: 50% 50% 50% 50% / 22% 22% 78% 78%;
  background: linear-gradient(#ffffff 0%, #fff4b0 18%, #ffb547 42%, #ff4f7e 72%, transparent);
  box-shadow: 0 0 22px 6px rgba(255, 150, 70, .55);
  transform-origin: 50% 0;
  transform: scaleY(var(--thrust)) scaleX(calc(.55 + var(--thrust) * .45));
  opacity: calc(var(--thrust) * 3);
  transition: transform .35s var(--ease), opacity .3s;
  animation: flicker .09s infinite alternate;
}
@keyframes flicker { to { filter: brightness(1.25) blur(.6px); height: 41px; } }

.smoke i, .dust i {
  position: absolute; bottom: 34px; left: 50%; width: 28px; height: 28px; border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, rgba(225, 220, 255, .85), rgba(160, 150, 220, 0) 70%);
}
.dust i { background: radial-gradient(circle, rgba(255, 170, 120, .85), rgba(200, 90, 50, 0) 70%); }
.smoke i:nth-child(1), .dust i:nth-child(1) { --dx: -70px; animation-delay: 0s; }
.smoke i:nth-child(2), .dust i:nth-child(2) { --dx: 70px; animation-delay: .1s; }
.smoke i:nth-child(3), .dust i:nth-child(3) { --dx: -40px; animation-delay: .25s; }
.smoke i:nth-child(4), .dust i:nth-child(4) { --dx: 40px; animation-delay: .35s; }
.smoke i:nth-child(5), .dust i:nth-child(5) { --dx: -100px; animation-delay: .5s; }
.smoke i:nth-child(6), .dust i:nth-child(6) { --dx: 100px; animation-delay: .6s; }
.stage.smoking .smoke i { animation: puff 1.3s ease-out infinite; }
.stage.dusting .dust i { animation: puff 1.1s ease-out 1 both; }
@keyframes puff {
  0% { opacity: .9; transform: translate(-50%, 0) scale(.4); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), -16px) scale(2.6); }
}
.burst { position: absolute; left: 50%; top: 62px; width: 0; height: 0; z-index: 4; }
.burst i { position: absolute; width: 6px; height: 6px; margin: -3px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.success-badge {
  position: absolute; top: 40px; left: 50%; width: 54px; height: 54px; margin-left: -27px; z-index: 4;
  display: grid; place-items: center; border-radius: 50%;
  background: linear-gradient(135deg, var(--ok), var(--accent-2));
  box-shadow: 0 0 34px rgba(61, 255, 168, .8);
  transform: scale(0);
}
.success-badge path { stroke-dasharray: 26; stroke-dashoffset: 26; }
.stage.success .success-badge { animation: badgePop .7s var(--spring) .15s forwards; }
.stage.success .success-badge path { animation: draw .5s ease .55s forwards; }
@keyframes badgePop { to { transform: scale(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.stage-caption {
  position: absolute; top: 12px; left: 0; right: 0; margin: 0; z-index: 5; text-align: center;
  font-family: var(--font-display); font-size: 11px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase;
  color: #e3ddff; text-shadow: 0 0 12px rgba(124, 92, 255, .9);
  opacity: 0; transform: translateY(-6px);
}
.stage-caption.show { animation: captionIn .45s var(--ease) forwards; }
@keyframes captionIn { to { opacity: 1; transform: none; } }
.stage.success .stage-caption { top: 104px; font-size: 17px; letter-spacing: .12em; color: #fff; text-shadow: 0 0 18px rgba(61, 255, 168, .9); }
.stage.success .rocket-wrap { opacity: .0; transition: opacity .6s .9s; }

/* the pseudo flying into the rocket */
.cargo {
  position: fixed; z-index: 90; pointer-events: none; white-space: nowrap;
  padding: 6px 12px; border-radius: 10px; font-weight: 700; color: #fff;
  background: rgba(124, 92, 255, .45); border: 1px solid var(--border-strong);
  box-shadow: 0 0 22px rgba(124, 92, 255, .7);
}
input.vanish { color: transparent !important; transition: color .2s; }
input.reappear { animation: reappear .8s var(--ease); }
@keyframes reappear { from { color: transparent; text-shadow: 0 0 12px var(--accent-2); } }

/* steps */
.steps { position: relative; perspective: 900px; }
.step { display: none; flex-direction: column; gap: 14px; }
.step.active { display: flex; animation: stepIn .6s var(--ease) both; }
.step.active.from-back { animation-name: stepInBack; }
@keyframes stepIn { from { opacity: 0; transform: rotateY(-22deg) translateX(40px); } }
@keyframes stepInBack { from { opacity: 0; transform: rotateY(22deg) translateX(-40px); } }
.step-title { margin: 0; font-family: var(--font-display); font-size: 17px; letter-spacing: .02em; line-height: 1.35; }
.step-title span { color: var(--accent-2); }
.back-btn, .link-btn {
  background: none; border: 0; padding: 2px 0; color: #7fe3ff; font-size: 13px; font-weight: 600;
  align-self: flex-start; border-radius: 4px;
}
.link-btn { align-self: flex-end; margin-top: -6px; }
.back-btn:hover, .link-btn:hover { text-decoration: underline; }
.btn-cta { font-size: 16px; padding: 13px 20px; }
.busy-text { text-align: center; margin: 8px 0 0; font-family: var(--font-display); letter-spacing: .08em; }
.progress-dots { display: flex; justify-content: center; gap: 8px; padding: 6px 0 4px; }
.progress-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); animation: bounce 1s infinite; }
.progress-dots i:nth-child(2) { animation-delay: .15s; } .progress-dots i:nth-child(3) { animation-delay: .3s; }
.strength-row { display: flex; align-items: center; gap: 10px; margin-top: -6px; }
.strength-row .strength { flex: 1; margin: 0; }
.strength-label { font-size: 12px; color: var(--muted); min-width: 64px; text-align: right; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: #d6d2ff; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--accent); padding: 0; }
.field em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); }
.form-info { color: #7fe3ff; font-size: 13px; text-align: center; margin: 12px 0 0; line-height: 1.45; }
.form-info:empty { display: none; }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* accessibility */
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: 10px; background: #fff; color: #120a38; font-weight: 700; transition: top .2s; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; }

/* legal footer & cookie banner */
.legal-footer { position: fixed; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 18px; font-size: 12px; z-index: 3; }
.legal-footer a, .side-legal a { color: var(--muted); text-decoration: none; }
.legal-footer a:hover, .side-legal a:hover { color: #fff; text-decoration: underline; }
.side-legal { font-size: 11px; color: var(--faint); text-align: center; }
#view-auth { padding-bottom: 48px; }
.cookie-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 95; margin: 0 auto; max-width: 720px;
  display: flex; gap: 16px; align-items: center; padding: 14px 18px; border-radius: 16px;
  background: linear-gradient(135deg, rgba(34, 26, 88, .97), rgba(12, 9, 36, .97));
  border: 1px solid var(--border-strong); box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .8);
  font-size: 13px; line-height: 1.5; animation: toastIn .5s var(--spring);
}
.cookie-banner p { margin: 0; color: #dcd8ff; }
.cookie-banner a { color: #7fe3ff; }
.cookie-banner.out { animation: toastOut .35s var(--ease) forwards; }
.cookie-actions { display: flex; gap: 8px; flex: none; }

/* upload progress */
.upload-info { display: grid; gap: 6px; min-width: 180px; }
.upload-bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.upload-bar i { display: block; height: 100%; width: 0; background: #fff; transition: width .3s; }

@media (max-width: 960px) {
  .stage { height: 190px; }
  .legal-footer { position: static; margin-top: 20px; }
  #view-auth { display: flex; flex-direction: column; align-items: center; }
}
@media (max-width: 600px) {
  .auth-card { padding: 0 18px 20px; }
  .stage { margin: 0 -18px 18px; }
  .cookie-banner { flex-direction: column; align-items: stretch; }
  .cookie-actions .btn { flex: 1; }
}

/* ==========================================================================
   Static pages (RGPD, CGU, 404)
   ========================================================================== */
body.doc-page { overflow: auto; background: radial-gradient(1000px 600px at 85% 0%, rgba(124, 92, 255, .22), transparent 60%), var(--bg); }
.doc { max-width: 820px; margin: 0 auto; padding: 32px 16px 64px; }
.doc-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.doc-brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-family: var(--font-display); font-weight: 700; letter-spacing: .12em; font-size: 14px; }
.doc-brand img { width: 36px; height: 36px; }
.doc-card { padding: 32px clamp(18px, 4vw, 44px); line-height: 1.7; }
.doc-card h1 { font-family: var(--font-display); font-size: clamp(24px, 4vw, 34px); margin: 0 0 6px; line-height: 1.2; }
.doc-card h2 { font-size: 19px; margin: 32px 0 8px; color: #fff; }
.doc-card p, .doc-card li { color: #dcd8ff; }
.doc-card a { color: #7fe3ff; }
.doc-card table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 12px 0; }
.doc-card th, .doc-card td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc-card th { color: #fff; }
.doc-meta { color: var(--muted); font-size: 14px; margin: 0; }
.doc-footer { display: flex; justify-content: center; gap: 18px; margin-top: 28px; font-size: 13px; }
.doc-footer a { color: var(--muted); }
.table-wrap { overflow-x: auto; }

.lost { min-height: 100dvh; display: grid; place-items: center; text-align: center; padding: 24px 16px; position: relative; overflow: hidden; }
.lost h1 { font-family: var(--font-display); font-size: clamp(64px, 18vw, 160px); margin: 0; line-height: 1;
  background: linear-gradient(90deg, #fff, var(--accent-2), var(--accent-3)); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 24px rgba(124, 92, 255, .6)); }
.lost p { color: #dcd8ff; font-size: 18px; margin: 8px 0 28px; }
.astronaut { font-size: 84px; display: inline-block; animation: drift 9s ease-in-out infinite; filter: drop-shadow(0 0 20px rgba(0, 212, 255, .5)); }
@keyframes drift { 0% { transform: translate(-30px, 0) rotate(-12deg); } 50% { transform: translate(30px, -18px) rotate(14deg); } 100% { transform: translate(-30px, 0) rotate(-12deg); } }
.lost .stars-bg { position: absolute; inset: 0; z-index: -1; opacity: .7;
  background-image: radial-gradient(1.6px 1.6px at 20px 30px, #fff, transparent), radial-gradient(1.2px 1.2px at 90px 120px, #cfd8ff, transparent), radial-gradient(1.8px 1.8px at 160px 60px, #fff, transparent);
  background-size: 200px 200px; animation: starsDrift 50s linear infinite; }

/* ==========================================================================
   Moderation (reports)
   ========================================================================== */
.ico-flag { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z'/><path d='M4 22v-7'/></svg>"); }
.seg-wrap { flex-wrap: wrap; }
.report-notice {
  margin: 0; padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.55; color: #e6e2ff;
  background: rgba(255, 207, 107, .07); border: 1px solid rgba(255, 207, 107, .28);
}
.report-notice p { margin: 0 0 6px; } .report-notice p:last-child { margin: 0; }
.report-notice a { color: #7fe3ff; }
.report-item.open { border-color: rgba(255, 95, 122, .45); background: rgba(255, 95, 122, .06); }
.transcript {
  display: grid; gap: 4px; max-height: 44vh; overflow-y: auto; padding: 10px; border-radius: 12px;
  background: rgba(0, 0, 0, .3); border: 1px solid var(--border); font-size: 13px;
}
.tr-line { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; align-items: baseline; padding: 4px 6px; border-radius: 6px; }
.tr-line time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.tr-line span { overflow-wrap: anywhere; white-space: pre-wrap; }
.tr-line em { grid-column: 3; color: var(--gold); font-size: 11px; }
.tr-line.reported { background: rgba(255, 95, 122, .16); box-shadow: inset 3px 0 0 var(--ko); }
.tr-line.deleted span { text-decoration: line-through; text-decoration-color: rgba(255, 207, 107, .6); }
@media (max-width: 600px) { .tr-line { grid-template-columns: 1fr; gap: 2px; } .tr-line em { grid-column: 1; } }

/* ==========================================================================
   Révisions IA
   ========================================================================== */
.ico-book { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20'/></svg>"); }
.ico-sparkles { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9z'/><path d='M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8z'/></svg>"); }
.can-publish-only { display: none; }
body.can-publish .can-publish-only { display: inline-flex; }
.role-badge.trusted { color: #7fe3ff; background: rgba(0, 212, 255, .1); border-color: rgba(0, 212, 255, .35); }

.study-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(260px, 330px) 1fr; gap: 18px; }
.course-lib {
  display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 14px; border-radius: 16px;
  background: rgba(0, 0, 0, .22); border: 1px solid var(--border);
}
.lib-head { display: flex; flex-direction: column; gap: 8px; }
.lib-head h3 { margin: 0; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.lib-head select { padding: 8px 10px; font-size: 13px; }
.course-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; min-height: 80px; }
.course-group { display: grid; gap: 6px; }
.course-group-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.course-group-head b { font-family: var(--font-display); letter-spacing: .06em; font-size: 12px; text-transform: uppercase; color: #cfc8ff; }
.course-group-head .link-btn { margin: 0; font-size: 12px; }
.course-item {
  display: grid; grid-template-columns: auto auto 1fr auto auto; gap: 8px; align-items: center; padding: 8px 8px 8px 10px;
  border-radius: 12px; background: rgba(255, 255, 255, .03); border: 1px solid var(--border); cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s var(--spring);
}
.course-item:hover { border-color: var(--border-strong); transform: translateX(2px); }
.course-item.selected { border-color: rgba(0, 212, 255, .55); background: rgba(0, 212, 255, .08); box-shadow: 0 0 18px -8px var(--accent-2); }
.course-item input { width: 17px; height: 17px; padding: 0; accent-color: var(--accent-2); }
.course-item .icon-btn { width: 30px; height: 30px; }
.ci-info { min-width: 0; display: flex; flex-direction: column; }
.ci-info b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-info small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kind-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px currentColor; }
.k-cours { background: var(--accent); color: var(--accent); }
.k-methode { background: var(--gold); color: var(--gold); }
.k-exercices { background: var(--ok); color: var(--ok); }
.k-autre { background: var(--muted); color: var(--muted); }
.selection-info { margin: 0; padding-top: 8px; border-top: 1px solid var(--border); }
.selection-info.warn { color: var(--ko); }
.small-empty { padding: 20px 8px; }

.study-main { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow-y: auto; padding-right: 4px; }
.study-tools { margin: 0; }
.study-options { display: grid; gap: 10px; }
.study-options .row { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.study-go { justify-self: start; }
.study-output { display: grid; gap: 14px; align-content: start; }
.study-placeholder, .study-error, .study-thinking {
  display: grid; justify-items: center; gap: 10px; text-align: center; padding: 34px 16px; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: 16px;
}
.study-placeholder .ico { width: 34px; height: 34px; color: var(--accent-2); }
.study-error { color: #ffb3c0; border-color: rgba(255, 95, 122, .45); }
.study-thinking p { margin: 0; font-family: var(--font-display); letter-spacing: .06em; font-size: 13px; }
.orbit-loader { position: relative; width: 54px; height: 54px; }
.orbit-loader span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--accent-2); animation: spin 1s linear infinite; }
.orbit-loader span + span { inset: 10px; border-top-color: var(--accent-3); animation-duration: .7s; animation-direction: reverse; }
.study-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.study-actions h3 { margin: 0 auto 0 0; font-family: var(--font-display); font-size: 17px; }
.ai-disclaimer { font-size: 12px; color: var(--muted); margin: 0; text-align: center; }

.md { line-height: 1.65; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md h2, .md h3, .md h4, .md h5 { margin: 18px 0 6px; color: #fff; }
.md h2 { font-size: 18px; color: #bfb2ff; } .md h3 { font-size: 16px; color: #9fe8ff; }
.md p { margin: 6px 0; }
.md ul, .md ol { margin: 6px 0; padding-left: 22px; }
.md li { margin: 3px 0; }
.md code { background: rgba(255, 255, 255, .08); }
.md pre { background: rgba(0, 0, 0, .35); padding: 10px 12px; border-radius: 10px; overflow-x: auto; }
.md table { border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; }
.md .math-block { overflow-x: auto; margin: 8px 0; }
.md .katex { font-size: 1.05em; }
.study-sheet { padding: 22px 24px; }

.quiz-score { font-family: var(--font-display); font-weight: 900; font-size: 18px; padding: 6px 14px; border-radius: 12px; background: rgba(0, 212, 255, .12); color: #7fe3ff; }
.quiz-score.final { background: linear-gradient(135deg, rgba(61, 255, 168, .2), rgba(0, 212, 255, .2)); color: #fff; animation: pop .5s var(--spring); }
.quiz-card, .exam-q { padding: 18px 20px; display: grid; gap: 10px; animation: propIn .5s var(--ease) both; }
.quiz-num { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); }
.quiz-choices { display: grid; gap: 8px; }
.quiz-choice {
  text-align: left; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255, 255, 255, .03);
  transition: border-color .2s, background .2s, transform .2s var(--spring);
}
.quiz-choice .md p { margin: 0; }
.quiz-choice:not(:disabled):hover { border-color: var(--border-strong); transform: translateX(3px); }
.quiz-choice.correct { border-color: var(--ok); background: rgba(61, 255, 168, .12); box-shadow: 0 0 18px -6px var(--ok); }
.quiz-choice.wrong { border-color: var(--ko); background: rgba(255, 95, 122, .12); animation: shake .4s; }
.quiz-choice:disabled { cursor: default; }
.quiz-feedback:empty { display: none; }
.quiz-feedback { padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, .25); font-size: 14px; }
.quiz-source { display: block; color: var(--muted); margin-top: 6px; font-size: 12px; }
.exam-q textarea { min-height: 90px; }
.exam-result:empty { display: none; }
.exam-result { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: rgba(0, 0, 0, .25); }
.exam-score { font-family: var(--font-display); font-weight: 900; color: #7fe3ff; }
.exam-result summary { cursor: pointer; color: #7fe3ff; font-weight: 600; font-size: 14px; }
.exam-total { display: flex; gap: 18px; align-items: center; padding: 18px 22px; border-color: rgba(61, 255, 168, .4); }
.big-score { font-family: var(--font-display); font-size: 48px; font-weight: 900; line-height: 1;
  background: linear-gradient(135deg, #fff, var(--ok)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.big-score small { font-size: 18px; }

.ask-thread { display: grid; gap: 10px; }
.ask-bubble { padding: 12px 16px; border-radius: 16px; max-width: 92%; animation: msgIn .5s var(--spring) both; }
.ask-bubble.me { justify-self: end; background: linear-gradient(135deg, #6647f0, #1f6fd6); }
.ask-bubble.me p { margin: 0; white-space: pre-wrap; }
.ask-bubble.ai { justify-self: start; background: rgba(40, 32, 96, .72); border: 1px solid var(--border); }
.ask-form { display: grid; gap: 8px; }
.ask-actions { display: flex; justify-content: space-between; gap: 8px; }
.course-preview { display: grid; gap: 12px; }
.course-preview img { max-width: 100%; border-radius: 10px; }
.course-text { white-space: pre-wrap; background: rgba(0, 0, 0, .3); padding: 12px; border-radius: 10px; max-height: 50vh; overflow: auto; }

@media (max-width: 900px) {
  .study-layout { grid-template-columns: 1fr; overflow-y: auto; }
  .course-lib { max-height: none; }
  .course-list { max-height: 40vh; }
  .study-main { overflow: visible; }
}

/* ==========================================================================
   Teachers & chat channels
   ========================================================================== */
body.is-teacher .student-only { display: none !important; }
.role-badge.teacher { color: #ffd98a; background: rgba(255, 181, 71, .12); border-color: rgba(255, 181, 71, .4); }
.channel-tabs { display: flex; gap: 6px; flex: none; margin: -4px 0 10px; overflow-x: auto; }
.channel-tabs:empty { display: none; }
.channel-tab {
  position: relative; border: 1px solid var(--border); background: rgba(255, 255, 255, .03); color: var(--muted);
  padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 13px; white-space: nowrap;
  transition: background .25s, color .25s, border-color .25s;
}
.channel-tab:hover { color: #fff; border-color: var(--border-strong); }
.channel-tab.active { color: #fff; background: linear-gradient(135deg, rgba(102, 71, 240, .55), rgba(31, 111, 214, .45)); border-color: rgba(150, 130, 255, .5); }
.channel-tab.unread::after {
  content: ''; position: absolute; top: 4px; right: 6px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-3); box-shadow: 0 0 10px var(--accent-3); animation: pop .4s var(--spring);
}
.invite-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.invite-block { display: grid; gap: 8px; padding: 14px; border-radius: 14px; background: rgba(0, 0, 0, .2); border: 1px solid var(--border); }
.invite-block .invite-code { font-size: clamp(22px, 3.2vw, 32px); padding: 10px; }
.invite-code.teacher { background-image: linear-gradient(90deg, #fff, var(--gold), #ffb547, #fff); }
.teacher-reports:empty { display: none; }
.teacher-reports { margin-bottom: 16px; flex: none; }

/* roles */
.role-badge.deputy { color: #c9bbff; background: rgba(124, 92, 255, .12); border-color: rgba(150, 130, 255, .4); }
.role-select { width: auto; padding: 6px 10px; font-size: 13px; border-radius: 10px; }
.role-summary { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--muted); }
.role-summary b { color: #fff; font-family: var(--font-display); }

/* ==========================================================================
   Conseil de classe
   ========================================================================== */
.ico-award { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='8' r='6'/><path d='M15.48 12.89 17 22l-5-3-5 3 1.52-9.11'/></svg>"); }
.council-body { flex: 1; min-height: 0; overflow-y: auto; }
.council-teacher { display: flex; flex-direction: column; gap: 14px; height: 100%; min-height: 0; }
.council-toolbar { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.council-toolbar .field { min-width: 200px; }
.council-stats { display: flex; gap: 16px; font-size: 13px; color: var(--muted); padding-bottom: 10px; }
.council-stats b { color: #fff; font-family: var(--font-display); }
.council-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(250px, 320px) 1fr; gap: 16px; }
.council-picker { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 12px; border-radius: 16px; background: rgba(0, 0, 0, .22); border: 1px solid var(--border); }
.council-search { padding: 9px 12px; }
.council-list { flex: 1; overflow-y: auto; display: grid; gap: 6px; align-content: start; min-height: 120px; }
.council-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; text-align: left;
  padding: 8px 10px; border-radius: 12px; border: 1px solid transparent; background: rgba(255, 255, 255, .03);
  transition: background .2s, border-color .2s;
}
.council-item:hover { background: rgba(124, 92, 255, .1); }
.council-item.active { border-color: rgba(0, 212, 255, .55); background: rgba(0, 212, 255, .1); }
.ci-name { display: flex; flex-direction: column; min-width: 0; }
.ci-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-name small { color: var(--muted); font-size: 11px; }
.ci-avg { font-family: var(--font-display); font-weight: 700; color: var(--ok); }
.ci-todo { font-size: 11px; color: var(--gold); border: 1px solid rgba(255, 207, 107, .4); border-radius: 8px; padding: 2px 7px; }
.council-editor { min-height: 0; overflow-y: auto; }
.council-form { padding: 20px 22px; display: grid; gap: 12px; }
.cf-head { display: flex; gap: 14px; align-items: center; }
.cf-head h3 { margin: 0; font-size: 18px; }
.council-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; align-content: start; }
.council-card { padding: 20px; display: grid; gap: 10px; animation: propIn .6s var(--ease) both; }
.cc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cc-average span { font-family: var(--font-display); font-size: 44px; font-weight: 900; line-height: 1;
  background: linear-gradient(135deg, #fff, var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cc-average small { font-size: 18px; color: var(--muted); margin-left: 4px; }
.mention { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 10px; color: var(--gold); background: rgba(255, 207, 107, .1); border: 1px solid rgba(255, 207, 107, .35); }
@media (max-width: 900px) {
  .council-layout { grid-template-columns: 1fr; }
  .council-list { max-height: 36vh; }
}

/* subjects (Révisions IA) */
.subject-chips { display: flex; gap: 8px; flex-wrap: wrap; flex: none; margin: -4px 0 14px; max-height: 96px; overflow-y: auto; }
.subject-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 13px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, .04); color: #dcd8ff; transition: background .2s, border-color .2s, transform .2s var(--spring);
}
.subject-chip:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.subject-chip b { font-size: 11px; padding: 1px 7px; border-radius: 8px; background: rgba(0, 212, 255, .18); color: #9fe8ff; }
.subject-chip.active { color: #fff; background: linear-gradient(135deg, rgba(102, 71, 240, .6), rgba(31, 111, 214, .5)); border-color: rgba(150, 130, 255, .6); box-shadow: 0 0 18px -6px var(--accent); }
.subject-chip.empty { color: var(--muted); border-style: dashed; }
.subject-chip.add { color: #7fe3ff; border-style: dashed; border-color: rgba(0, 212, 255, .4); }
.study-placeholder b { font-family: var(--font-display); letter-spacing: .06em; color: #fff; }

/* invitation link & QR */
.invite-modal { display: grid; gap: 14px; justify-items: center; text-align: center; }
.qr-wrap { padding: 12px; border-radius: 16px; background: #fff; box-shadow: 0 0 40px -10px rgba(124, 92, 255, .8); }
.qr-canvas { display: block; width: 240px; height: 240px; image-rendering: pixelated; }
.invite-link { width: 100%; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, .35); border: 1px solid var(--border); overflow-x: auto; }
.invite-link code { background: none; white-space: nowrap; font-size: 13px; color: #9fe8ff; user-select: all; }
.invite-modal .btn-row { justify-content: center; }

/* ---------------------------------------------------------------- reactions & notifications */
.ico-bell { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9'/><path d='M10.3 21a1.94 1.94 0 0 0 3.4 0'/></svg>"); }
.notify-btn.on { color: var(--gold); }
.notify-btn.on .ico { filter: drop-shadow(0 0 6px rgba(255, 207, 107, .7)); }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reactions:empty { display: none; }
.reaction {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font: inherit; font-size: 14px; cursor: pointer;
  color: var(--text, #fff); background: rgba(255, 255, 255, .06); border: 1px solid var(--border);
  transition: transform .2s var(--spring), background .2s;
  animation: reactIn .45s var(--spring) both;
}
.reaction b { font-size: 12px; font-weight: 600; color: var(--muted); }
.reaction:hover { transform: translateY(-2px) scale(1.06); background: rgba(255, 255, 255, .1); }
.reaction.mine { background: rgba(0, 212, 255, .14); border-color: rgba(0, 212, 255, .5); }
.reaction.mine b { color: var(--accent-2); }
@keyframes reactIn { from { opacity: 0; transform: scale(.4) rotate(-20deg); } }
.reaction-pop {
  position: absolute; bottom: calc(100% - 6px); left: 46px; z-index: 20; display: flex; gap: 2px; padding: 5px;
  border-radius: 999px; background: rgba(20, 16, 50, .96); border: 1px solid rgba(150, 130, 255, .3);
  box-shadow: 0 14px 34px -10px rgba(0, 0, 0, .9); animation: reactIn .3s var(--spring) both;
}
.msg.mine .reaction-pop { left: auto; right: 46px; }
.reaction-pop button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; font-size: 20px; cursor: pointer; transition: transform .15s var(--spring), background .15s; }
.reaction-pop button:hover, .reaction-pop button:focus-visible { transform: scale(1.3) translateY(-3px); background: rgba(255, 255, 255, .08); }
@media (max-width: 520px) { .reaction-pop { left: 0; } .msg.mine .reaction-pop { right: 0; } .reaction-pop button { width: 32px; height: 32px; font-size: 18px; } }

/* ---------------------------------------------------------------- installable app & offline */
.install-banner {
  position: fixed; z-index: 90; left: 50%; top: max(14px, env(safe-area-inset-top)); width: min(560px, calc(100% - 32px));
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 18px;
  background: rgba(16, 12, 42, .94); border: 1px solid rgba(150, 130, 255, .35);
  box-shadow: 0 22px 50px -18px rgba(0, 0, 0, .95), 0 0 34px -12px rgba(124, 92, 255, .7);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transform: translate(-50%, -140%) rotateX(40deg); opacity: 0; transition: transform .6s var(--spring), opacity .4s;
}
.install-banner.in { transform: translate(-50%, 0); opacity: 1; }
.install-icon img { display: block; border-radius: 12px; animation: installFloat 3s ease-in-out infinite; }
@keyframes installFloat { 50% { transform: translateY(-3px) rotate(-4deg); } }
.install-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); }
.install-text b { color: var(--text); font-size: 15px; }
.install-actions { display: flex; gap: 6px; flex: none; }
@media (max-width: 520px) {
  .install-banner { flex-wrap: wrap; }
  .install-text { flex-basis: calc(100% - 60px); }
  .install-actions { width: 100%; justify-content: flex-end; }
}
.offline-pill {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 7px 10px; border-radius: 10px; font-size: 12px; font-weight: 600;
  color: var(--gold); background: rgba(255, 207, 107, .08); border: 1px solid rgba(255, 207, 107, .3);
}
.offline-pill[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .install-banner { transition: opacity .2s; } .install-icon img { animation: none; } }

/* ---------------------------------------------------------------- guides & notification prompt */
.guide-link { display: block; margin: 12px auto 0; font-size: 13px; text-align: center; }
.link-btn.inline { display: inline; padding: 0; font-size: inherit; }
.guide-tabs { margin-bottom: 16px; }
.guide-steps { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 12px; counter-reset: none; }
.guide-step { display: flex; gap: 12px; align-items: flex-start; animation: reactIn .45s var(--spring) both; }
.guide-step:nth-child(2) { animation-delay: .06s; }
.guide-step:nth-child(3) { animation-delay: .12s; }
.guide-step:nth-child(4) { animation-delay: .18s; }
.guide-num {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff;
  background: linear-gradient(135deg, var(--accent, #7c5cff), var(--accent-2)); box-shadow: 0 0 16px -4px var(--accent-2);
}
.guide-step > div > b { display: block; margin-bottom: 2px; color: var(--text); }
.guide-step p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.guide-tip { margin: 8px 0 0; padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5; color: var(--muted); background: rgba(255, 255, 255, .04); border: 1px solid var(--border); }

.journey { list-style: none; display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin: 4px auto 14px; padding: 0; font-size: 13px; color: var(--muted); }
.journey li { display: flex; align-items: center; gap: 7px; }
.journey li span {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700;
  border: 1px solid var(--border); background: rgba(255, 255, 255, .04);
}
.journey li.done span { background: #3dffa8; border-color: #3dffa8; color: #04140c; }
.journey li.current { color: var(--text); font-weight: 600; }
.journey li.current span { border-color: var(--accent-2); color: var(--accent-2); box-shadow: 0 0 12px -2px var(--accent-2); animation: blink 1.6s infinite; }
.journey-note { text-align: center; max-width: 560px; margin: 0 auto 18px; }

.bell-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #ffcf6b, #ff8a3d); }
.bell-icon .ico { width: 24px; height: 24px; color: #2a1400; animation: bellRing 2.4s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes bellRing { 0%, 60%, 100% { transform: none; } 65% { transform: rotate(16deg); } 72% { transform: rotate(-14deg); } 79% { transform: rotate(8deg); } 86% { transform: rotate(-4deg); } }
.danger-zone .notify-btn.on { color: var(--gold); border-color: rgba(255, 207, 107, .4); }
@media (prefers-reduced-motion: reduce) { .bell-icon .ico, .journey li.current span { animation: none; } }
.guide-link { align-self: center; }
.link-btn.inline { align-self: auto; margin: 0; }
.danger-zone { flex-wrap: wrap; }

/* ---------------------------------------------------------------- phone layout fixes */
@media (max-width: 820px) {
  /* The column must never grow wider than the screen because of its content. */
  .app-shell { grid-template-columns: minmax(0, 1fr); padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .sidebar, .panels, .panel { min-width: 0; max-width: 100%; }
  /* Bottom bar: scrolls sideways when the buttons don't fit (7 tabs for delegates). */
  .nav-items { min-width: 0; width: 100%; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; scroll-snap-type: x proximity; }
  .nav-items::-webkit-scrollbar { display: none; }
  .nav-item { flex: 1 0 60px; min-width: 60px; scroll-snap-align: start; }
  .panel-head { flex-wrap: wrap; gap: 10px; }
  .panel-head > div { min-width: 0; }
  .panel-head .btn { flex: none; }
  .channel-tabs { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
  .channel-tab { flex: none; }
  .composer { min-width: 0; }
  .composer textarea { min-width: 0; }
  .msg-body { min-width: 0; }
  .bubble { max-width: 100%; }
  .media, .media img, .media video { max-width: 100%; }
  .modal { max-width: calc(100vw - 20px); }
  .modal-body { overflow-x: hidden; }
  .danger-zone { justify-content: center; }
  .danger-zone .btn { flex: 1 1 140px; }
  .toasts { left: 10px; right: 10px; }
}
@media (max-width: 820px) {
  .nav-item span[data-short] { font-size: 0; }
  .nav-item span[data-short]::after { content: attr(data-short); font-size: 10px; }
  .danger-zone .btn { white-space: normal; line-height: 1.2; }
}
@media (max-width: 820px) { .nav-item { flex: 1 0 48px; min-width: 48px; padding-left: 0; padding-right: 0; } .nav-item span { font-size: 9.5px; } .nav-item span[data-short]::after { font-size: 9.5px; } }

/* ---------------------------------------------------------------- profiles (photo, bio, real name) */
.avatar.has-photo { background-size: cover; background-position: center; background-color: var(--c); color: transparent; }
button.member-avatar { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 50%; }
button.member-avatar:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.member-bio { margin: 4px 0 0; font-size: 13px; line-height: 1.4; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.real-name { color: var(--accent-2); }
.member-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.profile-photo-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.profile-photo .avatar { box-shadow: 0 0 0 3px rgba(0, 212, 255, .35), 0 12px 30px -10px rgba(0, 0, 0, .8); }
.profile-view { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.profile-view > div:last-child { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; }
.pv-name { font-size: 20px; }
.pv-real { margin: 8px 0 0; color: var(--accent-2); display: flex; align-items: center; gap: 6px; }
.pv-bio { margin: 10px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }

/* ---------------------------------------------------------------- phone: long-press sheet on messages */
@media (hover: none) and (pointer: coarse) {
  .msg-actions { display: none !important; }
  .msg-body { max-width: 86%; }
  .bubble { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}
.msg.held .bubble { transform: scale(.97); filter: brightness(1.15); transition: transform .2s var(--spring), filter .2s; box-shadow: 0 0 0 2px var(--accent-2), 0 10px 30px -10px var(--accent-2); }
.sheet-backdrop { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; background: rgba(3, 2, 10, 0); transition: background .25s; }
.sheet-backdrop.open { background: rgba(3, 2, 10, .55); }
.msg-sheet {
  width: min(520px, 100%); padding: 8px 14px max(14px, env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0;
  background: rgba(18, 13, 46, .98); border: 1px solid rgba(150, 130, 255, .3); border-bottom: 0;
  box-shadow: 0 -20px 50px -10px rgba(0, 0, 0, .8); transform: translateY(100%); transition: transform .32s var(--spring);
}
.sheet-backdrop.open .msg-sheet { transform: none; }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .2); margin: 2px auto 12px; }
.sheet-reactions { display: flex; justify-content: space-between; gap: 4px; padding: 6px; margin-bottom: 10px; border-radius: 999px; background: rgba(255, 255, 255, .05); }
.sheet-reactions button { flex: 1; aspect-ratio: 1; max-width: 46px; border: 0; border-radius: 50%; background: none; font-size: 24px; cursor: pointer; transition: transform .15s var(--spring), background .15s; }
.sheet-reactions button:active { transform: scale(1.3); }
.sheet-reactions button.mine { background: rgba(0, 212, 255, .2); box-shadow: inset 0 0 0 1px rgba(0, 212, 255, .6); }
.sheet-actions { display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: rgba(255, 255, 255, .04); }
.sheet-action { display: flex; align-items: center; gap: 14px; padding: 15px 16px; border: 0; background: none; color: var(--text); font: inherit; font-size: 16px; text-align: left; cursor: pointer; }
.sheet-action + .sheet-action { border-top: 1px solid var(--border); }
.sheet-action:active { background: rgba(255, 255, 255, .08); }
.sheet-action .ico { width: 20px; height: 20px; color: var(--accent-2); }
.sheet-action.danger, .sheet-action.danger .ico { color: #ff6b6b; }
.sheet-cancel { width: 100%; margin-top: 10px; padding: 14px; border: 0; border-radius: 16px; background: rgba(255, 255, 255, .08); color: var(--text); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; }

/* ---------------------------------------------------------------- replies, gestures & fun details */
.ico-reply { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 17 4 12l5-5'/><path d='M20 18v-2a4 4 0 0 0-4-4H4'/></svg>"); }
@media (hover: none) and (pointer: coarse) { .messages .msg { touch-action: pan-y; } }
.msg { --swipe-icon: 0; }
.msg-body { will-change: transform; }
.msg::before {
  content: ''; position: absolute; left: 6px; top: 50%; width: 28px; height: 28px; margin-top: -14px; border-radius: 50%;
  background: rgba(0, 212, 255, .18) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300d4ff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M9 17 4 12l5-5'/><path d='M20 18v-2a4 4 0 0 0-4-4H4'/></svg>") center / 16px no-repeat;
  opacity: 0; transform: scale(.5); transition: opacity .15s, transform .2s var(--spring); pointer-events: none;
}
.msg.swipe-ready::before { opacity: 1; transform: scale(1); }

.reply-bar {
  display: flex; align-items: center; gap: 10px; margin: 0 0 6px; padding: 8px 10px 8px 12px; border-radius: 14px;
  background: rgba(0, 212, 255, .08); border: 1px solid rgba(0, 212, 255, .3); border-left-width: 3px; animation: reactIn .3s var(--spring) both;
}
.reply-bar[hidden] { display: none; }
.reply-bar > .ico { color: var(--accent-2); flex: none; }
.reply-bar > div { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.reply-bar b { color: var(--accent-2); }
.reply-bar span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-quote {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; margin: 0 0 6px; padding: 6px 10px; border: 0; border-left: 3px solid var(--accent-2);
  border-radius: 8px; background: rgba(0, 0, 0, .22); color: inherit; font: inherit; font-size: 12.5px; text-align: left; cursor: pointer;
}
.reply-quote b { color: var(--accent-2); font-size: 12px; }
.reply-quote span { opacity: .85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
.msg.mine .reply-quote { border-left-color: #fff; }
.msg.mine .reply-quote b { color: #fff; }
.bubble.has-media .reply-quote { margin: 2px 2px 6px; width: calc(100% - 4px); }

.msg.mentions-me .bubble { box-shadow: 0 0 0 1px rgba(255, 207, 107, .6), 0 0 24px -6px rgba(255, 207, 107, .7); }
.msg.mentions-me .bubble::after { content: '@'; position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #2a1400; background: var(--gold); }
.bubble { position: relative; }

.jump-bottom {
  position: absolute; right: 22px; bottom: 96px; z-index: 5; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(150, 130, 255, .4);
  background: rgba(24, 17, 64, .92); color: var(--text); font-size: 20px; cursor: pointer; box-shadow: 0 10px 26px -8px rgba(0, 0, 0, .9);
  animation: reactIn .35s var(--spring) both; backdrop-filter: blur(10px);
}
.jump-bottom[hidden] { display: none; }
.jump-bottom b:not(:empty) { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; font-size: 11px; line-height: 20px; color: #fff; background: var(--accent-2); }

.heart-burst { position: absolute; left: 50%; top: 50%; font-size: 46px; pointer-events: none; transform: translate(-50%, -50%); animation: heartPop .9s var(--spring) forwards; filter: drop-shadow(0 6px 14px rgba(255, 60, 120, .6)); }
@keyframes heartPop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.2); } 25% { opacity: 1; transform: translate(-50%, -50%) scale(1.25); } 60% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -120%) scale(.9); } }

.confetti { position: fixed; z-index: 95; width: 0; height: 0; pointer-events: none; }
.confetti i { position: absolute; width: 8px; height: 12px; border-radius: 2px; animation: confetti 1.2s cubic-bezier(.15, .7, .3, 1) forwards; }
@keyframes confetti { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(var(--x), calc(var(--y) + 120px)) rotate(var(--r)); opacity: 0; } }

.next-class {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: var(--text); background: rgba(124, 92, 255, .14); border: 1px solid rgba(124, 92, 255, .35); cursor: pointer; max-width: 100%;
}
.next-class[hidden] { display: none; }
.next-class .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--accent)); box-shadow: 0 0 8px var(--c, var(--accent)); flex: none; }
.next-class span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-class.now .dot { animation: blink 1.4s infinite; }
@media (prefers-reduced-motion: reduce) { .heart-burst, .confetti { display: none; } }
.replying .jump-bottom { bottom: 150px; }
.typing-pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 6px; border-radius: 999px; background: rgba(255, 255, 255, .05); border: 1px solid var(--border); animation: reactIn .3s var(--spring) both; }
.typing-avatars { display: flex; }
.typing-avatars .avatar + .avatar { margin-left: -6px; }
.typing-avatars .avatar { box-shadow: 0 0 0 2px rgba(10, 8, 30, .9); font-size: 8px !important; }

/* ---------------------------------------------------------------- status & birthdays */
.status-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 6px; }
.status-chip { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255, 255, 255, .04); color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer; }
.status-chip:hover { border-color: var(--accent-2); }
.member-status { display: inline-block; margin-top: 2px; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: rgba(0, 212, 255, .08); border: 1px solid rgba(0, 212, 255, .25); color: var(--text); }
.head-extra { font-size: 13px; }
.head-extra:empty { display: none; }
.pv-status { margin: 8px 0 0; }
.pv-bday { margin: 4px 0 0; color: var(--gold); }
.bday-banner {
  display: flex; align-items: center; gap: 10px; margin: 0 0 8px; padding: 8px 8px 8px 12px; border-radius: 14px; font-size: 14px;
  background: linear-gradient(90deg, rgba(255, 79, 216, .18), rgba(255, 207, 107, .18)); border: 1px solid rgba(255, 207, 107, .45);
  animation: reactIn .5s var(--spring) both;
}
.bday-banner > span:nth-child(2) { flex: 1; min-width: 0; }
.bday-cake { font-size: 24px; animation: installFloat 2.4s ease-in-out infinite; }

/* ---------------------------------------------------------------- countdowns */
.head-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.next-event { background: rgba(255, 207, 107, .12); border-color: rgba(255, 207, 107, .4); }
.next-event.soon { animation: pulseGold 2s ease-in-out infinite; }
@keyframes pulseGold { 50% { box-shadow: 0 0 16px -2px rgba(255, 207, 107, .8); } }
.events-strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 12px; margin-bottom: 4px; scrollbar-width: thin; }
.events-strip[hidden] { display: none; }
.event-card {
  flex: none; display: flex; align-items: center; gap: 10px; min-width: 190px; padding: 10px 12px; border-radius: 16px; cursor: pointer; text-align: left;
  color: var(--text); font: inherit; background: rgba(255, 255, 255, .05); border: 1px solid var(--border); transition: transform .2s var(--spring), border-color .2s;
}
.event-card:hover { transform: translateY(-2px); border-color: var(--accent-2); }
.event-card.kind-vacances { background: linear-gradient(135deg, rgba(0, 212, 255, .14), rgba(61, 255, 168, .08)); }
.event-card.kind-controle { background: linear-gradient(135deg, rgba(255, 107, 107, .14), rgba(255, 207, 107, .08)); }
.event-card.kind-sortie { background: linear-gradient(135deg, rgba(124, 92, 255, .16), rgba(255, 79, 216, .08)); }
.event-card.soon { border-color: rgba(255, 207, 107, .6); }
.event-card.add { min-width: 0; border-style: dashed; color: var(--muted); }
.ev-emoji { font-size: 24px; }
.ev-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ev-body b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.ev-body small { color: var(--muted); }
.ev-count { font-family: Orbitron, sans-serif; font-weight: 900; font-size: 18px; color: var(--accent-2); }
.event-detail { text-align: center; }
.ev-big { font-family: Orbitron, sans-serif; font-size: 52px; font-weight: 900; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------------------------------------------------------------- themes */
.msg.mine .bubble { background: linear-gradient(135deg, var(--mine-a, #6647f0), var(--mine-b, #1f6fd6)); }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; margin-top: 12px; }
.theme-card { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 8px 12px; border-radius: 18px; border: 1px solid var(--border); background: rgba(255, 255, 255, .04); color: var(--text); font: inherit; cursor: pointer; transition: transform .2s var(--spring), border-color .2s; }
.theme-card:hover { transform: translateY(-3px); }
.theme-card.active { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2), 0 10px 30px -12px var(--accent-2); }
.theme-planet { position: relative; width: 56px; height: 56px; border-radius: 50%; background: radial-gradient(circle at 32% 30%, var(--p3), var(--p2) 35%, var(--p1) 75%); box-shadow: inset -8px -8px 16px rgba(0, 0, 0, .55), 0 0 24px -6px var(--p2); }
.theme-planet::after { content: ''; position: absolute; left: -14px; right: -14px; top: 22px; height: 12px; border-radius: 50%; border: 2px solid var(--r); opacity: .8; transform: rotate(-14deg); }

/* ---------------------------------------------------------------- voice messages */
.ico-mic { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='9' y='2' width='6' height='12' rx='3'/><path d='M19 10v1a7 7 0 0 1-14 0v-1M12 18v4M8 22h8'/></svg>"); }
.composer { position: relative; }
.composer.recording > :not(.voice-rec):not(.popover) { visibility: hidden; }
.voice-rec {
  position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 6px 8px;
  border-radius: inherit; background: rgba(40, 12, 30, .96); border: 1px solid rgba(255, 90, 120, .5); animation: reactIn .3s var(--spring) both;
}
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #ff4d6d; box-shadow: 0 0 12px #ff4d6d; animation: blink 1s infinite; flex: none; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 40px; }
.rec-meter { flex: 1; min-width: 0; height: 28px; display: flex; align-items: center; gap: 3px; overflow: hidden; }
.rec-meter i { flex: 1; min-width: 2px; height: 100%; border-radius: 2px; background: linear-gradient(var(--accent-2), var(--accent)); transform: scaleY(.15); transition: transform .08s linear; }
.rec-cancel .ico { color: #ff6b6b; }
.voice-msg { display: flex; align-items: center; gap: 10px; min-width: 210px; max-width: 280px; padding: 2px 0; }
.voice-play {
  position: relative; flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .92); box-shadow: 0 4px 14px -4px rgba(0, 0, 0, .6);
}
.play-ico { position: absolute; inset: 0; margin: auto; width: 0; height: 0; border-left: 13px solid #3a2a90; border-top: 8px solid transparent; border-bottom: 8px solid transparent; transform: translateX(2px); }
.voice-msg.playing .play-ico { width: 12px; height: 14px; border: 0; transform: none; background: linear-gradient(90deg, #3a2a90 0 4px, transparent 4px 8px, #3a2a90 8px 12px); }
.voice-msg.loading .voice-play::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--accent-2); animation: spin .7s linear infinite; }
.voice-track { flex: 1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .22); cursor: pointer; overflow: hidden; }
.voice-track i { display: block; height: 100%; width: 0; border-radius: 3px; background: #fff; transition: width .15s linear; }
.voice-time { font-size: 12px; font-variant-numeric: tabular-nums; opacity: .85; min-width: 32px; }
.voice-mic { font-size: 14px; opacity: .8; }

/* ---------------------------------------------------------------- "Contacter les délégués" (private conversations) */
.ico-mail { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='2' y='4' width='20' height='16' rx='2'/><path d='m22 7-10 6L2 7'/></svg>"); }
body:not(.can-dm) .dm-nav, body:not(.can-dm) .dm-shortcut { display: none !important; }
.dm-shortcut { position: relative; background: rgba(0, 212, 255, .1); border-color: rgba(0, 212, 255, .4); }
.dm-shortcut .badge:not(:empty) { position: static; margin-left: 4px; }
@media (min-width: 821px) { .dm-shortcut { display: none !important; } }
@media (max-width: 820px) { .dm-nav { display: none !important; } }
.dm-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr; gap: 14px; }
.is-inbox .dm-layout { grid-template-columns: 280px minmax(0, 1fr); }
#panel-dm:not(.is-inbox) .dm-inbox { display: none; }
.dm-inbox { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; padding-right: 4px; }
.dm-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: 14px; border: 1px solid transparent; background: rgba(255, 255, 255, .03); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.dm-item:hover { background: rgba(255, 255, 255, .06); }
.dm-item.active { border-color: var(--accent-2); background: rgba(0, 212, 255, .08); }
.dm-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dm-item-body b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-item-body small { color: var(--muted); font-size: 12px; }
.dm-item.unread b { color: #fff; }
.dm-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); flex: none; }
.dm-new { align-self: flex-start; margin-bottom: 4px; }
.dm-view { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-radius: 18px; background: rgba(0, 0, 0, .15); border: 1px solid var(--border); overflow: hidden; }
.dm-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.dm-head > div { flex: 1; min-width: 160px; display: flex; flex-direction: column; }
.dm-principal { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 10px; border-radius: 999px; background: rgba(255, 207, 107, .1); border: 1px solid rgba(255, 207, 107, .35); cursor: pointer; }
.dm-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 14px 14px; display: flex; flex-direction: column; }
.dm-msg { margin-top: 10px; }
.dm-empty { margin: auto; text-align: center; color: var(--muted); max-width: 360px; padding: 24px; }
.dm-empty span { font-size: 42px; display: block; margin-bottom: 8px; }
.dm-composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px; border-top: 1px solid var(--border); }
.dm-composer[hidden] { display: none; }
.dm-composer textarea { flex: 1; min-width: 0; resize: none; max-height: 140px; }
.dm-back { display: none; }
@media (max-width: 820px) {
  .is-inbox .dm-layout { grid-template-columns: minmax(0, 1fr); }
  .is-inbox .dm-view:not(.open) { display: none; }
  .is-inbox .dm-view.open ~ *, .is-inbox:has(.dm-view.open) .dm-inbox { display: none; }
  .dm-back { display: inline-grid; }
}
.theme-planet { display: block; flex: none; }
.dm-principal { flex: none; white-space: nowrap; }
.dm-principal input { width: 18px; height: 18px; margin: 0; padding: 0; flex: none; accent-color: var(--gold); }

/* ---------------------------------------------------------------- funny avatars */
.fun-avatars { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 8px; max-height: 172px; overflow-y: auto; padding: 4px; }
.fun-avatar {
  aspect-ratio: 1; border-radius: 50%; border: 2px solid transparent; font-size: 24px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; box-shadow: inset -4px -4px 10px rgba(0, 0, 0, .3); transition: transform .2s var(--spring), border-color .2s;
}
.fun-avatar:hover, .fun-avatar:focus-visible { transform: scale(1.12) rotate(-6deg); }
.fun-avatar.active { border-color: #fff; box-shadow: 0 0 0 3px var(--accent-2), inset -4px -4px 10px rgba(0, 0, 0, .3); }

/* ---------------------------------------------------------------- animated (GIF) avatars */
.gif-avatar-box { margin: 2px 0 6px; border-radius: 14px; border: 1px solid var(--border); background: rgba(255, 255, 255, .03); padding: 8px 10px; }
.gif-avatar-box summary { cursor: pointer; font-weight: 600; font-size: 14px; list-style: none; }
.gif-avatar-box summary::-webkit-details-marker { display: none; }
.gif-avatar-box summary::after { content: ' ▾'; color: var(--muted); }
.gif-avatar-box[open] summary::after { content: ' ▴'; }
.gif-avatar-box input[type=search] { width: 100%; margin: 10px 0 8px; }
.gif-avatars { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; max-height: 210px; overflow-y: auto; padding: 2px; }
.gif-avatar { aspect-ratio: 1; padding: 0; border-radius: 50%; overflow: hidden; border: 2px solid transparent; background: rgba(0, 0, 0, .3); cursor: pointer; transition: transform .2s var(--spring); }
.gif-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gif-avatar:hover { transform: scale(1.08); }
.gif-avatar.active { border-color: #fff; box-shadow: 0 0 0 3px var(--accent-2); }
.avatar.has-photo { background-size: cover; background-position: center; }

/* ---------------------------------------------------------------- economy mode (phones / modest devices)
   Blur over an animated backdrop is recomputed at every frame: it is the main cause of lag on phones.
   Here the glass panels become near-opaque, and the heaviest effects are simplified. */
body.eco * { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
body.eco .card { background: linear-gradient(160deg, rgba(26, 19, 70, .96), rgba(10, 8, 32, .95)); }
body.eco .sidebar { background: linear-gradient(180deg, rgba(20, 14, 54, .97), rgba(8, 6, 26, .96)); }
body.eco .panel { background: linear-gradient(165deg, rgba(18, 13, 50, .93), rgba(6, 5, 22, .92)); transition: opacity .25s var(--ease), visibility 0s .25s; transform: none; }
body.eco .panel.active { transition: opacity .25s var(--ease), visibility 0s; }
body.eco .modal-backdrop { background: rgba(3, 2, 10, .82); }
body.eco .install-banner, body.eco .jump-bottom, body.eco .reaction-pop, body.eco .msg-sheet { background: rgb(18, 13, 46); }
body.eco .chat-scroll { perspective: none; }
body.eco .msg { animation: msgInLite .25s ease-out both; }
@keyframes msgInLite { from { opacity: 0; transform: translateY(8px); } }
body.eco .tilt { transform: none !important; }
body.eco .bubble, body.eco .msg.mine .bubble { box-shadow: none; }
body.eco .logo-ring, body.eco .bday-cake, body.eco .install-icon img { animation: none; }
.perf-title { margin: 20px 0 4px; font-size: 15px; }
.perf-seg { margin-top: 8px; }

/* ---------------------------------------------------------------- privacy page */
.tldr { margin: 18px 0 22px; padding: 16px 18px; border-radius: 16px; background: linear-gradient(135deg, rgba(61, 255, 168, .08), rgba(0, 212, 255, .06)); border: 1px solid rgba(61, 255, 168, .35); }
.tldr h2 { margin: 0 0 8px; font-size: 18px; }
.tldr ul { margin: 0; padding-left: 4px; list-style: none; display: grid; gap: 8px; }
.tldr li { line-height: 1.5; }
.toc { display: flex; flex-direction: column; gap: 4px; margin: 0 0 24px; padding: 14px 16px; border-radius: 14px; background: rgba(255, 255, 255, .03); border: 1px solid var(--border); }
.toc a { color: var(--accent-2); text-decoration: none; font-size: 14px; }
.toc a:hover { text-decoration: underline; }
.doc-card h2[id] { scroll-margin-top: 16px; }
.doc-card h3 { margin: 18px 0 6px; font-size: 15px; color: var(--accent-2); }
.legend { font-size: 13px; color: var(--muted); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag-e2e { background: rgba(61, 255, 168, .14); color: #3dffa8; border: 1px solid rgba(61, 255, 168, .4); }
.tag-clear { background: rgba(255, 207, 107, .12); color: var(--gold); border: 1px solid rgba(255, 207, 107, .35); }
.warn { padding: 12px 14px; border-radius: 12px; background: rgba(255, 107, 107, .08); border: 1px solid rgba(255, 107, 107, .35); }
.rights td:last-child { color: var(--text); }
@media (max-width: 600px) {
  .rights thead { display: none; }
  .rights, .rights tbody, .rights tr, .rights td { display: block; width: 100%; }
  .rights tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
  .rights td { padding: 2px 0; border: 0; }
  .rights td:first-child { font-size: 15px; }
  .rights td:nth-child(2) { color: var(--muted); font-size: 13px; }
}

/* ==========================================================================
   Timetable: toolbar, A/B weeks, alerts, AI import, month calendar
   ========================================================================== */
.tt-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 12px; }
.tt-toolbar .hint { flex-basis: 100%; }
.week-nav { display: inline-flex; align-items: center; gap: 6px; }
.week-nav b { display: inline-flex; align-items: center; gap: 8px; min-width: 150px; justify-content: center; font-size: 14px; }
.week-nav .icon-btn:disabled { opacity: .3; }
.week-tag { font: 700 11px/1 var(--font-display); letter-spacing: .06em; padding: 4px 7px; border-radius: 6px; background: rgba(0, 212, 255, .16); color: var(--accent-2); }
.tt-day small { opacity: .7; font-weight: 400; }
.slot.alerted { outline: 2px dashed var(--ko); outline-offset: -2px; }
.slot.alert-absent b, .slot.alert-cancel b { text-decoration: line-through; opacity: .75; }
.slot.alert-room { outline-color: var(--gold); }
.slot-alert { font-weight: 700; color: #fff; background: rgba(255, 95, 122, .35); border-radius: 5px; padding: 0 5px; }
.slot.alert-room .slot-alert { background: rgba(255, 207, 107, .35); }
.next-class.alerted { border-color: var(--ko); }
.alert-card { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(255, 95, 122, .45); background: rgba(255, 95, 122, .12); }
.alert-card.alert-room { border-color: rgba(255, 207, 107, .5); background: rgba(255, 207, 107, .1); }
.alert-card small { color: var(--muted); }
.alert-card .link-btn { justify-self: start; font-size: 12px; }
.alert-list { display: grid; gap: 8px; margin: 6px 0; }
.alert-buttons { display: grid; gap: 8px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.composer-locked .composer textarea { opacity: .7; }
.composer-locked .composer-tools, .composer-locked .send-btn { opacity: .35; pointer-events: none; }

.import-tt { display: grid; gap: 14px; }
.ai-loading { display: grid; justify-items: center; gap: 10px; padding: 30px 10px; text-align: center; }
.import-table-wrap { max-height: 50vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.import-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.import-table th { position: sticky; top: 0; background: rgba(14, 10, 40, .97); text-align: left; padding: 8px 6px; font-weight: 600; color: var(--muted); z-index: 1; }
.import-table td { padding: 4px; border-top: 1px solid var(--border); }
.import-table input, .import-table select { width: 100%; min-width: 64px; padding: 6px 7px; font-size: 13px; }
.import-table td:nth-child(4) input { min-width: 130px; }
.phone-only { display: none; }
@media (pointer: coarse) { .phone-only { display: inline-flex; } }

.calendar { display: grid; gap: 10px; }
.cal-head { display: flex; align-items: center; justify-content: center; gap: 12px; }
.cal-head b { min-width: 170px; text-align: center; text-transform: capitalize; font-size: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dow { text-align: center; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.cal-day {
  min-height: 86px; display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 6px; text-align: left;
  border-radius: 10px; border: 1px solid var(--border); background: rgba(10, 8, 30, .45); color: var(--text); overflow: hidden;
}
.cal-day.out { opacity: .4; }
.cal-day.today { border-color: var(--accent-2); box-shadow: 0 0 16px -6px var(--accent-2); }
.cal-day:hover { border-color: var(--border-strong); }
.cal-num { font-weight: 700; font-size: 13px; }
.cal-items { display: grid; gap: 2px; min-width: 0; }
.cal-item { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 4px; padding: 0 3px; background: rgba(124, 92, 255, .18); }
.cal-item.k-controle { background: rgba(255, 107, 107, .2); }
.cal-item.k-vacances { background: rgba(0, 212, 255, .18); }
.cal-item.k-bday { background: rgba(255, 207, 107, .2); }
.cal-item.k-alert { background: rgba(255, 95, 122, .25); }
.cal-more { font-size: 10px; color: var(--muted); }
.cal-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.cal-detail h4 { margin: 12px 0 6px; }
@media (max-width: 600px) {
  .cal-day { min-height: 54px; padding: 4px; }
  .cal-items { display: flex; flex-wrap: wrap; gap: 2px; }
  .cal-item { font-size: 0; width: 8px; height: 8px; padding: 0; border-radius: 50%; }
  .cal-grid { gap: 3px; }
}

/* ==========================================================================
   Chat studio: drawing, memes, wheel of fortune
   ========================================================================== */
.draw-box, .meme-box { display: grid; gap: 12px; }
.draw-canvas, .meme-canvas { width: 100%; height: auto; max-height: 60vh; object-fit: contain; border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; }
.meme-canvas { background: #1b1450; cursor: default; }
.draw-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.draw-colors { display: flex; gap: 6px; flex-wrap: wrap; }
.wheel-box { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.wheel-stage { display: grid; justify-items: center; gap: 12px; }
.wheel-canvas { width: min(100%, 320px); height: auto; filter: drop-shadow(0 10px 30px rgba(124, 92, 255, .45)); }
.wheel-result { font: 700 20px var(--font-display); min-height: 1.5em; margin: 0; text-align: center; }
.wheel-setup { display: grid; gap: 8px; }
.wheel-members { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 4px 10px; max-height: 240px; overflow: auto; }
@media (max-width: 700px) { .wheel-box { grid-template-columns: 1fr; } }

/* ==========================================================================
   Chat: polls, stickers, edited / ephemeral / forwarded messages, tools menu
   ========================================================================== */
.poll { display: grid; gap: 8px; min-width: min(280px, 70vw); }
.poll-q { font-weight: 700; }
.poll.wyr .poll-q::before { content: '🤔 '; }
.poll-opt { position: relative; display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: rgba(0, 0, 0, .25); color: var(--text); text-align: left; overflow: hidden; font: inherit; cursor: pointer; }
.poll-opt::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--pct, 0%); background: linear-gradient(90deg, rgba(124, 92, 255, .45), rgba(0, 212, 255, .25)); transition: width .5s var(--ease); z-index: 0; }
.poll-opt > * { position: relative; z-index: 1; }
.poll-opt.mine { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2) inset; }
.poll-opt b { font-variant-numeric: tabular-nums; }
.poll-foot { font-size: 12px; color: var(--muted); }
.bubble.sticker-bubble { background: none !important; box-shadow: none !important; border: 0 !important; padding: 0 !important; }
.sticker-img { width: 140px; height: 140px; object-fit: contain; display: block; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .45)); }
.msg-flags { font-size: 11px; color: var(--faint); font-style: italic; }
.fwd-tag { display: block; font-size: 11px; color: var(--faint); margin-bottom: 2px; }
.eph-tag { font-size: 11px; color: var(--gold); }
.translation { margin-top: 6px; padding: 6px 10px; border-left: 3px solid var(--accent-2); background: rgba(0, 212, 255, .08); border-radius: 0 8px 8px 0; font-size: 13px; }
.translation small { display: block; color: var(--faint); font-size: 11px; }
.blurred { position: relative; }
.blurred > img, .blurred > video { filter: blur(26px) saturate(.6); }
.blurred::after { content: '🙈 Toucher pour voir'; position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; color: #fff; text-shadow: 0 2px 8px #000; cursor: pointer; }
.tools-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.tools-menu button { display: grid; justify-items: center; gap: 4px; padding: 14px 8px; border-radius: 14px; border: 1px solid var(--border); background: rgba(10, 8, 30, .5); color: var(--text); font: 600 13px var(--font); cursor: pointer; }
.tools-menu button span { font-size: 26px; }
.tools-menu button:hover { border-color: var(--accent-2); }
.tools-menu button.on { border-color: var(--gold); background: rgba(255, 207, 107, .12); }
.composer-mode { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px 10px 0; }
.composer-mode:empty { display: none; }
.mode-pill { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: rgba(255, 207, 107, .15); color: var(--gold); border: 1px solid rgba(255, 207, 107, .4); }
.mode-pill button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; max-height: 260px; overflow: auto; }
.sticker-grid button { border: 0; background: rgba(0, 0, 0, .25); border-radius: 10px; padding: 4px; cursor: pointer; }
.sticker-grid img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.search-results { display: grid; gap: 6px; max-height: 55vh; overflow: auto; }
.search-hit { display: grid; gap: 2px; text-align: left; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: rgba(10, 8, 30, .5); color: var(--text); cursor: pointer; font: inherit; }
.search-hit mark { background: rgba(255, 207, 107, .4); color: #fff; border-radius: 3px; }
.search-hit small { color: var(--faint); }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.gallery-grid .media { width: 100% !important; aspect-ratio: 1 !important; margin: 0; }
.gallery-grid .media img, .gallery-grid .media video { width: 100%; height: 100%; object-fit: cover; }
.thread-view { display: grid; gap: 10px; max-height: 60vh; overflow: auto; }
.thread-item { padding: 8px 10px; border-radius: 10px; background: rgba(10, 8, 30, .5); border: 1px solid var(--border); }
.thread-item.root { border-color: var(--accent); }
.thread-item b { font-size: 13px; }
.thread-item time { font-size: 11px; color: var(--faint); margin-left: 6px; }
.formula-bar { display: flex; flex-wrap: wrap; gap: 4px; }
.formula-bar button { border: 1px solid var(--border); background: rgba(0, 0, 0, .25); color: var(--text); border-radius: 8px; padding: 4px 8px; font: 13px var(--font); cursor: pointer; }
.formula-preview { min-height: 2.2em; padding: 8px; border-radius: 10px; background: rgba(0, 0, 0, .25); overflow-x: auto; }
.rocket-fly { position: fixed; z-index: 60; pointer-events: none; font-size: 22px; animation: rocket-fly .9s var(--ease) forwards; }
@keyframes rocket-fly { 0% { transform: translate(0, 0) rotate(-45deg); opacity: 1; } 100% { transform: translate(40px, -260px) rotate(-45deg) scale(.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .rocket-fly { display: none; } }
.voice-speed { border: 1px solid var(--border-strong); background: rgba(0, 0, 0, .25); color: var(--text); border-radius: 8px; padding: 1px 6px; font: 700 11px var(--font); cursor: pointer; }
.chat-head-tools { display: flex; align-items: center; gap: 4px; }
.chat-head-tools .icon-btn { font-size: 16px; }
.reaction-pop.all { display: grid; grid-template-columns: repeat(8, 1fr); width: min(320px, 86vw); }
.reaction-pop .more, .sheet-reactions button:last-child { font-weight: 700; }
.sheet-reactions { flex-wrap: wrap; }
.more-btn { font-size: 20px; font-weight: 700; }
@media (max-width: 600px) { .chat-head-tools .icon-btn { width: 32px; height: 32px; } }

/* ==========================================================================
   Vie de classe: tiles, posts, leaderboard, mascot, games, live quiz
   ========================================================================== */
#panel-life { overflow-y: auto; }
.life-body { display: grid; gap: 14px; padding-bottom: 30px; }
.life-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.life-top > .card { padding: 16px; display: grid; gap: 8px; align-content: start; text-align: left; color: var(--text); font: inherit; }
.qotd p { font: 600 17px/1.35 var(--font); margin: 0; }
.qotd small, .progress-mini > small:first-child { color: var(--accent-2); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
.progress-card { cursor: pointer; border: 1px solid var(--border); }
.life-title { margin: 8px 0 0; font-size: 15px; }
.life-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.life-tile { display: grid; gap: 4px; padding: 14px; text-align: left; color: var(--text); font: inherit; cursor: pointer; border: 1px solid var(--border); }
.life-tile:hover { border-color: var(--accent-2); }
.tile-emoji { font-size: 28px; }
.life-tile small { color: var(--muted); font-size: 12px; }
.mascot { display: flex; gap: 12px; align-items: center; }
.mascot-body { font-size: 54px; animation: mascot-bob 3s ease-in-out infinite; filter: drop-shadow(0 6px 16px rgba(124, 92, 255, .6)); }
@keyframes mascot-bob { 50% { transform: translateY(-6px) rotate(-4deg); } }
@media (prefers-reduced-motion: reduce) { .mascot-body { animation: none; } }
.xp-bar { height: 8px; border-radius: 99px; background: rgba(0, 0, 0, .35); overflow: hidden; }
.xp-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: inherit; }
.level { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.streak { color: var(--gold); font-weight: 700; }
.challenges { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.challenges li.done { color: var(--ok); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge-chip { display: grid; justify-items: center; gap: 2px; width: 84px; padding: 8px 4px; border-radius: 12px; border: 1px solid var(--border); font-size: 24px; opacity: .35; filter: grayscale(1); }
.badge-chip.got { opacity: 1; filter: none; border-color: var(--gold); background: rgba(255, 207, 107, .08); }
.badge-chip small { font-size: 10px; text-align: center; }
.leaderboard { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.leaderboard li { display: grid; grid-template-columns: 34px 1fr auto; gap: 2px 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: rgba(10, 8, 30, .5); border: 1px solid var(--border); }
.leaderboard li.me { border-color: var(--accent-2); }
.leaderboard .rank { font-weight: 700; text-align: center; }
.leaderboard small { grid-column: 2; color: var(--muted); }
.lb-badges { grid-row: 1 / span 2; grid-column: 3; }
.post-form { display: grid; gap: 8px; padding: 12px; border-radius: 12px; border: 1px dashed var(--border-strong); }
.post-list { display: grid; gap: 8px; max-height: 55vh; overflow: auto; }
.post { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; background: rgba(10, 8, 30, .5); border: 1px solid var(--border); }
.post p { margin: 0; white-space: pre-wrap; }
.post.done, .post.sealed { opacity: .7; }
.post-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.post-foot { display: flex; align-items: center; gap: 12px; }
.like { border: 0; background: none; color: var(--text); cursor: pointer; font: inherit; }
.memory-photo { max-width: 100%; max-height: 320px; border-radius: 10px; object-fit: contain; }
.answer { padding: 8px 10px; border-left: 3px solid var(--ok); background: rgba(61, 255, 168, .07); border-radius: 0 8px 8px 0; }
.bring-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.bring-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; }
.bring-list li small { color: var(--muted); }
.bring-list li.taken small { color: var(--ok); }
.bring-list li button { grid-row: 1 / span 2; grid-column: 2; }
.kitty-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 4px 10px; }
.kitty-people .paid span { color: var(--ok); }
.award-podium { margin: 0; }
.bday-card { display: grid; gap: 10px; }
.bday-card .big { font-size: 18px; font-weight: 700; margin: 0; }
.card-word { padding: 10px; border-radius: 12px; background: linear-gradient(135deg, rgba(255, 79, 216, .12), rgba(124, 92, 255, .12)); }
.card-word p { margin: 4px 0 0; }
.mosaic-box { overflow: auto; max-height: 65vh; }
.mosaic { max-width: 100%; height: auto; border-radius: 12px; }
.game-card { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--border-strong); background: rgba(124, 92, 255, .12); }
.game-box { display: grid; gap: 12px; justify-items: center; }
.game-head { display: flex; gap: 10px; align-items: center; }
.game-status { font-weight: 700; margin: 0; text-align: center; }
.ttt { display: grid; grid-template-columns: repeat(3, 80px); gap: 6px; }
.ttt .cell { width: 80px; height: 80px; border-radius: 14px; border: 1px solid var(--border-strong); background: rgba(10, 8, 30, .6); font-size: 36px; cursor: pointer; }
.ttt .cell:disabled { cursor: default; }
.c4 { display: grid; grid-template-columns: repeat(7, 44px); gap: 4px; padding: 8px; border-radius: 14px; background: #1b3b9c; }
.c4-col { display: grid; gap: 4px; border: 0; background: none; padding: 0; cursor: pointer; }
.c4-col:disabled { cursor: default; }
.c4-cell { width: 44px; height: 44px; border-radius: 50%; background: #0b0820; }
.c4-cell.p-R { background: #ff5f7a; }
.c4-cell.p-J { background: #ffe14d; }
.c4-col:not(:disabled):hover .c4-cell.p-\. { background: #26204d; }
.rps { display: grid; gap: 12px; justify-items: center; }
.rps-choice { font-size: 18px; }
.rps-result { display: flex; gap: 30px; }
.rps-result div { display: grid; justify-items: center; gap: 4px; font-size: 22px; }
.rps-result b { font-size: 14px; }
@media (max-width: 420px) { .c4 { grid-template-columns: repeat(7, 36px); } .c4-cell { width: 36px; height: 36px; } }
.quiz-editor { display: grid; gap: 10px; }
.quiz-q { display: grid; gap: 6px; padding: 10px; border-radius: 12px; border: 1px solid var(--border); }
.lq-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.lq-choice { display: flex; align-items: center; gap: 6px; }
.lq-choice input[type=radio] { width: auto; }
.quiz-live { display: grid; gap: 12px; }
.quiz-counter { color: var(--muted); margin: 0; }
.quiz-question { font: 700 20px/1.3 var(--font); margin: 0; }
.quiz-answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.quiz-answer { min-height: 64px; border: 0; border-radius: 14px; background: var(--c); color: #0b0820; font: 700 16px var(--font); cursor: pointer; padding: 10px; }
.quiz-answer:disabled { cursor: default; opacity: .6; }
.quiz-answer.picked { outline: 4px solid #fff; opacity: 1; }
.quiz-answer.right { outline: 4px solid var(--ok); opacity: 1; box-shadow: 0 0 24px var(--ok); }
.lq-feedback { font-size: 18px; font-weight: 700; margin: 0; }
@media (max-width: 520px) { .quiz-answers, .lq-choices { grid-template-columns: 1fr; } }

/* ==========================================================================
   Revision: extras bar, flashcards, mind map, Pomodoro, whiteboard, grade book
   ========================================================================== */
.study-extras { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.flash-box { display: grid; gap: 12px; justify-items: center; }
.flash-card { position: relative; width: min(520px, 100%); min-height: 220px; border: 0; background: none; perspective: 1000px; cursor: pointer; padding: 0; color: var(--text); font: inherit; }
.flash-face { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; border-radius: 18px; backface-visibility: hidden; transition: transform .5s var(--ease); font-size: 18px; text-align: center; overflow: auto; }
.flash-face.front { background: linear-gradient(135deg, rgba(124, 92, 255, .35), rgba(0, 212, 255, .18)); border: 1px solid var(--border-strong); }
.flash-face.back { background: linear-gradient(135deg, rgba(61, 255, 168, .22), rgba(0, 212, 255, .15)); border: 1px solid var(--ok); transform: rotateY(180deg); }
.flash-card.flipped .front { transform: rotateY(180deg); }
.flash-card.flipped .back { transform: rotateY(360deg); }
.flash-rate[hidden] { display: none; }
.flash-done { text-align: center; }
.flash-done .big { font-size: 20px; font-weight: 700; }
.mindmap { display: grid; gap: 14px; justify-items: center; }
.mm-center { padding: 14px 22px; border-radius: 999px; background: linear-gradient(135deg, var(--accent), var(--accent-3)); font: 700 18px var(--font); text-align: center; }
.mm-center p { margin: 0; }
.mm-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; width: 100%; }
.mm-branch { border-radius: 14px; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); padding: 10px 12px; }
.mm-branch-title { font-weight: 700; color: var(--c); }
.mm-branch-title p { margin: 0; }
.mm-branch ul { margin: 6px 0 0; padding-left: 18px; }
.mm-branch li p { margin: 0; display: inline; }
.mm-branch li li { color: var(--muted); font-size: 13px; }
.plan { margin: 6px 0; padding-left: 20px; display: grid; gap: 3px; }
.pomodoro { display: grid; justify-items: center; gap: 6px; padding: 20px; border-radius: 18px; }
.pomodoro.focus { background: radial-gradient(circle, rgba(255, 95, 122, .2), transparent 70%); }
.pomodoro.pause { background: radial-gradient(circle, rgba(61, 255, 168, .2), transparent 70%); }
.pomo-phase { font-weight: 700; margin: 0; }
.pomo-time { font: 900 64px/1 var(--font-display); margin: 0; font-variant-numeric: tabular-nums; }
.board-canvas { width: 100%; height: auto; max-height: 65vh; object-fit: contain; border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; }
.grade-form { grid-template-columns: 1.4fr .7fr auto .6fr auto .6fr auto; align-items: center; }
.grade-form input { min-width: 0; }
.grade-overall { font-size: 17px; }
.grade-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.grade-chip { border: 1px solid var(--border-strong); background: rgba(0, 0, 0, .25); color: var(--text); border-radius: 8px; padding: 3px 8px; cursor: pointer; font: 600 13px var(--font); }
@media (max-width: 600px) { .grade-form { grid-template-columns: 1fr 1fr; } }

/* ─── Delegate dashboard & moderation log ─── */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.dash-stat { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: rgba(124, 92, 255, .08); }
.dash-stat b { font-size: 24px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.dash-stat small { color: var(--muted); font-size: 12px; line-height: 1.3; }
.log-line { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.log-line small { color: var(--muted); flex: none; min-width: 92px; }
.log-line span { overflow-wrap: anywhere; }

/* ─── Council PDF export (print only the sheet) ─── */
.print-sheet { display: none; }
@media print {
  body.printing > *:not(.print-sheet) { display: none !important; }
  body.printing { background: #fff !important; color: #000 !important; }
  body.printing .print-sheet { display: block; color: #000; font: 12px/1.4 system-ui, sans-serif; }
  .print-sheet h1 { font-size: 20px; margin: 0 0 4px; }
  .print-meta { color: #555; margin: 0 0 14px; }
  .print-sheet table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
  .print-sheet th, .print-sheet td { border: 1px solid #999; padding: 6px 8px; text-align: left; vertical-align: top; }
  .print-sheet th { background: #eee; }
  .print-sheet tr { break-inside: avoid; }
}

/* ─── Wave 7: display settings (display.js) ─── */
#view-app .app-shell { zoom: var(--ui-zoom, 1); height: calc(100dvh / var(--ui-zoom, 1)); }
.modal { zoom: var(--ui-zoom, 1); max-height: calc((100dvh - 32px) / var(--ui-zoom, 1)); }
body.font-spaced { letter-spacing: .035em; word-spacing: .14em; }
body.font-spaced .text, body.font-spaced p { line-height: 1.7; }
body.colorblind { --ok: #4da3ff; --ko: #ff9f1c; }
.switch-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; padding: 6px 0; }
.switch-row input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.switch-row span { display: flex; flex-direction: column; gap: 2px; }
.switch-row.small { font-size: 13px; align-items: center; }
.display-form .sample { padding: 10px 14px; border-radius: 12px; background: rgba(0, 0, 0, .25); border: 1px dashed var(--border-strong); margin: 0; }
.wall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.wall-card { height: 64px; border-radius: 12px; border: 2px solid var(--border); color: #fff; font: 600 12px var(--font); cursor: pointer; display: flex; align-items: flex-end; padding: 6px; background-color: rgba(8, 6, 26, .8); }
.wall-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.wall-card span { background: rgba(0, 0, 0, .45); border-radius: 6px; padding: 1px 6px; }
[data-wall="stars"], body[data-wallpaper="stars"] .chat-scroll {
  background-image: radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent), radial-gradient(1px 1px at 90px 70px, #cfd8ff, transparent),
    radial-gradient(1.2px 1.2px at 150px 20px, #fff, transparent), radial-gradient(1px 1px at 60px 120px, #ffe7ff, transparent),
    radial-gradient(1.4px 1.4px at 170px 140px, #fff, transparent);
  background-size: 200px 160px;
}
[data-wall="grid"], body[data-wallpaper="grid"] .chat-scroll {
  background-image: linear-gradient(transparent 0 95%, rgba(255, 79, 216, .22) 95%), linear-gradient(90deg, transparent 0 95%, rgba(0, 212, 255, .18) 95%),
    linear-gradient(180deg, rgba(124, 92, 255, .12), rgba(255, 79, 216, .12));
  background-size: 34px 34px, 34px 34px, 100% 100%;
}
[data-wall="nebula"], body[data-wallpaper="nebula"] .chat-scroll {
  background-image: radial-gradient(60% 50% at 20% 20%, rgba(124, 92, 255, .28), transparent 70%), radial-gradient(50% 60% at 85% 70%, rgba(255, 79, 216, .22), transparent 70%),
    radial-gradient(40% 40% at 50% 100%, rgba(0, 212, 255, .18), transparent 70%);
}
[data-wall="aurora"], body[data-wallpaper="aurora"] .chat-scroll {
  background-image: linear-gradient(170deg, rgba(31, 209, 138, .22), transparent 40%), linear-gradient(190deg, transparent 30%, rgba(124, 92, 255, .2) 70%, transparent);
}
[data-wall="dots"], body[data-wallpaper="dots"] .chat-scroll {
  background-image: radial-gradient(rgba(255, 255, 255, .12) 1.5px, transparent 1.6px); background-size: 22px 22px;
}
[data-wall="waves"], body[data-wallpaper="waves"] .chat-scroll {
  background-image: repeating-radial-gradient(circle at 50% 120%, transparent 0 18px, rgba(0, 212, 255, .08) 18px 20px);
}
body[data-wallpaper]:not([data-wallpaper="none"]) .chat-scroll { background-attachment: local; border-radius: var(--radius-sm); }
body.calm .aurora, body.calm .mood-badge, body.calm .c-core, body.calm .bg-star, body.calm .planet-spin { animation: none !important; }
body.calm .aurora { display: none; }
.desktop-only { display: inline-flex; }
@media (pointer: coarse) { .desktop-only { display: none; } }

/* ─── Wave 7: custom theme ─── */
.theme-perso { display: flex; gap: 14px; align-items: center; padding: 12px 14px; margin-top: 12px; flex-wrap: wrap; }
.theme-perso.active { border-color: var(--accent); }
.theme-perso > div:nth-child(2) { flex: 1; min-width: 160px; display: flex; flex-direction: column; }
.theme-perso-colors { display: flex; gap: 8px; }
.theme-perso-colors input { width: 46px; height: 46px; border: 2px solid var(--border-strong); border-radius: 12px; background: none; padding: 2px; cursor: pointer; }

/* ─── Wave 7: frames, moods, banners, ID card (looks.js) ─── */
.avatar { position: relative; }
.avatar.framed { box-shadow: 0 0 0 2px var(--f1), 0 0 0 4px var(--f2), 0 0 16px -2px var(--f2); }
.mood-badge {
  position: absolute; right: -6%; bottom: -6%; width: 44%; height: 44%; min-width: 14px; min-height: 14px;
  display: grid; place-items: center; font-size: max(10px, 1em * .75); line-height: 1; border-radius: 50%;
  background: rgba(8, 6, 26, .9); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .25); pointer-events: none;
}
.mood-bounce { display: inline-block; animation: moodBounce 1.4s ease-in-out infinite; }
.mood-pulse { display: inline-block; animation: moodPulse 1.6s ease-in-out infinite; }
.mood-float { display: inline-block; animation: moodFloat 2.6s ease-in-out infinite; }
.mood-shake { display: inline-block; animation: moodShake 1.8s ease-in-out infinite; }
.mood-spin { display: inline-block; animation: moodSpin 3s linear infinite; }
.mood-tilt { display: inline-block; animation: moodTilt 2s ease-in-out infinite; }
.mood-flicker { display: inline-block; animation: moodFlicker 1.2s steps(3) infinite; }
.mood-launch { display: inline-block; animation: moodLaunch 2.2s ease-in infinite; }
@keyframes moodBounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-18%); } 60% { transform: translateY(4%); } }
@keyframes moodPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@keyframes moodFloat { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-12%) rotate(4deg); } }
@keyframes moodShake { 0%, 60%, 100% { transform: translateX(0); } 65%, 75%, 85% { transform: translateX(-10%); } 70%, 80%, 90% { transform: translateX(10%); } }
@keyframes moodSpin { to { transform: rotate(360deg); } }
@keyframes moodTilt { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }
@keyframes moodFlicker { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.1) translateY(-4%); opacity: .8; } }
@keyframes moodLaunch { 0%, 60% { transform: translate(0, 0); opacity: 1; } 85% { transform: translate(40%, -60%); opacity: 0; } 86% { transform: translate(-30%, 40%); opacity: 0; } 100% { transform: translate(0, 0); opacity: 1; } }

.looks-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 12px; }
.looks-box summary { cursor: pointer; font-weight: 600; }
.looks-box[open] { gap: 14px; }
.banner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.banner-pick { height: 48px; border-radius: 10px; border: 2px solid transparent; color: #fff; font: 700 12px var(--font); text-shadow: 0 1px 3px #000; cursor: pointer; }
.banner-pick.active, .frame-pick.active, .mood-pick.active { border-color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
.frame-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.frame-pick { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 12px; border: 2px solid var(--border); background: rgba(0, 0, 0, .2); color: var(--text); cursor: pointer; font: 12px var(--font); }
.frame-pick.locked { opacity: .45; cursor: not-allowed; }
.frame-demo { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; background: rgba(255, 255, 255, .08); box-shadow: 0 0 0 2px var(--f1), 0 0 0 4px var(--f2), 0 0 14px -2px var(--f2); }
.mood-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.mood-pick { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--border); background: rgba(0, 0, 0, .2); font-size: 22px; cursor: pointer; display: grid; place-items: center; }

.profile-view-wrap { display: flex; flex-direction: column; }
.pv-banner { height: 92px; border-radius: 14px; margin-bottom: -46px; box-shadow: inset 0 -30px 40px -20px rgba(0, 0, 0, .5); }
.profile-view.has-banner { padding: 0 12px; }
.profile-view.has-banner > .avatar { box-shadow: 0 0 0 4px var(--bg), 0 8px 24px -6px var(--c); }
.profile-view.has-banner > .avatar.framed { box-shadow: 0 0 0 3px var(--f1), 0 0 0 6px var(--f2), 0 0 20px -2px var(--f2); }
.profile-view.has-banner > div:last-child { padding-top: 50px; }
.pv-song, .pv-mood { margin: 6px 0 0; }
.pv-song a { color: var(--accent-2); }

.id-card {
  position: relative; overflow: hidden; border-radius: 22px; padding: 18px 20px; color: #fff; max-width: 560px; margin: 0 auto;
  background: linear-gradient(120deg, var(--b1), var(--b2), var(--b3)); box-shadow: 0 20px 50px -20px var(--b2), inset 0 0 0 1px rgba(255, 255, 255, .25);
}
.id-card::before { content: ''; position: absolute; inset: 0; background: radial-gradient(1px 1px at 12% 20%, #fff, transparent), radial-gradient(1.5px 1.5px at 70% 12%, #fff, transparent), radial-gradient(1px 1px at 88% 30%, #fff, transparent), radial-gradient(1px 1px at 35% 8%, #fff, transparent); pointer-events: none; }
.id-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.id-top b { font-family: var(--font-display); letter-spacing: .08em; }
.id-top small { opacity: .8; }
.id-body { display: flex; gap: 18px; align-items: center; margin-top: 14px; padding: 14px; border-radius: 16px; background: rgba(5, 3, 15, .5); flex-wrap: wrap; }
.id-fields { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 2px; }
.id-name { font-size: 22px; }
.id-fields small { opacity: .75; }
.id-fields dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 10px 0 0; font-size: 14px; }
.id-fields dt { opacity: .65; }
.id-fields dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.id-badges { margin-top: 8px; font-size: 20px; letter-spacing: 2px; }
.id-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 13px; opacity: .85; flex-wrap: wrap; }

/* ─── Wave 8: constellation, solar system, aurora, easter eggs (cosmos.js) ─── */
.constellation-box, .solar-box { display: flex; flex-direction: column; gap: 10px; }
.constellation { width: 100%; height: auto; border-radius: 16px; background: radial-gradient(ellipse at 50% 40%, #120a36, #03020a 75%); }
.constellation .bg-star { fill: #fff; opacity: .5; animation: twinkle 3.2s ease-in-out infinite; }
.constellation .c-line { stroke: rgba(200, 190, 255, .45); stroke-width: 1; stroke-dasharray: 400; stroke-dashoffset: 400; animation: drawLine 1.2s ease forwards; }
.constellation .c-star { cursor: pointer; opacity: 0; animation: starIn .6s ease forwards; outline: none; }
.constellation .c-star:hover .c-core, .constellation .c-star:focus-visible .c-core { stroke: #fff; stroke-width: 2; }
.constellation .c-core { animation: twinkle 2.8s ease-in-out infinite; filter: drop-shadow(0 0 4px #fff); }
.constellation .c-label { fill: rgba(236, 235, 255, .85); font: 600 10px var(--font); text-anchor: middle; pointer-events: none; }
.constellation.no-labels .c-label { display: none; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
@keyframes starIn { from { opacity: 0; } to { opacity: 1; } }
.solar { width: min(100%, 520px); height: auto; margin: 0 auto; display: block; }
.solar .orbit { fill: none; stroke: rgba(170, 150, 255, .22); stroke-width: 1.5; stroke-dasharray: 4 6; }
.solar .sun { fill: #ffcf6b; filter: drop-shadow(0 0 24px #ff9f1c); }
.solar .sun-label { font-size: 40px; text-anchor: middle; }
.solar .planet { filter: drop-shadow(0 0 8px rgba(255, 255, 255, .35)); stroke: rgba(255, 255, 255, .5); stroke-width: 1.5; }
.solar .planet-spin { transform-origin: 500px 500px; transform-box: view-box; animation-name: orbitSpin; animation-timing-function: linear; animation-iteration-count: infinite; }
@keyframes orbitSpin { from { rotate: 0deg; } to { rotate: 360deg; } }
.solar-legend { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 14px; }
.solar-legend li { display: flex; align-items: center; gap: 8px; }
.solar-legend .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.solar-legend small { color: var(--muted); margin-left: auto; }

.aurora { position: fixed; inset: 0 0 auto; height: 55vh; z-index: 1; pointer-events: none; opacity: 0; transition: opacity 3s ease; mix-blend-mode: screen; overflow: hidden; }
.aurora span { position: absolute; inset: -20% -10% auto; height: 70%; filter: blur(40px); border-radius: 50%; animation: auroraWave 14s ease-in-out infinite alternate; }
.aurora span:nth-child(1) { background: linear-gradient(90deg, transparent, rgba(31, 209, 138, .55), rgba(0, 212, 255, .35), transparent); }
.aurora span:nth-child(2) { background: linear-gradient(90deg, transparent, rgba(124, 92, 255, .45), rgba(255, 79, 216, .3), transparent); animation-duration: 19s; animation-delay: -6s; top: -5%; }
.aurora span:nth-child(3) { background: linear-gradient(90deg, transparent, rgba(180, 255, 92, .3), transparent); animation-duration: 23s; animation-delay: -11s; }
body.class-lively[data-view="app"] .aurora { opacity: .5; }
@keyframes auroraWave { 0% { transform: translateX(-15%) skewX(-12deg) scaleY(.8); } 100% { transform: translateX(15%) skewX(12deg) scaleY(1.1); } }
body.rainbow .app-shell { animation: rainbow 1.5s linear 4; }
@keyframes rainbow { to { filter: hue-rotate(360deg); } }
body.barrel-roll .app-shell { animation: barrelRoll 1.2s var(--ease); }
@keyframes barrelRoll { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .aurora span, .mood-badge, .constellation *, .planet-spin { animation: none !important; } .constellation .c-star, .constellation .c-line { opacity: 1; stroke-dashoffset: 0; } }

/* ─── Wave 9: security, devices, shortcuts, sharing ─── */
.security-form h4 { margin: 8px 0 0; }
.device-list { display: flex; flex-direction: column; gap: 8px; }
.device-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: rgba(0, 0, 0, .2); }
.device-row.current { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.device-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.device-icon { font-size: 22px; }
.dev-tag { margin-left: 8px; font-size: 11px; padding: 1px 8px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 30%, transparent); font-weight: 600; }
.passkey-box { display: flex; flex-direction: column; gap: 8px; }
.passkey-box .row input { flex: 1; min-width: 0; }
.quiet-range { max-width: 320px; }
.quick-login { margin-top: 10px; }
.shortcut-list { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; align-items: center; }
.shortcut-list dd { margin: 0; color: var(--muted); }
kbd { display: inline-block; min-width: 22px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border-strong); border-bottom-width: 3px; background: rgba(255, 255, 255, .06); font: 600 12px var(--font); text-align: center; }
.share-box { display: flex; flex-direction: column; gap: 10px; }
.share-files { margin: 0; padding-left: 18px; }
.share-text { margin: 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: rgba(0, 0, 0, .25); border-radius: 0 10px 10px 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ─── Birthday party (birthday.js) ─── */
.bday-party {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, rgba(255, 79, 216, .35), rgba(3, 2, 10, .88) 70%);
  opacity: 0; transition: opacity .5s ease; backdrop-filter: blur(6px);
}
.bday-party.in { opacity: 1; }
.bday-party.out { opacity: 0; }
.bday-confetti, .bday-balloons { position: absolute; inset: 0; pointer-events: none; }
.bday-confetti i { position: absolute; top: -20px; border-radius: 2px; animation: confettiFall linear infinite; }
@keyframes confettiFall {
  0% { transform: translate(0, -20px) rotate(0); opacity: 1; }
  100% { transform: translate(var(--drift), 110vh) rotate(var(--spin)); opacity: .9; }
}
.bday-balloons span { position: absolute; bottom: -90px; animation: balloonRise ease-in infinite; }
@keyframes balloonRise {
  0% { transform: translate(0, 0); }
  50% { transform: translate(var(--sway), -55vh); }
  100% { transform: translate(0, -120vh); }
}
.bday-card {
  position: relative; text-align: center; max-width: 520px; width: 100%; padding: 26px 22px 20px; border-radius: 28px;
  background: linear-gradient(160deg, rgba(40, 20, 90, .92), rgba(12, 8, 34, .95));
  border: 1px solid rgba(255, 207, 107, .5); box-shadow: 0 0 60px -10px rgba(255, 79, 216, .7), 0 0 0 6px rgba(255, 207, 107, .08);
  animation: bdayPop .8s var(--spring) both;
}
@keyframes bdayPop { from { transform: scale(.6) translateY(40px); opacity: 0; } }
.bday-avatars { display: flex; justify-content: center; gap: 10px; }
.bday-avatars .avatar { box-shadow: 0 0 0 3px #ffcf6b, 0 0 24px #ff4fd8; animation: bdayBob 2s ease-in-out infinite; }
.bday-avatars .avatar:nth-child(2) { animation-delay: .3s; }
.bday-avatars .avatar:nth-child(3) { animation-delay: .6s; }
@keyframes bdayBob { 50% { transform: translateY(-8px) rotate(-3deg); } }
.bday-cake { font-size: 64px; margin: 6px 0 -4px; animation: cakeWiggle 1.2s ease-in-out infinite; display: inline-block; filter: drop-shadow(0 0 16px rgba(255, 207, 107, .7)); }
@keyframes cakeWiggle { 0%, 100% { transform: rotate(-6deg) scale(1); } 50% { transform: rotate(6deg) scale(1.08); } }
.bday-title {
  margin: 8px 0 6px; font: 900 clamp(22px, 5vw, 34px)/1.15 var(--font-display);
  background: linear-gradient(90deg, #ffcf6b, #ff4fd8, #00d4ff, #3dffa8, #ffcf6b); background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: bdayShine 4s linear infinite;
}
@keyframes bdayShine { to { background-position: 300% 0; } }
.bday-sub { margin: 0 0 16px; color: var(--text); }
.bday-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.bday-music.pulse { animation: bdayPulse 1.2s ease-in-out infinite; border-color: #ffcf6b; }
@keyframes bdayPulse { 50% { box-shadow: 0 0 0 6px rgba(255, 207, 107, .25); } }
/* The rest of the day: a few balloons drift quietly across the app. */
body.bday-day[data-view="app"]::after {
  content: '🎈'; position: fixed; left: 6%; bottom: -80px; font-size: 42px; z-index: 3; pointer-events: none;
  animation: balloonRise 16s ease-in infinite; --sway: 40px; opacity: .8;
}
body.bday-day[data-view="app"]::before {
  content: '🎈'; position: fixed; right: 8%; bottom: -80px; font-size: 34px; z-index: 3; pointer-events: none;
  animation: balloonRise 21s ease-in 7s infinite; --sway: -30px; opacity: .75; filter: hue-rotate(140deg);
}
@media (prefers-reduced-motion: reduce) {
  .bday-confetti, .bday-balloons { display: none; }
  .bday-card, .bday-cake, .bday-avatars .avatar, .bday-title { animation: none; }
}

/* ─── ◉ (arg.js) ─── */
.vega-term { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 16px; background: rgba(0, 4, 2, .82); backdrop-filter: blur(4px); animation: vegaIn .4s ease; }
@keyframes vegaIn { from { opacity: 0; } }
.vega-frame { width: min(640px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; border: 1px solid #1f6b4a; border-radius: 10px; background: #020a06; box-shadow: 0 0 40px -8px rgba(61, 255, 168, .45), inset 0 0 60px rgba(61, 255, 168, .05); overflow: hidden; }
.vega-bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; background: #062015; color: #3dffa8; font: 600 12px monospace; letter-spacing: .1em; }
.vega-bar button { background: none; border: 0; color: #3dffa8; font-size: 20px; cursor: pointer; line-height: 1; }
.vega-screen { padding: 14px 16px 18px; overflow-y: auto; color: #3dffa8; font: 14px/1.55 'Courier New', monospace; text-shadow: 0 0 6px rgba(61, 255, 168, .55); display: flex; flex-direction: column; gap: 10px;
  background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px); }
.vega-line { margin: 0; white-space: pre-wrap; font: inherit; }
.vega-dim { opacity: .7; }
.vega-ok { color: #9dffd8; }
.vega-title { margin: 6px 0 0; font-weight: 700; color: #b4ffe0; }
.vega-log summary { cursor: pointer; opacity: .85; }
.vega-log pre { margin: 6px 0 0 14px; white-space: pre-wrap; font: inherit; color: #9dffd8; }
.vega-input { display: flex; gap: 8px; align-items: center; border-top: 1px dashed #1f6b4a; padding-top: 10px; }
.vega-input input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: #3dffa8; font: inherit; caret-color: #3dffa8; text-shadow: inherit; }
.vega-btn { align-self: flex-start; background: #062015; color: #3dffa8; border: 1px solid #1f6b4a; border-radius: 6px; padding: 6px 12px; font: 600 13px monospace; cursor: pointer; }
.vega-btn:hover { background: #0b3322; }
.vega-bars { display: flex; gap: 6px; height: 40px; align-items: flex-end; }
.vega-bars i { width: 14px; height: 4px; background: #3dffa8; box-shadow: 0 0 8px #3dffa8; animation: vegaBar .6s ease-out both; }
@keyframes vegaBar { 0% { height: 4px; } 30% { height: 38px; } 100% { height: 6px; } }
.vega-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 96; width: min(480px, calc(100% - 32px)); padding: 12px 36px 12px 14px; border-radius: 10px; border: 1px solid #1f6b4a; background: #020a06; color: #3dffa8; font: 14px/1.5 monospace; box-shadow: 0 0 30px -6px rgba(61, 255, 168, .5); animation: vegaIn .4s ease; }
.vega-toast pre { margin: 6px 0 0; white-space: pre-wrap; font: inherit; }
.vega-toast button { position: absolute; top: 6px; right: 10px; background: none; border: 0; color: #3dffa8; font-size: 18px; cursor: pointer; }
.constellation .vega-star { cursor: pointer; outline: none; }
.constellation .vega-core { fill: #9aa3b8; opacity: .5; transition: opacity .08s; }
.constellation .vega-core.on { opacity: 1; fill: #e8fff6; filter: drop-shadow(0 0 6px #3dffa8) drop-shadow(0 0 12px #3dffa8); }
.constellation .vega-star:hover .vega-core, .constellation .vega-star:focus-visible .vega-core { opacity: .8; }

/* ─── VEGA shows up (vega-intro.js) ─── */
.vega-intro { position: fixed; inset: 0; z-index: 120; overflow: hidden; }
.vega-intro.out { opacity: 0; transition: opacity .4s ease; }
.vega-intro-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.vega-bubble {
  position: absolute; left: 50%; top: calc(46% - 250px); transform: translateX(-50%) scale(.9); opacity: 0;
  width: min(520px, calc(100% - 32px)); padding: 12px 16px; border: 1px solid #1f6b4a; border-radius: 10px; background: rgba(2, 10, 6, .92);
  color: #3dffa8; font: 600 16px/1.5 'Courier New', monospace; text-shadow: 0 0 8px rgba(61, 255, 168, .6); text-align: center;
  transition: opacity .25s, transform .25s; pointer-events: none;
}
.vega-bubble.on { opacity: 1; transform: translateX(-50%) scale(1); }
.vega-warn { position: absolute; left: 50%; top: 24px; transform: translateX(-50%); color: #ff5f7a; font: 800 18px monospace; letter-spacing: .3em; opacity: 0; text-shadow: 0 0 12px #ff3d5f; }
.vega-warn.on { opacity: 1; animation: vegaBlink .5s steps(2) infinite; }
@keyframes vegaBlink { 50% { opacity: .2; } }
.vega-skip { position: absolute; right: 16px; top: 16px; background: rgba(0, 0, 0, .5); color: #9dffd8; border: 1px solid #1f6b4a; border-radius: 8px; padding: 6px 12px; font: 600 13px monospace; cursor: pointer; }
@media (max-width: 600px) { .vega-bubble { top: calc(46% - 230px); font-size: 14px; } }

/* The whole page glitches for an instant */
body.vega-glitching .app-shell, body.vega-glitching .view.active > * { animation: vegaJitter .12s steps(2) infinite; }
body.vega-glitch-strong .app-shell { filter: drop-shadow(4px 0 rgba(255, 61, 242, .75)) drop-shadow(-4px 0 rgba(0, 229, 255, .75)) contrast(1.3) hue-rotate(25deg); }
@keyframes vegaJitter {
  0% { transform: translate(0, 0); clip-path: inset(0 0 0 0); }
  25% { transform: translate(-6px, 2px) skewX(-2deg); clip-path: inset(12% 0 40% 0); }
  50% { transform: translate(5px, -3px); clip-path: inset(0 0 0 0); }
  75% { transform: translate(-3px, 0) skewX(3deg); clip-path: inset(55% 0 8% 0); }
  100% { transform: translate(0, 0); }
}

/* The note: old pixel paper, on purpose nothing like the rest of the site */
.vega-note-wrap { position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .55); }
.vega-note-wrap.out { opacity: 0; transition: opacity .3s; }
.vega-note {
  position: relative; width: min(430px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; box-sizing: border-box;
  padding: 30px 30px 24px; color: #3b2a17; background-size: 100% 100%; image-rendering: pixelated; image-rendering: crisp-edges;
  font: 400 17px/1.45 'Pixelify Sans', 'Courier New', monospace; text-shadow: none; letter-spacing: .01em;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, .45); border-radius: 0;
  transform: rotate(-1.5deg) translateY(-40px) scale(.6); opacity: 0;
  transition: transform .55s cubic-bezier(.2, 1.4, .4, 1), opacity .3s;
}
.vega-note-wrap.in .vega-note { transform: rotate(-1.5deg); opacity: 1; }
.vega-note p { margin: 0 0 10px; }
.vega-note ol { margin: 0 0 12px; padding-left: 22px; }
.vega-note li { margin-bottom: 6px; }
.vega-note-date { font-size: 13px; color: #7a5c33; text-transform: uppercase; letter-spacing: .08em; }
.vega-note-sign { text-align: right; font-weight: 600; font-size: 20px; }
/* Buttons in the old block-game style: grey stone, hard bevel, pixel text */
.mc-btn, .mc-x {
  font: 600 16px 'Pixelify Sans', monospace; color: #fff; text-shadow: 2px 2px 0 #3f3f3f; cursor: pointer; border-radius: 0;
  background: #6f6f6f; border: 2px solid #000; box-shadow: inset 2px 2px 0 #aaa, inset -2px -2px 0 #3c3c3c;
}
.mc-btn { display: block; width: 100%; padding: 8px 12px; }
.mc-btn:hover, .mc-x:hover { background: #7e87bd; box-shadow: inset 2px 2px 0 #b8c0f0, inset -2px -2px 0 #4a5190; }
.mc-x { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; padding: 0; line-height: 1; }
.vega-note-icon {
  position: fixed; left: 296px; bottom: 18px; z-index: 60; width: 44px; height: 44px; padding: 0; border: 0; cursor: pointer;
  background: transparent center / contain no-repeat; image-rendering: pixelated;
  filter: drop-shadow(0 0 6px rgba(61, 255, 168, .55)); animation: vegaIconGlitch 5s steps(1) infinite;
}
@keyframes vegaIconGlitch { 0%, 92%, 100% { transform: none; filter: drop-shadow(0 0 6px rgba(61, 255, 168, .55)); } 94% { transform: translate(-3px, 1px); filter: drop-shadow(3px 0 #ff3df2) drop-shadow(-3px 0 #00e5ff); } 97% { transform: translate(2px, -1px) skewX(8deg); } }
@media (max-width: 820px) { .vega-note-icon { left: 12px; bottom: 86px; } }
@media (prefers-reduced-motion: reduce) { .vega-note-icon { animation: none; } body.vega-glitching .app-shell { animation: none; } }

.vega-signal { color: #eafff7; font-size: 16px; letter-spacing: .05em; overflow-wrap: anywhere; }
.vega-morse { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 2px 10px; font-size: 13px; opacity: .9; }
.vega-morse b { color: #eafff7; }

/* ─── Maintenance / stuck loading (inline script at the end of index.html) ─── */
.maint { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: rgba(3, 2, 10, .88); backdrop-filter: blur(6px); }
.maint[hidden] { display: none; }
.maint-card { width: min(460px, 100%); padding: 26px 24px; border-radius: 20px; text-align: center; background: linear-gradient(160deg, rgba(28, 20, 72, .95), rgba(8, 6, 26, .97)); border: 1px solid rgba(170, 150, 255, .38); color: #ecebff; font: 15px/1.5 'Inter', system-ui, sans-serif; }
.maint-icon { font-size: 44px; }
.maint-card h2 { margin: 6px 0 8px; font-size: 20px; }
.maint-card p { margin: 0 0 10px; color: #c9c5f0; }
.maint-tips { text-align: left; margin: 0 0 16px; padding-left: 20px; color: #b3afdc; font-size: 14px; }
.maint-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.maint-foot { margin-top: 14px !important; font-size: 13px; color: #8f8ac2 !important; }
