:root {
  color-scheme: dark;

  --bg: #140d26;
  --bg-elev: #1d1535;
  --surface: #241a40;
  --surface-2: #2e2350;
  --surface-hover: #362a5e;
  --border: rgb(255 255 255 / 0.08);
  --border-strong: rgb(255 255 255 / 0.16);

  --text: #f6f2ff;
  --text-2: #c4b8e6;
  --text-3: #9d93c2;

  --brand: #ff6bcb;
  --brand-2: #9b5de5;
  --gold: #fee440;
  --ok: #2ee6b8;
  --ok-bg: rgb(46 230 184 / 0.14);
  --bad: #ff6b8b;
  --bad-bg: rgb(255 107 139 / 0.14);
  --focus: #7cc4ff;
  --grad-brand: linear-gradient(135deg, #ff6bcb 0%, #9b5de5 100%);
  --grad-boss: linear-gradient(135deg, #ffb238 0%, #ff5e7e 100%);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;
  --gap: 12px;
  --pad: 16px;
  --tap: 48px;

  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 1.75rem;

  --shadow: 0 8px 24px rgb(0 0 0 / 0.35);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  overflow: hidden;
  background-color: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: var(--fs-md);
  line-height: 1.45;
  color: var(--text);
  background:
    radial-gradient(120% 60% at 100% 0%, rgb(155 93 229 / 0.25), transparent 60%),
    radial-gradient(90% 50% at 0% 100%, rgb(255 107 203 / 0.12), transparent 60%),
    var(--bg);
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.muted {
  color: var(--text-3);
  font-weight: 500;
}

.app {
  --col: 560px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.scroller {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding-inline: max(0px, calc((100% - var(--col)) / 2));
  scrollbar-width: thin;
  scrollbar-color: var(--surface-hover) transparent;
}

.browser-old {
  margin: calc(10px + env(safe-area-inset-top, 0px)) var(--pad) 0;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--bad-bg);
  color: var(--bad);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.browser-old[hidden] {
  display: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: calc(12px + env(safe-area-inset-top, 0px)) var(--pad) 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand img {
  border-radius: 9px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.4);
}

.settings {
  position: relative;
  flex: none;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  touch-action: manipulation;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.icon-btn svg {
  transition: transform 0.35s var(--ease);
}

.icon-btn[aria-expanded="true"] {
  color: var(--brand);
  border-color: rgb(255 107 203 / 0.45);
  background: var(--surface-2);
}

.icon-btn[aria-expanded="true"] svg {
  transform: rotate(60deg);
}

.settings-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: max-content;
  min-width: 220px;
  max-width: min(300px, calc(100vw - 32px));
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  animation: pop 0.18s var(--ease);
}

.menu-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.menu-avatar {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--grad-brand);
  color: #fff;
  font-size: var(--fs-lg);
  font-weight: 800;
}

.menu-user-text {
  min-width: 0;
}

.menu-user-text small {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-3);
}

.menu-user-text strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-item {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: none;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text);
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  font-size: var(--fs-md);
  cursor: pointer;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--surface-hover);
}

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

