:root {
  color-scheme: light dark;
  --ink: #1c1914;
  --paper: #f4f7fa;
  --line: #d0d8e0;
  --accent: #2a6f8f;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8eef3;
    --paper: #12161b;
    --line: #3a4652;
    --accent: #7ec8e3;
  }
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
}
body {
  font-family: Georgia, "Times New Roman", serif;
  background: var(--paper);
  color: var(--ink);
}
.stage { min-height: 100vh; }
.buddy {
  position: fixed;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: min(380px, calc(100vw - 32px));
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: left 0.85s cubic-bezier(.2, .8, .2, 1),
              top 0.85s cubic-bezier(.2, .8, .2, 1),
              transform 0.85s cubic-bezier(.2, .8, .2, 1),
              width 0.85s ease;
}
.mode-results .buddy {
  left: 20px;
  top: 16px;
  transform: none;
  width: 210px;
  align-items: flex-start;
  text-align: left;
}
.jmp-assistant {
  width: 100%;
}
.mode-hello .jmp-assistant,
.mode-searching .jmp-assistant {
  width: min(100%, 280px);
}
.mode-results .jmp-assistant {
  width: 160px;
}
.mode-results .jmp-stage {
  padding: 10px 8px 8px;
}
.mode-results .jmp-status {
  display: none;
}
.speech {
  margin: .85rem 0 .75rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 4px;
  line-height: 1.45;
  font-size: 1.12rem;
}
.mode-results .speech {
  font-size: .9rem;
  width: 100%;
}
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  justify-content: center;
  width: 100%;
}
.mode-results .choices {
  justify-content: flex-start;
}
.choice {
  font: inherit;
  font-size: .95rem;
  padding: .45rem .8rem;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.choice-all {
  width: 100%;
  padding: .65rem 1rem;
}
.choice:disabled { opacity: .5; cursor: wait; }
.status {
  min-height: 1.2em;
  margin: .55rem 0 0;
  color: color-mix(in srgb, var(--ink) 70%, transparent);
  font-size: .85rem;
}
.panel {
  display: none;
  padding: 28px 28px 48px 250px;
  max-width: 1100px;
}
.mode-results .panel {
  display: block;
  animation: fadein 0.7s ease 0.25s both;
}
@keyframes fadein {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.card {
  border-top: 1px solid var(--line);
  padding: 1rem 0;
}
.card h2 { font-size: 1.05rem; margin: 0 0 .35rem; }
.card a { color: var(--accent); }
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-top: .75rem;
}
.card-actions button {
  font: inherit;
  font-size: .9rem;
  padding: .4rem .75rem;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.card-actions button:disabled { opacity: .5; cursor: wait; }
.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: #11161b;
}
.sheet[hidden] { display: none; }
.sheet-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  color: #e8eef3;
  border-bottom: 1px solid #3a4652;
}
.sheet-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.sheet-actions button {
  font: inherit;
  font-size: .9rem;
  padding: .4rem .7rem;
  border: 1px solid #e8eef3;
  background: transparent;
  color: #e8eef3;
  cursor: pointer;
}
.sheet-split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(320px, 1.4fr);
}
.sheet-split pre {
  margin: 0;
  padding: 16px;
  overflow: auto;
  white-space: pre-wrap;
  color: #e8eef3;
  font-size: .92rem;
  border-right: 1px solid #3a4652;
}
.sheet-split iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fbf8f2;
}
@media (max-width: 860px) {
  .sheet-split { grid-template-columns: 1fr; }
  .sheet-split pre { max-height: 28vh; border-right: 0; border-bottom: 1px solid #3a4652; }
}
.meta {
  font-size: .9rem;
  margin: 0 0 .5rem;
  color: color-mix(in srgb, var(--ink) 70%, transparent);
}
@media (max-width: 720px) {
  .mode-results .buddy {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    padding: 16px 16px 0;
  }
  .mode-results .panel { padding: 12px 16px 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .buddy, .panel { transition: none; animation: none; }
}
