/**
 * Linus Desk — glass Ubuntu/Puter-feel desktop + StudyTonight strip.
 */
:root {
  --bg: #0a0c11;
  --ub-orange: #e95420;
  --ub-aubergine: #77216f;
  --glass: rgba(22, 24, 36, 0.72);
  --glass-border: rgba(255, 255, 255, 0.14);
  --tx: #f5f5f5;
  --tx2: #b8bfd0;
  --accent: #4d38b2;
  --accent2: #ffb800;
  --st-purple: #4d38b2;
  --st-gold: #ffb800;
  --ok: #34d399;
  --bad: #f87171;
  --glow: #77ffd9;
  --st-strip-h: 40px;
  --font: 'Plus Jakarta Sans', system-ui, sans-serif;
  --display: 'Outfit', var(--font);
  --mono: 'Ubuntu Mono', ui-monospace, monospace;
  --r-sm: 8px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--tx);
  font-family: var(--font);
  overflow: hidden;
}

/* Brand strip — GameDesign.md / SysDesign baseline */
.st-strip {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  height: var(--st-strip-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: linear-gradient(90deg, #0D111D 0%, #14142B 100%);
  border-bottom: 1px solid rgba(77, 56, 178, 0.35);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
  font: 600 12px var(--font);
  color: #e8ecf6;
}
.st-strip-left, .st-strip-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.st-strip-right { gap: 8px; }
.st-strip-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #fff;
  text-decoration: none;
  font: 700 13px var(--display);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.st-strip-logo .st-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--st-gold);
  box-shadow: 0 0 8px rgba(255, 184, 0, 0.6);
}
.st-strip-logo span { color: var(--st-gold); }
.st-strip-sep { width: 1px; height: 16px; background: rgba(255, 255, 255, 0.12); }
.st-strip-label { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #8e98af; white-space: nowrap; }
.st-strip-label .st-live {
  width: 6px; height: 6px; border-radius: 50%;
  background: #10b981;
  animation: ld-pulse 1.6s infinite;
}
@keyframes ld-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.st-strip-xp {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  background: rgba(255, 184, 0, 0.1);
  border: 1px solid rgba(255, 184, 0, 0.3);
  color: var(--st-gold);
  font: 700 11px var(--mono);
  white-space: nowrap;
}
.st-strip-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  background: rgba(18, 22, 36, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  font: 700 11px var(--font);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.st-strip-chat-btn:hover {
  background: rgba(77, 56, 178, 0.4);
  border-color: rgba(77, 56, 178, 0.7);
  box-shadow: 0 0 10px rgba(77, 56, 178, 0.4);
}
.st-chat-pulse { width: 6px; height: 6px; border-radius: 50%; background: #10b981; animation: ld-pulse 1.8s infinite; }
.st-chat-icon { font-size: 12px; line-height: 1; }
.st-chat-badge {
  font: 700 10px var(--mono);
  color: #10b981;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 1px 6px;
  border-radius: 6px;
}
.st-chat-unread {
  margin-left: 2px;
  padding: 1px 5px;
  border-radius: 999px;
  background: #f43f5e;
  color: #fff;
  font: 800 9px var(--mono);
}
.st-strip-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--r-sm);
  background: rgba(77, 56, 178, 0.18);
  border: 1px solid rgba(77, 56, 178, 0.4);
  color: #a99be8;
  font: 600 11px var(--font);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.st-strip-back:hover {
  background: var(--st-purple);
  border-color: var(--st-purple);
  color: #fff;
}

.boot {
  position: fixed;
  inset: var(--st-strip-h) 0 0 0;
  background: linear-gradient(160deg, #1a0520 0%, #2c001e 50%, #0a0c11 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 90;
}
/* Author display:flex beats the HTML hidden attribute — force hide when done. */
.boot[hidden],
.boot.is-done,
.shell[hidden],
.desk[hidden],
.win[hidden],
.modal-backdrop[hidden] {
  display: none !important;
}

/* Shell = chrome bars + desk under fixed strip */
.shell {
  position: fixed;
  inset: var(--st-strip-h) 0 0 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 20;
}

.game-top {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 14px 10px;
  background: linear-gradient(90deg, #12141f, #161a28);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 50;
}
.top-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 40px;
  min-width: 0;
}
.top-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 800 13px var(--display);
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.brand i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
  animation: ld-pulse 1.6s infinite;
}
.brand span { color: #7dd3fc; }
.top-sep { width: 1px; height: 18px; background: rgba(255,255,255,0.12); }
.case-badge {
  max-width: clamp(120px, 28vw, 280px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--tx2);
  font-size: 12px;
}
.case-badge b { color: var(--tx); font-weight: 600; }
.grow { flex: 1; min-width: 8px; }
.top-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}
.stat-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--tx2);
  font: 700 11px var(--mono);
  white-space: nowrap;
}
.stat-pill.gold {
  border-color: rgba(255, 184, 0, 0.3);
  color: var(--st-gold);
}
.mode-tabs { display: flex; gap: 4px; }
.mode-tabs button {
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: var(--tx2);
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
}
.mode-tabs button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.mode-tabs button:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-brief, .btn-act {
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--tx);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-act.primary {
  background: var(--ub-orange);
  border-color: var(--ub-orange);
  color: #fff;
}
.btn-brief:hover, .btn-act:hover { border-color: rgba(125, 211, 252, 0.5); }

