:root {
    --bg: #15151a;
    --surface: #212129;
    --text: #e8e6e3;
    --muted: #9a98a0;
    --accent: #b3261e;
    --accent-hover: #d4342b;
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
}

main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
}

/* Navigation */

.navbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 16px;
    background: #0d0d10;
    position: sticky;
    top: 0;
    z-index: 10;
}

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

.button {
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font: inherit;
    font-size: 15px;
    border: none;
    cursor: pointer;
}

.button:hover {
    background: var(--accent-hover);
}

.nav-links .button,
.button-secondary {
    background: var(--surface);
}

.nav-links .button:hover,
.button-secondary:hover {
    background: #2e2e38;
}

/* Loadout */

.toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 8px 0 16px;
}

.toolbar .button {
    font-size: 18px;
    padding: 12px 28px;
}

.seed {
    color: var(--muted);
    font-family: ui-monospace, monospace;
}

.loadout {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.card {
    margin: 0;
    padding: 12px;
    background: var(--surface);
    border-radius: var(--radius);
    text-align: center;
}

.card figcaption {
    margin-top: 8px;
}

.portrait {
    flex: 0 1 240px;
}

.portrait img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
}

.portrait figcaption {
    font-size: 20px;
    font-weight: 600;
}

.perks,
.equipment-row {
    flex: 1 1 min(400px, 100%);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
    gap: 16px;
}

.icon {
    width: 128px;
    height: 128px;
    margin: 0 auto;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.win-condition {
    flex: 1 1 min(260px, 100%);
    text-align: left;
}

.win-condition h2 {
    margin: 0 0 8px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.difficulty {
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: 0;
    text-transform: none;
    color: #15151a;
}

.difficulty-easy {
    background: #7fc97f;
}

.difficulty-medium {
    background: #f0c75e;
}

.difficulty-hard {
    background: #e8735a;
}

.difficulty-fun {
    background: #b79cf2;
}

.win-condition-name {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 4px;
}

.hint {
    color: var(--muted);
    align-self: center;
}

.notice {
    max-width: 560px;
    margin: 48px auto;
    padding: 24px;
}

/* Smartphones */

@media (max-width: 480px) {
    .perks,
    .equipment-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .icon {
        width: 96px;
        height: 96px;
    }

    .portrait {
        flex-basis: 100%;
    }

    .portrait img {
        max-width: 240px;
    }
}

/* Sammlung */

.collection-status {
    margin: -8px 0 16px;
    color: var(--muted);
    font-size: 14px;
}

.collection-status a {
    margin-left: 8px;
}

.badge-new {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    background: #f0c75e;
    color: #15151a;
    font-size: 12px;
    font-weight: 600;
}

.intro {
    max-width: 720px;
    color: var(--muted);
}

.notice-saved {
    padding: 8px 12px;
    border-radius: var(--radius);
    background: #24442a;
}

.collection-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 24px 0 12px;
}

.collection-header h2 {
    margin: 0 8px 0 0;
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.collection-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    opacity: 0.45;
}

.collection-card:has(input:checked) {
    opacity: 1;
    outline: 2px solid var(--accent);
}

.collection-card input {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.collection-card img {
    width: 96px;
    height: 96px;
    object-fit: contain;
}

.collection-name {
    font-weight: 600;
}

.collection-chapter {
    color: var(--muted);
    font-size: 12px;
}

.collection-actions {
    position: sticky;
    bottom: 0;
    padding: 16px 0;
    background: var(--bg);
}

.collection-reset {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

/* Lobby */

h1 {
    margin: 8px 0 12px;
}

.notice-error {
    padding: 8px 12px;
    border-radius: var(--radius);
    background: #4a2020;
}

.lobby-entry {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.form-card {
    flex: 1 1 min(320px, 100%);
    text-align: left;
}

.form-card label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 12px 0;
    color: var(--muted);
}

.form-card input,
.invite input {
    padding: 8px 10px;
    border: 1px solid #3a3a46;
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}

.code-input {
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.lobby-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.lobby-code {
    font-family: ui-monospace, monospace;
    letter-spacing: 0.15em;
    color: var(--muted);
}

.invite {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 min(420px, 100%);
}

.invite label {
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
}

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

.lobby-round {
    color: var(--muted);
}

.lobby-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.lobby-layout {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 16px;
}

.lobby-order {
    flex: 0 1 280px;
    text-align: left;
}

.lobby-order h2,
.lobby-main h2 {
    margin: 0 0 12px;
    font-size: 18px;
}

.lobby-order ol {
    margin: 0;
    padding-left: 20px;
}

.lobby-order li {
    padding: 8px 0;
    border-bottom: 1px solid #2e2e38;
}

.lobby-order li.is-you .order-name {
    font-weight: 700;
}

.order-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.order-controls {
    display: inline-flex;
    gap: 4px;
    margin-top: 6px;
}

.icon-button {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: #2e2e38;
    color: var(--text);
    cursor: pointer;
}

.icon-button:hover {
    background: #3a3a46;
}

.tag,
.role {
    padding: 1px 8px;
    border-radius: 999px;
    background: #2e2e38;
    font-size: 12px;
    font-weight: 400;
}

.role-killer {
    background: var(--accent);
    color: #fff;
}

.role-survivor {
    background: #2f4f7a;
    color: #fff;
}

.lobby-main {
    flex: 1 1 min(560px, 100%);
    min-width: 0;
}

.lobby-main h2 + .hint {
    margin-top: 0;
}

.other-seats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.other-seat {
    flex: 1 1 100%;
    text-align: left;
}

/* Nur Charakter oder gar nichts sichtbar: kleine Karten nebeneinander statt ganzer Zeilen. */
.other-seat.is-small {
    flex: 0 1 180px;
}

.other-seat h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.lobby-main .perks,
.lobby-main .equipment-row {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

.lobby-main .icon {
    width: 96px;
    height: 96px;
}

.compact > .portrait {
    max-width: 140px;
}

.compact .loadout {
    gap: 8px;
    margin-bottom: 8px;
}

.compact .card {
    padding: 6px;
    background: #1a1a21;
}

.compact .portrait {
    flex: 0 1 120px;
}

.compact .portrait figcaption {
    font-size: 14px;
}

.compact .perks,
.compact .equipment-row {
    flex-basis: min(300px, 100%);
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 8px;
}

.compact .icon {
    width: 64px;
    height: 64px;
}

.compact figcaption {
    font-size: 12px;
}

/* Aufdecken, Punkte, persönliches Neu-Würfeln */

.notice-rerolls {
    padding: 8px 12px;
    border-radius: var(--radius);
    background: #3a3220;
}

.tag-reroll {
    background: #3a3220;
}

.reroll-me,
.result {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.reroll-me .hint,
.result .hint {
    margin: 0;
    font-size: 14px;
}

.reroll-me .hint {
    flex-basis: 100%;
}

.result-badge {
    padding: 2px 10px;
    border-radius: 999px;
    background: #2e2e38;
    font-size: 13px;
}

.result-yes {
    background: #2f6b3a;
}

.result-no {
    background: #5a2a2a;
}

.scoreboard-title {
    margin-top: 20px;
}

.scoreboard {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.scoreboard th,
.scoreboard td {
    padding: 4px 6px;
    text-align: left;
    border-bottom: 1px solid #2e2e38;
}

.scoreboard th {
    color: var(--muted);
    font-weight: 400;
}

.leave-form {
    margin-left: auto;
}
