/*
 * Herrenabend design system. Mobile first: base rules target phones (360 px+),
 * desktop is layered on with min-width breakpoints only. Colours, radii and
 * spacing come exclusively from the tokens below.
 */

:root {
    --ink: #1d1f22;
    --ink-raised: #2a2d31;
    --on-ink: #ffffff;
    --on-ink-muted: #a3a8b0;
    --bg: #f2f3f5;
    --surface: #ffffff;
    --surface-2: #f0f2f4;
    --border: #e5e7ea;
    --text: #1d1f22;
    --text-muted: #868b93;
    --accent: #22d39b;
    --accent-strong: #12a77a;
    --accent-gradient: linear-gradient(135deg, #4de9a9 0%, #1fc8b6 100%);
    --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
    --on-accent: #052a20;
    --teal-gradient: linear-gradient(135deg, #2ad4c3 0%, #1aa5a8 100%);
    --ink-gradient: linear-gradient(135deg, #34383d 0%, #1d1f22 100%);
    --danger: #e5484d;
    --danger-soft: color-mix(in srgb, var(--danger) 14%, transparent);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius: 16px;
    --radius-sm: 12px;
    --shadow: 0 10px 30px rgb(17 24 39 / 0.07);
    --shadow-strong: 0 18px 40px rgb(17 24 39 / 0.16);
    --gutter: 16px;
    --tabbar-height: 64px;
    --touch: 44px;
    --content-width: 960px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ink: #1c1e21;
        --ink-raised: #2a2d31;
        --bg: #111214;
        --surface: #1b1d20;
        --surface-2: #25282c;
        --border: #2d3136;
        --text: #eceef1;
        --text-muted: #8d939b;
        --accent-strong: #4de9a9;
        --shadow: 0 10px 30px rgb(0 0 0 / 0.35);
        --shadow-strong: 0 18px 40px rgb(0 0 0 / 0.5);
        color-scheme: dark;
    }
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--ink);
    color: var(--text);
    line-height: 1.5;
    /* Long URLs and names must wrap instead of widening the page on phones. */
    overflow-wrap: anywhere;
    -webkit-tap-highlight-color: transparent;
}

a {
    color: var(--accent-strong);
}

h1:focus {
    outline: none;
}

h1, h2, h3 {
    line-height: 1.2;
}

img {
    max-width: 100%;
}

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

/* ---------- App frame ---------- */

.app {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(env(safe-area-inset-top) + 12px) var(--gutter) 4px;
    background: var(--ink);
    color: var(--on-ink);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--on-ink);
    font-weight: 700;
    text-decoration: none;
}

.brand img {
    width: 30px;
    height: 30px;
    border-radius: 9px;
}

.topbar .avatar-link {
    margin-left: auto;
    border-radius: 50%;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
}

/* ---------- Hero + sheet (every page) ---------- */

.hero {
    background: var(--ink);
    color: var(--on-ink);
    padding: 12px var(--gutter) 44px;
}

.hero-inner, .sheet-inner {
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
}

.hero h1 {
    margin: 4px 0 0;
    font-size: 1.75rem;
    font-weight: 800;
}

.hero .eyebrow {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
}

.hero .subtitle {
    margin: 6px 0 0;
    color: var(--on-ink-muted);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: var(--touch);
    margin-left: -8px;
    padding: 0 8px;
    color: var(--on-ink-muted);
    text-decoration: none;
    font-size: 0.95rem;
}

