:root {
  --bg: #f7faf8;
  --bg-elev: #ffffff;
  --bg-soft: #eef5f2;
  --ink: #14201c;
  --muted: #5c6f68;
  --line: rgba(20, 32, 28, 0.1);
  --line-strong: rgba(20, 32, 28, 0.18);
  --accent: #2a9d8f;
  --accent-ink: #ffffff;
  --accent-soft: #d7f0ea;
  --danger: #b3261e;
  --danger-soft: rgba(179, 38, 30, 0.1);
  --ok: #1b7a4a;
  --ok-soft: rgba(27, 122, 74, 0.1);
  --shadow: 0 18px 40px rgba(20, 32, 28, 0.1);
  --radius: 16px;
  --font-sans: "Calibri", "Carlito", system-ui, sans-serif;
  --font-display: "Calibri", "Carlito", system-ui, sans-serif;
  --find: #c9850d;
  --route: #2a7de1;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(42, 157, 143, 0.14), transparent 55%),
    radial-gradient(720px 380px at 100% 0%, rgba(42, 125, 225, 0.08), transparent 50%),
    linear-gradient(180deg, #fbfdfc 0%, var(--bg) 42%, #eef4f1 100%);
  background-attachment: fixed;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.shell {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 3.5rem;
}

.shell-wide {
  width: min(1180px, calc(100% - 2rem));
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0 1.4rem;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn,
button.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.68rem 1.1rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  gap: 0.35rem;
}

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

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

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

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  background: rgba(42, 157, 143, 0.08);
  border-color: rgba(42, 157, 143, 0.4);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(179, 38, 30, 0.28);
}

/* —— Landing —— */

.landing-body {
  overflow-x: hidden;
}

.landing-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 0;
}

.landing-nav {
  position: relative;
  z-index: 2;
  padding-bottom: 0.5rem;
}

.hero-landing {
  position: relative;
  min-height: min(72svh, 640px);
  display: grid;
  align-content: start;
  gap: 1rem;
  padding: 3.5rem 0 2.5rem;
  isolation: isolate;
}

.hero-landing::before {
  content: "";
  position: absolute;
  inset: 0 -8vw auto;
  height: 100%;
  z-index: -1;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(247, 250, 248, 0.2) 0%, rgba(247, 250, 248, 0.75) 78%, var(--bg) 100%),
    radial-gradient(ellipse 70% 55% at 70% 35%, rgba(42, 157, 143, 0.22), transparent 60%),
    radial-gradient(ellipse 45% 40% at 18% 60%, rgba(201, 133, 13, 0.12), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='%232a9d8f' stroke-opacity='0.12' stroke-width='1'%3E%3Cpath d='M0 80h160M80 0v160'/%3E%3Ccircle cx='80' cy='80' r='28'/%3E%3Ccircle cx='80' cy='80' r='52'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(145deg, #e7f4f0 0%, #f7faf8 45%, #e8eef8 100%);
  background-size: auto, auto, auto, 160px 160px, auto;
  animation: hero-glow 8s ease-in-out infinite alternate;
}

.hero-landing .brand-mark {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3rem, 9vw, 5.2rem);
  line-height: 0.92;
  font-weight: 800;
  letter-spacing: -0.04em;
  max-width: 9ch;
  color: var(--ink);
  position: relative;
  z-index: 1;
  animation: rise 700ms ease both;
}

.hero-landing .hero-line {
  margin: 0;
  max-width: 28rem;
  color: var(--muted);
  font-size: 1.12rem;
  position: relative;
  z-index: 1;
  animation: rise 700ms ease 80ms both;
}

.hero-landing .hero-actions {
  position: relative;
  z-index: 1;
  animation: rise 700ms ease 140ms both;
}

.hero-phone {
  position: absolute;
  right: max(0px, 2vw);
  top: 8%;
  width: min(280px, 34vw);
  aspect-ratio: 9 / 18.5;
  border-radius: 28px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.2)),
    radial-gradient(circle at 40% 30%, #d7f0ea, #cfe0f5 55%, #e8efe9);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: phone-float 5.5s ease-in-out infinite;
  z-index: 0;
}

