:root {
  --bg-dark: #0f1512;
  --bg-card: #1a2420;
  --bg-elevated: #222e2a;
  --bg-past: #171f1c;
  --bg-future: #1b2522;
  --bg-future-active: #243029;
  --green: #5ecf96;
  --green-light: #3db87a;
  --green-soft: #1e3d30;
  --red: #ef5f5f;
  --orange: #f0a060;
  --cream: #f2ead8;
  --gold: #d4af37;
  --accent: #d4af37;
  --accent-bg: #2e2818;
  --accent-focus: #3d3520;
  --text: #e8e2d4;
  --text-muted: #8fa89a;
  --text-faint: #5f7569;
  --text-inverse: #141c19;
  --border: rgba(212, 175, 55, 0.2);
  --shadow: rgba(0, 0, 0, 0.28);
  --shadow-md: rgba(0, 0, 0, 0.45);
  --shadow-green: rgba(61, 184, 122, 0.35);
  --shadow-orange: rgba(240, 160, 96, 0.35);
  --shadow-red: rgba(239, 95, 95, 0.35);
  --shadow-gold: rgba(212, 175, 55, 0.35);
  --modal-backdrop: rgba(5, 8, 7, 0.78);
  --contract-current-size: clamp(1.45rem, 8vw, 2.25rem);
  --contract-next-size: clamp(0.62rem, 2.2vw, 0.76rem);
  --game-frame-title-size: clamp(0.7rem, 2.9vw, 0.8rem);
  --game-player-stats-size: clamp(0.78rem, 3vw, 0.92rem);
  --app-max-width: 480px;
  --game-screen-pad-x: clamp(0.4rem, 2.5vw, 0.65rem);
  --game-nav-btn-min-height: clamp(2.35rem, 5.5vh, 2.85rem);
  --game-nav-icon-size: clamp(1.3rem, 3.8vw, 1.6rem);
  --game-nav-icon-font: clamp(0.75rem, 2.3vw, 0.92rem);
  --game-nav-label-size: clamp(0.6rem, 1.9vw, 0.72rem);
  --game-nav-pad-y: clamp(0.2rem, 1vh, 0.32rem);
  --game-nav-pad-x: var(--game-screen-pad-x);
  --game-nav-inner-gap: clamp(0.06rem, 0.5vh, 0.12rem);
  --game-nav-col-gap: clamp(0.28rem, 1.5vw, 0.45rem);
  --game-nav-height: calc(var(--game-nav-btn-min-height) + (2 * var(--game-nav-pad-y)) + 2px);
  --app-nav-height: calc(3.4rem + var(--safe-bottom));
  --radius: 10px;
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

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

body {
  font-family: var(--font-body);
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, #243830 0%, transparent 55%),
    radial-gradient(ellipse 80% 50% at 80% 100%, #1a2820 0%, transparent 50%),
    linear-gradient(180deg, #121a17 0%, #0f1512 100%);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  touch-action: manipulation;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

button, input {
  font: inherit;
}

#app {
  max-width: var(--app-max-width);
  margin: 0 auto;
  min-height: 100dvh;
}

#app:has(#screen-game:not([hidden])) {
  min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
  overflow: hidden;
}

.screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  padding: 1rem 1rem calc(1rem + var(--safe-bottom));
}

.screen[hidden] {
  display: none !important;
}

/* Header */
.app-header {
  text-align: center;
  padding: 2rem 0 1.5rem;
}

.app-header h1 {
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--accent);
  letter-spacing: 0.06em;
  line-height: 1;
  text-shadow: 0 2px 12px rgba(212, 175, 55, 0.25);
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.screen-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.input-row {
  display: flex;
  gap: 0.5rem;
}

input[type="text"] {
  flex: 1;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  min-height: 48px;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, #e4c255 0%, var(--gold) 100%);
  color: var(--text-inverse);
  border-color: #9a7b1e;
  box-shadow: 0 3px 14px var(--shadow-gold);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
  box-shadow: 0 1px 4px var(--shadow);
}

.btn-outline {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
  box-shadow: 0 1px 4px var(--shadow);
}

.btn-full {
  width: 100%;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--red);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}

/* Player list */
.player-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  overflow-y: auto;
}

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 500;
  color: var(--text);
  box-shadow: 0 2px 8px var(--shadow);
}

.player-item-me {
  border-color: rgba(212, 175, 55, 0.55);
  background: var(--accent-bg);
  color: var(--gold);
  font-weight: 600;
}

.player-item-me .player-item-club {
  color: rgba(212, 175, 55, 0.75);
}

.club-select,
.player-picker {
  flex: 1;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  min-height: 48px;
}

.player-picker optgroup {
  font-weight: 600;
  color: var(--text-muted);
}

.player-picker option {
  font-weight: 500;
  color: var(--text);
  padding: 0.25rem 0;
}

.player-picker option:disabled {
  color: var(--text-muted);
}

.player-item-club {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 0.1rem;
}