.dialog {
  width: min(92vw, 420px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.dialog[open] {
  animation: pop 0.2s var(--ease);
}

.dialog::backdrop {
  background: rgb(10 6 20 / 0.7);
  backdrop-filter: blur(4px);
}

.dialog-form {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding: 20px var(--pad) var(--pad);
}

.dialog-form h2 {
  font-size: var(--fs-xl);
}

.dialog-sub {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.about {
  align-items: center;
  text-align: center;
  padding-top: 28px;
}

.about-logo {
  border-radius: 18px;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.45);
}

.about p {
  margin: 0;
}

.about-version {
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-sm);
  color: var(--text-3);
  user-select: all;
  -webkit-user-select: all;
}

.about-dev {
  color: var(--text-2);
  margin-bottom: 8px !important;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.main {
  flex: 1;
  padding: 8px var(--pad) 24px;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  animation: panel-in 0.25s var(--ease);
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.panel-head {
  padding: 8px 2px 2px;
}

.panel-head h2 {
  font-size: var(--fs-2xl);
  font-weight: 800;
}

.panel-sub {
  margin: 4px 0 0;
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.panel-sub:empty {
  display: none;
}

.section-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  margin: 12px 2px 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.card-collapsible {
  padding: 0;
  gap: 0;
}

.card-collapsible > summary {
  list-style: none;
  cursor: pointer;
  min-height: var(--tap);
  padding: 12px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}

.card-collapsible > summary::-webkit-details-marker {
  display: none;
}

.card-collapsible > summary::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--text-3);
  border-bottom: 2px solid var(--text-3);
  transform: rotate(45deg) translateY(-3px);
  transition: transform 0.2s var(--ease);
}

.card-collapsible[open] > summary::after {
  transform: rotate(-135deg) translateY(-1px);
}

.card-collapsible[open] {
  padding-bottom: var(--pad);
}

.card-collapsible[open] > :not(summary) {
  margin: 0 var(--pad) var(--gap);
}

.card-collapsible[open] > :last-child {
  margin-bottom: 0;
}

.card-collapsible[open] > .btn-block {
  width: calc(100% - 2 * var(--pad));
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

.span-2 {
  grid-column: 1 / -1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background-color: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 0 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.4;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-3);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgb(155 93 229 / 0.35);
}

input:disabled {
  opacity: 0.6;
}

select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23c4b8e6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.select-compact {
  width: auto;
  flex: none;
}

.search-row {
  display: flex;
  gap: 8px;
}

input[type="search"] {
  padding-left: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238f84b3' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 14px center;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  min-height: var(--tap);
}

.switch {
  appearance: none;
  flex: none;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: var(--r-pill);
  background: var(--surface-hover);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.3);
  transition: transform 0.2s var(--ease);
}

.switch:checked {
  background: var(--ok);
}

.switch:checked::after {
  transform: translateX(20px);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 20px;
  border: none;
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.12s var(--ease), filter 0.15s, background 0.15s;
}

.btn:active {
  transform: scale(0.97);
}

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

.btn-primary {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 4px 14px rgb(155 93 229 / 0.35);
}

.btn-boss {
  background: var(--grad-boss);
  color: #fff;
  box-shadow: 0 4px 14px rgb(255 94 126 / 0.35);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  min-height: 56px;
  font-size: var(--fs-lg);
  border-radius: var(--r-lg);
}

.btn-text {
  border: none;
  background: none;
  color: var(--brand);
  font-weight: 600;
  font-size: var(--fs-sm);
  min-height: 44px;
  padding: 0 8px;
  cursor: pointer;
}

.file-btn {
  cursor: pointer;
}

.file-btn.is-busy,
.file-btn.is-locked {
  opacity: 0.5;
  pointer-events: none;
}

.file-btn.is-locked {
  filter: grayscale(1);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.list:empty {
  display: none;
}

.list > li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 8px 8px var(--pad);
}

.list > li + li {
  border-top: 1px solid var(--border);
}

.pager {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.pager-btn {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.pager-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.pager-info {
  min-width: 96px;
  text-align: center;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.pager-size {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.pager-size select {
  width: auto;
  min-width: 84px;
}

.empty-state {
  text-align: center;
  color: var(--text-2);
  padding: 32px 16px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
}

.empty-state strong {
  display: block;
  font-size: var(--fs-lg);
  color: var(--text);
  margin-bottom: 4px;
}

.empty-state .e-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 8px;
}

.v-text {
  flex: 1;
  min-width: 0;
}

.v-foreign {
  display: block;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.v-german {
  display: block;
  color: var(--text-2);
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}

.v-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: none;
}

.lang-badge,
.page-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  letter-spacing: 0.03em;
}

.lang-badge {
  text-transform: uppercase;
  background: rgb(124 196 255 / 0.16);
  color: #9fd3ff;
}

.lang-badge.fr {
  background: rgb(255 107 203 / 0.16);
  color: #ffa3de;
}

.page-badge {
  background: var(--surface-2);
  color: var(--text-2);
}

.id-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.v-edit-btn {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: var(--r-sm);
  background: none;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0.7;
}

.v-edit-btn:hover,
.v-edit-btn:focus-visible {
  opacity: 1;
  background: var(--surface-2);
}

.list > li.editing {
  display: block;
  padding: 12px var(--pad);
  background: var(--surface-2);
}

.v-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.v-edit input[data-field="foreign"] {
  font-weight: 600;
}

.v-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.v-edit-row select {
  width: 88px;
  flex: none;
}

.v-edit-page {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.v-edit-row input[type="number"] {
  width: 96px;
  flex: none;
}

.v-edit-row .id-badge {
  margin-left: auto;
}

.v-edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.import-preview {
  display: flex;
  flex-direction: column;
  max-height: 320px;
  overflow-y: auto;
  border-radius: var(--r-md);
}

.import-preview:empty {
  display: none;
}

.import-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 4px;
  font-size: var(--fs-sm);
  border-bottom: 1px solid var(--border);
}

.import-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--brand-2);
  flex: none;
}

.import-row {
  flex: none;
  padding: 12px 2px;
}

.imp-fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.import-row .imp-input {
  min-height: 38px;
  padding: 0 10px;
  border-radius: var(--r-sm);
}

.import-row .imp-input[data-field="foreign"] {
  font-weight: 600;
}

.import-row .imp-input[data-field="german"] {
  color: var(--text-2);
}

.import-row .imp-input.bad {
  border-color: var(--bad);
}

.import-row.off .imp-fields {
  opacity: 0.45;
}

.boss-intro {
  padding: 14px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, rgb(255 178 56 / 0.14), rgb(255 94 126 / 0.12));
  border: 1px solid rgb(255 178 56 / 0.3);
}