.sheet {
    flex: 1;
    margin-top: -24px;
    padding: 20px var(--gutter) 28px;
    background: var(--bg);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

/* ---------- Bottom tab bar (phone) / top navigation (desktop) ---------- */

.tabbar {
    position: fixed;
    inset: auto 0 0;
    z-index: 800;
    display: flex;
    justify-content: space-around;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -6px 24px rgb(17 24 39 / 0.06);
}

.tab {
    white-space: nowrap;
    overflow-wrap: normal;
    position: relative;
    flex: 1;
    max-width: 120px;
    min-height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
}

.tab.active {
    color: var(--accent-strong);
}

.tab.active .icon {
    stroke-width: 2.4;
}

.tab-badge {
    position: absolute;
    top: 4px;
    left: calc(50% + 6px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    line-height: 18px;
    text-align: center;
}

.topnav {
    display: none;
}

/* ---------- Icons, avatars ---------- */

.icon {
    width: 22px;
    height: 22px;
    flex: none;
}

.icon.small {
    width: 18px;
    height: 18px;
}

.icon.large {
    width: 28px;
    height: 28px;
}

.avatar {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: var(--on-accent);
    font-weight: 800;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.avatar.small {
    width: 30px;
    height: 30px;
    font-size: 0.72rem;
}

.avatar.large {
    width: 84px;
    height: 84px;
    border-radius: var(--radius-lg);
    font-size: 1.8rem;
}

.avatar-stack {
    display: flex;
    margin-top: 14px;
}

.avatar-stack .avatar {
    margin-right: -8px;
    border: 2px solid var(--ink);
}

/* ---------- Typography helpers ---------- */

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

.small {
    font-size: 0.85rem;
}

.center {
    text-align: center;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 28px 0 12px;
    font-size: 1.05rem;
    font-weight: 800;
}

.section-title:first-child {
    margin-top: 4px;
}

/* ---------- Cards and lists ---------- */

.card {
    margin-bottom: 14px;
    padding: var(--gutter);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.card h2 {
    margin: 0 0 4px;
    font-size: 1.05rem;
}

.card h3 {
    margin: 0;
    font-size: 1rem;
}

.card > :last-child {
    margin-bottom: 0;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.card-head h2, .card-head h3 {
    flex: 1;
    min-width: 0;
    margin: 0;
}

.link-button, .button, .chip {
    overflow-wrap: normal;
}

.list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 10px 0;
    color: var(--text);
    text-decoration: none;
}

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

.list-row .row-main {
    flex: 1;
    min-width: 0;
}

.list-row .row-title {
    display: block;
    font-weight: 700;
}

.list-row .row-sub {
    display: block;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.list-row .row-end {
    flex: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: right;
}

.tile {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    overflow: hidden;
}

.tile.accent {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.empty {
    padding: 28px var(--gutter);
    text-align: center;
}

.empty .icon {
    width: 40px;
    height: 40px;
    color: var(--accent-strong);
}

/* ---------- Buttons ---------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--touch);
    padding: 10px 20px;
    border: 0;
    border-radius: 999px;
    background: var(--accent-gradient);
    color: var(--on-accent);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 30%, transparent);
}

.button.secondary {
    background: var(--surface-2);
    color: var(--text);
    box-shadow: none;
}

.button.dark {
    background: var(--ink);
    color: var(--on-ink);
    box-shadow: none;
}

.button.ghost {
    background: rgb(255 255 255 / 0.1);
    color: var(--on-ink);
    box-shadow: none;
}

.button.danger {
    background: var(--danger);
    color: #fff;
    box-shadow: none;
}

.button.block {
    width: 100%;
}

.button:disabled, .button.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: var(--touch);
    height: var(--touch);
    border: 0;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
}

.link-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 36px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.link-button.danger-text, .danger-text {
    color: var(--danger);
}

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

.row.align-end {
    align-items: flex-end;
}

.row > label {
    flex: 1 1 150px;
}

.stack {
    display: grid;
    gap: 10px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 6px;
}

/* ---------- Quick action tiles (like Send / Request / Pay) ---------- */

.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 4px 0 8px;
}

.quick-action {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 12px 4px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}

.quick-action .tile {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

/* ---------- Feature card (credit-card look) ---------- */

.feature-card {
    position: relative;
    display: block;
    overflow: hidden;
    margin: -12px 0 18px;
    padding: 20px;
    border-radius: var(--radius-lg);
    background: var(--accent-gradient);
    color: var(--on-accent);
    text-decoration: none;
    box-shadow: var(--shadow-strong);
}

.feature-card::after {
    content: "";
    position: absolute;
    right: -40px;
    bottom: -60px;
    width: 180px;
    height: 180px;
    border: 34px solid rgb(255 255 255 / 0.35);
    border-radius: 50%;
}

.feature-card .feature-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.8;
}

.feature-card h2 {
    position: relative;
    z-index: 1;
    margin: 8px 0 4px;
    font-size: 1.5rem;
    font-weight: 800;
}

.feature-card .feature-meta {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-size: 0.88rem;
    font-weight: 600;
}

.feature-card .feature-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.feature-card.dark {
    background: var(--ink-gradient);
    color: var(--on-ink);
}

/* ---------- Game tiles ---------- */

.game-grid {
    display: grid;
    gap: 12px;
}

.game-tile {
    display: grid;
    gap: 10px;
    padding: 18px;
    border-radius: var(--radius-lg);
    background: var(--accent-gradient);
    color: var(--on-accent);
    box-shadow: var(--shadow);
}

.game-tile:nth-child(3n+2) {
    background: var(--teal-gradient);
    color: #032b2b;
}

.game-tile:nth-child(3n+3) {
    background: var(--ink-gradient);
    color: var(--on-ink);
}

.game-tile:nth-child(3n+3) .button {
    background: var(--accent-gradient);
    color: var(--on-accent);
}

.game-tile h3 {
    margin: 0;
    font-size: 1.2rem;
}

.game-tile p {
    margin: 0;
    opacity: 0.85;
    font-size: 0.9rem;
}

.game-tile .tile {
    background: rgb(255 255 255 / 0.28);
    color: inherit;
}

.game-tile .button {
    background: var(--ink);
    color: var(--on-ink);
    box-shadow: none;
}

.game-tile select {
    background: rgb(255 255 255 / 0.85);
    color: #1d1f22;
    border-color: transparent;
}

.game-tile label {
    color: inherit;
}

.live-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-lg);
    background: var(--ink);
    color: var(--on-ink);
    text-decoration: none;
    box-shadow: var(--shadow);
}

.live-card .row-main {
    flex: 1;
}

.live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 6px var(--accent-soft);
}

/* ---------- Forms ---------- */

.form {
    display: grid;
    gap: 14px;
}

.form label, label.field {
    display: grid;
    gap: 6px;
    font-weight: 600;
    font-size: 0.88rem;
}

.form label.compact {
    font-weight: 500;
}

input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea, select {
    width: 100%;
    min-height: var(--touch);
    padding: 11px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 1rem; /* 16 px keeps iOS from zooming into focused inputs */
}

textarea {
    resize: vertical;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
}

fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

legend {
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.88rem;
}

.segmented + .row {
    margin-top: 12px;
}

.form label.check {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--touch);
    font-weight: 500;
}

.form label.check input {
    width: 22px;
    height: 22px;
    accent-color: var(--accent-strong);
}

.option-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.validation-message {
    color: var(--danger);
}

.alert {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--danger-soft);
    color: var(--text);
    font-size: 0.92rem;
}