.player-item-me-tag {
  color: var(--gold);
  font-weight: 700;
  font-size: 0.85em;
}

.player-picker option[data-is-me="1"] {
  color: #d4af37;
  font-weight: 700;
}

/* Unfinished games dropdown */
.unfinished-games {
  margin-bottom: 1.1rem;
}

.unfinished-games[hidden] {
  display: none;
}

.unfinished-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3.4rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(212, 175, 55, 0.14), rgba(20, 20, 20, 0.55));
  color: var(--cream);
  text-align: left;
  cursor: pointer;
}

.unfinished-toggle-kicker {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.unfinished-toggle-label {
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.03em;
  font-weight: 700;
}

.unfinished-toggle-arrow {
  color: var(--gold);
  font-size: 1.25rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

.unfinished-toggle[aria-expanded="true"] .unfinished-toggle-arrow {
  transform: rotate(180deg);
}

.unfinished-list {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.unfinished-list[hidden] {
  display: none;
}

.unfinished-item {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}

.unfinished-item-mode {
  display: block;
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.03em;
  color: var(--cream);
  margin-bottom: 0.25rem;
}

.unfinished-item-players,
.unfinished-item-date {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.unfinished-item-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.unfinished-item-actions .btn {
  min-height: 2.5rem;
  font-size: 0.9rem;
}

.btn-danger-outline {
  border-color: rgba(220, 80, 80, 0.55);
  color: #f0a0a0;
  background: transparent;
}

.btn-danger-outline:hover,
.btn-danger-outline:focus-visible {
  border-color: rgba(220, 80, 80, 0.85);
  background: rgba(220, 80, 80, 0.12);
}

.mode-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.mode-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3.4rem;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--cream);
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.mode-row:not(:disabled):hover {
  background: var(--bg-elevated);
  border-color: rgba(212, 175, 55, 0.4);
}

.mode-row:not(:disabled):active {
  transform: scale(0.98);
}

.mode-row:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.mode-row-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.mode-row-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  line-height: 1;
}

.mode-row-soon {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.mode-row-arrow {
  color: var(--gold);
  font-size: 1.6rem;
  line-height: 1;
  font-weight: 400;
}

.mode-row:disabled .mode-row-arrow {
  color: var(--text-faint);
}

.setup-back-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
  min-height: 36px;
  padding: 0.35rem 0.85rem 0.35rem 0.55rem;
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.setup-back-arrow {
  color: var(--gold);
  font-size: 1.6rem;
  line-height: 1;
  font-weight: 400;
}

.setup-back-btn:hover {
  background: var(--accent-bg);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.25);
  text-decoration: none;
}

/* Game screen — 3 zones équitables au-dessus de la navigation */
#screen-game.screen {
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
  height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
  overflow: hidden;
  padding: 0.35rem var(--game-screen-pad-x) calc(var(--game-nav-height) + var(--safe-bottom));
  gap: 0.25rem;
  box-sizing: border-box;
}

.game-zone {
  min-height: 0;
  display: flex;
}

.game-zone-top,
.game-zone-bottom {
  flex-direction: column;
}

.game-zone-mid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.28rem;
  min-height: 0;
}

.game-zone-mid.no-next {
  grid-template-columns: 1fr;
}

.game-panel {
  flex: 1;
  min-height: 0;
  width: 100%;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: 0 2px 8px var(--shadow);
  overflow: hidden;
}

.player-info {
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  justify-items: center;
  text-align: center;
  background: var(--green-soft);
  border: 1.5px solid var(--green-light);
  padding: 0.3rem 0.45rem 0.28rem;
  box-shadow: 0 0 12px rgba(61, 184, 122, 0.1);
}

.player-info > .player-label {
  align-self: start;
  width: 100%;
  font-size: var(--game-frame-title-size);
  color: var(--green);
  letter-spacing: 0.07em;
  text-shadow: 0 1px 4px rgba(61, 184, 122, 0.25);
  white-space: nowrap;
}

.challenge-panel {
  display: grid;
  grid-template-rows: minmax(0, 3fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 0.28rem;
  padding: 0.25rem;
  overflow: hidden;
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.15);
}

.contract-frame {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
  border-radius: 8px;
  overflow: hidden;
  text-align: center;
}

.contract-frame-current {
  gap: 0.22rem;
  padding: 0.32rem 0.38rem 0.38rem;
  border: 2px solid var(--gold);
  background:
    radial-gradient(ellipse 95% 75% at 50% 0%, rgba(212, 175, 55, 0.16) 0%, transparent 68%),
    var(--accent-bg);
  box-shadow:
    0 0 16px rgba(212, 175, 55, 0.3),
    inset 0 0 24px rgba(212, 175, 55, 0.05);
}

.contract-frame-next {
  gap: 0.1rem;
  padding: 0.2rem 0.28rem 0.18rem;
  border: 1px solid rgba(212, 175, 55, 0.22);
  background: var(--bg-dark);
  box-shadow: inset 0 1px 0 rgba(212, 175, 55, 0.06);
}