.boss-intro p {
  margin: 0 0 10px;
  line-height: 1.45;
}

.boss-rules {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.boss-rules li {
  display: flex;
  gap: 8px;
  line-height: 1.4;
}

.import-hint {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.import-hint[hidden] {
  display: none;
}

.status {
  font-size: var(--fs-sm);
  color: var(--text-2);
  text-align: center;
}

.status.bad {
  color: var(--bad);
}

.status:empty {
  display: none;
}

.scan-busy {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scan-busy[hidden],
.scan-result[hidden] {
  display: none;
}

.scan-photo {
  position: relative;
  height: 180px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
}

.scan-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.6) brightness(0.75);
}

.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 36%;
  background: linear-gradient(180deg, transparent 0%, rgb(155 93 229 / 0.35) 85%, #ff6bcb 100%);
  border-bottom: 2px solid #ff6bcb;
  box-shadow: 0 6px 18px rgb(255 107 203 / 0.55);
  animation: scan-sweep 2.2s ease-in-out infinite alternate;
}

@keyframes scan-sweep {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(180%);
  }
}

.scan-busy-text {
  display: flex;
  align-items: center;
  gap: 12px;
}

.scan-busy-text strong {
  display: block;
}

.scan-busy-text span:not(.spinner) {
  display: block;
  font-size: var(--fs-sm);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.spinner {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgb(255 255 255 / 0.12);
  border-top-color: var(--brand);
  border-right-color: var(--brand-2);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.scan-result {
  border-color: rgb(155 93 229 / 0.45);
  background:
    linear-gradient(180deg, rgb(155 93 229 / 0.16), transparent 140px),
    var(--surface);
}

.scan-result.pop-in {
  animation: pop 0.35s var(--ease);
}

.scan-result-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.scan-result-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 2rem;
}

.scan-result-head strong {
  display: block;
  font-size: var(--fs-xl);
  line-height: 1.2;
}

.scan-result-head div > span {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.scan-result-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 360px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.scan-result-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--border);
}

.scan-result-list li.known {
  opacity: 0.55;
}

.scan-chip {
  flex: none;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-3);
}

.scan-chip.new {
  background: var(--ok-bg);
  color: var(--ok);
}

.quiz {
  gap: 14px;
}

.quiz-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-track {
  flex: 1;
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--grad-brand);
  transition: width 0.35s var(--ease);
}

.quiz-count {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
}

.chip {
  align-self: flex-start;
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-2);
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: var(--r-pill);
}

.chip:empty {
  display: none;
}

