:root {
  color-scheme: light;
  --bg-0: #f4f7ff;
  --bg-1: #ffffff;
  --ink: #111827;
  --muted: #64748b;
  --line: #e2e8f0;
  --head: #eef2ff;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --shadow: 0 20px 48px rgba(15, 23, 42, 0.08);
  --panel-border: #ffffff;
  --search-bg: #ffffff;
  --th-ink: #1e1b4b;
  --row-alt: #fcfdff;
  --img-bg: #ffffff;
  --badge-bg: #f1f5f9;
  --badge-ink: #0f172a;
  --badge-line: #e2e8f0;
  --copyright-bg: #fcfdff;
  --uid-copied-bg: #dcfce7;
  --uid-copied-ink: #166534;
  --uid-copied-line: #86efac;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg-0: #0f1419;
  --bg-1: #1a2230;
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --line: #334155;
  --head: #1e293b;
  --accent: #818cf8;
  --accent-soft: rgba(129, 140, 248, 0.14);
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.4);
  --panel-border: rgba(255, 255, 255, 0.06);
  --search-bg: #131a24;
  --th-ink: #c7d2fe;
  --row-alt: rgba(15, 23, 42, 0.45);
  --img-bg: #131a24;
  --badge-bg: #334155;
  --badge-ink: #e2e8f0;
  --badge-line: #475569;
  --copyright-bg: rgba(15, 23, 42, 0.55);
  --uid-copied-bg: #14532d;
  --uid-copied-ink: #bbf7d0;
  --uid-copied-line: #22c55e;
}
* {
  box-sizing: border-box;
}
html {
  min-height: 100%;
}
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  background-color: var(--bg-0);
  background-image:
    radial-gradient(1200px 420px at 10% -10%, #dbeafe 0%, transparent 55%),
    radial-gradient(900px 360px at 100% 0%, #ede9fe 0%, transparent 55%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}
[data-theme="dark"] body {
  background-color: var(--bg-0);
  background-image:
    radial-gradient(1200px 420px at 10% -10%, rgba(37, 99, 235, 0.22) 0%, transparent 55%),
    radial-gradient(900px 360px at 100% 0%, rgba(109, 40, 217, 0.18) 0%, transparent 55%);
}
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-1);
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.theme-toggle:hover {
  border-color: var(--accent);
  transform: scale(1.03);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.theme-toggle__sun,
.theme-toggle__moon {
  display: none;
}
:root:not([data-theme="dark"]) .theme-toggle__moon {
  display: block;
}
[data-theme="dark"] .theme-toggle__sun {
  display: block;
}
.page {
  max-width: 1320px;
  margin: 40px auto;
  padding: 0 20px;
}
.panel {
  background: var(--bg-1);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-header {
  padding: 24px 24px 10px;
}
.title {
  margin: 0;
  font-size: clamp(1.3rem, 1.9vw, 1.9rem);
  letter-spacing: 0.2px;
}
.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.header-link {
  margin: 6px 0 0;
  font-size: 0.92rem;
}
.header-link + .header-link {
  margin-top: 4px;
}
.header-link a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.header-link a:hover {
  text-decoration: underline;
}
.guide-hub {
  border-top: 1px solid var(--line);
  padding: 8px 0 4px;
}
.guide-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.guide-list li {
  margin: 0;
  border-bottom: 1px solid var(--line);
}
.guide-list li:last-child {
  border-bottom: none;
}
.guide-list li:nth-child(odd) a {
  background: var(--row-alt);
}
.guide-card {
  display: block;
  padding: 16px 24px;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s ease;
}
.guide-card__inner {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.guide-card__logo {
  flex-shrink: 0;
  width: 92px;
  height: 92px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-1);
  padding: 12px;
  box-sizing: border-box;
}
.guide-card__body {
  flex: 1;
  min-width: 0;
}
.guide-card:hover {
  background: var(--accent-soft);
}
.guide-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.guide-card__title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.guide-card__title span.badge {
  display: inline-block;
  background: var(--badge-bg);
  color: var(--badge-ink);
  border: 1px solid var(--badge-line);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.75rem;
  font-weight: 600;
}
.guide-card__desc {
  margin-top: 6px;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.45;
  max-width: 72ch;
}
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px 24px 18px;
}
.controls label {
  font-weight: 700;
  color: var(--muted);
}
.controls__count {
  margin-left: auto;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}
#tableSearch,
.controls select {
  min-width: 200px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--search-bg);
  color: var(--ink);
  font: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#tableSearch {
  min-width: 280px;
  width: min(460px, 100%);
}
#tableSearch:focus,
.controls select:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.table-wrap {
  overflow: auto;
  border-top: 1px solid var(--line);
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 480px;
}
table.table--wide {
  min-width: 980px;
}
table.table--wide.table--tausch {
  min-width: 0;
}
table.table--ddv {
  min-width: 920px;
}
th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  vertical-align: top;
  text-align: left;
}
th {
  background: var(--head);
  color: var(--th-ink);
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 2;
}
tbody tr:nth-child(odd) td {
  background: var(--row-alt);
}
tbody tr:hover td {
  background: var(--accent-soft);
}
th.sortable {
  cursor: pointer;
  user-select: none;
}
td.photo {
  width: 140px;
}
td.photo img {
  display: block;
  width: 120px;
  height: auto;
  min-height: 68px;
  border-radius: 10px;
  border: 1px solid rgba(79, 70, 229, 0.15);
  background: var(--img-bg);
}
td.photo img.photo-img--pending {
  background: linear-gradient(
    110deg,
    var(--img-bg) 8%,
    var(--row-alt) 18%,
    var(--img-bg) 33%
  );
  background-size: 200% 100%;
}
td.photo img.photo-img--error {
  opacity: 0.45;
}
[data-theme="dark"] td.photo img {
  border-color: rgba(129, 140, 248, 0.35);
}
td.weather,
td.time {
  white-space: nowrap;
}
td.cell-activity {
  font-weight: 700;
  white-space: nowrap;
}
td.cell-variants {
  max-width: 280px;
}
td.cell-food,
td.cell-approach {
  max-width: 340px;
  line-height: 1.45;
}
.badge {
  display: inline-block;
  background: var(--badge-bg);
  color: var(--badge-ink);
  border: 1px solid var(--badge-line);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.8rem;
  font-weight: 600;
}
.variant-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.uid-copy {
  display: inline-block;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92rem;
  font-weight: 600;
  background: var(--badge-bg);
  color: var(--badge-ink);
  border: 1px solid var(--badge-line);
  border-radius: 8px;
  padding: 5px 10px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.uid-copy:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.uid-copy:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.uid-copy--copied {
  background: var(--uid-copied-bg) !important;
  color: var(--uid-copied-ink) !important;
  border-color: var(--uid-copied-line) !important;
}
.error-box {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 10px 12px;
}
[data-theme="dark"] .error-box {
  color: #fecaca;
  background: #450a0a;
  border-color: #7f1d1d;
}
.copyright {
  padding: 14px 24px 20px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: right;
  border-top: 1px solid var(--line);
  background: var(--copyright-bg);
}
@media (max-width: 760px) {
  .page {
    margin-top: 20px;
    padding: 0 10px;
  }
  .panel-header,
  .controls {
    padding-left: 14px;
    padding-right: 14px;
  }
  .guide-card {
    padding-left: 14px;
    padding-right: 14px;
  }
  .controls__count {
    margin-left: 0;
    width: 100%;
  }
}

/* Tausch-Liste */
.page--wide {
  max-width: 96vw;
}
.auth-status {
  margin: 10px 0 0;
  font-size: 0.92rem;
  color: var(--muted);
}
.auth-status code {
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--badge-bg);
  border: 1px solid var(--badge-line);
}
.auth-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--accent-soft);
}
.auth-banner__badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.auth-banner__text {
  margin: 0;
  flex: 1 1 16rem;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--ink);
}
.auth-banner__text code {
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--badge-bg);
  border: 1px solid var(--badge-line);
}
.auth-banner--ok {
  background: #f0fdf4;
  border-color: #86efac;
}
.auth-banner--ok .auth-banner__badge {
  background: #16a34a;
  color: #fff;
}
.auth-banner--guest {
  background: #fff7ed;
  border-color: #fdba74;
}
.auth-banner--guest .auth-banner__badge {
  background: #ea580c;
  color: #fff;
}
[data-theme="dark"] .auth-banner--ok {
  background: rgba(22, 163, 74, 0.16);
  border-color: #166534;
}
[data-theme="dark"] .auth-banner--guest {
  background: rgba(234, 88, 12, 0.16);
  border-color: #9a3412;
}
.flash {
  margin: 0 24px 12px;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.92rem;
}
.flash--error {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
}
.flash--success {
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}
[data-theme="dark"] .flash--error {
  color: #fecaca;
  background: #450a0a;
  border-color: #7f1d1d;
}
[data-theme="dark"] .flash--success {
  color: #bbf7d0;
  background: #14532d;
  border-color: #22c55e;
}
.empty-box {
  color: var(--muted);
  padding: 12px;
}
.tausch-visibility {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 24px 14px;
}
.tausch-visibility__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.tausch-visibility__label {
  min-width: 5.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}