.contract-frame-title {
  flex: 0 0 auto;
  width: 100%;
  font-size: var(--game-frame-title-size);
  color: var(--gold);
  letter-spacing: 0.08em;
  text-shadow: 0 1px 6px rgba(212, 175, 55, 0.35);
  white-space: nowrap;
}

.contract-frame-title.contract-frame-title-next {
  font-size: 0.58rem;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  text-shadow: none;
}

.challenge-track {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
}

.contract-frame-next .challenge-item {
  flex: 1;
  min-height: 0;
}

.challenge-next .challenge-label,
.contract-frame-next .challenge-label {
  font-size: var(--contract-next-size);
  white-space: normal;
  line-height: 1.08;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.contract-frame-next .challenge-item.contract-empty {
  cursor: default;
  opacity: 0.55;
  pointer-events: none;
}

.next-player {
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  justify-items: center;
  text-align: center;
  padding: 0.22rem 0.22rem 0.2rem;
}

.challenge-item {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.22rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.challenge-item:active {
  transform: scale(0.98);
}

.challenge-label {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
  text-align: center;
  line-height: 1.2;
}

.challenge-past {
  opacity: 0.55;
  background: var(--bg-past);
  padding: 0.2rem 0.4rem;
  border-color: rgba(212, 175, 55, 0.08);
}

.challenge-past:active {
  opacity: 0.7;
}

.challenge-past .challenge-label {
  color: var(--text-faint);
  font-size: 0.78rem;
}

.challenge-future {
  opacity: 0.7;
  background: var(--bg-future);
  padding: 0.2rem 0.4rem;
  border-color: rgba(212, 175, 55, 0.1);
}

.challenge-future:active {
  background: var(--bg-future-active);
}

.challenge-future .challenge-label {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.challenge-panel .challenge-item {
  border: none;
  background: transparent;
  padding: 0;
  width: 100%;
  height: 100%;
}

.challenge-panel .challenge-item.challenge-current {
  flex: 1;
  min-height: 0;
  height: auto;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.contract-frame-next .challenge-item:not(.contract-empty) {
  width: 100%;
  min-height: 0;
  height: auto;
  border: 1px solid rgba(212, 175, 55, 0.12);
  border-radius: 6px;
  background: var(--bg-future);
  padding: 0.1rem 0.22rem;
  opacity: 0.88;
}

.challenge-current {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

/* Texte principal — contrat en cours, joueur actif, joueur suivant */
.game-primary-text {
  font-family: var(--font-display);
  font-size: var(--contract-current-size);
  font-weight: 400;
  font-style: normal;
  color: var(--cream);
  letter-spacing: 0.05em;
  line-height: 1.06;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.challenge-current .game-primary-text {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
}

.player-info > .game-primary-text,
.next-player > .game-primary-text {
  display: block;
  align-self: center;
  width: 100%;
  margin-top: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-label {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.player-label.contract-frame-title:not(.contract-frame-title-next) {
  font-size: var(--game-frame-title-size);
  letter-spacing: 0.08em;
}

.next-player .player-label {
  display: block;
  width: 100%;
  text-align: center;
  font-size: var(--game-frame-title-size);
  letter-spacing: 0.05em;
  white-space: nowrap;
  align-self: start;
}

.player-info .player-stats,
.player-stats {
  display: flex;
  justify-content: center;
  align-self: end;
  width: 100%;
  gap: 0.6rem;
  margin-top: 0;
  font-size: var(--game-player-stats-size);
  color: var(--text-muted);
}

.player-stats strong {
  color: var(--green);
}

.next-player .player-stats {
  display: flex;
  justify-content: center;
  align-self: end;
  width: 100%;
  margin-top: 0;
  gap: 0.5rem;
  font-size: var(--game-player-stats-size);
}

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

.next-player .player-stats strong {
  color: var(--green);
}

/* Score entry */
.score-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.35rem;
}

.score-entry {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  margin-bottom: 0;
  width: 100%;
  max-width: 100%;
  justify-content: center;
}

.score-entry .label {
  font-size: var(--game-frame-title-size);
  text-align: center;
  margin-bottom: 0;
  letter-spacing: 0.05em;
}

.score-entry input[type="number"] {
  width: 100%;
  padding: 0.3rem 0.5rem;
  background: var(--bg-dark);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  color: var(--cream);
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 4.5vw, 1.35rem);
  text-align: center;
  min-height: 36px;
  -moz-appearance: textfield;
  box-shadow: 0 0 8px var(--shadow-gold);
}

.score-entry input[type="number"]::-webkit-outer-spin-button,
.score-entry input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.score-entry input[type="number"]:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 16px var(--shadow-gold);
}

.score-actions {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 0.35rem;
}

.btn-back {
  background: var(--orange);
  color: var(--text-inverse);
  border: none;
  box-shadow: 0 3px 10px var(--shadow-orange);
  font-size: 1.75rem;
  line-height: 1;
  font-weight: 700;
}

.btn-back:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.score-actions .btn {
  min-height: 44px;
  padding: 0.42rem 0.45rem;
  font-size: 0.88rem;
}

.score-actions .btn-failure {
  min-width: unset;
  min-height: 44px;
  font-size: 1.4rem;
}

.score-actions .btn-back {
  font-size: 1.4rem;
  line-height: 1;
}

.btn-failure {
  min-width: 52px;
  min-height: 44px;
  background: var(--red);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 3px 10px var(--shadow-red);
}

.btn-failure:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.cell-fail {
  color: var(--red);
  font-size: 1.1rem;
  font-weight: 700;
}

/* Game bottom navigation */
.game-bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--app-max-width);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.15rem;
  align-items: stretch;
  background: rgba(15, 21, 18, 0.94);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(10px);
  box-shadow: none;
  padding: 0.35rem 0.45rem calc(0.35rem + var(--safe-bottom));
  z-index: 200;
  box-sizing: border-box;
}

.game-bottom-nav[hidden] {
  display: none !important;
}

.game-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.3rem 0.2rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  min-height: 3rem;
  -webkit-tap-highlight-color: transparent;
  box-shadow: none;
}

.game-nav-btn:active {
  transform: scale(0.97);
  background: var(--accent-bg);
  color: var(--gold);
}

.game-nav-icon {
  display: block;
  width: 1.35rem;
  height: 1.35rem;
  border: none;
  border-radius: 0;
  background: none;
  color: inherit;
  flex-shrink: 0;
}

.game-nav-label {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1.1;
  white-space: nowrap;
}

.game-nav-btn-quit {
  color: #f08a8a;
}

.game-nav-btn-quit:hover,
.game-nav-btn-quit:active {
  background: rgba(239, 95, 95, 0.14);
  color: var(--red);
}

/* Écrans smartphone compacts */
@media (max-height: 700px) {
  :root {
    --contract-current-size: clamp(1.2rem, 7vw, 1.85rem);
    --contract-next-size: clamp(0.58rem, 2vw, 0.72rem);
    --game-frame-title-size: clamp(0.66rem, 2.7vw, 0.76rem);
    --game-player-stats-size: clamp(0.72rem, 2.7vw, 0.84rem);
    --game-nav-btn-min-height: clamp(2.1rem, 5vh, 2.5rem);
    --game-nav-icon-size: clamp(1.2rem, 3.5vw, 1.45rem);
    --game-nav-icon-font: clamp(0.7rem, 2.1vw, 0.85rem);
    --game-nav-label-size: clamp(0.58rem, 1.8vw, 0.68rem);
    --game-nav-pad-y: clamp(0.16rem, 0.8vh, 0.24rem);
  }

  #screen-game.screen {
    padding-top: 0.28rem;
    gap: 0.22rem;
  }

  .score-entry input[type="number"] {
    min-height: 32px;
  }

  .score-actions .btn {
    min-height: 40px;
    font-size: 0.84rem;
  }

  .score-actions .btn-back,
  .score-actions .btn-failure {
    font-size: 1.3rem;
  }

  .challenge-panel {
    gap: 0.22rem;
    padding: 0.22rem;
  }

  .contract-frame-current {
    padding: 0.24rem 0.28rem 0.28rem;
    gap: 0.16rem;
  }

  .contract-frame-next {
    padding: 0.16rem 0.22rem 0.14rem;
  }
}

@media (max-height: 600px) {
  :root {
    --contract-current-size: clamp(1.05rem, 6.5vw, 1.55rem);
    --contract-next-size: clamp(0.55rem, 1.9vw, 0.68rem);
    --game-frame-title-size: clamp(0.62rem, 2.5vw, 0.72rem);
    --game-player-stats-size: clamp(0.68rem, 2.5vw, 0.78rem);
    --game-screen-pad-x: clamp(0.35rem, 2.2vw, 0.5rem);
    --game-nav-btn-min-height: clamp(1.9rem, 4.5vh, 2.2rem);
    --game-nav-icon-size: clamp(1.1rem, 3.2vw, 1.3rem);
    --game-nav-icon-font: clamp(0.65rem, 2vw, 0.78rem);
    --game-nav-label-size: clamp(0.54rem, 1.7vw, 0.62rem);
    --game-nav-pad-y: clamp(0.14rem, 0.7vh, 0.2rem);
    --game-nav-col-gap: clamp(0.22rem, 1.2vw, 0.35rem);
  }

  #screen-game.screen {
    padding-top: 0.2rem;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    gap: 0.18rem;
  }

  .score-entry {
    gap: 0.15rem;
  }

  .score-entry input[type="number"] {
    min-height: 30px;
    font-size: 1rem;
  }

  .score-actions .btn {
    min-height: 36px;
    font-size: 0.8rem;
  }

  .score-actions .btn-back,
  .score-actions .btn-failure {
    font-size: 1.2rem;
  }

  .challenge-panel {
    gap: 0.18rem;
    padding: 0.18rem;
  }

  .contract-frame-title.contract-frame-title-next {
    font-size: 0.54rem;
  }

  .contract-frame-current {
    padding: 0.18rem 0.22rem 0.22rem;
    gap: 0.12rem;
    border-width: 1.5px;
  }

  .contract-frame-next {
    padding: 0.12rem 0.18rem 0.1rem;
    gap: 0.06rem;
  }
}