.hero-phone::before {
  content: "";
  position: absolute;
  inset: 10% 12% 18%;
  border-radius: 18px;
  background:
    radial-gradient(circle at 55% 42%, rgba(42, 157, 143, 0.35), transparent 28%),
    linear-gradient(160deg, #b9d8cf 0%, #9bb8d4 45%, #d5e0d8 100%);
  box-shadow: inset 0 0 0 1px rgba(20, 32, 28, 0.08);
}

.hero-phone::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 7%;
  width: 38%;
  height: 5px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(20, 32, 28, 0.18);
}

.landing-section {
  padding: 3.5rem 0 4.5rem;
  animation: rise 600ms ease both;
}

.landing-section h2 {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  letter-spacing: -0.02em;
  font-weight: 700;
}

.landing-section p {
  margin: 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 2rem;
}

.feature-item {
  padding: 0.25rem 0;
}

.feature-item strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-bottom: 0.35rem;
}

.feature-item p {
  font-size: 0.95rem;
}

.landing-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.landing-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.88rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero {
  min-height: calc(100vh - 8rem);
  display: grid;
  align-content: center;
  gap: 1rem;
  padding: 2rem 0 3rem;
  animation: rise 700ms ease both;
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3rem, 10vw, 5.4rem);
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -0.03em;
  max-width: 10ch;
}

.hero p {
  margin: 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  align-items: center;
}

.panel {
  width: min(460px, 100%);
  margin: 2rem auto 0;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  animation: rise 500ms ease both;
}

.panel h1 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel .lead {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

label {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink);
  border-radius: 12px;
  padding: 0.78rem 0.9rem;
  font: inherit;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(42, 157, 143, 0.35);
  border-color: transparent;
}

.form-actions {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.1rem;
}

.msg {
  margin: 0 0 1rem;
  padding: 0.7rem 0.75rem 0.7rem 0.95rem;
  border-radius: 12px;
  font-size: 0.92rem;
  display: none;
  align-items: flex-start;
  gap: 0.65rem;
}

.msg.show {
  display: flex;
}

.msg-text {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.msg-close {
  appearance: none;
  flex: 0 0 auto;
  width: 1.7rem;
  height: 1.7rem;
  margin: -0.15rem 0 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  opacity: 0.7;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.msg-close:hover {
  opacity: 1;
  background: rgba(20, 32, 28, 0.06);
}

.msg.error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(179, 38, 30, 0.28);
}

.msg.ok {
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid rgba(27, 122, 74, 0.28);
}

.meta {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.card-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  background: var(--bg-soft);
}

.card strong {
  display: block;
  margin-bottom: 0.2rem;
}

.muted {
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(42, 157, 143, 0.28);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  padding: 0.7rem 0.4rem;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-weight: 600;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes phone-float {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-10px) rotate(-1deg);
  }
}

@keyframes hero-glow {
  from {
    filter: saturate(1);
  }
  to {
    filter: saturate(1.08) brightness(1.02);
  }
}