/* ---------- Chips and segmented control ---------- */

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
}

button.chip {
    cursor: pointer;
}

button.chip:disabled {
    cursor: default;
    opacity: 0.6;
}

.chip.selected {
    border-color: transparent;
    background: var(--accent-gradient);
    color: var(--on-accent);
}

.segmented {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: var(--surface-2);
}

.segmented button {
    white-space: nowrap;
    overflow-wrap: normal;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.segmented button.selected {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

.section-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    gap: 8px;
    margin: 0 calc(-1 * var(--gutter)) 14px;
    padding: 8px var(--gutter);
    overflow-x: auto;
    background: var(--bg);
    scrollbar-width: none;
}

.section-nav a {
    flex: none;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--shadow);
}

/* ---------- Chronicle ---------- */

.day-title {
    margin: 22px 0 8px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.timeline {
    margin: 0;
    padding: 0;
    list-style: none;
}

.entry {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    padding: 14px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.entry-body {
    flex: 1;
    min-width: 0;
}

.entry-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.entry-highlight {
    box-shadow: inset 0 0 0 2px var(--accent), var(--shadow);
}

.entry blockquote {
    margin: 4px 0 0;
    font-size: 1.1rem;
    font-style: italic;
    font-weight: 600;
}

.entry blockquote footer {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-style: normal;
    font-weight: 500;
}

.markdown > :first-child {
    margin-top: 0.2em;
}

.markdown > :last-child {
    margin-bottom: 0.2em;
}

.markdown ul, .markdown ol {
    padding-left: 1.2em;
}

/* ---------- Photos ---------- */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin: 0 calc(-1 * var(--gutter) + 4px);
}

.photo-tile {
    padding: 0;
    border: 0;
    overflow: hidden;
    aspect-ratio: 1;
    border-radius: 6px;
    background: var(--surface-2);
    cursor: pointer;
}

.photo-tile img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-button {
    position: relative;
    overflow: hidden;
}

.file-button input[type=file] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: grid;
    grid-template-rows: auto 1fr auto;
    background: rgb(0 0 0 / 0.94);
    color: #f2f3f5;
    outline: none;
}

