:root {
  /* LobeChat-style dark monochrome — black ground, white ink, white accent */
  --bg: #0d0d0e;              /* near-black ground */
  --card: #16161a;            /* slightly lighter chrome surfaces */
  --ink: #f0f0f0;             /* near-white text */
  --ink-soft: #8a8a90;        /* muted grey */
  --line: #2a2a30;            /* subtle dark divider */

  /* Avatars */
  --patient: #2a2a30;         /* dark grey tile */
  --doctor: #f0f0f0;          /* near-white */

  /* Bubbles */
  --bubble: #1f1f24;          /* dark grey, patient default */
  --bubble-ink: #f0f0f0;
  --bubble-doctor: #f0f0f0;   /* near-white, doctor — inverted */
  --bubble-doctor-ink: #0d0d0e;

  /* Accents — white as the "accent" (no color, pure mono) */
  --accent: #f0f0f0;          /* white */
  --accent-soft: #2a2a30;     /* dark grey for hover states */
  --accent-strong: #ffffff;   /* pure white for active */
  --danger: #c54848;          /* the one pop of color, only for danger */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Inter", -apple-system, BlinkMacSystemFont,
    "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.app__header {
  position: relative;
  padding: 60px 20px 18px;   /* extra top room for the absolute-positioned icons above the title */
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.header__icon-btn {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family: inherit;
}

.header__icon-btn:hover {
  background: var(--accent-soft);
}

.header__right {
  position: absolute;
  top: 14px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Icon buttons inside the right cluster shouldn't inherit the hamburger's absolute positioning */
.header__right .header__icon-btn {
  position: static;
  transform: none;
  left: auto;
}

.streak-badge {
  padding: 5px 11px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.streak-badge--pop {
  animation: streak-pop 0.4s ease;
}

@keyframes streak-pop {
  0%   { transform: scale(0.7); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

.app__title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.5px;
  line-height: 1.05;
  color: var(--ink);
  font-variation-settings: "opsz" 144;
}


.messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg);
}

.hint {
  align-self: center;
  background: transparent;
  color: var(--ink-soft);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  letter-spacing: 0.2px;
}

.row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.row--patient { justify-content: flex-start; }
.row--doctor  { justify-content: flex-end; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;            /* circle */
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
}

.avatar--patient {
  background: var(--patient);
  color: var(--ink);
}

.avatar--doctor {
  background: var(--doctor);
  color: var(--bubble-doctor-ink);
}

.bubble-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 75%;
  min-width: 0;
}

.row--doctor .bubble-stack { align-items: flex-end; }

.bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.bubble {
  padding: 11px 14px;
  background: var(--bubble);
  color: var(--bubble-ink);
  border-radius: 16px;
  line-height: 1.5;
  font-size: 15px;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.row--patient .bubble { border-bottom-left-radius: 4px; }
.row--doctor  .bubble {
  border-bottom-right-radius: 4px;
  background: var(--bubble-doctor);
  color: var(--bubble-doctor-ink);
}

.answer-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.answer-btn:hover { background: var(--accent-soft); }

.answer-reveal {
  background: var(--card);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  border-left: 3px solid var(--accent);
  font-style: italic;
}

.bubble--pending {
  color: var(--ink-soft);
  font-style: italic;
}

.cryptic-span {
  font-style: italic;
  font-weight: 600;
  background: linear-gradient(180deg, transparent 60%, rgba(240, 240, 240, 0.2) 60%);
  padding: 1px 4px;
  border-radius: 3px;
}

/* Meta bubble = the implicit "(asks for a cryptic)" doctor turn */
.bubble--meta {
  background: transparent !important;
  color: var(--ink-soft) !important;
  font-style: italic;
  font-size: 12px;
  padding: 4px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.composer {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--card);
}

.composer__input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 22px;
  font-size: 15px;
  outline: none;
  color: var(--ink);
  font-family: inherit;
}

.composer__input::placeholder { color: var(--ink-soft); }

.composer__input:focus {
  border-color: var(--accent);
}

.composer__send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}

.composer__send:hover:not(:disabled) {
  background: var(--accent-strong);
}

.composer__send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.toolbar {
  display: flex;
  gap: 8px;
  padding: 10px 12px 16px;
  background: var(--card);
}

.toolbar__btn {
  flex: 1;
  padding: 10px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.toolbar__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.toolbar__btn--primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 700;
}