/* Scores modal */
.modal-scores .modal-content-scores {
  width: min(96vw, 520px);
  max-height: min(88dvh, 720px);
  display: flex;
  flex-direction: column;
  padding: 1rem 0.75rem 0.85rem;
}

.scores-modal-scroll {
  overflow: auto;
  margin: 0.5rem 0 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  -webkit-overflow-scrolling: touch;
}

.scores-table-sticky {
  --col-player-width: 5.5rem;
  --col-cumul-width: 3.25rem;
  --col-ech-width: 2.75rem;
}

.scores-table-sticky .col-sticky {
  position: sticky;
  z-index: 2;
  background: var(--bg-card);
  box-shadow: 2px 0 4px var(--shadow);
}

.scores-table-sticky th.col-sticky {
  background: var(--bg-elevated);
  z-index: 3;
}

.scores-table-sticky .col-player {
  left: 0;
  min-width: var(--col-player-width);
  max-width: var(--col-player-width);
}

.scores-table-sticky .col-cumul {
  left: var(--col-player-width);
  min-width: var(--col-cumul-width);
  max-width: var(--col-cumul-width);
}

.scores-table-sticky .col-ech {
  left: calc(var(--col-player-width) + var(--col-cumul-width));
  min-width: var(--col-ech-width);
  max-width: var(--col-ech-width);
}