.lightbox-bar, .lightbox-info {
    padding: 10px var(--gutter);
}

.lightbox-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: calc(env(safe-area-inset-top) + 8px);
}

.lightbox-info {
    padding-bottom: calc(env(safe-area-inset-bottom) + 14px);
}

.lightbox .link-button, .lightbox .muted {
    color: #c9ccd1;
}

.lightbox .icon-button {
    background: rgb(255 255 255 / 0.12);
    color: #fff;
}

.lightbox-stage {
    position: relative;
    display: grid;
    min-height: 0;
}

.lightbox-stage img {
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
    margin: auto;
    object-fit: contain;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: var(--touch);
    height: var(--touch);
    border: 0;
    border-radius: 50%;
    background: rgb(0 0 0 / 0.45);
    color: #fff;
    cursor: pointer;
}

.lightbox-nav.prev {
    left: 8px;
}

.lightbox-nav.next {
    right: 8px;
}

.lightbox-nav:disabled {
    display: none;
}

.lightbox .caption {
    margin: 0 0 4px;
    font-size: 1.05rem;
}

/* ---------- Votes and results ---------- */

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

.vote-button {
    display: grid;
    justify-items: center;
    gap: 8px;
    min-height: 96px;
    padding: 14px 8px;
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    box-shadow: var(--shadow);
    cursor: pointer;
}

.vote-button.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.prompt-card {
    padding: 22px 18px;
    border-radius: var(--radius-lg);
    background: var(--ink-gradient);
    color: var(--on-ink);
    text-align: center;
    box-shadow: var(--shadow-strong);
}

.prompt-card .muted {
    color: var(--on-ink-muted);
}

.prompt-card h2 {
    margin: 8px 0 0;
    font-size: 1.45rem;
    line-height: 1.3;
}

.results {
    display: grid;
    gap: 12px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.results li {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 10px;
    align-items: center;
}

.results .result-name {
    font-weight: 600;
}

.results .result-count {
    font-weight: 800;
}

.results .result-bar {
    grid-column: 1 / -1;
    height: 10px;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
}

.results .result-bar > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--accent-gradient);
}

.results .result-voters {
    grid-column: 1 / -1;
    margin-top: -2px;
}

.results li.winner .result-name {
    color: var(--accent-strong);
    font-weight: 800;
}

.prompt-card .results .result-bar {
    background: rgb(255 255 255 / 0.12);
}

.prompt-card .results li.winner .result-name {
    color: var(--accent);
}

.poll {
    padding: 14px 0;
}

.poll + .poll {
    border-top: 1px solid var(--border);
}

.poll h3 {
    margin: 0;
    font-size: 1rem;
}

.poll-winner {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    color: var(--accent-strong);
    font-size: 1.15rem;
    font-weight: 800;
}

/* ---------- Members / profile ---------- */

.profile-head {
    display: grid;
    justify-items: center;
    gap: 6px;
    margin-top: -64px;
    margin-bottom: 18px;
    text-align: center;
}

