/* ============================================================
   CAAKE Academy — Hermes wizard dock
   FAB, chat panel, messages, challenge cards, build actions,
   upgrade cards, sandbox overlay
   ============================================================ */

/* ---------- FAB ---------- */
.hm-fab {
  position: fixed;
  right: 24px; bottom: 24px;
  z-index: 140;
  display: flex; align-items: center; gap: 10px;
  background: var(--grad-gold);
  color: #1a1406;
  border: none;
  border-radius: 999px;
  padding: 12px 20px 12px 12px;
  font: 800 14px var(--font-body);
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: var(--shadow-gold);
}
.hm-fab-bee { font-size: 26px; line-height: 1; }
.hm-fab-badge {
  position: absolute;
  top: -6px; right: -6px;
  min-width: 20px; height: 20px;
  padding: 0 5px;
  display: grid; place-items: center;
  background: var(--rose);
  color: #fff;
  font: 800 11px var(--font-body);
  border-radius: 999px;
  border: 2px solid var(--midnight);
}
.hm-fab-pulse { animation: hmFabPulse 1.8s ease-in-out infinite; }
@keyframes hmFabPulse { 0%, 100% { box-shadow: var(--shadow-gold); } 50% { box-shadow: 0 10px 46px -8px rgba(233, 185, 73, 0.75); } }

/* ---------- panel ---------- */
.hm-panel {
  position: fixed;
  right: 24px; bottom: 96px;
  z-index: 150;
  width: min(400px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 150px));
  display: none;
  flex-direction: column;
  background: rgba(12, 12, 23, 0.97);
  border: 1px solid rgba(233, 185, 73, 0.3);
  border-radius: 20px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.hm-panel.hm-open { display: flex; }