.prompt {
  margin: 4px 0 6px;
  font-size: var(--fs-2xl);
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.answer-row {
  display: flex;
  gap: 8px;
}

.answer-row input {
  flex: 1;
  min-width: 0;
}

.mc-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mc-options button {
  min-height: 56px;
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 2px solid var(--border-strong);
  border-bottom-width: 4px;
  background: var(--bg-elev);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s var(--ease), border-color 0.15s, background 0.15s;
}

.mc-options button:active:not(:disabled) {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.mc-options button:disabled {
  cursor: default;
  opacity: 0.6;
}

.mc-options button.correct {
  opacity: 1;
  border-color: var(--ok);
  background: var(--ok-bg);
}

.mc-options button.wrong {
  opacity: 1;
  border-color: var(--bad);
  background: var(--bad-bg);
}

.feedback {
  margin: 0;
  font-weight: 700;
  border-radius: var(--r-md);
}

.feedback:empty {
  display: none;
}

.feedback.ok,
.feedback.bad {
  padding: 12px 14px;
  animation: pop 0.25s var(--ease);
}

.feedback.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.feedback.bad {
  background: var(--bad-bg);
  color: var(--bad);
}

@keyframes pop {
  from {
    transform: scale(0.96);
    opacity: 0;
  }
}

.result-card {
  align-items: center;
  text-align: center;
  padding: 24px var(--pad);
}

.result-emoji {
  font-size: 3rem;
  line-height: 1;
}

.result-score {
  font-size: 2.5rem;
  font-weight: 800;
  margin: 0;
}

.result-pct {
  margin: 0;
  color: var(--text-2);
}

.result-xp {
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--gold);
  margin: 0;
}

.result-xp:empty {
  display: none;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 768px) {
  .tiles {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stats-list > li.stats-empty {
  justify-content: center;
  padding: 20px var(--pad);
  color: var(--text-2);
  text-align: center;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tile-value {
  font-size: var(--fs-xl);
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-label {
  font-size: var(--fs-xs);
  color: var(--text-2);
}

.s-icon {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 1.2rem;
}

.s-text {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-sm);
}

.s-text strong {
  display: block;
  font-size: var(--fs-md);
}

.s-text span {
  color: var(--text-2);
}

.s-pct {
  flex: none;
  font-weight: 800;
  padding-right: 8px;
}

.s-pct.good {
  color: var(--ok);
}

.s-pct.mid {
  color: var(--gold);
}

.s-pct.low {
  color: var(--bad);
}

.xp-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px var(--pad);
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.streak-chip {
  font-weight: 800;
  padding: 6px 10px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-3);
  white-space: nowrap;
}

.streak-chip.lit {
  background: linear-gradient(180deg, #ffa53b, #ff6b35);
  color: #fff;
  box-shadow: 0 2px 10px rgb(255 120 50 / 0.4);
}

.level-box {
  flex: 1;
  min-width: 0;
}

.level-line {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--text-2);
  margin-bottom: 5px;
}

.level-line strong {
  color: var(--gold);
}

.bar {
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--brand));
  transition: width 0.6s var(--ease);
}

@property --p {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

.goal-ring {
  --p: 0;
  width: 54px;
  height: 54px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--surface-2) 0);
  transition: --p 0.6s var(--ease);
}

.goal-ring span {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.goal-ring.done span {
  font-size: 1.1rem;
  color: var(--ok);
}

.xp-float {
  display: inline-block;
  margin-left: 8px;
  color: var(--gold);
  font-weight: 800;
  animation: xp-pop 1.2s ease-out forwards;
}

@keyframes xp-pop {
  0% { transform: translateY(6px) scale(0.6); opacity: 0; }
  20% { transform: translateY(0) scale(1.15); opacity: 1; }
  70% { transform: translateY(-4px) scale(1); opacity: 1; }
  100% { transform: translateY(-14px); opacity: 0; }
}

.seg {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 3px;
}

.seg-btn {
  flex: 1;
  min-height: 44px;
  border: none;
  background: none;
  color: var(--text-2);
  font-weight: 600;
  font-size: var(--fs-sm);
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.seg-btn.active {
  background: var(--surface-hover);
  color: var(--text);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.3);
}

.rank-list li.me {
  background: rgb(155 93 229 / 0.18);
}

.rank-pos {
  flex: none;
  width: 32px;
  font-weight: 800;
  text-align: center;
  font-size: var(--fs-lg);
  color: var(--text-2);
}

.rank-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
}

.rank-name small {
  display: block;
  font-weight: 400;
  color: var(--text-2);
  font-size: var(--fs-xs);
}