.toolbar__btn--primary:hover:not(:disabled) {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.toolbar__btn--danger {
  background: var(--danger);
  color: #fdfaf3;
  border-color: var(--danger);
  font-weight: 600;
}

.toolbar__btn:hover:not(:disabled):not(.toolbar__btn--primary):not(.toolbar__btn--danger) {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
}

.banner {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 16px;
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
}

.banner--reveal { color: var(--ink-soft); }

.banner__text strong {
  color: var(--ink);
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 15px;
}

.banner__btn {
  padding: 7px 13px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.banner__btn:hover { background: var(--accent-soft); border-color: var(--accent-soft); }

.symptom-hint {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  font-size: 13px;
  color: var(--ink);
  max-width: 88%;
  line-height: 1.4;
}

.symptom-hint__icon {
  flex-shrink: 0;
  font-size: 15px;
}

.symptom-hint__text {
  flex: 1;
}

.symptom-hint__count {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--ink-soft);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  background: var(--bg);
  border-radius: 6px;
}

/* Sidebar (past cases history) */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 300px;
  max-width: 85vw;
  height: 100vh;
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  box-shadow: 4px 0 24px rgba(26, 20, 16, 0.08);
}

.sidebar:not([hidden]) {
  transform: translateX(0);
}

.sidebar[hidden] {
  display: flex;
  pointer-events: none;
}

.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.sidebar__title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.sidebar__list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar__stats {
  display: flex;
  gap: 6px;
  padding: 14px 12px;
  margin: 4px 4px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.sidebar__stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.sidebar__stat strong {
  font-family: "Fraunces", Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
}

.sidebar__stat span {
  font-size: 10px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 500;
}

.sidebar__empty {
  color: var(--ink-soft);
  font-size: 13px;
  text-align: center;
  padding: 32px 16px;
  line-height: 1.5;
}

.sidebar__item {
  position: relative;
  display: flex;
  align-items: stretch;
  border-radius: 10px;
}

.sidebar__item-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 36px 11px 12px;   /* right padding makes room for the × button */
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
  min-width: 0;
}

.sidebar__item-main:hover { background: var(--accent-soft); }

.sidebar__item-delete {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.12s, background 0.12s, color 0.12s;
  font-family: inherit;
}

.sidebar__item:hover .sidebar__item-delete { opacity: 0.7; }

.sidebar__item-delete:hover {
  background: var(--danger);
  color: #fff;
  opacity: 1;
}

.sidebar__item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar__item-status {
  font-size: 12px;
  flex-shrink: 0;
}

.sidebar__item-subtitle {
  font-size: 12px;
  color: var(--ink-soft);
}

.sidebar__item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 4px;
}

.sidebar__footer {
  padding: 12px;
  border-top: 1px solid var(--line);
}

.sidebar__clear {
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}

.sidebar__clear:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 20, 16, 0.35);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.sidebar-backdrop:not([hidden]) {
  opacity: 1;
}

.sidebar-backdrop[hidden] {
  display: block;
  pointer-events: none;
}

/* "Viewing past case" banner */
.viewing-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-soft);
}

/* The class rule above outranks the UA [hidden]{display:none}; restore it. */
.viewing-banner[hidden] { display: none; }