.hm-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(233, 185, 73, 0.05);
}
.hm-avatar {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  font-size: 18px;
  background: var(--grad-gold);
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(233, 185, 73, 0.35);
}
.hm-head-id { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.hm-head-id b { font: 800 14px var(--font-display); color: var(--gold); letter-spacing: 0.02em; }
.hm-head-id i { font-style: normal; font-size: 11px; color: var(--faint); }
.hm-close {
  background: transparent; border: none;
  color: var(--muted); font-size: 14px;
  cursor: pointer; padding: 6px;
}
.hm-close:hover { color: var(--text); }

/* ---------- messages ---------- */
.hm-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
}
.hm-msg { display: flex; gap: 8px; align-items: flex-end; }
.hm-msg.hm-user { justify-content: flex-end; }
.hm-msg .hm-avatar {
  width: 26px; height: 26px; font-size: 14px; flex-shrink: 0;
  margin-bottom: 2px;
}
.hm-bubble {
  max-width: 84%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px 14px 14px 4px;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  word-wrap: break-word;
}
.hm-user .hm-bubble {
  background: rgba(233, 185, 73, 0.14);
  border-color: rgba(233, 185, 73, 0.35);
  border-radius: 14px 14px 4px 14px;
}
.hm-bubble p { margin: 0 0 8px; }
.hm-bubble p:last-child { margin-bottom: 0; }
.hm-bubble ul { margin: 6px 0 6px 18px; }
.hm-bubble li { margin-bottom: 4px; }
.hm-bubble b { color: #fff; }
.hm-bubble code { color: #f6d876; font-size: 12.5px; }
.hm-bubble a { color: var(--gold); }

/* typing dots */
.hm-typing { display: inline-flex; gap: 4px; padding: 13px 14px; }
.hm-typing span {
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: 50%;
  animation: hmDot 1s ease-in-out infinite;
}
.hm-typing span:nth-child(2) { animation-delay: 0.15s; }
.hm-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes hmDot { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

/* ---------- rich cards ---------- */
.hm-card { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; }
.hm-card-kicker {
  font: 800 10.5px var(--font-body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}
.hm-link { display: inline-block; margin-top: 8px; font-weight: 700; font-size: 12.5px; color: var(--gold); text-decoration: none; }
.hm-link:hover { text-decoration: underline; }
.hm-variant { margin-top: 8px; font-size: 12px; color: var(--muted); border-top: 1px dashed var(--line-strong); padding-top: 8px; }
.hm-md p { margin: 0 0 8px; }
.hm-md strong { color: #fff; }
.hm-takeaways { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.hm-takeaways ul { margin: 4px 0 0 16px; }

/* analogy */
.hm-analogy { border-color: rgba(233, 185, 73, 0.4); }
.hm-analogy > b { display: block; font: 700 14px var(--font-display); color: var(--gold); margin-bottom: 2px; }

/* challenge */
.hm-challenge { border-color: rgba(139, 92, 246, 0.45); }
.hm-q { font-weight: 700; margin-bottom: 8px; }
.hm-opts { display: flex; flex-direction: column; gap: 6px; }
.hm-opt {
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  font: 600 13px var(--font-body);
  padding: 9px 11px;
  cursor: pointer;
}
.hm-opt:hover { border-color: var(--purple); background: rgba(139, 92, 246, 0.12); }
.hm-opt.hm-opt-right { border-color: #34d399; background: rgba(52, 211, 153, 0.12); }
.hm-opt.hm-opt-wrong { border-color: var(--rose); background: rgba(251, 113, 133, 0.12); }
.hm-opt:disabled { cursor: default; opacity: 0.85; }
.hm-challenge-foot { margin-top: 8px; font-size: 11.5px; color: var(--faint); }
.hm-verdict { border-radius: 10px; padding: 9px 11px; font-size: 13px; }
.hm-right { background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.4); }
.hm-wrong { background: rgba(251, 113, 133, 0.1); border: 1px solid rgba(251, 113, 133, 0.35); }
.hm-again { margin-top: 8px; }

/* build + upgrade */
.hm-build { border-color: rgba(45, 212, 191, 0.45); }
.hm-build > b { display: block; font: 700 14px var(--font-display); color: var(--teal); margin-bottom: 4px; }
.hm-build-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hm-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font: 700 12px var(--font-body);
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
}
.hm-btn:hover { border-color: var(--gold); color: var(--gold); }
.hm-btn-gold { background: var(--grad-gold); color: #1a1406; border: none; box-shadow: 0 6px 18px -8px rgba(233, 185, 73, 0.6); }
.hm-btn-gold:hover { color: #1a1406; filter: brightness(1.06); }
.hm-upgrade { border-color: rgba(233, 185, 73, 0.5); }
.hm-upgrade-rule {
  background: rgba(233, 185, 73, 0.1);
  border: 1px dashed rgba(233, 185, 73, 0.45);
  border-radius: 10px;
  padding: 10px 12px;
  font-style: italic;
  color: #f6d876;
}
.hm-phi { border-color: rgba(251, 113, 133, 0.5); }

/* progress */
.hm-prog-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 6px; }
.hm-prog-row > span:first-child { flex: 1; color: var(--muted); }
.hm-prog-track { flex: 2; height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; }
.hm-prog-track > span { display: block; height: 100%; background: var(--grad-gold); border-radius: 999px; }
.hm-prog-row b { color: var(--gold); min-width: 32px; text-align: right; }

/* ---------- chips ---------- */
.hm-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 12px 0;
}
.hm-chip {
  background: rgba(233, 185, 73, 0.08);
  border: 1px solid rgba(233, 185, 73, 0.35);
  color: var(--gold);
  font: 700 11.5px var(--font-body);
  border-radius: 999px;
  padding: 5px 11px;
  cursor: pointer;
}
.hm-chip:hover { background: rgba(233, 185, 73, 0.18); }

/* ---------- input ---------- */
.hm-input-row {
  display: flex; gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
}
.hm-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  font: 500 13.5px var(--font-body);
  padding: 10px 16px;
  outline: none;
}
.hm-input:focus { border-color: var(--gold); }
.hm-input::placeholder { color: var(--faint); }
.hm-send {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--grad-gold);
  color: #1a1406;
  border: none;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--shadow-gold);
}

/* ---------- sandbox overlay ---------- */
.hm-overlay {
  position: fixed; inset: 0;
  z-index: 400;
  background: rgba(5, 5, 12, 0.82);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: 24px;
}
.hm-overlay-inner {
  width: min(940px, 100%);
  height: min(80vh, 760px);
  display: flex; flex-direction: column;
  background: var(--cosmic);
  border: 1px solid rgba(233, 185, 73, 0.4);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.9);
}
.hm-overlay-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--gold);
  font: 800 14px var(--font-display);
}
.hm-overlay-close {
  background: transparent; border: none; color: var(--muted);
  font-size: 15px; cursor: pointer; padding: 4px 8px;
}
.hm-overlay-close:hover { color: var(--text); }
.hm-overlay-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.hm-frame { flex: 1; width: 100%; border: 0; background: #fff; }
.hm-copy-area {
  flex: 1; width: 100%;
  background: #0a0a14; color: #d9d8e6;
  border: 0; outline: none; resize: none;
  font: 12px/1.55 ui-monospace, Consolas, monospace;
  padding: 14px;
}
.hm-overlay-foot { padding: 10px 16px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; }

/* ---------- settings gear + panel (Phase 2) ---------- */
.hm-gear {
  background: transparent; border: none;
  color: var(--muted); font-size: 15px;
  cursor: pointer; padding: 6px;
}
.hm-gear:hover { color: var(--gold); transform: rotate(30deg); }

.hm-settings {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  max-height: 55%;
  overflow-y: auto;
  background: rgba(233, 185, 73, 0.03);
}
.hm-settings-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin-bottom: 10px;
}
.hm-settings-head b { font: 800 13px var(--font-display); color: var(--gold); }
.hm-settings-head span { font-size: 11px; color: var(--faint); }
.hm-field { margin-bottom: 9px; }
.hm-field label {
  display: block;
  font: 800 10.5px var(--font-body);
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 4px;
}
.hm-field input, .hm-field select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--text);
  font: 500 13px var(--font-body);
  padding: 8px 10px;
  outline: none;
}
.hm-field input:focus, .hm-field select:focus { border-color: var(--gold); }
.hm-settings-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.hm-settings-status { font-size: 12px; color: var(--muted); font-weight: 700; }
.hm-settings-status.hm-settings-ok { color: #34d399; }
.hm-settings-status.hm-settings-bad { color: var(--rose); }
.hm-settings-hint {
  margin-top: 10px;
  font-size: 11.5px; color: var(--faint); line-height: 1.5;
  border-top: 1px dashed var(--line-strong); padding-top: 8px;
}
.hm-settings-hint code { color: #f6d876; }

/* ---------- streaming caret ---------- */
.hm-caret {
  display: inline-block; width: 7px; height: 14px;
  background: var(--gold);
  border-radius: 2px;
  vertical-align: -2px;
  animation: hmCaret 0.8s steps(2) infinite;
}
@keyframes hmCaret { 0%, 100% { opacity: 1; } 50% { opacity: 0.15; } }

/* ---------- cloud nudge ---------- */
.hm-cloud-nudge { border-color: rgba(139, 92, 246, 0.5); }
.hm-cloud-nudge code { color: #c4b5fd; }

/* ---------- image tool (Phase 2) ---------- */
.hm-image { border-color: rgba(45, 212, 191, 0.4); }
.hm-img-wrap {
  position: relative;
  margin: 8px 0 4px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  min-height: 120px;
  display: grid; place-items: center;
}
.hm-img {
  display: block;
  width: 100%; height: auto;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.hm-img-pending::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.09) 50%, transparent 70%);
  animation: hmShimmer 1.3s linear infinite;
}
.hm-img-wrap:not(.hm-img-pending) .hm-img { opacity: 1; }
.hm-img-pending span {
  position: absolute;
  font-size: 12px; color: var(--faint); font-weight: 700;
}
.hm-img-fail span { color: var(--rose); }
@keyframes hmShimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- The Awakening panel (Phase 5) ---------- */
.hm-awakening {
  border-bottom: 1px solid var(--line);
  padding: 14px;
  max-height: 72%;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(233, 185, 73, 0.06), rgba(12, 12, 23, 0));
}
.hm-awake-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.hm-awake-head b { font: 800 15px var(--font-display); color: var(--gold); }
.hm-awake-head span { font-size: 11.5px; color: var(--faint); font-weight: 800; }
.hm-awake-sub { font-size: 12.5px; color: var(--muted); margin: 6px 0 10px; line-height: 1.5; }
.hm-awake-track { height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; margin-bottom: 12px; }
.hm-awake-track > span { display: block; height: 100%; background: var(--grad-gold); border-radius: 999px; transition: width 0.4s ease; }