@media (max-width: 900px) {
  .hero-phone {
    width: min(180px, 42vw);
    top: 4%;
    opacity: 0.9;
  }

  .feature-strip {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 640px) {
  .hero h1,
  .hero-landing .brand-mark {
    max-width: none;
  }

  .hero-phone {
    display: none;
  }
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 700px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ── Logowanie: dostawcy, zakładki, telefon, 2FA i sekcja Security ──────────────
   Nowe drogi logowania (KONTRAKT-AUTH.md §5). Wszystko na zmiennych motywu
   (`var(--bg-elev)`, `var(--line)`, `var(--accent)`…), więc działa i w jasnym,
   i w ciemnym (`html[data-theme="dark"]`), bez osobnej palety. */

/* Bez tego `hidden` nie działa na elementach, którym nadajemy `display` (np. formularz). */
[hidden] {
  display: none !important;
}

.auth-providers {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1.1rem;
}

.provider-list {
  display: grid;
  gap: 0.55rem;
}

.provider-btn {
  justify-content: flex-start;
  width: 100%;
  gap: 0.6rem;
}

.provider-badge {
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--bg-soft);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.provider-label {
  min-width: 0;
}

.auth-separator {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.auth-separator::before,
.auth-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.25rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
}

.auth-tabs button {
  flex: 1;
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.5rem 0.7rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.auth-tabs button.active {
  background: var(--bg-elev);
  color: var(--accent);
  box-shadow: var(--shadow);
}

.auth-form {
  display: grid;
  gap: 0.2rem;
}

/* ── Sekcja „Security” na /account ─────────────────────────────────────────── */

.security-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev);
  padding: 1rem 1.1rem;
  margin-bottom: 0.9rem;
}

.security-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

.security-status {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.9rem;
}

.security-dot {
  flex: none;
  width: 0.62rem;
  height: 0.62rem;
  margin-top: 0.42rem;
  border-radius: 50%;
  background: var(--muted);
}

.security-dot.on {
  background: var(--ok);
}

.security-dot.off {
  background: var(--danger);
}

.security-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.security-hint {
  font-size: 0.8rem;
  line-height: 1.4;
  margin: 0.35rem 0;
}

.security-wizard {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.security-steps {
  display: grid;
  gap: 1rem;
}

.security-step-title {
  font-weight: 600;
  font-size: 0.88rem;
  margin: 0 0 0.35rem;
}

.qr-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.qr-box svg {
  width: 190px;
  height: 190px;
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.secret-box {
  display: block;
  padding: 0.6rem 0.75rem;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--ink);
  font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  overflow-wrap: anywhere;
}

.recovery-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.35rem 0.8rem;
  margin: 0.5rem 0 0.9rem;
  padding-left: 1.4rem;
  font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace;
  font-size: 0.92rem;
}

.security-warning {
  border-radius: 12px;
  border: 1px solid rgba(179, 38, 30, 0.28);
  background: var(--danger-soft);
  color: var(--danger);
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  margin: 0.5rem 0 0.6rem;
}

.identity-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.identity-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.8rem;
  padding: 0.55rem 0;
  font-size: 0.9rem;
}

.identity-row + .identity-row {
  border-top: 1px solid var(--line);
}

.identity-info {
  flex: 1;
  min-width: 160px;
}

.identity-meta {
  font-size: 0.76rem;
}

.security-connect {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

/* ── Tryb ciemny dla stron www (jawna paleta, nie automat z systemu) ─────────────
   Włącza się TYLKO atrybutem `data-theme="dark"` na <html>: apka podaje go
   kreatorowi postaci jako `?theme=dark`, a `creator.html` bierze go z przełącznika
   panelu. Publiczne strony zostają jasne, chyba że ktoś tego zażąda.
   Wartości te same co paleta `--d-*` w panel.css, żeby apka i panel wyglądały tak samo.
   Blok musi być NA KOŃCU pliku — nadpisuje zmienne z `:root` i gradient tła z `body`. */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101614;
  --bg-elev: #1a221e;
  --bg-soft: #16211d;
  --ink: #e8eeea;
  --muted: #8f9f97;
  --line: rgba(232, 238, 234, 0.14);
  --line-strong: rgba(232, 238, 234, 0.26);
  --accent: #35b5a4;
  --accent-ink: #06201c;
  --accent-soft: #1c3028;
  --danger: #ff7a70;
  --danger-soft: rgba(255, 122, 112, 0.14);
  --ok: #5ad195;
  --ok-soft: rgba(90, 209, 149, 0.14);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  /* paleta panelu — character-gen.css używa jej z fallbackiem na --bg-elev */
  --d-bg: #101614;
  --d-card: #1a221e;
  --d-line: #2e3c36;
  --d-ink: #e8eeea;
  --d-muted: #8f9f97;
  --d-green: #2f6d4f;
  --d-green-fg: #9fd8b9;
  --d-mint-soft: #1c3028;
}

html[data-theme="dark"] body {
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(42, 157, 143, 0.18), transparent 55%),
    radial-gradient(720px 380px at 100% 0%, rgba(42, 125, 225, 0.12), transparent 50%),
    linear-gradient(180deg, #121a17 0%, var(--bg) 45%, #0c1210 100%);
}

html[data-theme="dark"] a {
  color: var(--accent);
}

/* Zgoda na regulamin przy rejestracji (checkbox + tekst) */
label.consent {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
  line-height: 1.45;
  margin-top: 0.2rem;
}

label.consent input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin-top: 0.15rem;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

label.consent a {
  text-decoration: underline;
}
