/* SpieleRegal Designsystem 2.0 – verbindliche helle und dunkle Mockup-Optik */
:root {
  --bg: #f5f1e9;
  --surface: #fffdf9;
  --surface-soft: #f7f3eb;
  --surface-raised: #ffffff;
  --text: #20251f;
  --muted: #73796f;
  --primary: #718b5b;
  --primary-hover: #5f784b;
  --primary-soft: #e7ecde;
  --accent: #d89a51;
  --border: #e5dfd4;
  --border-strong: #d8d0c3;
  --danger: #a65145;
  --shadow-sm: 0 2px 10px rgba(52, 57, 43, .045);
  --shadow-md: 0 16px 42px rgba(52, 57, 43, .09);
  --radius-sm: 9px;
  --radius-md: 13px;
  --radius-lg: 18px;
}

html[data-theme="dark"] {
  --bg: #101512;
  --surface: #171d19;
  --surface-soft: #1c231e;
  --surface-raised: #202822;
  --text: #f0f1e9;
  --muted: #a4aa9f;
  --primary: #8fa86e;
  --primary-hover: #a1b982;
  --primary-soft: #293622;
  --accent: #d89135;
  --border: #303830;
  --border-strong: #404940;
  --danger: #d47f70;
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, .18);
  --shadow-md: 0 18px 54px rgba(0, 0, 0, .35);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg: #101512;
    --surface: #171d19;
    --surface-soft: #1c231e;
    --surface-raised: #202822;
    --text: #f0f1e9;
    --muted: #a4aa9f;
    --primary: #8fa86e;
    --primary-hover: #a1b982;
    --primary-soft: #293622;
    --accent: #d89135;
    --border: #303830;
    --border-strong: #404940;
    --danger: #d47f70;
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, .18);
    --shadow-md: 0 18px 54px rgba(0, 0, 0, .35);
  }
}

body,
body.signed-in {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button, .button, input, select, textarea { font: inherit; }
button, .button { transition: background .18s ease, border-color .18s ease, transform .18s ease, color .18s ease; }
button:hover, .button:hover { background: var(--primary-hover); transform: translateY(-1px); }
button:focus-visible, .button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 30%, transparent);
  outline-offset: 2px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.sidebar {
  width: 232px;
  padding: 27px 17px 18px;
  background: var(--surface);
  border-color: var(--border);
}

.app-content { margin-left: 232px; background: var(--bg); }
.brand { gap: 11px; color: var(--text); letter-spacing: -.02em; }
.brand-mark {
  width: 38px;
  height: 42px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(145deg, var(--surface-soft), var(--primary-soft));
  color: var(--primary);
}
.brand-mark img { display: block; width: 100%; height: 100%; padding: 3px; object-fit: contain; }
.brand small { color: var(--muted); letter-spacing: 0; }

