:root {
    color-scheme: light;
    --bg: #f7f4ef;
    --panel: #ffffff;
    --ink: #1f2933;
    --muted: #64707d;
    --line: #d9dee5;
    --accent: #236b5a;
    --accent-dark: #17483e;
    --gold: #bd8b13;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

body.dark-mode {
    --bg: #111827;
    --panel: #1f2937;
    --ink: #f9fafb;
    --muted: #b6c0cc;
    --line: #374151;
    --accent: #2f9c7f;
    --accent-dark: #79d0b8;
    --gold: #f3c454;
}

a {
    color: inherit;
    text-decoration: none;
}

.site-header {
    align-items: center;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    padding: 16px clamp(16px, 4vw, 48px);
    position: relative;
}

.brand {
    align-items: center;
    color: var(--accent-dark);
    display: inline-flex;
    font-size: 1.25rem;
    font-weight: 700;
    gap: 8px;
    line-height: 1;
}

.brand svg {
    display: block;
    fill: none;
    flex: 0 0 auto;
    height: 20px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    width: 20px;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.logout-form {
    display: inline-flex;
    margin: 0;
}

.logout-form button {
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.nav-toggle {
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
    display: none;
    flex-direction: column;
    gap: 4px;
    height: 38px;
    justify-content: center;
    padding: 0;
    width: 42px;
}

.nav-toggle span {
    background: var(--accent-dark);
    border-radius: 999px;
    display: block;
    height: 2px;
    width: 18px;
}

nav a {
    align-items: center;
    color: var(--muted);
    display: inline-flex;
    font-size: 0.95rem;
}

.nav-game-link {
    background: color-mix(in srgb, var(--accent) 9%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
    border-radius: 999px;
    color: var(--accent-dark);
    font-weight: 800;
    gap: 7px;
    padding: 7px 12px;
}

.nav-game-link svg {
    fill: none;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.8;
    width: 18px;
}

.nav-game-link:hover {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.nav-icon-link {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    display: inline-flex;
    height: 36px;
    justify-content: center;
    padding: 0;
    width: 36px;
}

.nav-icon-link svg {
    fill: none;
    height: 19px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    width: 19px;
}

.nav-icon-link:hover {
    color: var(--accent-dark);
}

.page {
    margin: 0 auto;
    max-width: 1120px;
    padding: 32px 16px 56px;
}

.birthday-banner {
    display: grid;
    gap: 12px;
    margin: -8px 0 24px;
}

.birthday-card {
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 14px;
    grid-template-columns: auto auto 1fr;
    overflow: hidden;
    padding: 12px 16px;
    position: relative;
}

.birthday-gif {
    align-items: center;
    background: color-mix(in srgb, var(--gold) 18%, transparent);
    border-radius: 50%;
    display: inline-flex;
    height: 48px;
    justify-content: center;
    position: relative;
    width: 48px;
}

.birthday-cake {
    animation: birthday-bounce 1.2s ease-in-out infinite;
    font-size: 1.6rem;
    line-height: 1;
}

.birthday-spark {
    animation: birthday-spark 1.4s ease-in-out infinite;
    background: var(--gold);
    border-radius: 50%;
    height: 6px;
    position: absolute;
    width: 6px;
}

.birthday-spark.one {
    right: 4px;
    top: 6px;
}

.birthday-spark.two {
    animation-delay: 0.2s;
    bottom: 7px;
    left: 6px;
}

.birthday-spark.three {
    animation-delay: 0.4s;
    right: 10px;
    bottom: 4px;
}

.birthday-avatar,
.birthday-avatar img {
    border-radius: 50%;
    height: 52px;
    width: 52px;
}

.birthday-avatar {
    align-items: center;
    background: var(--accent);
    color: white;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    overflow: hidden;
}

.birthday-avatar img {
    object-fit: cover;
}

.birthday-card strong {
    display: block;
    font-size: 1.1rem;
}

.birthday-name-cake {
    display: inline;
    font-size: 0.95em;
    white-space: nowrap;
}

@keyframes birthday-bounce {
    0%, 100% {
        transform: translateY(0) rotate(-4deg);
    }
    50% {
        transform: translateY(-4px) rotate(5deg);
    }
}

@keyframes birthday-spark {
    0%, 100% {
        opacity: 0.35;
        transform: scale(0.75);
    }
    50% {
        opacity: 1;
        transform: scale(1.25);
    }
}

.hero,
.page-title {
    align-items: center;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    margin-bottom: 24px;
}

.hero > div:first-child,
.page-title > div:first-child {
    min-width: 0;
}

.eyebrow {
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 700;
    margin: 0 0 6px;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.4rem);
}

.hero h1 {
    font-size: clamp(2rem, 4vw, 3.1rem);
}

h2 {
    font-size: 1.2rem;
    margin-bottom: 14px;
}

.primary-action,
button.primary-action,
.secondary-action,
.danger-action {
    background: var(--accent);
    border: 0;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    justify-content: center;
    padding: 11px 16px;
}

.primary-action:hover,
button.primary-action:hover {
    background: var(--accent-dark);
}

.secondary-action {
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--ink);
}

.danger-action {
    background: #b42318;
    color: white;
}

.danger-link {
    color: #b42318;
}

.disabled-link {
    color: var(--muted);
    cursor: not-allowed;
    font-size: 0.92rem;
    font-weight: 700;
}

.form-actions,
.row-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero .form-actions {
    flex: 0 0 auto;
    justify-content: flex-end;
}

.login-page {
    align-items: center;
    display: flex;
    min-height: 100vh;
    padding: 24px;
}

.login-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.12);
    display: grid;
    gap: 16px;
    margin: 0 auto;
    max-width: 420px;
    padding: 28px;
    width: 100%;
}

.login-panel h1 {
    font-size: 2rem;
    margin: 0;
}

.login-panel label {
    display: grid;
    gap: 7px;
}

.login-panel label span {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.login-error {
    background: rgba(180, 35, 24, 0.1);
    border: 1px solid rgba(180, 35, 24, 0.25);
    border-radius: 8px;
    color: #b42318;
    margin: 0;
    padding: 10px 12px;
}

.player-list-entry {
    align-items: center;
    display: flex;
    gap: 12px;
}

.player-avatar,
.player-photo-preview {
    align-items: center;
    background: color-mix(in srgb, var(--accent) 12%, var(--panel));
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--accent-dark);
    display: inline-flex;
    flex: 0 0 auto;
    font-weight: 900;
    justify-content: center;
    overflow: hidden;
}

.player-avatar {
    height: 44px;
    width: 44px;
}

.player-avatar img,
.player-photo-preview img {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.player-avatar > span {
    align-items: center;
    display: flex;
    height: 100%;
    justify-content: center;
    line-height: 1;
    width: 100%;
}

.metric-pill {
    align-items: baseline;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-flex;
    gap: 8px;
    padding: 8px 12px;
}

.metric-pill strong {
    color: var(--accent-dark);
    font-size: 1.2rem;
}

.metric-pill span {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.team-metric-players {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    min-height: 34px;
}

.mini-avatar,
.mini-avatar img {
    border-radius: 50%;
    height: 34px;
    width: 34px;
}

.mini-avatar {
    align-items: center;
    background: color-mix(in srgb, var(--accent) 14%, var(--panel));
    border: 1px solid var(--line);
    color: var(--accent-dark);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 0.85rem;
    font-weight: 900;
    justify-content: center;
    overflow: hidden;
}

.mini-avatar img {
    object-fit: cover;
}

.mini-avatar > span {
    align-items: center;
    display: flex;
    height: 100%;
    justify-content: center;
    line-height: 1;
    width: 100%;
}

.choice-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.choice-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    min-height: 150px;
    padding: 22px;
}

.choice-card span {
    color: var(--accent-dark);
    font-size: 1.6rem;
    font-weight: 800;
}

.choice-card strong {
    align-self: end;
    color: var(--muted);
}

.active-choice {
    border-color: var(--accent);
}

.disabled-choice {
    opacity: 0.55;
}

.metrics,
.content-grid {
    display: grid;
    gap: 16px;
}

.metrics {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 28px;
}

.metrics article,
.form-section,
aside,
.list,
.notes,
.messages {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.metrics article {
    padding: 18px;
}

.metrics span {
    color: var(--accent-dark);
    display: block;
    font-size: 2rem;
    font-weight: 800;
}

.metrics span.score-positive {
    color: var(--accent-dark);
}

.metrics span.score-negative {
    color: #b42318;
}

.metrics p {
    color: var(--muted);
    margin: 0;
}

.content-grid {
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    align-items: start;
}

.list {
    overflow: hidden;
}

.game-row {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 14px 16px;
}

.game-row-main {
    align-items: center;
    display: flex;
    flex: 1 1 auto;
    gap: 12px;
    min-width: 0;
}

.game-row-main > div {
    min-width: 0;
}

.game-row:last-child {
    border-bottom: 0;
}

.game-row.is-hidden,
.leaderboard li.is-hidden,
.list-more-button.is-hidden {
    display: none;
}

.game-row span,
.empty {
    color: var(--muted);
}

.game-row div span {
    display: block;
    font-size: 0.9rem;
}

.game-row .player-avatar > span {
    align-items: center;
    display: flex;
    font-size: 1rem;
    height: 100%;
    justify-content: center;
    line-height: 1;
    width: 100%;
}

.game-row .mini-avatar > span {
    align-items: center;
    display: flex;
    height: 100%;
    justify-content: center;
    line-height: 1;
    width: 100%;
}

.history-points {
    color: var(--ink);
    font-weight: 900;
}

.result-pill {
    border-radius: 999px;
    flex: 0 0 auto;
    font-size: 0.85rem;
    font-weight: 900;
    margin-left: auto;
    padding: 4px 10px;
}

.result-pill.is-success {
    background: rgba(35, 107, 90, 0.12);
    color: var(--accent-dark);
}

.result-pill.is-failure {
    background: rgba(180, 35, 24, 0.12);
    color: #b42318;
}

.result-pill.is-neutral {
    background: color-mix(in srgb, var(--muted) 14%, transparent);
    color: var(--muted);
}

aside {
    padding: 16px;
}

aside h3 {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 14px 0 8px;
}

.section-heading {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-heading h2 {
    margin-bottom: 0;
}

.filter-tabs {
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-flex;
    overflow: hidden;
}

.filter-tabs a {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 800;
    padding: 7px 11px;
}

.filter-tabs a.active {
    background: var(--accent);
    color: white;
}

.panel-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
}

.leaderboard {
    margin: 0;
    padding-left: 20px;
}

.leaderboard li {
    margin-bottom: 10px;
}

.leaderboard li span {
    display: inline-block;
    min-width: 120px;
}

.stacked-title {
    margin-top: 28px;
}

.list-more-button {
    background: transparent;
    border: 0;
    color: var(--accent-dark);
    cursor: pointer;
    display: block;
    font: inherit;
    font-weight: 800;
    padding: 14px 16px;
    text-align: left;
    width: 100%;
}

.ranking-more-button {
    background: transparent;
    border: 0;
    color: var(--accent-dark);
    cursor: pointer;
    display: block;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    margin: 4px 0 12px 20px;
    padding: 0;
    text-align: left;
}

.ranking-mode-picker {
    display: grid;
    gap: 6px;
    justify-items: start;
    margin-bottom: 16px;
}

.ranking-mode-picker select {
    min-width: 150px;
    width: auto;
}

.mode-ranking-panel {
    display: none;
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.mode-ranking-panel.active {
    display: block;
}

.mode-ranking-panel h3 {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 14px 0 8px;
}

.form-layout {
    display: grid;
    gap: 18px;
}

.form-layout.narrow {
    max-width: 520px;
}

.form-section {
    padding: 18px;
}

.form-section p,
.score-form-row p {
    display: grid;
    gap: 6px;
    margin: 0 0 14px;
}

.player-photo-field {
    display: grid;
    gap: 10px;
}

.player-photo-editor {
    align-items: center;
    display: grid;
    gap: 12px;
    justify-items: start;
}

.player-photo-editor p {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0;
}

.player-photo-preview {
    height: 148px;
    width: 148px;
}

.player-photo-preview span {
    font-size: 2.4rem;
}

.player-photo-preview img.is-hidden,
.player-photo-preview span.is-hidden {
    display: none;
}

.two-columns {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.split-section {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.split-section ul {
    display: grid;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.split-section label {
    align-items: center;
    display: flex;
    gap: 8px;
}

.team-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.team-box {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.team-box h3 {
    margin: 0 0 12px;
}

.team-box select,
.round-form select {
    max-width: 320px;
}

.belotte-play-grid {
    align-items: start;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    margin-bottom: 18px;
}

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

.last-trick-field {
    display: grid;
    gap: 8px;
}

.last-trick-field > span {
    color: var(--muted);
    font-weight: 800;
}

.last-trick-field ul {
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    list-style: none;
    margin: 0;
    padding: 6px;
}

.last-trick-field li {
    margin: 0;
}

.last-trick-field li label {
    align-items: center;
    background: var(--panel);
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    gap: 8px;
    justify-content: center;
    min-height: 42px;
    padding: 8px 10px;
    text-align: center;
}

.last-trick-field input[type="radio"] {
    width: auto;
}

.last-trick-field li:has(input:checked) label {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.round-form ul:not(.errorlist) {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.round-form ul:not(.errorlist) li {
    margin: 0;
}

.round-form ul:not(.errorlist) li label {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    cursor: pointer;
    display: inline-flex;
    gap: 7px;
    min-height: 36px;
    padding: 7px 12px;
}

.round-form input[type="radio"] {
    width: auto;
}

.errorlist {
    background: rgba(180, 35, 24, 0.12);
    border: 1px solid rgba(180, 35, 24, 0.35);
    border-radius: 8px;
    color: #b42318;
    display: grid;
    font-weight: 900;
    gap: 6px;
    list-style: none;
    margin: 8px 0 0;
    padding: 10px 12px;
}

.errorlist li {
    margin: 0;
}

.errorlist li::before {
    content: "!";
    display: inline-block;
    margin-right: 6px;
}

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

.round-list li {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.round-list li:last-child {
    border-bottom: 1px solid var(--line);
}

.round-card {
    display: grid;
    gap: 9px;
    padding: 12px;
}

.round-card-header {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.round-card-header > span {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
}

.round-edit-button,
.round-dialog-close {
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--accent-dark);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    height: 30px;
    justify-content: center;
    padding: 0;
    width: 30px;
}

.round-edit-button svg {
    fill: none;
    height: 16px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    width: 16px;
}

.round-dialog {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    max-height: calc(100dvh - 32px);
    max-width: min(680px, calc(100vw - 24px));
    overflow: auto;
    padding: 18px;
    width: 100%;
}

.round-dialog::backdrop {
    background: rgba(15, 23, 42, 0.48);
}

.dialog-header {
    align-items: center;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    margin-bottom: 14px;
}

.dialog-header h2 {
    margin-bottom: 0;
}

.round-dialog-close {
    font-weight: 900;
}

.round-score-line {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.round-score-line strong {
    color: var(--ink);
    font-size: 0.92rem;
    min-width: 0;
}

.round-score-line b {
    color: var(--accent-dark);
    font-size: 1.15rem;
}

.round-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 22px;
}

.round-badges em {
    background: color-mix(in srgb, var(--gold) 18%, transparent);
    border-radius: 999px;
    color: var(--gold);
    font-size: 0.76rem;
    font-style: normal;
    font-weight: 900;
    padding: 3px 8px;
}

.split-section input[type="checkbox"] {
    width: auto;
}

.padded {
    padding: 14px 16px;
}

.player-select-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.player-select-row {
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    min-height: 154px;
    padding: 12px;
    position: relative;
}

.poignee-control {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 32px;
}

.poignee-toggle {
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--accent-dark);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 900;
    height: 30px;
    justify-content: center;
    padding: 0;
    width: 30px;
}

.poignee-toggle.has-value {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.poignee-selected {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.poignee-select {
    display: none;
}

.poignee-menu {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    display: none;
    gap: 6px;
    grid-template-columns: 1fr;
    left: 12px;
    padding: 8px;
    position: absolute;
    right: 12px;
    top: 92px;
    z-index: 5;
}

.poignee-control.is-menu-open .poignee-menu {
    display: grid;
}

.poignee-menu button {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    min-width: 0;
    padding: 7px 9px;
    text-align: left;
    white-space: normal;
}

.player-select-row.is-hidden,
.switch-line.is-hidden,
.choice-chip.is-hidden,
.self-called-control.is-hidden {
    display: none;
}

.player-score {
    color: var(--accent-dark);
    font-weight: 800;
    min-height: 24px;
}

.player-score.is-negative {
    color: #b42318;
}

.player-score.is-positive {
    color: var(--accent-dark);
}

.switch-line {
    align-items: center;
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.switch-line input {
    height: 1px;
    opacity: 0;
    position: absolute;
    width: 1px;
}

.switch-track {
    background: var(--line);
    border-radius: 999px;
    display: inline-flex;
    height: 28px;
    padding: 3px;
    transition: background 0.2s ease;
    width: 52px;
}

.switch-track::before {
    background: var(--panel);
    border-radius: 50%;
    content: "";
    height: 22px;
    transition: transform 0.2s ease;
    width: 22px;
}

.switch-line input:checked + .switch-track {
    background: var(--accent);
}

.switch-line input:checked + .switch-track::before {
    transform: translateX(24px);
}

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

.choice-chip {
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    gap: 8px;
    padding: 9px 14px;
}

.choice-chip input {
    height: 1px;
    opacity: 0;
    position: absolute;
    width: 1px;
}

.choice-chip:has(input:checked) {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.tarot-extra-options {
    align-items: flex-start;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
    padding-top: 16px;
}

.self-called-control {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
}

.self-called-control input {
    height: 1px;
    opacity: 0;
    position: absolute;
    width: 1px;
}

.self-called-label {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.segmented-control {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(54px, 1fr));
    overflow: hidden;
    width: max-content;
}

.segmented-control button {
    background: transparent;
    border: 0;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    min-height: 36px;
    padding: 8px 14px;
}

.segmented-control button.is-active {
    background: var(--accent);
    color: white;
}

.segmented-control button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.tarot-petit-field {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
}

.tarot-petit-field span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 400;
    white-space: nowrap;
}

.tarot-petit-field select {
    font-size: 0.86rem;
    font-weight: 400;
    min-width: 150px;
    width: auto;
}

.score-preview {
    border-color: var(--accent);
}

.preview-main {
    font-size: 1.15rem;
    font-weight: 800;
}

.preview-details {
    color: var(--muted);
    margin-bottom: 0;
}

label {
    color: var(--muted);
    font-weight: 700;
}

input,
select,
textarea {
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    padding: 5px;
    width: 100%;
}

.score-form-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.score-form-row {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.score-table {
    background: var(--panel);
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
}

.score-table th,
.score-table td {
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
    text-align: left;
}

.score-table th {
    background: #edf4f1;
}

body.dark-mode .score-table th {
    background: #101827;
    color: var(--ink);
}

body.dark-mode .score-table td {
    color: var(--ink);
}

body.dark-mode .stats-table th {
    background: #0b1220;
    color: #f9fafb;
}

.tarot-summary {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    margin-bottom: 18px;
}

.tarot-summary article {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 16px;
}

.tarot-summary span {
    color: var(--muted);
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
}

.tarot-summary strong {
    display: block;
    font-size: 1.35rem;
    margin-top: 4px;
}

.score-positive {
    color: var(--accent-dark);
}

.score-negative {
    color: #b42318;
}

.stats-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.stats-tab {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    padding: 10px 14px;
}

.stats-tab.active {
    background: var(--accent);
    color: white;
}

.stats-panel {
    display: none;
}

.stats-panel.active {
    display: grid;
    gap: 18px;
}

.stats-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.stats-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.bar-list {
    display: grid;
    gap: 12px;
}

.bar-row.is-hidden {
    display: none;
}

.bar-row {
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(90px, 1fr) minmax(120px, 2fr) auto;
    align-items: center;
}

.bar-row span {
    color: var(--muted);
    font-weight: 700;
}

.bar-track {
    background: color-mix(in srgb, var(--line) 70%, transparent);
    border-radius: 999px;
    display: flex;
    height: 12px;
    overflow: hidden;
}

.bar-value {
    background: var(--accent);
    border-radius: inherit;
    display: block;
    height: 100%;
    transition: width 160ms ease;
}

.total-bar {
    background: var(--accent);
}

.negative-bar {
    background: #b42318;
}

.neutral-bar {
    background: #3867d6;
}

.gold-bar {
    background: var(--gold);
}

.table-wrap {
    overflow-x: auto;
}

.stats-table {
    min-width: 980px;
}

.stats-more-button {
    background: transparent;
    border: 0;
    color: var(--accent-dark);
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    margin-top: 12px;
    padding: 0;
    text-align: left;
}

.notes,
.messages {
    margin-bottom: 18px;
    padding: 14px 16px;
}

.message {
    margin: 0;
}

@media (max-width: 720px) {
    .site-header,
    .hero,
    .page-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .game-row {
        align-items: center;
        flex-direction: row;
    }

    .hero .form-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .metrics,
    .content-grid,
    .belotte-play-grid {
        grid-template-columns: 1fr;
    }

    .site-header {
        align-items: center;
        flex-direction: row;
        gap: 12px;
        padding: 12px 16px;
    }

    .brand {
        font-size: 1.05rem;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .site-header nav {
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 8px;
        box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
        display: none;
        flex-direction: column;
        gap: 8px;
        left: 16px;
        padding: 10px;
        position: absolute;
        right: 16px;
        top: calc(100% + 8px);
        z-index: 20;
    }

    .site-header nav.is-open {
        display: flex;
    }

    .nav-game-link,
    .nav-icon-link {
        border-radius: 6px;
        gap: 7px;
        height: auto;
        justify-content: flex-start;
        min-height: 40px;
        padding: 8px 12px;
        width: 100%;
    }

    .nav-icon-link {
        background: color-mix(in srgb, var(--accent) 9%, transparent);
        border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
        color: var(--accent-dark);
        font-weight: 800;
    }

    .nav-icon-link::after {
        content: "Parametres";
    }

    .nav-icon-link svg {
        height: 18px;
        width: 18px;
    }

    .choice-grid {
        gap: 8px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .choice-card {
        min-height: 74px;
        padding: 10px;
    }

    .choice-card span {
        font-size: clamp(0.95rem, 5vw, 1.12rem);
    }

    .choice-card strong {
        display: none;
    }

    .round-dialog {
        max-height: calc(100dvh - 18px);
        max-width: calc(100vw - 18px);
        padding: 14px;
    }

    .last-trick-field ul {
        grid-template-columns: 1fr;
    }

    .bar-row {
        grid-template-columns: 1fr;
    }

    .birthday-card {
        grid-template-columns: auto 1fr;
    }

    .birthday-gif {
        grid-row: span 2;
    }

    .tarot-extra-options,
    .tarot-petit-field {
        align-items: stretch;
        flex-direction: column;
    }

    .tarot-petit-field select {
        width: 100%;
    }

    .table-wrap {
        overflow: visible;
    }

    .stats-table {
        background: transparent;
        border: 0;
        min-width: 0;
    }

    .stats-table thead {
        display: none;
    }

    .stats-table tbody,
    .stats-table tr,
    .stats-table td {
        display: block;
        width: 100%;
    }

    .stats-table tr {
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 8px;
        margin-bottom: 12px;
        overflow: hidden;
    }

    .stats-table td {
        align-items: center;
        border-bottom: 1px solid var(--line);
        display: flex;
        justify-content: space-between;
        gap: 16px;
        text-align: right;
    }

    .stats-table td:last-child {
        border-bottom: 0;
    }

    .stats-table td::before {
        color: var(--muted);
        content: attr(data-label);
        font-weight: 800;
        text-align: left;
    }
}

@media (max-width: 380px) {
    .page {
        padding-left: 10px;
        padding-right: 10px;
    }

    .choice-grid {
        gap: 7px;
    }

    .choice-card {
        min-height: 62px;
        padding: 8px;
    }

    .choice-card span {
        font-size: 0.92rem;
    }
}
