/* Chat mode: one panel, the app's own screens hidden while it is on. */

:root {
  --cm-bg: #eef1f7;
  --cm-glass: rgba(255, 255, 255, 0.72);
  --cm-line: rgba(20, 30, 60, 0.12);
  --cm-text: #151a2b;
  --cm-muted: #5b6480;
  --cm-accent: #4f46e5;
  --cm-accent-text: #ffffff;
  --cm-radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cm-bg: #0d1020;
    --cm-glass: rgba(30, 36, 60, 0.7);
    --cm-line: rgba(255, 255, 255, 0.12);
    --cm-text: #eef1ff;
    --cm-muted: #a4acc9;
    --cm-accent: #818cf8;
    --cm-accent-text: #0d1020;
  }
}
:root[data-theme="dark"] {
  --cm-bg: #0d1020;
  --cm-glass: rgba(30, 36, 60, 0.7);
  --cm-line: rgba(255, 255, 255, 0.12);
  --cm-text: #eef1ff;
  --cm-muted: #a4acc9;
  --cm-accent: #818cf8;
  --cm-accent-text: #0d1020;
}

/* Mode switch: the app marks its normal screens with data-classic. */
body.chat-mode [data-classic] { display: none !important; }
#chatmode { display: none; }
body.chat-mode #chatmode { display: block; }

#chatmode {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
  color: var(--cm-text);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.cm-panel {
  background: var(--cm-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--cm-line);
  border-radius: var(--cm-radius);
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}
.cm-transcript { min-height: 120px; max-height: 58vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.cm-msg { max-width: 88%; padding: 12px 16px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; }
.cm-msg.user { align-self: flex-end; background: var(--cm-accent); color: var(--cm-accent-text); }
.cm-msg.bot { align-self: flex-start; border: 1px solid var(--cm-line); background: var(--cm-bg); }
.cm-card { align-self: stretch; border: 1px solid var(--cm-line); border-radius: 14px; padding: 14px 16px; background: var(--cm-bg); }
.cm-card h3 { margin: 0 0 6px; font-size: 1.1em; }
.cm-card p { margin: 0 0 8px; color: var(--cm-muted); white-space: pre-wrap; }
.cm-card ul { margin: 0; padding-left: 20px; }
.cm-card li { margin: 4px 0; }
.cm-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

.cm-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cm-chip { border: 1px solid var(--cm-line); background: var(--cm-bg); color: var(--cm-text); border-radius: 999px; padding: 8px 14px; font-size: 15px; cursor: pointer; }

.cm-composer { display: flex; gap: 10px; align-items: flex-end; }
.cm-input {
  flex: 1; min-height: 56px; max-height: 180px; resize: vertical;
  font: inherit; font-size: 18px; color: var(--cm-text);
  background: var(--cm-bg); border: 2px solid var(--cm-line); border-radius: 14px; padding: 14px 16px;
}
.cm-input:focus { outline: none; border-color: var(--cm-accent); }
.cm-send, .cm-btn {
  min-height: 56px; min-width: 56px; border: 0; border-radius: 14px; padding: 0 20px;
  font: inherit; font-size: 17px; font-weight: 600; cursor: pointer;
  background: var(--cm-accent); color: var(--cm-accent-text);
}
.cm-btn.ghost { background: transparent; color: var(--cm-text); border: 1px solid var(--cm-line); }
.cm-status { min-height: 1.4em; color: var(--cm-muted); font-size: 14px; margin-top: 8px; }

.cm-toggle { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--cm-line); background: var(--cm-glass); color: var(--cm-text); font: inherit; font-weight: 600; cursor: pointer; }
.cm-toggle[aria-pressed="true"] { background: var(--cm-accent); color: var(--cm-accent-text); border-color: transparent; }

/* Tour */
.cm-hl { outline: 3px solid var(--cm-accent) !important; outline-offset: 4px; border-radius: 8px; transition: outline-color .2s; }
.cm-tour {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  width: min(560px, calc(100vw - 32px)); z-index: 1000;
  background: var(--cm-glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  color: var(--cm-text); border: 1px solid var(--cm-line); border-radius: var(--cm-radius);
  padding: 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.cm-tour p { margin: 0 0 12px; }

@media (max-width: 600px) {
  #chatmode { padding: 10px; }
  .cm-panel { padding: 14px; }
  .cm-msg { max-width: 96%; }
}