.scores-table-sticky .col-focus {
  background: var(--accent-bg);
}

.scores-table-sticky th.col-focus {
  background: var(--accent-focus);
  color: var(--cream);
}

/* Scores table (modal) */
.scores-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.scores-table th,
.scores-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.scores-table th {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.scores-table .active-row td {
  color: var(--green);
  font-weight: 700;
}

.scores-table-wide {
  font-size: 0.75rem;
}

.scores-table-wide th,
.scores-table-wide td {
  padding: 0.4rem 0.35rem;
  text-align: center;
  white-space: nowrap;
}

.scores-table-wide td:first-child,
.scores-table-wide th:first-child {
  text-align: left;
}

.scores-table-sticky.scores-table-wide td:first-child,
.scores-table-sticky.scores-table-wide th:first-child {
  position: sticky;
  left: 0;
  background: var(--bg-card);
  z-index: 1;
}

.cell-ok {
  color: var(--green);
  font-weight: 600;
}

/* Results */
.results-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.result-card {
  display: flex;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.result-card.winner {
  border-color: var(--accent);
  background: var(--accent-bg);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.15);
}

.result-rank {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--accent);
  line-height: 1;
  min-width: 2rem;
}

.result-body h3 {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.result-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 1rem;
  font-size: 0.85rem;
}

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

.result-details dd {
  font-weight: 600;
  text-align: right;
}

.result-details .final-score {
  color: var(--green);
  font-size: 1.1rem;
  font-weight: 700;
}

.results-actions {
  gap: 0.75rem;
}

/* Editable scores */
.cell-editable {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.cell-editable:active {
  opacity: 0.7;
}

/* Edit modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--modal-backdrop);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.25rem 1rem calc(1.25rem + var(--safe-bottom));
  box-shadow: 0 -4px 24px var(--shadow-md);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.modal-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.35rem 0 1rem;
}

.rule-modal-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0.35rem 0 1rem;
}

#score-error-modal .modal-title,
#score-error-modal .rule-modal-text {
  text-align: center;
}

.modal-content input[type="number"] {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg-dark);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  color: var(--cream);
  font-family: var(--font-display);
  font-size: 2rem;
  text-align: center;
  min-height: 64px;
  margin-bottom: 0.75rem;
  -moz-appearance: textfield;
  box-shadow: 0 0 12px var(--shadow-gold);
}

.modal-content input[type="number"]::-webkit-outer-spin-button,
.modal-content input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn-modal-fail {
  min-height: 48px;
  font-size: 1rem;
}

/* ── Tablette (768px+) — téléphone inchangé ── */
@media (min-width: 768px) {
  #app {
    max-width: 680px;
  }

  :root {
    --app-max-width: 680px;
    --game-nav-btn-min-height: clamp(2.5rem, 4.5vh, 3rem);
    --game-nav-icon-size: clamp(1.45rem, 2.8vw, 1.75rem);
    --game-nav-icon-font: clamp(0.82rem, 1.8vw, 0.98rem);
    --game-nav-label-size: clamp(0.68rem, 1.4vw, 0.8rem);
    --game-nav-pad-y: clamp(0.24rem, 1.2vh, 0.38rem);
    --game-nav-pad-x: clamp(0.55rem, 2vw, 0.85rem);
    --game-screen-pad-x: clamp(0.55rem, 2vw, 0.85rem);
  }

  .screen {
    padding: 1.5rem 2rem calc(1.5rem + var(--safe-bottom));
  }

  .app-header h1 {
    font-size: 3.5rem;
  }

  .score-entry input[type="number"] {
    font-size: 2rem;
    min-height: 56px;
  }

  .scores-table-wide {
    font-size: 0.85rem;
  }

  .scores-table-wide th,
  .scores-table-wide td {
    padding: 0.5rem 0.5rem;
  }

  .results-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .modal {
    align-items: center;
  }

  .modal-content {
    border-radius: var(--radius);
    max-width: 440px;
    padding: 1.5rem;
  }

  .player-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-content: start;
  }

  .screen-body.results-actions {
    flex-direction: row;
  }

  .screen-body.results-actions .btn-full {
    flex: 1;
  }
}

