html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

html, body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body > .container {
  flex: 1 0 auto;
}

/* ── the student helper in the corner ──────────────────────────────────────
   Positioned with logical properties, so it sits in the trailing corner of an
   RTL page the way it would in an LTR one, without a second rule. */
.ostazy-bot__launch {
  position: fixed;
  inset-block-end: 1.25rem;
  inset-inline-end: 1.25rem;
  z-index: 1040;
  width: 3.25rem;
  height: 3.25rem;
  border: none;
  border-radius: 50%;
  background: var(--ostazy-primary);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  box-shadow: var(--ostazy-shadow-lg);
  cursor: pointer;
}

.ostazy-bot__launch:hover { background: var(--ostazy-primary-600); }

.ostazy-bot__launch:focus-visible {
  outline: 3px solid var(--ostazy-accent);
  outline-offset: 2px;
}

.ostazy-bot__panel {
  position: fixed;
  inset-block-end: 5.25rem;
  inset-inline-end: 1.25rem;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  width: min(22rem, calc(100vw - 2.5rem));
  /* Tall enough to hold a conversation, never taller than the screen it is on. */
  max-height: min(30rem, calc(100vh - 8rem));
  background: var(--ostazy-surface);
  border: 1px solid var(--ostazy-line);
  border-radius: var(--ostazy-radius);
  box-shadow: var(--ostazy-shadow-lg);
  overflow: hidden;
}

.ostazy-bot__panel[hidden] { display: none; }

.ostazy-bot__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--ostazy-primary);
  color: #fff;
}

.ostazy-bot__sub { font-size: 0.75rem; opacity: 0.85; }

.ostazy-bot__x {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}

.ostazy-bot__log {
  flex: 1 1 auto;
  min-height: 6rem;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--ostazy-bg);
}

.ostazy-bot__msg {
  max-width: 88%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--ostazy-radius-sm);
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-line;
}

.ostazy-bot__msg--bot {
  align-self: flex-start;
  background: var(--ostazy-surface);
  border: 1px solid var(--ostazy-line);
  color: var(--ostazy-text);
}

.ostazy-bot__msg--me {
  align-self: flex-end;
  background: var(--ostazy-primary);
  color: #fff;
}

.ostazy-bot__link {
  display: block;
  margin-top: 0.4rem;
  font-weight: 700;
  color: var(--ostazy-primary);
  text-decoration: none;
}

.ostazy-bot__link:hover { text-decoration: underline; }

.ostazy-bot__topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.6rem 0.75rem 0;
  /* The suggestions are a menu, not a transcript: they stay put while the log scrolls. */
  max-height: 8rem;
  overflow-y: auto;
}

.ostazy-bot__chip {
  border: 1px solid var(--ostazy-primary);
  background: transparent;
  color: var(--ostazy-primary);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.78rem;
  cursor: pointer;
}

.ostazy-bot__chip:hover { background: var(--ostazy-primary); color: #fff; }

.ostazy-bot__form {
  display: flex;
  gap: 0.4rem;
  padding: 0.75rem;
}

@media print {
  .ostazy-bot__launch, .ostazy-bot__panel { display: none !important; }
}