.rank-xp {
  flex: none;
  font-weight: 800;
  color: var(--gold);
  padding-right: 8px;
}

.goal-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.goal-btn {
  min-height: 56px;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 700;
  padding: 6px 2px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.goal-btn small {
  display: block;
  color: var(--text-2);
  font-weight: 500;
  font-size: var(--fs-xs);
}

.goal-btn.active {
  border-color: var(--ok);
  background: var(--ok-bg);
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

.badge-wrap {
  position: relative;
}

.badge {
  text-align: center;
  padding: 12px 6px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.15s, transform 0.12s var(--ease);
}

.badge:active {
  transform: scale(0.96);
}

.badge[aria-expanded="true"] {
  border-color: var(--focus);
}

.badge-tip {
  --arrow-x: 50%;
  position: absolute;
  z-index: 10;
  width: min(280px, 100%);
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  animation: pop 0.18s var(--ease);
  cursor: pointer;
}

.badge-tip[hidden] {
  display: none;
}

.badge-tip::after {
  content: "";
  position: absolute;
  left: calc(var(--arrow-x) - 7px);
  bottom: -7px;
  width: 12px;
  height: 12px;
  background: var(--surface-2);
  border-right: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  transform: rotate(45deg);
}

.badge-tip.below::after {
  bottom: auto;
  top: -7px;
  transform: rotate(225deg);
}

.badge-tip strong {
  display: block;
  font-size: var(--fs-sm);
  margin-bottom: 4px;
}

.badge-tip p {
  margin: 0 0 8px;
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--text-2);
}

.badge-tip small {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-3);
}

.badge-tip small.got {
  color: var(--ok);
}

.badge .b-icon {
  display: block;
  font-size: 1.9rem;
  margin-bottom: 4px;
  filter: grayscale(1);
  opacity: 0.35;
}

.badge.earned {
  background: linear-gradient(180deg, rgb(254 228 64 / 0.14), rgb(254 228 64 / 0.04));
  border-color: rgb(254 228 64 / 0.35);
  color: var(--text);
}

.badge.earned .b-icon {
  filter: none;
  opacity: 1;
}

.xp-rules {
  padding-left: 1.2rem;
  line-height: 1.7;
  color: var(--text-2);
}

.xp-rules strong {
  color: var(--text);
}

.tabbar {
  flex: none;
  position: relative;
  z-index: 5;
  display: flex;
  padding: 8px max(12px, calc((100% - var(--col)) / 2 + 12px)) calc(14px + env(safe-area-inset-bottom, 0px));
  background: rgb(20 13 38 / 0.82);
  backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--border);
}