.tausch-visibility__chips,
.tausch-visibility__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tausch-chip {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--search-bg);
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.tausch-chip:hover {
  border-color: var(--accent);
}
.tausch-chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--ink);
}
.tausch-chip--action {
  color: var(--ink);
}
.tausch-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
table.table--tausch .is-col-hidden {
  display: none !important;
}
table.table--tausch {
  width: max-content;
  min-width: 0;
  table-layout: auto;
}
table.table--tausch .tausch-user-col,
table.table--tausch td.sticky-col {
  width: 1%;
  max-width: 14rem;
  white-space: nowrap;
  padding-left: 12px;
  padding-right: 12px;
}
.tausch-user-cell {
  white-space: normal;
}
.tausch-user-name {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-weight: 600;
}
.tausch-ht-code {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.82rem;
  font-weight: 600;
}
.tausch-ht-code--missing {
  color: var(--muted);
  font-weight: 500;
}
table.table--tausch thead th {
  vertical-align: middle;
}
.tausch-group-col {
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.tausch-group-col--event {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--accent-soft);
}
.tausch-group-col--character {
  font-size: 0.82rem;
  font-weight: 600;
}
.tausch-character-head {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
table.table--tausch th.tausch-item-col {
  min-width: 88px;
  max-width: 7.5rem;
  width: 7.5rem;
  vertical-align: top;
  text-align: center;
  white-space: normal;
  font-size: 0.75rem;
  line-height: 1.25;
  padding-top: 10px;
}
.tausch-item-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 100%;
}
.tausch-zoom {
  appearance: none;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  border-radius: 10px;
  position: relative;
  z-index: 1;
}
.tausch-zoom:disabled {
  cursor: default;
  opacity: 0.55;
}
.tausch-zoom:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tausch-item-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: var(--img-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  transform-origin: center center;
}
.tausch-zoom:not(:disabled):hover .tausch-item-img,
.tausch-zoom:not(:disabled):focus-visible .tausch-item-img {
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
  background: var(--bg-1);
}
[data-theme="dark"] .tausch-zoom:not(:disabled):hover .tausch-item-img,
[data-theme="dark"] .tausch-zoom:not(:disabled):focus-visible .tausch-item-img {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
.tausch-hover-preview {
  position: fixed;
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28);
  pointer-events: none;
}
.tausch-hover-preview.is-visible {
  display: flex;
}
.tausch-hover-preview__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}
.tausch-item-img--sm {
  width: 56px;
  height: 56px;
  border-radius: 8px;
}
.tausch-item-img--missing {
  display: block;
  background:
    linear-gradient(135deg, var(--badge-bg) 25%, transparent 25%) -4px 0 / 8px 8px,
    linear-gradient(225deg, var(--badge-bg) 25%, transparent 25%) -4px 0 / 8px 8px,
    linear-gradient(315deg, var(--badge-bg) 25%, transparent 25%) 0 0 / 8px 8px,
    linear-gradient(45deg, var(--badge-bg) 25%, var(--img-bg) 25%) 0 0 / 8px 8px;
}
.tausch-item-name {
  display: block;
  overflow: visible;
  word-break: break-word;
  width: 100%;
  line-height: 1.25;
}
.tausch-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(2px);
}
.tausch-lightbox.is-open {
  display: flex;
}
.tausch-lightbox__dialog {
  position: relative;
  max-width: min(920px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.tausch-lightbox__img {
  max-width: 100%;
  max-height: min(80vh, 820px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  background: var(--bg-1);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}
.tausch-lightbox__caption {
  margin: 0;
  color: #f8fafc;
  text-align: center;
  font-size: 0.95rem;
  max-width: 40rem;
}
.tausch-lightbox__close {
  appearance: none;
  position: absolute;
  top: -12px;
  right: -12px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.tausch-lightbox__close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.tausch-qty {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.tausch-qty--zero {
  color: #dc2626;
}
.tausch-qty--one {
  color: #111827;
}
.tausch-qty--many {
  color: #16a34a;
}
[data-theme="dark"] .tausch-qty--zero {
  color: #f87171;
}
[data-theme="dark"] .tausch-qty--one {
  color: #f8fafc;
}
[data-theme="dark"] .tausch-qty--many {
  color: #4ade80;
}
.tausch-qty input[type="number"],
.tausch-qty-input {
  width: 4.2rem;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--search-bg);
  color: inherit;
  text-align: center;
  font: inherit;
  font-weight: 700;
}
.tausch-qty input[type="number"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.tausch-row--own td {
  background: var(--accent-soft);
}
.sticky-col {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--bg-1);
  box-shadow: 1px 0 0 var(--line);
}
thead .sticky-col {
  z-index: 2;
  background: var(--head);
}
.tausch-row--own .sticky-col {
  background: var(--accent-soft);
}
.tausch-actions {
  display: flex;
  justify-content: flex-end;
  padding: 12px 24px 8px;
}
.btn-primary {
  appearance: none;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
}
.btn-primary:hover {
  filter: brightness(1.05);
}
.btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (max-width: 760px) {
  .flash,
  .tausch-actions {
    margin-left: 14px;
    margin-right: 14px;
    padding-left: 0;
    padding-right: 0;
  }
  .tausch-visibility {
    padding-left: 14px;
    padding-right: 14px;
  }
  .tausch-visibility__label {
    min-width: 100%;
  }
}