/* ── Desktop (1024px+) ── */
@media (min-width: 1024px) {
  #app {
    max-width: 1040px;
  }

  :root {
    --app-max-width: 520px;
    --game-nav-btn-min-height: clamp(2.6rem, 4vh, 3.1rem);
    --game-nav-label-size: clamp(0.72rem, 1.2vw, 0.85rem);
    --game-nav-pad-x: clamp(0.65rem, 1.5vw, 1rem);
    --game-screen-pad-x: clamp(0.65rem, 1.5vw, 1rem);
  }

  .screen {
    padding: 2rem 2.5rem calc(2rem + var(--safe-bottom));
  }

  #screen-setup .screen-body,
  #screen-resume .screen-body {
    max-width: 520px;
    margin-inline: auto;
    width: 100%;
  }

  #screen-game {
    max-width: 520px;
    margin-inline: auto;
    width: 100%;
    padding: 1.5rem 2rem calc(var(--game-nav-height) + 1rem + var(--safe-bottom));
    min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
    max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
    height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
  }

  .results-list {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }

  .result-details {
    font-size: 0.95rem;
  }
}

/* ── Grand écran (1280px+) ── */
@media (min-width: 1280px) {
  #app {
    max-width: 1180px;
  }

  :root {
    --app-max-width: 560px;
  }

  #screen-game {
    max-width: 560px;
  }
}

/* Hover — souris uniquement, pas mobile tactile */
@media (hover: hover) and (min-width: 768px) {
  .btn:hover:not(:disabled) {
    filter: brightness(1.05);
  }

  .challenge-item:hover {
    border-color: var(--accent);
  }

  .challenge-panel .challenge-item.challenge-current:hover {
    background: transparent;
    box-shadow: none;
  }

  .challenge-current:hover .game-primary-text {
    color: var(--gold);
  }

  .cell-editable:hover {
    background: rgba(212, 175, 55, 0.12);
  }

  .game-nav-btn:hover {
    background: var(--accent-bg);
    color: var(--gold);
  }

  .player-item:hover {
    border-color: var(--accent);
  }
}

/* Records */
.home-links {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1rem;
}

.home-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.9rem;
}

.home-link:hover {
  text-decoration: underline;
}

.btn-auth-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0.35rem 0.85rem;
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-auth-outline:hover {
  background: var(--accent-bg);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.25);
}

.btn-auth-outline:active {
  transform: scale(0.97);
}