.tab {
  flex: 1;
  min-width: 0;
  min-height: 68px;
  padding: 0 1px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: none;
  background: none;
  border-radius: var(--r-md);
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.tab-icon {
  font-size: 1.75rem;
  line-height: 1;
  filter: grayscale(0.7);
  opacity: 0.7;
  transition: filter 0.15s, opacity 0.15s, transform 0.2s var(--ease);
}

.tab-label {
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.tab.active {
  color: var(--brand);
  background: rgb(255 107 203 / 0.1);
}

.tab.active .tab-icon {
  filter: none;
  opacity: 1;
  transform: translateY(-1px) scale(1.08);
}

.login-screen {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 24px var(--pad) 48px;
}

.login-card {
  width: 100%;
  padding: 28px 20px;
  gap: 14px;
}

.login-logo {
  align-self: center;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.login-title {
  text-align: center;
  font-size: var(--fs-xl);
  font-weight: 800;
}

.login-sub {
  margin: -6px 0 4px;
  text-align: center;
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.captcha-box[hidden],
.captcha-missing[hidden] {
  display: none;
}

.captcha-missing {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--bad-bg);
  color: var(--bad);
  font-size: var(--fs-sm);
  font-weight: 600;
}

altcha-widget {
  --altcha-max-width: 100%;
  --altcha-color-base: var(--surface-2);
  --altcha-color-base-content: var(--text);
  --altcha-color-neutral: var(--border-strong);
  --altcha-color-neutral-content: var(--text-2);
  --altcha-color-primary: var(--brand-2);
  --altcha-color-success: var(--ok);
  --altcha-color-success-content: var(--bg);
  --altcha-color-error: var(--bad);
  --altcha-checkbox-border-color: var(--text-3);
  --altcha-border-radius: var(--r-sm);
}

.toast-stack {
  position: fixed;
  left: 50%;
  top: calc(10px + env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  width: min(92vw, 420px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  z-index: 10;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: rgb(46 35 80 / 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid rgb(254 228 64 / 0.35);
  box-shadow: var(--shadow);
  animation: toast-in 0.35s var(--ease), toast-out 0.4s ease-in 3.6s forwards;
}

.toast .t-icon {
  font-size: 1.8rem;
}

.toast strong {
  display: block;
  color: var(--gold);
}

.toast small {
  color: var(--text-2);
}

@keyframes toast-in {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
}

@keyframes toast-out {
  to {
    transform: translateY(-10px);
    opacity: 0;
  }
}

@media (min-width: 768px) {
  :root {
    --pad: 24px;
  }

  .app {
    --col: 760px;
  }

  .v-meta {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .v-meta .id-badge {
    min-width: 4ch;
    text-align: right;
  }

  .form-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .form-grid .span-2 {
    grid-column: span 2;
  }

  .tabbar {
    margin: 0 auto calc(12px + env(safe-area-inset-bottom, 0px));
    width: min(560px, calc(100% - 32px));
    border: 1px solid var(--border-strong);
    border-radius: 24px;
    padding-bottom: 8px;
    padding-inline: 12px;
  }
}

@media (max-width: 359px) {
  .tabbar {
    padding-left: 8px;
    padding-right: 8px;
  }

  .tab-label {
    font-size: 0.6875rem;
    letter-spacing: -0.02em;
  }
}

@media (max-height: 500px) {
  .tab {
    min-height: 46px;
    flex-direction: row;
    gap: 6px;
  }

  .tab-icon {
    font-size: 1.3rem;
  }

  .panel-head h2 {
    font-size: var(--fs-xl);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Privacy page (datenschutz.html) and its links */
.doc-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text-2);
  font-weight: 600;
  text-decoration: none;
}

.doc {
  padding: 4px var(--pad) calc(32px + env(safe-area-inset-bottom, 0px));
  color: var(--text-2);
  line-height: 1.6;
}

.doc h1 {
  font-size: var(--fs-2xl);
  color: var(--text);
  margin-bottom: 10px;
}

.doc h2 {
  font-size: var(--fs-lg);
  color: var(--text);
  margin: 30px 0 8px;
}

.doc h3 {
  font-size: var(--fs-md);
  color: var(--text);
  margin: 22px 0 6px;
}

.doc p,
.doc ul {
  margin: 0 0 12px;
}

.doc ul {
  padding-left: 1.2rem;
}

.doc li {
  margin-bottom: 6px;
}

.doc strong {
  color: var(--text);
}

.doc a:not(.btn) {
  color: var(--focus);
  overflow-wrap: anywhere;
}

.doc code {
  font-size: 0.85em;
  color: var(--text);
  overflow-wrap: anywhere;
}

.doc-lead {
  font-size: var(--fs-md);
}

.doc-summary {
  margin: 18px 0 8px;
  padding: 14px 16px 4px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border-strong);
}

.doc-summary h2 {
  margin-top: 0;
}

.doc-contact {
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
}

.doc-date {
  margin-top: 24px;
  font-size: var(--fs-sm);
  color: var(--text-3);
}

.login-privacy {
  margin: 14px 0 0;
  text-align: center;
  font-size: var(--fs-sm);
}

.login-privacy a {
  display: inline-block;
  padding: 12px 6px;
  color: var(--text-2);
  text-decoration: none;
}

.login-privacy a:hover,
.login-privacy a:focus-visible {
  color: var(--text);
  text-decoration: underline;
}

.scan-privacy {
  margin: 10px 0 0;
  font-size: var(--fs-sm);
  color: var(--text-3);
}

.scan-privacy a {
  display: inline-block;
  padding: 14px 6px;
  margin: -14px -6px;
  color: var(--text-2);
}

.doc-missing {
  color: var(--bad);
}

.btn-solution {
  margin-top: 4px;
}

.feedback.reveal {
  padding: 12px 14px;
  background: rgb(254 228 64 / 0.12);
  color: var(--gold);
  animation: pop 0.25s var(--ease);
}