.side-nav { gap: 4px; margin-top: 34px; }
.side-nav a {
  min-height: 41px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .82rem;
  font-weight: 560;
}
.side-nav a:hover { background: var(--surface-soft); border-color: var(--border); }
.side-nav a.active { background: var(--primary-soft); color: var(--text); border-color: transparent; }
.side-nav a span { display: grid; place-items: center; width: 20px; color: var(--primary); }
.side-nav .side-add { margin-bottom: 12px; background: var(--primary); color: #fff; border: 0; }
.side-nav .side-add:hover { background: var(--primary-hover); }
.side-nav .side-add span { color: #fff; }

.ui-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark .ui-icon { width: 23px; height: 27px; }

.side-profile { padding: 15px 5px 4px; border-color: var(--border); }
.profile-link { border: 1px solid transparent; }
.profile-link:hover, .profile-link:focus-visible, .profile-link.active { background: var(--surface-soft); border-color: var(--border); }
.avatar { background: var(--primary); color: #fff; }
.logout-button { border-color: var(--border); color: var(--muted); }

.topbar {
  height: 70px;
  padding: 0 30px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-color: var(--border);
  backdrop-filter: blur(16px);
}
.topbar > div strong { font-size: 1.22rem; letter-spacing: -.02em; }

.signed-in main { max-width: 1160px; padding: 24px 28px 64px; }
h1 { font-size: clamp(1.55rem, 2.3vw, 2.05rem); letter-spacing: -.035em; }
h2 { color: var(--text); }
.eyebrow { color: var(--primary); font-weight: 700; }

.hero {
  min-height: 132px;
  padding: 23px 27px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(108deg, var(--surface), var(--surface-soft));
  box-shadow: none;
}
.hero h1 { font-size: 1.35rem; }
.hero p { color: var(--muted); }
.hero .shelf { color: var(--primary); filter: saturate(.7); }

.dashboard-stats { grid-template-columns: repeat(5, minmax(0,1fr)); gap: 11px; }
.dashboard-stats a { min-height: 106px; padding: 15px; box-shadow: none; }
.dashboard-stats a:hover { border-color: var(--border-strong); background: var(--surface-raised); transform: translateY(-2px); }
.dashboard-stats strong { margin: 7px 0 3px; font-size: 1.65rem; font-weight: 650; }
.dashboard-stats em { color: var(--primary); }
.dashboard-add-card { border-color: var(--primary) !important; background: var(--primary) !important; color: #fff !important; }
.dashboard-add-card:hover { border-color: var(--primary-hover) !important; background: var(--primary-hover) !important; }
.dashboard-add-card small, .dashboard-add-card em { color: #f4f7ef !important; }
.dashboard-add-card strong { font-size: 1.05rem; line-height: 1.15; }
.dashboard-add-card .stat-icon { background: #ffffff22 !important; color: #fff !important; }
.stat-icon { right: 14px; top: 13px; color: var(--accent); }

.dashboard-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 11px; }
.dashboard-list { min-width: 0; padding: 14px; box-shadow: none; }
.panel-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.panel-title h2 { margin: 0; font-size: .83rem; }
.panel-title a { color: var(--primary); font-size: .65rem; text-decoration: none; }
.mini-game { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 6px 2px; border-bottom: 1px solid var(--border); }
.mini-game:last-child { border-bottom: 0; }
.mini-game img, .mini-placeholder { width: 34px; height: 38px; border-radius: 5px; object-fit: cover; }
.mini-placeholder { display: grid; place-items: center; background: var(--surface-soft); font-size: 1rem; }
.mini-game > span:not(.mini-placeholder) { display: grid; min-width: 0; }
.mini-game strong { overflow: hidden; color: var(--text); font-size: .71rem; text-overflow: ellipsis; white-space: nowrap; }
.mini-game small, .mini-game time { color: var(--muted); font-size: .58rem; }
.panel-empty { margin: 18px 0; color: var(--muted); font-size: .72rem; }

.dashboard-library { margin-top: 27px; }
.dashboard-library > .section-heading { margin-bottom: 12px; }
.section-heading h1, .section-heading h2 { letter-spacing: -.025em; }
.info-button { color: var(--primary); }

.filters {
  grid-template-columns: minmax(230px, 2fr) repeat(3, minmax(90px, 1fr)) auto auto;
  gap: 10px;
  padding: 13px;
  background: var(--surface);
  box-shadow: none;
}
.filters label { color: var(--muted); font-size: .72rem; font-weight: 650; }
.filters input, .filters select { min-height: 38px; background: var(--surface-soft); }

input, select, textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 72%, transparent); }

.games { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 11px; margin-top: 15px; }
.game {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border-width: 1px;
  background: var(--surface);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.game:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.game img, .game .placeholder {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
}
.game-body { display: flex; flex: 1; flex-direction: column; padding: 10px; }
.game h3 { margin: 7px 0 4px; font-size: .91rem; line-height: 1.25; }
.game p { margin: 3px 0; color: var(--muted); font-size: .69rem; line-height: 1.5; }
.game-body small { margin-top: auto; padding-top: 5px; color: var(--muted); }
.game-body form, .game-body > p:last-child { margin: 8px 0 0; }
.game-body .button, .game-body button { width: 100%; text-align: center; }
.location-badge { align-self: flex-start; background: var(--primary-soft); color: var(--primary); font-size: .65rem; }

.game-media { position: relative; overflow: hidden; background: var(--surface-soft); }
.game-media img, .game-media .placeholder { display: block; border-bottom: 1px solid var(--border); }
.game-body > h3 { margin: 8px 0 7px; }
.game-facts { display: grid; gap: 4px; color: var(--muted); font-size: .66rem; }
.game-facts > span { display: flex; align-items: center; gap: 5px; min-width: 0; white-space: nowrap; }
.game-facts > span:first-child { align-items: flex-start; white-space: normal; }
.game-info-icon { flex: 0 0 13px; width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.game-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 7px; margin-top: auto; padding-top: 10px; }
.game-card-footer .location-badge { min-width: 0; }
.game-heart { display: grid; flex: 0 0 24px; place-items: center; width: 24px; height: 24px; color: var(--primary); }
.game-heart .game-info-icon { width: 17px; height: 17px; }
.game-card-action { margin-top: 7px !important; }
.game-body > .game-card-action.button, .game-card-action button { min-height: 31px; padding: 6px 9px; border-radius: 8px; font-size: .69rem; }
.game-card-action input { display: none; }
.category-picker { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-soft); }
.category-picker legend { padding: 0 5px; color: var(--text); font-size: .82rem; font-weight: 750; }
.category-chip { position: relative; display: inline-flex; cursor: pointer; }
.category-chip input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.category-chip span { display: inline-flex; align-items: center; min-height: 31px; padding: 5px 10px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .73rem; font-weight: 600; transition: .16s ease; }
.category-chip input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-hover); }
.category-chip input:focus-visible + span { outline: 3px solid color-mix(in srgb,var(--primary) 30%,transparent); outline-offset: 2px; }
.filter-category-picker { position: relative; align-self: end; }
.filter-category-picker summary { display: flex; align-items: center; min-height: 38px; padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-soft); color: var(--text); cursor: pointer; font-size: .78rem; font-weight: 500; list-style: none; }
.filter-category-picker summary::-webkit-details-marker { display: none; }
.filter-category-picker summary::after { content: '⌄'; margin-left: auto; color: var(--muted); }
.category-filter-options { position: absolute; z-index: 25; left: 0; top: calc(100% + 7px); display: flex; flex-wrap: wrap; gap: 7px; width: min(430px,calc(100vw - 30px)); padding: 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-raised); box-shadow: var(--shadow-md); }
.category-filter-title, .category-filter-done, .category-filter-cancel { display: none; }
.busy-overlay { position: fixed; z-index: 1000; inset: 0; display: grid; place-content: center; justify-items: center; gap: 9px; padding: 24px; background: color-mix(in srgb,var(--bg) 72%,transparent); color: var(--text); text-align: center; opacity: 0; backdrop-filter: blur(5px); transition: opacity .18s ease; }
.busy-overlay[hidden] { display: none; }
.busy-overlay.is-visible { opacity: 1; }
.busy-overlay strong { font-size: .95rem; }
.busy-overlay small { color: var(--muted); font-size: .72rem; }
.busy-spinner { width: 46px; height: 46px; border: 4px solid color-mix(in srgb,var(--primary) 22%,var(--surface)); border-top-color: var(--primary); border-radius: 50%; animation: busy-spin .72s linear infinite; }
@keyframes busy-spin { to { transform: rotate(360deg); } }
.delete-game-form { max-width: 480px; margin: 14px auto 5vh; padding: 16px; border: 1px solid color-mix(in srgb,var(--danger) 42%,var(--border)); border-radius: 13px; background: var(--surface); }
.delete-game-form small { color: var(--muted); }
.danger-button { background: var(--danger); }
.danger-button:hover { background: color-mix(in srgb,var(--danger) 82%,#000); }

.game.state-own-home { border-color: #8ba476; background: var(--surface); }
.game.state-own-lent { border-color: #bd8650; background: color-mix(in srgb, var(--surface) 96%, #c67f38); }
.game.state-other-available { border-color: #c5aa68; background: color-mix(in srgb, var(--surface) 96%, #d7b354); }
.game.state-borrowed-by-us { border-color: #789ead; background: color-mix(in srgb, var(--surface) 96%, #6f9fae); }
.game.state-other-unavailable { border-color: var(--border-strong); background: var(--surface-soft); opacity: .72; }

.secondary { background: transparent; color: var(--primary); border-color: var(--primary); }
.secondary:hover { background: var(--primary-soft); color: var(--text); }
.flash { border: 1px solid currentColor; box-shadow: var(--shadow-sm); }

.settings { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.settings > .card { padding: 18px; }
.member-invite, .notification-option, .connected-family { background: var(--surface-soft); border-color: var(--border); }
.notification-channels { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; margin: 0 0 17px; padding: 13px; border: 1px solid var(--border); border-radius: 13px; }
.notification-channels legend { padding: 0 6px; font-size: .78rem; font-weight: 750; }
.notification-option.is-disabled { opacity: .55; }
.push-device-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 17px; padding: 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--primary-soft); }
.push-device-card > div { display: grid; gap: 3px; }
.push-device-card strong { font-size: .78rem; }
.push-device-card small { color: var(--muted); font-size: .68rem; }
.push-device-card button { flex: 0 0 auto; }
.push-device-card button.is-loading { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; cursor: wait; opacity: .9; }
.push-device-card button.is-loading::before { content: ""; width: 1rem; height: 1rem; flex: 0 0 1rem; border: 2px solid rgba(255,255,255,.42); border-top-color: #fff; border-radius: 50%; animation: push-button-spin .75s linear infinite; }
@keyframes push-button-spin { to { transform: rotate(360deg); } }
.notification-events-title { margin: 8px 0; font-size: .88rem; }

.add-drawer[open] { background: var(--surface); border-color: var(--border); box-shadow: -20px 0 65px rgba(0, 0, 0, .2); }
.add-drawer[open] > summary { background: var(--surface); border-color: var(--border); }
.form-step { background: var(--primary-soft); }
fieldset[data-game-details] { background: var(--surface-soft); border-color: var(--border); }
.lookup-dialog, .legend-dialog { background: var(--surface-raised); border-color: var(--border); }

.bottom-nav { background: color-mix(in srgb, var(--surface) 94%, transparent); border-color: var(--border); }
.bottom-nav a { color: var(--muted); }
.bottom-nav a.active { color: var(--primary); }

.notification-center { position: relative; z-index: 5; margin-left: auto; }
.notification-bell { position: relative; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--text); }
.notification-bell:hover { border-color: var(--border); background: var(--surface-soft); transform: none; }
.notification-bell b { position: absolute; right: -1px; top: -2px; min-width: 17px; height: 17px; padding: 1px 4px; border: 2px solid var(--surface); border-radius: 999px; background: #c96755; color: #fff; font-size: .56rem; line-height: 12px; text-align: center; }
.notification-panel { position: absolute; right: 0; top: 46px; width: min(380px, calc(100vw - 28px)); overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-raised); box-shadow: var(--shadow-md); }
.notification-panel > header { position: static; display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; border-bottom: 1px solid var(--border); background: transparent; }
.notification-panel > header button { padding: 4px; background: transparent; color: var(--primary); font-size: .65rem; }
.notification-list { max-height: min(520px, 70vh); overflow: auto; }
.notification-item { display: grid; grid-template-columns: 30px minmax(0,1fr) auto; align-items: start; gap: 8px; padding: 11px 13px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.notification-item:hover { background: var(--surface-soft); }
.notification-item.is-unread { background: color-mix(in srgb, var(--primary-soft) 62%, var(--surface)); }
.notification-item i { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-style: normal; }
.notification-item > span { display: grid; min-width: 0; }
.notification-item strong { font-size: .72rem; }
.notification-item small { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: .62rem; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.notification-item time { color: var(--muted); font-size: .58rem; }
.notification-empty { padding: 22px 14px; color: var(--muted); text-align: center; }
.toast-stack { position: fixed; z-index: 300; right: 20px; top: 82px; display: grid; gap: 9px; width: min(360px, calc(100vw - 28px)); }
.app-toast { position: relative; display: grid; gap: 3px; padding: 13px 42px 13px 14px; border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 12px; background: var(--surface-raised); box-shadow: var(--shadow-md); color: var(--text); opacity: 0; transform: translateX(18px); transition: opacity .2s ease, transform .2s ease; }
.app-toast.is-visible { opacity: 1; transform: translateX(0); }
.app-toast strong { font-size: .78rem; }
.app-toast span { color: var(--muted); font-size: .67rem; }
.app-toast button { position: absolute; right: 8px; top: 7px; padding: 3px 7px; background: transparent; color: var(--muted); font-size: 1rem; }

@media (max-width: 1180px) {
  .games { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .sidebar { width: 200px; }
  .app-content { margin-left: 200px; }
  .games { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters { grid-template-columns: 2fr 1fr 1fr; }
}

@media (max-width: 760px) {
  .app-content { margin-left: 0; }
  .topbar { height: 62px; padding: 0 14px; }
  .signed-in main { padding: 16px 13px 28px; }
  .hero { padding: 18px; }
  .hero .eyebrow { margin-top: 0; }
  .dashboard-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .dashboard-stats a { min-height: 96px; padding: 12px; }
  .dashboard-stats .dashboard-add-card { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 12px 54px 12px 18px; text-align: center; }
  .dashboard-add-card small, .dashboard-add-card em { display: none; }
  .dashboard-add-card strong { margin: 0; font-size: .88rem; }
  .dashboard-add-card .stat-icon { right: 14px; top: 50%; transform: translateY(-50%); }
  .topbar .top-add { display: none !important; }
  .filter-category-picker[open]::before { content: ''; position: fixed; z-index: 210; inset: 0; background: #1119; backdrop-filter: blur(2px); }
  .filter-category-picker .category-filter-options { position: fixed; z-index: 220; left: 50%; top: 50%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: min(430px,calc(100vw - 26px)); max-height: min(620px,82dvh); padding: 18px 15px 15px; overflow-y: auto; border-radius: 17px; transform: translate(-50%,-50%); }
  .category-filter-title { display: block; grid-column: 1 / -1; margin: 0 0 4px; font-size: 1rem; }
  .category-filter-cancel { position: absolute; right: 12px; top: 11px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: var(--surface-soft); color: var(--muted); font-size: 1.35rem; }
  .category-filter-title { padding-right: 38px; }
  .filter-category-picker .category-chip, .filter-category-picker .category-chip span { width: 100%; min-width: 0; }
  .filter-category-picker .category-chip span { justify-content: center; min-height: 39px; padding: 7px 5px; text-align: center; white-space: normal; }
  .category-filter-done { display: block; grid-column: 1 / -1; width: 100%; margin-top: 5px; }
  .filters { grid-template-columns: 1fr 1fr; padding: 11px; }
  .games { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .game { display: flex; }
  .game img, .game .placeholder { min-height: 0; aspect-ratio: 4 / 5; }
  .game-body { padding: 9px; }
  .game h3 { font-size: .86rem; }
  .game p { font-size: .65rem; }
  .settings { grid-template-columns: 1fr; }
  .dashboard-panels { grid-template-columns: 1fr; }
  .notification-panel { position: fixed; right: 12px; top: 58px; }
  .notification-channels { grid-template-columns: 1fr; }
  .push-device-card { align-items: stretch; flex-direction: column; }
  .toast-stack { left: 14px; right: 14px; top: 72px; width: auto; }
  .bottom-nav { height: 68px; }
  .bottom-nav .ui-icon { width: 20px; height: 20px; }
}

@media (max-width: 390px) {
  .games { gap: 7px; }
  .game-body { padding: 8px; }
  .location-badge { font-size: .59rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Desktop-Skalierung: Die Anwendung soll große Browserfenster sichtbar ausfüllen. */
@media (min-width: 761px) {
  body.signed-in { font-size: 15.5px; }
  .sidebar { width: 244px; padding: 31px 20px 21px; }
  .app-content { margin-left: 244px; }
  .brand { font-size: 1.18rem; }
  .brand-mark { width: 42px; height: 47px; }
  .brand small { font-size: .64rem; }
  .side-nav { margin-top: 39px; }
  .side-nav a { min-height: 45px; padding: 10px 13px; font-size: .88rem; }
  .side-nav a span { width: 22px; }
  .side-nav .ui-icon { width: 20px; height: 20px; }
  .topbar { height: 78px; padding: 0 38px; }
  .topbar > div strong { font-size: 1.38rem; }
  .signed-in main { width: 100%; max-width: 1480px; padding: 32px 38px 76px; }
  .hero { min-height: 154px; padding: 29px 33px; }
  .hero h1 { font-size: 1.58rem; }
  .hero p { font-size: .9rem; }
  .hero .shelf { font-size: 3.8rem; }
  .dashboard-stats { gap: 14px; margin-top: 16px; }
  .dashboard-stats a { min-height: 123px; padding: 19px; }
  .dashboard-stats small { font-size: .8rem; }
  .dashboard-stats strong { font-size: 2rem; }
  .dashboard-stats em { font-size: .76rem; }
  .stat-icon .ui-icon { width: 22px; height: 22px; }
  .dashboard-panels { gap: 14px; margin-top: 14px; }
  .dashboard-list { padding: 18px; }
  .panel-title h2 { font-size: .94rem; }
  .mini-game { grid-template-columns: 42px minmax(0,1fr) auto; gap: 10px; padding: 8px 2px; }
  .mini-game img, .mini-placeholder { width: 42px; height: 47px; }
  .mini-game strong { font-size: .79rem; }
  .mini-game small, .mini-game time { font-size: .66rem; }
  .dashboard-library { margin-top: 34px; }
  .dashboard-library > .section-heading h2 { font-size: 1.4rem; }
  .filters { grid-template-columns: minmax(210px,2fr) minmax(175px,1.4fr) repeat(3,minmax(80px,1fr)) auto auto; gap: 13px; padding: 16px; }
  .filters label { font-size: .78rem; }
  .filters input, .filters select { min-height: 44px; }
  .filter-category-picker summary { min-height: 44px; }
  .games { grid-template-columns: repeat(auto-fill,minmax(205px,1fr)); gap: 15px; margin-top: 19px; }
  .game-body { padding: 13px; }
  .game h3, .game-body > h3 { margin: 10px 0 8px; font-size: 1.02rem; }
  .game-facts { gap: 6px; font-size: .76rem; }
  .game-info-icon { flex-basis: 15px; width: 15px; height: 15px; }
  .game-card-footer { padding-top: 13px; }
  .location-badge { padding: 4px 9px; font-size: .7rem; }
  .game-body > .game-card-action.button, .game-card-action button { min-height: 37px; font-size: .76rem; }
  .notification-bell { width: 42px; height: 42px; }
}

@media (min-width: 1700px) {
  .signed-in main { max-width: 1580px; }
  .games { grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); }
}

@media (min-width: 761px) and (max-width: 1050px) {
  .sidebar { width: 210px; padding-inline: 16px; }
  .app-content { margin-left: 210px; }
  .signed-in main { padding: 25px; }
  .games { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

/* Begrüßung und Kennzahlen nach der freigegebenen Dashboard-Vorlage. */
.hero { grid-template-columns: minmax(0,1fr) 250px; }
.hero .welcome-title { margin: 0 0 6px; color: var(--text); font-size: 1.05rem; font-weight: 750; text-transform: none; }
.hero .welcome-title::after { content: ' 👋'; }
.hero .shelf { display: grid; place-items: center; font-size: 0; }
.welcome-art { width: min(100%,210px); height: auto; overflow: visible; color: #cbb68d; }
.welcome-art rect { fill: #d9c8a7; stroke: #b8a47e; stroke-width: 1; }
.welcome-art rect:nth-of-type(2), .welcome-art rect:nth-of-type(5) { fill: #bdc4a3; }
.welcome-art rect:nth-of-type(3) { fill: #e1c5a9; }
.welcome-art .welcome-shelf { fill: #bca27b; }
.welcome-art .welcome-plant { fill: none; stroke: #758f62; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.welcome-art .welcome-pot { fill: #cbb18b; }
.dashboard-stats a { padding-right: 70px; }
.stat-icon { display: grid; place-items: center; right: 17px; top: 50%; width: 42px; height: 42px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); transform: translateY(-50%); }
.dashboard-stats a:nth-child(2) .stat-icon { background: color-mix(in srgb,#d99449 16%,var(--surface)); color: #c1782e; }
.dashboard-stats a:nth-child(3) .stat-icon { background: color-mix(in srgb,#c77c47 16%,var(--surface)); color: #b66b37; }
.dashboard-stats a:nth-child(4) .stat-icon { background: color-mix(in srgb,#759668 18%,var(--surface)); color: #67865b; }
.dashboard-stats a:nth-child(5) .stat-icon { background: #ffffff22; color: #fff; }
.stat-icon .ui-icon { width: 25px; height: 25px; stroke-width: 1.9; }

@media (min-width: 761px) {
  .hero { min-height: 116px; padding: 20px 25px; }
  .hero .welcome-title { font-size: 1.08rem; }
  .hero p { margin: 0; font-size: .78rem; }
  .dashboard-stats a { min-height: 112px; }
}

@media (max-width: 760px) {
  .hero { display: block; padding: 17px 16px; }
  .hero .welcome-title { font-size: 1rem; }
  .hero p { margin: 0; font-size: .76rem; }
  .dashboard-stats a { padding-right: 58px; }
  .stat-icon { right: 10px; width: 37px; height: 37px; border-radius: 10px; }
  .stat-icon .ui-icon { width: 22px; height: 22px; }
  html, body { max-width: 100%; overflow-x: hidden; }
  .category-picker { display: grid; grid-template-columns: 1fr 1fr; width: 100%; min-width: 0; overflow: visible; }
  .category-picker .category-chip, .category-picker .category-chip span { width: 100%; min-width: 0; }
  .category-picker .category-chip span { justify-content: center; padding-inline: 6px; text-align: center; white-space: normal; }
  fieldset[data-game-details], .auth form { min-width: 0; }
}

.game-footer-icons { display: inline-flex; align-items: center; gap: 2px; }
.game-history-button { display: grid; place-items: center; width: 27px; height: 27px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--primary); }
.game-history-button:hover { background: var(--primary-soft); transform: none; }
.game-history-button .game-info-icon { width: 17px; height: 17px; }
.clear-dashboard-filter { display: block; margin-top: 3px; color: var(--primary); font-size: .7rem; text-decoration: none; }
.history-dialog { width: min(560px,calc(100% - 26px)); max-height: min(720px,88dvh); padding: 0; overflow: auto; border: 1px solid var(--border); border-radius: 17px; background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow-md); }
.history-dialog::backdrop { background: #111a; backdrop-filter: blur(2px); }
.history-dialog-content { position: relative; padding: 22px; }
.history-dialog-content h2 { margin: 2px 38px 18px 0; font-size: 1.25rem; }
.history-close { position: absolute; right: 12px; top: 10px; width: 34px; height: 34px; padding: 0; background: transparent; color: var(--muted); font-size: 1.4rem; }
.history-list { display: grid; gap: 9px; }
.history-entry { display: grid; grid-template-columns: 13px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-soft); }
.history-entry > div { display: grid; gap: 2px; }
.history-entry strong { font-size: .82rem; }
.history-entry small { color: var(--muted); font-size: .69rem; }
.history-entry form { margin: 0; }
.history-entry button { padding: 7px 10px; font-size: .7rem; }
.history-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.history-dot.is-active { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb,var(--accent) 18%,transparent); }
.history-empty { color: var(--muted); }
.mobile-more-sheet { width: 100%; max-width: none; margin: auto 0 0; padding: 0; overflow: visible; border: 0; border-radius: 20px 20px 0 0; background: transparent; color: var(--text); }
.mobile-more-sheet::backdrop { background: #1119; backdrop-filter: blur(2px); }
.mobile-more-panel { display: grid; gap: 12px; padding: 8px 15px max(20px,env(safe-area-inset-bottom)); border: 1px solid var(--border); border-bottom: 0; border-radius: 20px 20px 0 0; background: var(--surface-raised); box-shadow: 0 -14px 45px #0003; }
.mobile-more-handle { justify-self: center; width: 42px; height: 4px; border-radius: 999px; background: var(--border-strong); }
.mobile-more-heading { display: flex; align-items: center; justify-content: space-between; min-height: 35px; }
.mobile-more-heading > strong { font-size: 1.05rem; }
.mobile-more-close { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: var(--surface-soft); color: var(--muted); font-size: 1.35rem; }
.mobile-more-profile { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-soft); color: var(--text); text-decoration: none; }
.mobile-more-profile .avatar { width: 42px; height: 42px; }
.mobile-more-profile > span:nth-child(2) { display: grid; gap: 2px; }
.mobile-more-profile strong { font-size: .86rem; }
.mobile-more-profile small { color: var(--muted); font-size: .68rem; }
.mobile-more-arrow { color: var(--primary); font-size: 1.6rem; }
.mobile-more-logout { margin: 0; }
.mobile-more-logout .logout-button { width: 100%; min-height: 46px; border-color: var(--border); background: transparent; color: var(--muted); }

/* Kompaktes Scannerfenster: sichtbar ist nur der Barcode-Ausschnitt. */
.scanner-shell { background: #090d0b; }
.scanner-shell .scanner { position: absolute; inset: auto; left: 50%; top: 50%; width: min(92vw,640px); height: auto; aspect-ratio: 2.45 / 1; border: 1px solid #ffffff55; border-radius: 17px; object-fit: cover; transform: translate(-50%,-50%); }
.scanner-guide { width: min(84vw,580px); aspect-ratio: 2.7 / 1; border-width: 2px; border-radius: 12px; box-shadow: inset 0 0 20px #0005; }
.scanner-hint { bottom: max(24px,env(safe-area-inset-bottom)); }
.scanner-zoom { bottom: max(78px,calc(env(safe-area-inset-bottom) + 62px)); }

@media (max-width: 520px) {
  .scanner-shell .scanner { width: 94vw; aspect-ratio: 2.25 / 1; }
  .scanner-guide { width: 86vw; aspect-ratio: 2.55 / 1; }
  .scanner-hint { font-size: .78rem; }
  .history-dialog-content { padding: 18px 15px; }
  .history-entry { grid-template-columns: 12px minmax(0,1fr); }
  .history-entry form { grid-column: 2; }
}

/* Eigene Tablet-Zwischenstufe: großzügige mobile Anordnung mit Seitenleiste. */
@media (min-width: 761px) and (max-width: 1100px), (min-width: 761px) and (max-width: 1600px) and (pointer: coarse) {
  html { scroll-padding-top: 94px; }
  .sidebar { width: 184px; padding: 25px 13px 18px; }
  .app-content { margin-left: 184px; }
  .brand { gap: 8px; font-size: 1rem; }
  .brand-mark { width: 37px; height: 42px; }
  .brand small { font-size: .56rem; }
  .side-nav { margin-top: 28px; }
  .side-nav a { min-height: 41px; padding: 8px 10px; font-size: .78rem; }
  .side-profile { padding-inline: 4px; }
  .side-profile strong { font-size: .78rem; }
  .topbar { height: 70px; padding: 0 24px; }
  .topbar .top-add { display: none !important; }
  .signed-in main { padding: 24px 22px 64px; }
  .hero { display: grid; grid-template-columns: minmax(0,1fr) 150px; min-height: 108px; padding: 18px 21px; }
  .welcome-art { width: 145px; }
  .dashboard-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dashboard-stats a { min-height: 100px; padding: 15px 64px 14px 15px; }
  .dashboard-stats .dashboard-add-card { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; min-height: 50px; padding: 12px 60px 12px 18px; text-align: center; }
  .dashboard-add-card small, .dashboard-add-card em { display: none; }
  .dashboard-add-card strong { margin: 0; font-size: .9rem; }
  .dashboard-add-card .stat-icon { right: 15px; }
  .dashboard-panels { grid-template-columns: 1fr; }
  .dashboard-library { scroll-margin-top: 94px; }
  .filters { grid-template-columns: 1fr 1fr; gap: 11px; padding: 13px; }
  .filters > label:first-of-type, .filters > .filter-category-picker, .filters > button { grid-column: 1 / -1; }
  .filters > button { width: 100%; }
  .games { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .filter-category-picker[open]::before { content: ''; position: fixed; z-index: 210; inset: 0; background: #1119; backdrop-filter: blur(2px); }
  .filter-category-picker .category-filter-options { position: fixed; z-index: 220; left: 50%; top: 50%; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; width: min(500px,calc(100vw - 42px)); max-height: min(650px,82dvh); padding: 20px 17px 17px; overflow-y: auto; border-radius: 17px; transform: translate(-50%,-50%); }
  .category-filter-title { display: block; grid-column: 1 / -1; margin-bottom: 4px; font-size: 1.05rem; }
  .category-filter-cancel { position: absolute; right: 13px; top: 12px; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: var(--surface-soft); color: var(--muted); font-size: 1.4rem; }
  .category-filter-title { padding-right: 42px; }
  .filter-category-picker .category-chip, .filter-category-picker .category-chip span { width: 100%; min-width: 0; }
  .filter-category-picker .category-chip span { justify-content: center; min-height: 41px; text-align: center; white-space: normal; }
  .category-filter-done { display: block; grid-column: 1 / -1; width: 100%; margin-top: 5px; }
}