/* Auth modal */
.modal-content-auth {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  padding: 0.25rem;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.auth-tab {
  min-height: 40px;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.auth-tab.is-active {
  background: var(--accent-bg);
  border-color: var(--gold);
  color: var(--cream);
}

.auth-panel {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.auth-panel[hidden] {
  display: none !important;
}

.auth-panel input[type="email"],
.auth-panel input[type="password"],
.auth-panel input[type="text"] {
  width: 100%;
  flex: none;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  min-height: 48px;
  margin-bottom: 0.25rem;
}

.auth-panel .club-select {
  width: 100%;
  flex: none;
  margin-bottom: 0.25rem;
}

.auth-club-hint {
  margin: -0.1rem 0 0.35rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--gold);
}

.auth-club-hint-link {
  display: inline;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  color: var(--gold);
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.auth-club-hint-link:hover {
  color: #e4c255;
}

.auth-error {
  margin: 0;
  padding: 0.65rem 0.75rem;
  background: rgba(180, 60, 50, 0.18);
  border: 1px solid rgba(220, 90, 80, 0.45);
  border-radius: var(--radius);
  color: #f0b4ae;
  font-size: 0.85rem;
  line-height: 1.35;
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.15rem 0 0.25rem;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}

.auth-remember input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--gold);
  cursor: pointer;
}

.auth-user-bar {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.auth-user-bar[hidden] {
  display: none !important;
}

.auth-user-pseudo {
  color: var(--gold);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Home landing */
.home-landing-screen {
  gap: 1.25rem;
  padding: 1rem 1rem calc(1.5rem + var(--safe-bottom));
  overflow-y: auto;
  max-height: none;
  min-height: 100dvh;
}

.home-top {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.home-brand {
  text-align: center;
  padding-top: 0.75rem;
}

.home-brand h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 8vw, 2.75rem);
  color: var(--accent);
  letter-spacing: 0.05em;
  line-height: 1;
  text-shadow: 0 2px 12px rgba(212, 175, 55, 0.25);
}

.home-guest {
  display: flex;
  justify-content: stretch;
}

.home-guest[hidden] {
  display: none !important;
}

.home-guest-card {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(212, 175, 55, 0.18), transparent 42%),
    linear-gradient(180deg, #243029 0%, var(--bg-card) 100%);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 14px;
  box-shadow: 0 8px 24px var(--shadow);
  color: var(--cream);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.home-guest-card:hover {
  border-color: rgba(212, 175, 55, 0.65);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(212, 175, 55, 0.15);
}

.home-guest-card:active {
  transform: scale(0.985);
}

.home-guest-avatar {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  background: rgba(15, 21, 18, 0.45);
  color: var(--gold);
}

.home-guest-avatar svg {
  width: 1.35rem;
  height: 1.35rem;
}

.home-guest-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.home-guest-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  line-height: 1.1;
  color: var(--cream);
}

.home-guest-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.home-guest-cta {
  flex-shrink: 0;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: var(--gold);
  color: #141a16;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.home-profile {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(180deg, #243029 0%, var(--bg-card) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 24px var(--shadow);
}

.home-profile[hidden] {
  display: none !important;
}

.home-profile-avatar {
  position: relative;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-bg);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.home-profile-avatar-btn {
  padding: 0;
  cursor: pointer;
  overflow: visible;
}

.home-profile-avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.home-profile-avatar-edit {
  position: absolute;
  right: -0.2rem;
  bottom: -0.2rem;
  z-index: 1;
  width: 1.35rem;
  height: 1.35rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--gold);
  font-size: 0.7rem;
  line-height: 1;
}

.home-profile-pseudo {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--cream);
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.home-profile-meta {
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.home-profile-meta[hidden] {
  display: none !important;
}

.home-profile-actions {
  display: flex;
  gap: 0.35rem;
}

.home-news {
  position: relative;
  padding: 1rem 1.05rem 0.95rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(212, 175, 55, 0.22), transparent 45%),
    linear-gradient(135deg, #2a2818 0%, #1a2420 55%, #1e2a25 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 24px var(--shadow);
}

.home-news-badge {
  display: inline-flex;
  align-items: center;
  margin-bottom: 0.45rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.45);
  background: var(--accent-bg);
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.home-news-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.04em;
  color: var(--cream);
  line-height: 1.1;
}

.home-news-text {
  margin-top: 0.4rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.home-news-date {
  margin-top: 0.65rem;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 600;
}

.home-social {
  margin-top: 0.35rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    radial-gradient(circle at 15% 50%, rgba(212, 175, 55, 0.12), transparent 45%),
    linear-gradient(120deg, rgba(30, 38, 34, 0.95), rgba(20, 26, 23, 0.9));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
}

.home-social-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.home-social-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
}

.home-social-btn {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  background: rgba(15, 21, 18, 0.55);
  color: var(--gold);
}

.home-social-btn svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

.home-icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--gold);
  font-size: 1.05rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.home-icon-btn:hover {
  background: var(--accent-bg);
  border-color: var(--gold);
}

.home-icon-btn:active {
  transform: scale(0.96);
}

.home-icon-btn-logout {
  color: var(--red);
  border-color: rgba(239, 95, 95, 0.45);
  background: rgba(239, 95, 95, 0.12);
}

.home-icon-btn-logout:hover {
  background: rgba(239, 95, 95, 0.22);
  border-color: var(--red);
  color: #ff8f8f;
}

.home-logout-icon {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

.home-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 0.25rem;
}

.home-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.35rem;
  min-height: 10.5rem;
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--cream);
  box-shadow: 0 10px 28px var(--shadow);
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.home-tile-pictogram {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 2.1rem;
  height: 2.1rem;
  color: var(--gold);
  opacity: 0.9;
  pointer-events: none;
}

.home-tile:active {
  transform: scale(0.98);
}

.home-tile-solo {
  background:
    radial-gradient(circle at 85% 15%, rgba(212, 175, 55, 0.28), transparent 45%),
    linear-gradient(160deg, #2a382f 0%, #1a2420 70%);
}

.home-tile-multi {
  background:
    radial-gradient(circle at 85% 15%, rgba(94, 207, 150, 0.22), transparent 45%),
    linear-gradient(160deg, #243830 0%, #18241f 70%);
}

.home-tile-records {
  grid-column: 1 / -1;
  min-height: 7.5rem;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background:
    radial-gradient(circle at 90% 40%, rgba(240, 160, 96, 0.18), transparent 40%),
    linear-gradient(120deg, #2a2818 0%, #1a2420 55%, #1e2a25 100%);
}

.home-tile-content {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.35rem;
  min-width: 0;
}

.home-tile-icon {
  flex-shrink: 0;
  width: 3.4rem;
  height: 3.4rem;
  color: var(--gold);
  opacity: 0.92;
}

.home-tile-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.home-tile-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.03em;
  line-height: 1.05;
}

.home-tile-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.35;
}

@media (min-width: 768px) {
  .home-tile {
    min-height: 12rem;
  }

  .home-tile-title {
    font-size: 1.8rem;
  }
}

.profile-back {
  margin: 0.25rem 0 0;
}

.profile-form-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.25rem 0 1rem;
}