.viewing-banner__actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.viewing-banner__btn {
  padding: 5px 10px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.viewing-banner__btn:hover { background: var(--accent-soft); border-color: var(--accent-soft); }

/* Right panel — only visible at desktop widths (≥1000px) */
.right-panel { display: none; }

.rp-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rp-section__title {
  font-size: 10px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.rp-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
  color: var(--ink);
}

.rp-row span { color: var(--ink-soft); }

.rp-row strong {
  font-family: "Fraunces", Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}

.rp-streak {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 4px;
}

.rp-streak__num {
  font-family: "Fraunces", Georgia, serif;
  font-size: 56px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.rp-streak__flame {
  font-family: "Inter", sans-serif;
  font-size: 28px;
}

.rp-streak__label {
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}

/* ----- Desktop layout: side panels appear at ≥1000px ----- */
@media (min-width: 1000px) {
  html, body { height: 100vh; overflow: hidden; }

  body {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 280px;
    grid-template-rows: 100vh;
    grid-template-areas: "sidebar app right";
    align-items: stretch;
  }

  .app {
    grid-area: app;
    width: 520px;            /* explicit, not max — grid items can ignore max-width */
    min-width: 0;            /* override grid's auto min-content sizing */
    margin: 0 auto;
    height: 100vh;
  }

  /* Sidebar: always visible, integrated into the grid */
  .sidebar,
  .sidebar[hidden] {
    grid-area: sidebar;
    position: static;
    transform: none !important;
    pointer-events: auto !important;
    width: 100%;
    max-width: none;
    height: 100vh;
    box-shadow: none;
    border-right: 1px solid var(--line);
    display: flex;
  }

  /* Backdrop and toggle buttons not needed when sidebar is permanent */
  .sidebar-backdrop { display: none !important; }
  #history-btn,
  .sidebar__header .header__icon-btn { display: none; }

  .sidebar__header { justify-content: flex-start; }

  /* Right panel becomes visible */
  .right-panel {
    grid-area: right;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    height: 100vh;
    overflow-y: auto;
    border-left: 1px solid var(--line);
    background: var(--bg);
  }

  /* Header streak badge is redundant when right panel shows a big streak */
  .streak-badge { display: none; }
}

/* Tutorial modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  padding: 16px;
}

.modal[hidden] { display: none; }

.modal__panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 26px 22px;
  width: 100%;
  max-width: 440px;
  position: relative;
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: inherit;
}

.modal__close:hover { background: var(--accent-soft); color: var(--ink); }

.modal__title {
  margin: 0 0 14px;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.5px;
}

.modal__body {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}

.modal__body p {
  margin: 0 0 14px;
}

.modal__list {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal__list li {
  padding-left: 14px;
  position: relative;
  color: var(--ink);
}

.modal__list li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

.modal__list strong {
  font-weight: 600;
  color: var(--ink);
}

.modal__btn {
  width: 100%;
  margin-top: 18px;
  padding: 12px 16px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.2px;
}

.modal__btn:hover { background: var(--accent-strong); }

/* Smaller modal panel (for confirmations) */
.modal__panel--small {
  max-width: 360px;
  padding: 24px 22px 18px;
}

/* Row of buttons (for confirm/cancel-style modals) */
.modal__actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.modal__actions .modal__btn { margin-top: 0; }

.modal__btn--secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.modal__btn--secondary:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

.modal__btn--danger {
  background: var(--danger);
  color: #fff;
}

.modal__btn--danger:hover {
  background: var(--danger);
  filter: brightness(0.9);
}

/* Tutorial modal — doctor name input */
.modal__field {
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.modal__field-label {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 8px;
  letter-spacing: 0.2px;
}

.modal__field-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.15s;
}

.modal__field-row:focus-within {
  border-color: var(--accent);
}

.modal__field-prefix {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}

.modal__field-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  min-width: 0;
}

.modal__field-input::placeholder { color: var(--ink-soft); }

/* ========================================================================
 * DATING MODE THEME — pink/lavender, hearts, flash
 * Triggered by body.mode-dating class (set from JS after flirt #2)
 * ======================================================================== */
body.mode-dating {
  --bg: #fff0f5;              /* whisper pink ground */
  --card: #fffafc;            /* near-white pink */
  --ink: #4a1a3a;             /* deep plum */
  --ink-soft: #a878a0;
  --line: #f5e4ed;
  --patient: #ffb8d0;
  --doctor: #c44a82;
  --bubble: #ffe4ee;          /* warm pastel pink, patient default */
  --bubble-ink: #4a1a3a;
  --bubble-doctor: #c44a82;   /* coral plum, doctor */
  --bubble-doctor-ink: #fff;
  --accent: #ff6b9d;          /* coral pink */
  --accent-soft: #ffe0ec;
  --accent-strong: #e04f84;
  --danger: #c84a82;
}

body.mode-dating .app__title {
  letter-spacing: -0.3px;
}

/* Floating hearts — only when in dating mode */
.hearts-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
  display: none;
}

body.mode-dating .hearts-container { display: block; }

.heart {
  position: absolute;
  bottom: -50px;
  opacity: 0;
  animation: float-up linear infinite;
  will-change: transform, opacity;
}

@keyframes float-up {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
  10%  { opacity: 0.7; }
  90%  { opacity: 0.7; }
  100% { transform: translateY(-110vh) rotate(20deg); opacity: 0; }
}

/* Mode-transition flash overlay */
.transition-flash {
  position: fixed;
  inset: 0;
  background: #fff;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
}