/* Tools sit on bar 1 when wide; wrap to a second row only when tight (GameDesign.md). */
.top-tools {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}
.btn-tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--tx2);
  font: 600 11px var(--font);
  cursor: pointer;
  white-space: nowrap;
}
.btn-tool:hover { border-color: #7dd3fc; color: var(--tx); }
.btn-tool.active {
  border-color: rgba(52, 211, 153, 0.45);
  color: var(--ok);
  background: rgba(52, 211, 153, 0.08);
}
.btn-tool-ico { font-size: 13px; line-height: 1; }

@media (max-width: 1100px) {
  .top-tools {
    flex-basis: 100%;
    order: 5;
    justify-content: center;
    padding-top: 6px;
    margin-top: 2px;
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  .top-progress { order: 4; }
  .grow { display: none; }
}

@media (max-width: 720px) {
  .st-strip-sep, .st-strip-label, .st-chat-text, .st-chat-badge { display: none; }
  .brand { font-size: 11px; }
  .case-badge { max-width: 100px; }
  .btn-tool-label { display: none; }
}
.boot-mark {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e95420, #77216f);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 22px;
  color: #ffe08a;
  box-shadow: 0 0 0 2px rgba(255, 184, 0, 0.45), 0 12px 40px rgba(233, 84, 32, 0.35);
}
.boot-logo {
  font-family: var(--display);
  font-weight: 800;
  font-size: 28px;
  color: #fff;
  letter-spacing: -0.03em;
}
.boot-sub { font-size: 12px; color: rgba(255,255,255,0.55); font-family: var(--mono); }
.boot-bar {
  width: 160px;
  height: 3px;
  background: rgba(255,255,255,0.12);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}
.boot-bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--ub-orange), var(--accent2));
  transition: width 0.12s linear;
}