.profile-edit-form {
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.profile-photo-hint {
  margin: 0.15rem 0 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.auth-success {
  margin: 0;
  padding: 0.65rem 0.75rem;
  background: rgba(61, 184, 122, 0.15);
  border: 1px solid rgba(94, 207, 150, 0.4);
  border-radius: var(--radius);
  color: var(--green);
  font-size: 0.85rem;
  line-height: 1.35;
}

/* App bottom nav */
.has-app-nav .screen,
.has-app-nav .home-landing-screen {
  padding-bottom: calc(var(--app-nav-height) + 1rem);
}

.app-bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 200;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--app-max-width);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.1rem;
  padding: 0.35rem 0.35rem calc(0.35rem + var(--safe-bottom));
  background: rgba(15, 21, 18, 0.94);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.app-bottom-nav[hidden] {
  display: none !important;
}

.app-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 3rem;
  padding: 0.25rem 0.1rem;
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease, background 0.2s ease;
}

.app-nav-btn.is-active {
  color: var(--gold);
  background: var(--accent-bg);
}

.app-nav-btn:active {
  transform: scale(0.97);
}

.app-nav-icon {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

.app-nav-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-bottom: 0.5rem;
}

.settings-section-title {
  margin: 0.85rem 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

.settings-section-title:first-child {
  margin-top: 0.15rem;
}

.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 0.95rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: left;
  color: inherit;
  font: inherit;
}

.settings-item-soon {
  opacity: 0.72;
  cursor: not-allowed;
}

.settings-item-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.settings-item-label {
  color: var(--cream);
  font-size: 0.95rem;
  font-weight: 600;
}

.settings-item-value {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  text-align: right;
}

.settings-item-soon-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.settings-hint {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.rules-detail-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 0.5rem;
}

.rules-intro {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
}

.rules-intro p {
  margin: 0;
  color: var(--cream);
  line-height: 1.45;
  font-size: 0.95rem;
}

.rules-penalties {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.rules-penalties strong {
  color: var(--gold);
}

.rules-section-title {
  margin: 0.25rem 0 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  color: var(--cream);
}

.rules-contracts {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.rules-contract {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}

.rules-contract-head {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin-bottom: 0.3rem;
}

.rules-contract-index {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold);
}

.rules-contract-label {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.03em;
  color: var(--cream);
}

.rules-contract-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

#rules-detail .rules-back-btn {
  align-self: flex-start;
  flex-shrink: 0;
  margin: 0.35rem 0 0;
}

#rules-detail .rules-detail-header {
  padding-top: 0.75rem;
  padding-bottom: 1rem;
  flex-shrink: 0;
}

#rules-modes.screen,
#rules-detail.screen {
  min-height: 0;
}

#rules-modes .screen-body,
#rules-detail .screen-body {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 0.5rem;
}

.label-optional {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--text-muted);
  opacity: 0.85;
}

.auth-panel input[type="email"]:focus,
.auth-panel input[type="password"]:focus,
.auth-panel input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
}

.auth-panel .btn {
  margin-top: 0.35rem;
}

.modal-content-auth > .btn-secondary {
  margin-top: 0.15rem;
}

.records-screen {
  max-width: 480px;
  margin: 0 auto;
}

.records-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0;
}

.records-filters {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.records-filter-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.records-select {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  min-height: 48px;
}

.records-sort {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

.records-sort-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
}

.records-sort-btn.active {
  background: linear-gradient(180deg, #e4c255 0%, var(--gold) 100%);
  border-color: var(--gold);
  color: var(--text-inverse);
}

.records-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.records-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1rem;
}

.records-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.records-table th,
.records-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.records-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-elevated);
}

.records-rank {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 1.1rem;
}

.records-best {
  color: var(--accent);
  font-size: 1rem;
}

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

.records-footer {
  margin-top: auto;
  padding-top: 0.5rem;
}

.records-detail-btn {
  min-height: 36px;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

.records-game-meta {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.records-section-title {
  font-size: 1rem;
  margin: 0 0 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.records-club-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

.records-table-scroll {
  overflow-x: auto;
  margin-bottom: 1rem;
}

.records-table-wide th,
.records-table-wide td {
  text-align: center;
}

.records-table-wide td:first-child,
.records-table-wide th:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--bg-card);
}

@media (min-width: 768px) {
  .records-screen {
    max-width: 900px;
  }
}