.transition-flash.flash-pink { background: #ffcce0; }

.transition-flash.run { animation: flash 0.7s ease-out forwards; }

@keyframes flash {
  0%   { opacity: 0; }
  35%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Smooth swap of palette variables when modes shift */
body, .app, .bubble, .toolbar__btn, .composer__send,
.composer__input, .sidebar, .right-panel, .rp-section {
  transition: background 0.4s, color 0.4s, border-color 0.4s;
}

/* ========================================================================
 * DATING MODE — objective banner + icon swap
 * ======================================================================== */
.dating-objective {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.dating-objective[hidden] { display: none; }

.dating-objective__icon { font-size: 15px; }

/* Send button — swap paper-plane for heart in dating mode */
.composer__send .icon-heart { display: none; }
body.mode-dating .composer__send .icon-send { display: none; }
body.mode-dating .composer__send .icon-heart { display: block; }

/* ========================================================================
 * COURTROOM MODE — oxblood + parchment + brass
 * Triggered by body.mode-courtroom (set by JS after [DATE_REJECTED])
 * ======================================================================== */
body.mode-courtroom {
  --bg: #2a1818;              /* dark oxblood */
  --card: #3a2222;
  --ink: #f0e4d0;             /* parchment text */
  --ink-soft: #baa890;
  --line: #5a3a3a;
  --patient: #6b3434;
  --doctor: #8b2c2c;
  --bubble: #4a2828;          /* plaintiff bubble — dark wood */
  --bubble-ink: #f0e4d0;
  --bubble-doctor: #8b2c2c;   /* defendant bubble — oxblood */
  --bubble-doctor-ink: #f0e4d0;
  --accent: #c9a961;          /* aged brass */
  --accent-soft: #4a3322;
  --accent-strong: #b09245;
  --danger: #c44a4a;
}

body.mode-courtroom .app__title {
  letter-spacing: -0.3px;
  animation: title-wobble 2.4s ease-in-out infinite;
  transform-origin: center center;
  display: inline-block;   /* needed for the transform animation */
}

@keyframes title-wobble {
  0%, 100% { transform: translateY(0) rotate(-2.5deg); }
  20%      { transform: translateY(-6px) rotate(2deg); }
  40%      { transform: translateY(2px) rotate(-1deg); }
  60%      { transform: translateY(-4px) rotate(3deg); }
  80%      { transform: translateY(0) rotate(-2deg); }
}

/* Judge bubble — centered, italic, brass-on-dark */
.row--judge {
  justify-content: center;
}

.row--judge .bubble-stack {
  max-width: 80%;
  align-items: center;
}

.row--judge .bubble {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-style: italic;
  font-family: "Fraunces", Georgia, serif;
  font-size: 14px;
  text-align: center;
  padding: 12px 18px;
}

.row--judge .avatar {
  background: var(--accent);
  color: var(--bg);
  font-size: 16px;
}

body.mode-courtroom .row--judge .bubble {
  background: rgba(201, 169, 97, 0.12);
}

/* Gavel slam — momentary big emoji on courtroom entry */
.gavel-floater {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: grid;
  place-items: center;
  z-index: 49;
  font-size: 120px;
  opacity: 0;
  animation: gavel-slam 1.2s ease-out forwards;
}

@keyframes gavel-slam {
  0%   { transform: translateY(-200px) rotate(-25deg); opacity: 0; }
  40%  { transform: translateY(0) rotate(15deg); opacity: 1; }
  60%  { transform: translateY(0) rotate(15deg); opacity: 1; }
  100% { transform: translateY(0) rotate(15deg); opacity: 0; }
}

/* Dark variant of the transition flash (for courtroom entry) */
.transition-flash.flash-dark { background: #1a0a0a; }

/* Courtroom objective banner reuses .dating-objective styles via .objective-banner */
.objective-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.objective-banner[hidden] { display: none; }

/* ========================================================================
 * TRANSITIONS — dim backdrop, text does the work
 * Courtroom: 弹簧 spring-bounce energy
 * Match: joyful pow! zoom
 * ======================================================================== */
.courtroom-transition {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);   /* dim overlay — chat shows through */
  z-index: 9999;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  padding: 16px;
  animation: ct-fade 1.6s ease-in-out forwards;
}

.courtroom-transition__text {
  font-family: "Comic Sans MS", "Chalkboard SE", "Impact", sans-serif;
  font-size: clamp(40px, 10vw, 84px);
  font-weight: 900;
  color: #ffeb3b;
  text-align: center;
  letter-spacing: 1px;
  line-height: 1.05;
  text-shadow:
    3px 3px 0 #c44a4a,
    6px 6px 0 #6b2020,
    9px 9px 0 rgba(0,0,0,0.6),
    0 0 30px rgba(255, 235, 59, 0.4);
  -webkit-text-stroke: 2px #6b2020;
  /* Default: courtroom 弹簧 spring bounce */
  animation: ct-spring 1.6s cubic-bezier(0.5, 1.5, 0.6, 1) forwards;
}

@keyframes ct-fade {
  0%   { opacity: 0; }
  8%   { opacity: 1; }
  90%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Spring-bounce: drops from above, hits "ground", boings up/down a few times
   with diminishing amplitude, then shrinks away. 弹簧 / Slinky energy. */
@keyframes ct-spring {
  0%   { transform: translateY(-320px) scale(0.4) rotate(-8deg); opacity: 0; }
  14%  { transform: translateY(0)     scale(1.3) rotate(0deg);   opacity: 1; }
  24%  { transform: translateY(-44px) scale(1.05) rotate(3deg); }
  34%  { transform: translateY(0)     scale(1.2) rotate(-2deg); }
  44%  { transform: translateY(-24px) scale(1.08) rotate(2deg); }
  54%  { transform: translateY(0)     scale(1.15) rotate(-1deg); }
  62%  { transform: translateY(-10px) scale(1.1) rotate(1deg); }
  70%  { transform: translateY(0)     scale(1.12) rotate(0deg); }
  86%  { transform: translateY(0)     scale(1.12); opacity: 1; }
  100% { transform: translateY(0)     scale(0); opacity: 0; }
}

/* Match variant — joyful POW! zoom from tiny center to BIG */
.courtroom-transition.match-transition {
  background: rgba(60, 0, 30, 0.45);  /* warm dim, hints at pink */
}

.courtroom-transition.match-transition .courtroom-transition__text {
  color: #fff;
  text-shadow:
    3px 3px 0 #ff6b9d,
    6px 6px 0 #c44a82,
    9px 9px 0 rgba(0,0,0,0.45),
    0 0 30px rgba(255, 180, 210, 0.6);
  -webkit-text-stroke: 2px #c44a82;
  /* Override default spring with the pow burst */
  animation: ct-pow 1.6s cubic-bezier(0.34, 1.7, 0.5, 1) forwards;
}

/* POW: starts at scale 0 at center, bursts huge, settles with a little wobble,
   then collapses back to 0. Joyful confetti-popper energy. */
@keyframes ct-pow {
  0%   { transform: scale(0) rotate(0deg); opacity: 0; }
  18%  { transform: scale(1.5) rotate(-2deg); opacity: 1; }
  28%  { transform: scale(1.05) rotate(2deg); }
  38%  { transform: scale(1.25) rotate(-1deg); }
  48%  { transform: scale(1.12) rotate(1deg); }
  58%  { transform: scale(1.18) rotate(0deg); }
  85%  { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(0) rotate(8deg); opacity: 0; }
}

/* Modal footer link — for "change your name" inside tutorial */
.modal__footer-link {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.text-link {
  background: transparent;
  border: none;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: 0.2px;
}

.text-link:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

/* ========================================================================
 * TITLE FONT — Comic Sans, commit to the bit
 * ======================================================================== */
.app__title {
  font-family: "Comic Sans MS", "Chalkboard SE", "Marker Felt", cursive !important;
  letter-spacing: -0.5px;
}

/* Sidebar two-section layout */
.sidebar__section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}

.sidebar__section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ink-soft);
  padding: 10px 12px 4px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

.sidebar__section:first-of-type .sidebar__section-title {
  border-top: none;
  margin-top: 0;
}


/* JUDGE label above the judge bubble */
.row--judge .row__label {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  text-align: center;
  margin-bottom: 4px;
  opacity: 0.75;
}

/* Right-panel Diagnosed list */
.rp-diagnosed-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
  margin: 4px -8px -4px;   /* allow items to use their own padding */
}

.rp-empty {
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
  padding: 12px 8px 4px;
  letter-spacing: 0.2px;
}

/* Diagnosed section grows to fill remaining space in the right panel;
   list inside scrolls if overflow. Equal gaps come from .right-panel gap. */
.rp-section--diagnosed {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.rp-section--diagnosed .rp-diagnosed-list {
  flex: 1;
  min-height: 0;
  max-height: none;
}
