/* Kit components (plan 10): toast, dialog, bottom sheet / sign-in, Plus badge.
   Linked on demand by lib/ui/kit.js (ensureKitCss), so it also works on the
   older pages: colours come from the page's own tokens (tokens.css in the app;
   study / collections share the same names; the editor's names are the
   fallbacks). No colours of its own. */

/* --- toast --- */
.iy-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px);
  max-width: calc(100vw - 32px);
  background: var(--surface-hover, var(--hover-bg));
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  z-index: 3000;
}
.iy-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.iy-toast a,
.iy-toast button {
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font-weight: 600;
  margin-left: 8px;
  text-decoration: underline;
}

/* --- dialog + sheet (shared backdrop) --- */
.iy-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop, rgba(0, 0, 0, 0.55));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 2500;
}
.iy-dialog,
.iy-sheet {
  background: var(--surface-color, var(--canvas-bg, var(--bg-color)));
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius, 14px);
  box-shadow: var(--shadow, 0 12px 40px rgba(0, 0, 0, 0.45));
  width: 100%;
  max-width: 420px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 0.95rem;
}
.iy-dialog h2,
.iy-sheet h2 {
  margin: 0;
  font-size: 1.15rem;
}
.iy-dialog p,
.iy-sheet p {
  margin: 0;
  line-height: 1.45;
}
.iy-muted {
  color: var(--text-muted, var(--muted-color));
  font-size: 0.85rem;
}
.iy-dialog input,
.iy-sheet input {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-color);
}
.iy-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.iy-btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-color);
}
.iy-btn:hover:not(:disabled) {
  background: var(--surface-hover, var(--hover-bg));
}
.iy-btn-primary {
  border-color: transparent;
  background: var(--primary-gradient, var(--accent));
  color: var(--on-primary, #fff);
}
.iy-btn-primary:hover:not(:disabled) {
  background: var(--primary-gradient, var(--accent));
  filter: brightness(1.08);
}
.iy-btn-danger {
  color: var(--danger);
}
.iy-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.iy-btn-block {
  width: 100%;
}
.iy-or {
  text-align: center;
  color: var(--text-muted, var(--muted-color));
  font-size: 0.8rem;
}
.iy-status {
  min-height: 1.2em;
  color: var(--text-muted, var(--muted-color));
  font-size: 0.85rem;
}
.iy-status.error {
  color: var(--danger);
}

/* the sheet is a bottom sheet on phones */
@media (max-width: 560px) {
  .iy-backdrop.iy-sheet-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .iy-sheet {
    max-width: none;
    border-radius: var(--radius, 14px) var(--radius, 14px) 0 0;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
}

/* --- Iyaku Plus badge --- */
.plus-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--plus, var(--warning));
  border: 1px solid currentColor;
  border-radius: 6px;
  padding: 0 5px;
  margin-left: 4px;
  vertical-align: middle;
}

/* dialog forms lay their children out in the dialog's own column */
.iy-dialog-form {
  display: contents;
}
.iy-dialog-form[hidden] {
  display: none;
}