.profile-head .avatar {
    border: 4px solid var(--bg);
}

.profile-head h2 {
    margin: 4px 0 0;
    font-size: 1.3rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 0.72rem;
    font-weight: 800;
}

/* ---------- Auth screens (login, waiting room) ---------- */

.auth {
    min-height: 100dvh;
    display: flex;
    padding: calc(env(safe-area-inset-top) + 28px) 24px calc(env(safe-area-inset-bottom) + 28px);
    background: var(--ink);
    color: var(--on-ink);
}

.auth-inner {
    flex: 1;
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 28px;
}

.auth-art {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 18px;
    text-align: center;
}

.auth-art img {
    width: 112px;
    height: 112px;
    border-radius: 30px;
    box-shadow: 0 24px 60px color-mix(in srgb, var(--accent) 35%, transparent);
}

.auth h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
}

.auth p {
    margin: 0;
    color: var(--on-ink-muted);
}

.auth-actions {
    display: grid;
    gap: 12px;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.auth-actions form {
    margin: 0;
}

.auth .alert {
    background: rgb(229 72 77 / 0.2);
    color: var(--on-ink);
}

/* ---------- Blazor error UI ---------- */

#blazor-error-ui {
    position: fixed;
    inset: auto 0 0;
    z-index: 1000;
    display: none;
    padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
    background: var(--danger);
    color: #fff;
}

#blazor-error-ui .reload {
    color: #fff;
    font-weight: 700;
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: 10px;
    right: 14px;
    cursor: pointer;
}

.blazor-error-boundary {
    padding: 1rem;
    border-radius: var(--radius-sm);
    background: var(--danger);
    color: white;
}

.blazor-error-boundary::after {
    content: "Ein Fehler ist aufgetreten.";
}

/* ---------- Larger screens ---------- */

@media (min-width: 640px) {
    .vote-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .photo-grid {
        grid-template-columns: repeat(4, 1fr);
        margin: 0;
        gap: 6px;
    }

    .game-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .feature-card {
        padding: 26px;
    }
}

@media (min-width: 900px) {
    :root {
        --gutter: 24px;
    }

    .app-main {
        padding-bottom: 0;
    }

    .tabbar {
        display: none;
    }

    .topbar {
        width: 100%;
        max-width: calc(var(--content-width) + 2 * var(--gutter));
        margin: 0 auto;
        padding-top: 16px;
    }

    .topnav {
        display: flex;
        gap: 4px;
        margin-left: 24px;
    }

    .topnav .tab {
        flex-direction: row;
        gap: 8px;
        max-width: none;
        min-height: 40px;
        padding: 0 14px;
        border-radius: 999px;
        color: var(--on-ink-muted);
        font-size: 0.9rem;
    }

    .topnav .tab.active {
        background: rgb(255 255 255 / 0.08);
        color: var(--on-ink);
    }

    .topnav .tab-badge {
        position: static;
    }

    .hero {
        padding-top: 24px;
        padding-bottom: 64px;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .sheet {
        width: calc(100% - 2 * var(--gutter));
        max-width: calc(var(--content-width) + 2 * var(--gutter));
        margin: -40px auto 40px;
        padding: 28px var(--gutter);
        border-radius: var(--radius-xl);
    }

    .game-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .photo-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .split {
        display: grid;
        grid-template-columns: 1.4fr 1fr;
        gap: 18px;
        align-items: start;
    }

    .section-nav {
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
    }

    .auth {
        align-items: center;
        justify-content: center;
    }

    .auth-inner {
        flex: none;
        grid-template-rows: auto auto;
        gap: 36px;
        width: 100%;
        max-width: 440px;
    }
}

.card .photo-grid {
    margin-top: 14px;
}

.live-card .row-sub {
    display: block;
    color: var(--on-ink-muted);
    font-size: 0.82rem;
}

.prompt-card {
    margin-bottom: 14px;
}

.list-row form {
    margin: 0;
}

.member-row {
    align-items: flex-start;
}

.member-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.member-actions .button {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 0.88rem;
}