.desk {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 30px;
  background: rgba(8, 10, 18, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 40;
  font-size: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.top-item, .top-icon {
  background: transparent;
  border: 0;
  color: var(--tx);
  cursor: pointer;
  font: inherit;
  padding: 2px 8px;
  border-radius: 6px;
}
.top-item:hover, .top-icon:hover { background: rgba(255,255,255,0.08); }
.top-right { display: flex; gap: 2px; }

.wallpaper {
  position: absolute;
  inset: 30px 0 0 0;
  background-color: #1a0f32;
  background-image: url('/game/linux/wallpaper.svg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  cursor: default;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wallpaper-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: -24px;
  opacity: 0.92;
  pointer-events: none;
}
.wallpaper-brand img {
  width: min(340px, 46vw);
  height: auto;
  display: block;
}
.wallpaper-brand-tag {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(245, 245, 247, 0.72);
  text-align: center;
}
.wallpaper-brand-tag strong {
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
}

.desk-icons {
  position: absolute;
  left: 18px;
  top: 48px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 76px;
}
.desk-icon {
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: 10px;
}
.desk-icon:hover { background: rgba(255,255,255,0.1); }
.desk-icon-glyph {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}
.desk-icon-glyph.term {
  font-family: var(--mono);
  font-weight: 700;
  color: #86efac;
  font-size: 20px;
  background: rgba(20, 30, 28, 0.75);
}
.desk-icon-label {
  font-size: 11px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  text-align: center;
}

.windows {
  position: absolute;
  inset: 30px 0 78px 0;
  z-index: 20;
  pointer-events: none;
}
.windows .win { pointer-events: auto; }

.win {
  position: absolute;
  min-width: 320px;
  min-height: 200px;
  background: rgba(18, 18, 22, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.win.focused {
  border-color: rgba(233, 84, 32, 0.45);
  box-shadow: 0 28px 70px rgba(0,0,0,0.55), 0 0 0 1px rgba(233, 84, 32, 0.2);
}
.win-resize {
  position: absolute;
  z-index: 5;
  background: transparent;
}
.win-resize[data-dir="e"] {
  top: 8px;
  right: 0;
  width: 8px;
  bottom: 8px;
  cursor: ew-resize;
}
.win-resize[data-dir="s"] {
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 8px;
  cursor: ns-resize;
}
.win-resize[data-dir="se"] {
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
}
.win-resize[data-dir="se"]::after {
  content: '';
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(255,255,255,0.35);
  border-bottom: 2px solid rgba(255,255,255,0.35);
  border-radius: 1px;
  pointer-events: none;
}
.win-title {
  height: 36px;
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  cursor: grab;
  user-select: none;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.win-title:active { cursor: grabbing; }
.win-dots { display: flex; gap: 7px; margin-left: auto; order: 2; }
.win-title-text {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: #ddd;
  order: 1;
}
.win-dots button {
  position: relative;
  z-index: 6;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
}
.win-dots .close { background: #ff5f57; }
.win-dots .min { background: #febc2e; }
.win-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.term-out {
  flex: 1;
  overflow: auto;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
  color: #d4d4d4;
  white-space: pre-wrap;
  word-break: break-word;
  background: #0b0b0d;
}
.term-out .err { color: #f87171; }
.term-line {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 10px;
  border-top: 1px solid #222;
  background: #0a0a0a;
  font-family: var(--mono);
  font-size: 13px;
}
.term-prompt { color: #3eb34f; flex-shrink: 0; }
.term-input-wrap { flex: 1; position: relative; }
.term-ghost {
  position: absolute;
  left: 0; top: 0;
  color: rgba(255,255,255,0.28);
  pointer-events: none;
  font-family: var(--mono);
  font-size: 13px;
  white-space: pre;
}
.term-input {
  width: 100%;
  background: transparent;
  border: 0;
  outline: none;
  color: #eee;
  font-family: var(--mono);
  font-size: 13px;
  caret-color: #eee;
}

.files-body {
  display: flex;
  height: 100%;
  background: #f4f5f8;
  color: #222;
}
.files-side {
  width: 132px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.65);
  border-right: 1px solid #dde1ea;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.files-side button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  color: #333;
}
.files-side button:hover,
.files-side button.active {
  background: rgba(77, 56, 178, 0.12);
  color: #4d38b2;
  font-weight: 600;
}
.files-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.files-path {
  padding: 8px 12px;
  font-size: 12px;
  font-family: var(--mono);
  background: #fff;
  border-bottom: 1px solid #e5e7ef;
  color: #555;
}
.files-list {
  flex: 1;
  overflow: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  align-content: start;
}
.files-item {
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 10px 6px;
  cursor: pointer;
  text-align: center;
  font-size: 11px;
  color: #222;
}
.files-item:hover { background: rgba(77, 56, 178, 0.1); }
.files-item .ico { font-size: 28px; display: block; margin-bottom: 4px; }
.files-preview {
  border-top: 1px solid #e5e7ef;
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 11px;
  max-height: 100px;
  overflow: auto;
  white-space: pre-wrap;
  background: #fff;
  color: #333;
}

.dock {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(16, 18, 28, 0.55);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  z-index: 45;
}
.dock-sep {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,0.15);
  margin: 0 2px;
}
.dock-btn {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  color: var(--tx);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, background 0.12s ease;
}
.dock-btn:hover {
  background: rgba(255,255,255,0.16);
  transform: translateY(-4px) scale(1.06);
}
.dock-glyph { font-size: 20px; line-height: 1; }
.dock-glyph.term {
  font-family: var(--mono);
  font-weight: 700;
  color: #86efac;
  font-size: 22px;
}

.mission-card {
  position: absolute;
  right: 16px;
  top: 44px;
  width: min(300px, calc(100% - 120px));
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 12px 14px;
  z-index: 30;
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
}
.brief { margin: 0; font-size: 12px; color: #c5c9d6; line-height: 1.45; }
.eli5 { margin: 6px 0 0; font-size: 11px; color: #8b95a8; font-style: italic; }

.coach {
  position: absolute;
  left: 18px;
  bottom: 88px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  z-index: 32;
  max-width: min(420px, calc(100% - 40px));
}
.coach.is-clear {
  z-index: 140;
  max-width: min(440px, calc(100% - 24px));
}
.coach-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(18, 22, 36, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.2);
  overflow: visible;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
/* Live companion is painted by the React play shell over this slot */
.coach-avatar.has-live-companion {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.coach-mascot {
  width: 100%;
  height: 100%;
  position: relative;
}
.coach-mascot.is-live-slot {
  opacity: 0;
  pointer-events: none;
}
.coach-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.coach-bubble {
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.4;
}
.coach-bubble strong {
  display: block;
  font-size: 10px;
  color: var(--accent2);
  margin-bottom: 2px;
}
.coach-bubble p { margin: 0; color: #dde1ec; }
.coach-clear {
  background: rgba(18, 22, 36, 0.96);
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
}
.coach-clear[hidden] { display: none !important; }
.coach-clear-title {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 800;
  color: var(--ok);
}
.coach-clear-body {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--tx2);
  line-height: 1.4;
}
.coach-quiz .quiz-q {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
}
.coach-quiz .quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.coach-quiz .quiz-choices button {
  text-align: left;
  background: #1a2030;
  border: 1px solid #2a3348;
  color: var(--tx);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
}
.coach-quiz .quiz-choices button:hover { border-color: var(--accent2); }
.coach-quiz .quiz-choices button.correct {
  border-color: var(--ok);
  background: rgba(52, 211, 153, 0.12);
}
.coach-quiz .quiz-choices button.wrong {
  border-color: var(--bad);
  opacity: 0.7;
}
.coach-next {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 800;
  font-family: var(--display);
  background: linear-gradient(135deg, var(--ub-orange), var(--ub-aubergine));
  color: #fff;
  cursor: pointer;
}
.coach-next:hover { filter: brightness(1.08); }

/* Activities — GNOME-style top-bar drawer (compact, not fullscreen) */
.activities {
  position: absolute;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 34px; /* hang under Ubuntu topbar */
  pointer-events: none;
}
.activities[hidden] { display: none !important; }
.activities-scrim {
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: auto;
}
.activities-drawer {
  position: relative;
  z-index: 1;
  pointer-events: auto;
  width: min(520px, calc(100% - 24px));
  animation: actIn 0.18s ease-out;
}
.activities-caret {
  width: 14px;
  height: 14px;
  margin: 0 auto -7px;
  background: rgba(42, 42, 46, 0.96);
  border-left: 1px solid rgba(255,255,255,0.12);
  border-top: 1px solid rgba(255,255,255,0.12);
  transform: rotate(45deg);
}
.activities-panel {
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 0;
  border-radius: 14px;
  background: rgba(42, 42, 46, 0.96);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 18px 48px rgba(0,0,0,0.45);
  overflow: hidden;
  max-height: min(360px, calc(100vh - 160px));
}
@keyframes actIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
.activities-col {
  padding: 12px 14px 14px;
  min-width: 0;
}
.activities-col-apps {
  border-right: 1px solid rgba(255,255,255,0.08);
}
.activities-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.activities-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #ececec;
}
.activities-close {
  border: 0;
  background: transparent;
  color: #b8b8bc;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.activities-close:hover { background: rgba(255,255,255,0.08); color: #fff; }
.activities-clock {
  margin-bottom: 10px;
  line-height: 1.25;
}
.activities-clock .act-weekday {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: #f0f0f2;
}
.activities-clock .act-date {
  display: block;
  font-size: 12px;
  color: #a8a8b0;
  margin-top: 2px;
}
.activities-cal {
  padding: 0;
  background: transparent;
  border: 0;
}
.cal-month {
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 12px;
  color: #dddde2;
  text-align: center;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
  font-size: 11px;
}
.cal-dow { color: #8e8e96; font-weight: 600; padding: 2px 0; font-size: 10px; }
.cal-day {
  padding: 4px 0;
  border-radius: 50%;
  color: #ececec;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-day.empty { visibility: hidden; }
.cal-day.today {
  background: var(--ub-orange);
  color: #fff;
  font-weight: 800;
}
.activities-search-wrap { display: block; margin-bottom: 10px; }
.activities-search {
  width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.22);
  color: var(--tx);
  padding: 7px 10px;
  font-size: 12px;
}
.activities-apps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.act-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #e8e8ec;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
}
.act-app:hover {
  border-color: rgba(233, 84, 32, 0.35);
  background: rgba(255,255,255,0.06);
}
.act-app-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.28);
  font-size: 16px;
  font-family: var(--mono);
  font-weight: 700;
}
@media (max-width: 560px) {
  .activities-panel {
    grid-template-columns: 1fr;
    max-height: min(420px, calc(100vh - 120px));
    overflow: auto;
  }
  .activities-col-apps { border-right: 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
  .activities-apps { grid-template-columns: repeat(3, 1fr); }
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Trash window */
.trash-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 10px;
  gap: 8px;
}
.trash-toolbar { display: flex; justify-content: flex-end; }
.trash-btn {
  border: 1px solid #2a3348;
  background: #1a2030;
  color: var(--tx);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.trash-btn.restore {
  border-color: rgba(52, 211, 153, 0.4);
  color: var(--ok);
}
.trash-list {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.trash-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
}
.trash-name { display: block; font-weight: 700; font-size: 13px; }
.trash-path { display: block; font-size: 11px; color: var(--tx2); font-family: var(--mono); }
.trash-empty, .trash-hint {
  margin: 0;
  font-size: 12px;
  color: var(--tx2);
}

.hint-glow {
  box-shadow: 0 0 0 3px var(--glow), 0 0 18px rgba(119, 255, 217, 0.65) !important;
  animation: pulseGlow 1.2s ease-in-out infinite;
  z-index: 50 !important;
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 3px var(--glow), 0 0 12px rgba(119, 255, 217, 0.5); }
  50% { box-shadow: 0 0 0 5px var(--glow), 0 0 22px rgba(119, 255, 217, 0.85); }
}

.editor-modal {
  width: min(560px, 100%);
}
.editor-path {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--tx2);
}
.editor-text {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid #2a3348;
  background: #0c1018;
  color: #d6e0f0;
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px;
  line-height: 1.45;
}
.editor-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.editor-actions .btn-act {
  background: #1a2030;
  border: 1px solid #2a3348;
  color: var(--tx);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(18, 22, 36, 0.96);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: var(--ok);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 120;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.bad {
  border-color: rgba(248, 113, 113, 0.45);
  color: var(--bad);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 130;
  padding: 16px;
}
.modal {
  width: min(420px, 100%);
  background: #121624;
  border: 1px solid #2a3348;
  border-radius: 16px;
  padding: 18px;
}
.modal h2 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 18px;
}
.modal p { margin: 0 0 10px; font-size: 13px; color: #b8bfce; line-height: 1.45; }
.explain-note { font-size: 11px !important; color: #8b95a8 !important; }
.quiz-block { margin: 12px 0; }
.quiz-q { font-weight: 700; color: #e8ecf4 !important; }
.quiz-choices { display: flex; flex-direction: column; gap: 6px; }
.quiz-choices button {
  text-align: left;
  border-radius: 10px;
  border: 1px solid #2a3348;
  background: #1a1f2e;
  color: #e8ecf4;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
}
.quiz-choices button:hover { border-color: var(--accent); }
.quiz-choices button.correct { border-color: var(--ok); background: rgba(52,211,153,0.12); }
.quiz-choices button.wrong { border-color: var(--bad); }
.row { display: flex; gap: 8px; justify-content: flex-end; }
.next {
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  padding: 8px 14px;
  cursor: pointer;
}

@media (max-width: 720px) {
  .mission-card {
    right: 8px;
    left: 8px;
    width: auto;
    top: auto;
    bottom: 86px;
  }
  .coach {
    left: 8px;
    right: 8px;
    max-width: none;
    bottom: 72px;
  }
  .coach:not(.is-clear) .coach-bubble { max-width: 220px; }
  .desk-icons { top: 42px; left: 8px; }
  .dock-btn { width: 42px; height: 42px; }
}
