/* Reset, page basics, buttons, form controls, toast, and screen-reader helper. */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 11px 20px;
  font: 500 15px/1 var(--ui);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .2s ease,background .2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-dark {
  background: var(--btn-bg);
  color: var(--btn-fg);
}

.btn-accent {
  background: var(--accent);
  color: var(--fg);
}

.btn-accent:hover {
  background: color-mix(in srgb,var(--accent) 88%,#fff);
}

.btn-line {
  border-color: var(--line);
  background: var(--bg-raised);
  color: var(--fg);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 14px;
}

[hidden] {
  display: none!important;
}

.field-ctl {
  appearance: none;
  -webkit-appearance: none;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--fg);
  font: 400 14.5px var(--ui);
  padding: 0 14px;
  min-width: 0;
}

select.field-ctl {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236F6D66' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  cursor: pointer;
}

.field-ctl:hover {
  border-color: color-mix(in srgb,var(--fg) 22%,var(--line));
}

.field-ctl:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.icon-btn {
  height: 34px;
  min-width: 34px;
  padding: 0 9px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: 500 13px var(--ui);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: color .15s ease,border-color .15s ease,background .15s ease;
}

.icon-btn:hover {
  color: var(--fg);
  border-color: color-mix(in srgb,var(--fg) 22%,var(--line));
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn.copied {
  color: var(--accent-ink);
}

.btn-sm.btn-line {
  background: var(--bg-raised);
}

.btn-danger {
  background: #B3261E;
  color: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom,0px) + 22px);
  transform: translate(-50%,16px);
  opacity: 0;
  z-index: 50;
  background: var(--btn-bg);
  color: var(--btn-fg);
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 14px;
  transition: opacity .25s ease,transform .25s ease;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%,0);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Shown only in demo mode (no Firebase config): a reminder that data is local. */
.demo-badge {
  position: fixed;
  left: 12px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  z-index: 40;
  padding: 7px 11px;
  border-radius: 999px;
  background: #141413;
  color: #FAF9F5;
  font: 500 11px/1 var(--mono);
  letter-spacing: .06em;
  opacity: .85;
  pointer-events: none;
}