.hm-awake-step {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.hm-awake-check {
  background: transparent; border: none;
  color: var(--faint); font-size: 16px;
  cursor: pointer; padding: 2px; line-height: 1;
}
.hm-awake-check.done { color: #34d399; }
.hm-awake-step-main { flex: 1; min-width: 0; }
.hm-awake-step-main b { display: block; font: 700 13px var(--font-body); margin-bottom: 3px; color: var(--text); }
.hm-awake-step-main p { font-size: 12.5px; color: var(--muted); line-height: 1.55; margin-bottom: 8px; }
.hm-awake-step-main code { color: #f6d876; font-size: 12px; }
.hm-awake-cmd {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #0a0a14;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 7px 9px;
  margin-bottom: 6px;
}
.hm-awake-cmd code { flex: 1; min-width: 0; overflow-wrap: anywhere; color: #d9d8e6; }
.hm-awake-cmd .hm-skill-cat { font-size: 10.5px; color: var(--faint); }
.hm-awake-gen, .hm-awake-test { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.hm-awake-snippet {
  display: block; width: 100%;
  min-height: 76px;
  background: #0a0a14;
  border: 1px dashed rgba(233, 185, 73, 0.4);
  border-radius: 9px;
  color: #f6d876;
  font: 12px/1.6 ui-monospace, Consolas, monospace;
  padding: 9px 10px;
  resize: vertical;
  outline: none;
  margin-bottom: 6px;
}
.hm-awake-endpoint { font-size: 11.5px; color: var(--faint); margin-top: 6px; }
.hm-awake-endpoint code { color: var(--teal); }
.hm-awake-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.hm-btn-awaken {
  width: 100%;
  background: rgba(233, 185, 73, 0.1);
  border-color: rgba(233, 185, 73, 0.5);
  color: var(--gold);
  font-weight: 800;
  padding: 9px 13px;
}

/* ---------- tool progress chips (Phase 5) ---------- */
.hm-tools { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.hm-tool {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  background: rgba(45, 212, 191, 0.07);
  border: 1px solid rgba(45, 212, 191, 0.3);
  border-radius: 8px;
  padding: 4px 9px;
}
.hm-tool b { color: var(--teal); font-weight: 800; }

/* ---------- skills & jobs cards (Phase 5) ---------- */
.hm-skill {
  border-top: 1px solid var(--line);
  padding: 7px 0;
  font-size: 12.5px;
}
.hm-skill b { color: var(--text); }
.hm-skill p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.hm-skill-cat {
  display: inline-block;
  font: 700 10px var(--font-body);
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--purple);
  background: rgba(139, 92, 246, 0.12);
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 6px;
}
.hm-job {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--line);
  padding: 8px 0;
  font-size: 12.5px;
}
.hm-job-main { min-width: 0; }
.hm-job-main b { color: var(--text); }
.hm-job-main p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.hm-job-actions { display: flex; gap: 5px; flex-shrink: 0; }
.hm-btn-sm { font-size: 11px; padding: 5px 10px; }
.hm-awaken-nudge { border-color: rgba(233, 185, 73, 0.5); }

/* ---------- responsive ---------- */
@media (max-width: 560px) {
  .hm-fab { right: 14px; bottom: 14px; padding: 11px 16px 11px 11px; }
  .hm-fab-label { display: none; }
  .hm-panel { right: 8px; bottom: 78px; width: calc(100vw - 16px); }
}

@media (prefers-reduced-motion: reduce) {
  .hm-fab-pulse, .hm-typing span, .hm-caret, .hm-img-pending::after { animation: none; }
}
