:root {
  --bg: #f5f5f7;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --blue: #0071e3;
  --card: #ffffff;
  --line: #d2d2d7;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: inherit; }
.top {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 22px;
  background: rgba(245,245,247,.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.logo {
  text-decoration: none;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav { display: flex; gap: 16px; flex: 1; }
.nav a { text-decoration: none; color: var(--muted); font-size: 15px; }
.nav a:hover { color: var(--ink); }
.top-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.lang {
  display: flex;
  background: #e8e8ed;
  border-radius: 980px;
  padding: 3px;
}
.lang a {
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 980px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.lang a.on { background: #fff; color: var(--ink); }
.seg {
  display: flex;
  justify-content: center;
  margin: 0 auto 22px;
  background: #e8e8ed;
  border-radius: 980px;
  padding: 3px;
  width: fit-content;
  max-width: 100%;
}
.seg a {
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 980px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.seg a.on { background: #fff; color: var(--ink); }
.feedback {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 16px;
}
.feedback.good { color: #248a3d; }
.feedback.bad { color: #ff3b30; }
.choices button.right { background: #34c759; color: #fff; }
.choices button.wrong { background: #ff3b30; color: #fff; }
.choices button:disabled { cursor: default; opacity: 1; }
.ghost, .btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  border-radius: 980px;
  padding: 10px 18px;
  font-size: 15px;
}
.ghost { background: #e8e8ed; color: var(--ink); }
.btn, button.btn { background: var(--blue); color: #fff; }
.btn.secondary { background: #e8e8ed; color: var(--ink); }
main { max-width: 980px; margin: 0 auto; padding: 28px 20px 64px; }
.hero { text-align: center; padding: 32px 0 16px; }
.hero h1 { font-size: clamp(40px, 8vw, 72px); letter-spacing: -0.04em; line-height: 1.05; margin: 8px 0; }
.lead { color: var(--muted); font-size: 18px; max-width: 540px; margin: 0 auto 24px; line-height: 1.5; }
.hero.tight { padding: 8px 0 4px; }
.hero.tight h1 { font-size: clamp(28px, 8vw, 44px); margin: 4px 0 8px; }
.hero.tight .lead { margin-bottom: 12px; }
#karte { scroll-margin-top: 96px; }
.faces { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 28px 0; }
.faces img, .avatar {
  width: 84px; height: 84px; border-radius: 50%; object-fit: cover; background: #ddd;
}
.grid { display: grid; gap: 16px; }
@media (min-width: 800px) { .grid.three { grid-template-columns: repeat(3, 1fr); } .grid.people { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--card);
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 8px 30px rgba(0,0,0,.05);
}
.stat { font-size: 32px; font-weight: 700; }
.muted { color: var(--muted); }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.form { max-width: 440px; margin: 0 auto; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
input[type=text], input[type=password], input[type=file], textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  background: #fff;
}
.err { color: #ff3b30; margin: 12px 0; }
.ok { color: #248a3d; margin: 12px 0; }
.big-photo {
  width: min(320px, 100%);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 28px;
  display: block;
  margin: 0 auto 18px;
  background: #ddd;
}
.choices { display: grid; gap: 10px; }
.choices button { width: 100%; }
.person-card { text-decoration: none; color: inherit; display: block; }
.person-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 18px; }
.foot { padding: 28px 20px 48px; color: var(--muted); text-align: center; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.burger, .nav-toggle { display: none; }
.form .btn { width: 100%; }
@media (max-width: 800px) {
  .top {
    flex-wrap: wrap;
    gap: 8px 10px;
    padding: 10px 14px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
  .logo { flex-shrink: 0; }
  .logo span { font-size: 15px; }
  .nav {
    display: flex;
    order: 3;
    flex-basis: 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding-bottom: 4px;
  }
  .nav a {
    background: #e8e8ed;
    border-radius: 980px;
    padding: 10px 14px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
  }
  .top-right {
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .top-right .ghost {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 13px;
  }
  .ghost, .btn, button.btn {
    min-height: 44px;
    padding: 10px 16px;
  }
  .hero.tight { padding: 4px 0 0; }
  .hero.tight .lead { display: none; }
  #karte { scroll-margin-top: 140px; }
  .hero h1 { font-size: clamp(32px, 11vw, 44px); }
  .lead { font-size: 16px; margin-bottom: 18px; }
  .faces { gap: 8px; margin: 18px 0; }
  .faces img, .avatar { width: 58px; height: 58px; }
  main {
    padding: 16px 16px 48px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(48px, env(safe-area-inset-bottom));
  }
  .card { padding: 16px; border-radius: 18px; }
  .stat { font-size: 28px; }
  .actions { flex-direction: column; align-items: stretch; }
  .actions .btn, .actions .ghost, .actions button {
    width: 100%;
    max-width: none;
  }
  .form { max-width: none; }
  input[type=text], input[type=password], input[type=file], textarea {
    font-size: 16px;
    padding: 14px 16px;
  }
  .seg a {
    padding: 10px 14px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }
  .feedback { font-size: 20px; }
  .big-photo { border-radius: 22px; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .foot {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-bottom: max(48px, env(safe-area-inset-bottom));
  }
}
