/* Ligue de Mahjong — design « C » : nuit violette à vagues seigaiha, or et rose, tuiles ivoire. */
:root {
  --night: #160f3d;
  --night-2: #1b1349;
  --gold: #f2c14e;
  --gold-light: #ffe08a;
  --gold-shadow: #a8701a;
  --pink: #ff7eb6;
  --pink-deep: #c2185b;
  --rose-text: #ffc2dd;
  --text: #ffffff;
  --muted: #e4daff;
  --pos: #ffe08a;
  --neg: #ffb3c8;
  --up: #9cf0c4;
  --ivory: #fffdf4;
  --ivory-2: #efe6cf;
  --ink: #1b1349;
  --jade: #2e9e6a;
  --tile-done: #e8823a;
  --glass: rgba(255, 255, 255, 0.08);
  --glass-line: rgba(255, 255, 255, 0.16);
  --jp: "Zen Antique", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--night);
  color: var(--text);
  font-family: "M PLUS Rounded 1c", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

.seigaiha {
  min-height: 100vh;
  background-color: var(--night-2);
  background-image: radial-gradient(circle at 50% 100%, transparent 18px, rgba(255, 194, 221, 0.07) 19px,
    rgba(255, 194, 221, 0.07) 21px, transparent 22px, transparent 28px, rgba(255, 194, 221, 0.05) 29px,
    rgba(255, 194, 221, 0.05) 31px, transparent 32px);
  background-size: 64px 32px;
}

a { color: var(--rose-text); }
a:hover { color: #fff; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
h1, h2, h3 { margin: 0; }
.muted { color: var(--muted); }
.jp { font-family: var(--jp); color: var(--gold); font-size: 16px; letter-spacing: 0.15em; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* En-tête */
.site-header { background: linear-gradient(90deg, rgba(22, 15, 61, 0.95), rgba(60, 26, 98, 0.9)); border-bottom: 2px solid var(--gold); }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 14px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; }
.brand { display: flex; align-items: center; gap: 14px; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand-badge {
  flex: none; width: 52px; height: 52px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8fc0, var(--pink-deep)); border: 2px solid var(--gold);
  display: flex; align-items: center; justify-content: center; font-family: var(--jp); font-size: 28px;
  box-shadow: 0 0 18px rgba(255, 126, 182, 0.55);
}
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-weight: 800; font-size: 20px; letter-spacing: 0.02em; }
.brand-jp { font-family: var(--jp); font-size: 14px; color: var(--gold); letter-spacing: 0.2em; }
.main-nav { display: flex; flex-wrap: wrap; gap: 6px; flex-grow: 1; justify-content: center; }
.main-nav a, .chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 22px;
  color: #fff; font-weight: 700; font-size: 14px; text-decoration: none; border: 1px solid rgba(255, 255, 255, 0.25);
}
.main-nav a[aria-current="page"], .chip.active { background: var(--pink); color: #2a0b33; border-color: var(--pink); font-weight: 800; }
.chip.absent { background: var(--neg); color: #2a0b33; border-color: var(--neg); font-weight: 800; }

/* Boutons */
.btn-gold {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 22px;
  font: inherit; font-weight: 800; font-size: 14px; color: #2a1a00; text-decoration: none; cursor: pointer;
  background: linear-gradient(#ffe08a, #f2b33d); border: 2px solid #fff3c4; border-radius: 24px;
  box-shadow: 0 4px 0 var(--gold-shadow);
}
.btn-gold:hover { color: #2a1a00; filter: brightness(1.05); }
.btn-gold.large { min-height: 56px; font-size: 18px; border-radius: 28px; width: 100%; }
.btn-gold[disabled] { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px;
  font: inherit; font-weight: 700; font-size: 14px; color: #fff; text-decoration: none; cursor: pointer;
  background: transparent; border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 22px;
}
.btn-ghost:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.link-button { background: none; border: none; padding: 0; font: inherit; color: var(--rose-text); text-decoration: underline; cursor: pointer; }

/* Mise en page */
.page-main { max-width: 1200px; margin: 0 auto; padding: 28px 16px 40px; display: flex; flex-direction: column; gap: 28px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.section-head h2 { font-size: 24px; font-weight: 800; }
.panel { border-radius: 20px; background: var(--glass); border: 1px solid var(--glass-line); padding: 18px; }
.messages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.message { padding: 12px 16px; border-radius: 14px; background: rgba(242, 193, 78, 0.18); border: 1px solid var(--gold); font-weight: 700; }
.message.error { background: rgba(255, 179, 200, 0.15); border-color: var(--neg); }
.season-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }

/* Bandeau de saison */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 26px 28px;
  background: linear-gradient(120deg, #3b1c7a 0%, #6a2a8c 55%, #b83a7e 100%);
  border: 2px solid rgba(242, 193, 78, 0.7); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  display: flex; flex-wrap: wrap; align-items: center; gap: 24px;
}
.hero-kanji { position: absolute; right: -10px; top: -30px; font-family: var(--jp); font-size: 190px; line-height: 1; color: rgba(255, 255, 255, 0.07); pointer-events: none; }
.hero-text { position: relative; flex: 1 1 320px; display: flex; flex-direction: column; gap: 6px; }
.badge { align-self: flex-start; font-size: 12px; font-weight: 800; color: #2a0b33; background: var(--gold); border-radius: 12px; padding: 4px 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.badge.ended { background: #d6deea; }
.hero h1 { margin-top: 4px; font-size: 34px; font-weight: 800; line-height: 1.15; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); }
.hero-meta { font-size: 15px; color: #f3e8ff; }
.hero-meta strong { color: var(--gold-light); }
.winds { position: relative; display: flex; gap: 10px; }
.wind {
  width: 58px; height: 76px; border-radius: 8px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
.wind-k { font-family: var(--jp); font-size: 30px; line-height: 1.1; }
.wind-s { font-size: 10px; font-weight: 800; min-height: 14px; white-space: nowrap; }
.wind.done { background: linear-gradient(var(--ivory), var(--ivory-2)); border-bottom: 6px solid var(--jade); }
.wind.done .wind-k { color: var(--ink); }
.wind.done .wind-s { color: #2e7a55; }
.wind.now { background: linear-gradient(#fff0f7, #ffd1e6); border-bottom: 6px solid #ff4f9a; box-shadow: 0 0 0 3px var(--pink), 0 0 22px rgba(255, 126, 182, 0.8); }
.wind.now .wind-k { color: var(--pink-deep); }
.wind.now .wind-s { color: #9c1450; }
.wind.todo { background: rgba(255, 255, 255, 0.1); border: 1px dashed rgba(255, 255, 255, 0.35); box-shadow: none; }
.wind.todo .wind-k { color: rgba(255, 255, 255, 0.55); }

/* Podium */
.podium { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 18px; }

.podium-card {

  --metal: 221, 228, 238;
  --metal-opacity: 0.32;
  --accent: #d6deea; --glow: rgba(214, 222, 234, 0.25);
  flex: 1 1 260px; min-width: 0; border-radius: 20px; padding: 20px; text-align: center;
  background:
  linear-gradient(115deg, rgba(255, 255, 255, 0) 28%, rgba(255, 255, 255, 0.14) 40%, rgba(255, 255, 255, 0) 52%),
  linear-gradient(170deg, rgba(var(--metal), calc(var(--metal-opacity) + 0.1)) 0%, rgba(var(--metal), calc(var(--metal-opacity) - 0.14)) 100%);
  border: 2px solid var(--accent); box-shadow: 0 0 24px var(--glow);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.podium-card.p1 { --metal: 247, 207, 92; --accent: #f2c14e; --glow: rgba(242, 193, 78, 0.45); padding-top: 34px; }
.podium-card.p3 { --metal: 240, 174, 128; --accent: #e9a27a; --glow: rgba(233, 162, 122, 0.25); }

@media (min-width: 900px) {
  .podium-card.p1 { order: 2; }
  .podium-card.p2 { order: 1; }
  .podium-card.p3 { order: 3; }
}
.place-label { font-family: var(--jp); font-size: 18px; color: var(--ink); background: var(--accent); border-radius: 14px; padding: 3px 14px; }
.avatar {
  flex: none; display: block; width: 84px; height: 84px; border-radius: 50%; border: 3px solid #fff;
  object-fit: cover; background: var(--night-2);
}
.avatar.small { width: 44px; height: 44px; border-width: 2px; }
.podium-name { font-size: 19px; font-weight: 800; }
.big-pts { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.trend { font-size: 13px; font-weight: 800; }
.trend.up { color: var(--up); }
.trend.down { color: var(--neg); }
.trend.same { color: var(--muted); }
.pips { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
.pip { display: inline-block; width: 12px; height: 17px; border-radius: 3px; flex: none; }
.pip.done { background: var(--tile-done); border: 1px solid #ffd2a8; }
.pip.todo { background: var(--ivory); border-bottom: 3px solid var(--jade); box-shadow: 0 0 6px rgba(255, 253, 244, 0.6); }
.left { font-size: 13px; font-weight: 700; }

/* Classement (4e et suivants) */
.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rank-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px 18px;
  border-radius: 16px; background: var(--glass); border: 1px solid var(--glass-line);
}
.rank-num { flex: none; width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, 0.12); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; }
.rank-who { flex: 1 1 140px; min-width: 0; font-size: 16px; font-weight: 800; }
.rank-score { width: 96px; display: flex; flex-direction: column; align-items: flex-end; }
.rank-pts { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rank-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.rank-progress .pips { justify-content: flex-start; }
.rank-progress .left { white-space: nowrap; min-width: 82px; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; font-size: 13px; color: var(--muted); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend .spacer { flex-grow: 1; }
.next-table { font-weight: 800; display: inline-flex; align-items: center; min-height: 44px; }

/* Calendrier et historique */
.filters { display: flex; flex-direction: column; gap: 12px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.filter-label { min-width: 52px; font-size: 13px; font-weight: 800; color: var(--gold); text-transform: uppercase; letter-spacing: 0.06em; }
.help { font-size: 13px; color: var(--muted); margin: 0; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.game-card {
  border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)); border: 1px solid var(--glass-line);
}
.game-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
.game-title { font-size: 17px; font-weight: 800; }
.game-date { font-size: 13px; color: var(--muted); }
.table-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.table-tile {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 6px; border-radius: 8px;
  background: linear-gradient(var(--ivory), var(--ivory-2)); border-bottom: 4px solid var(--jade);
  color: var(--ink); font-weight: 800; text-align: center; min-width: 0; overflow-wrap: anywhere;
}
.table-tile .tw { font-family: var(--jp); color: var(--pink-deep); font-size: 16px; }
.table-tile.me { background: linear-gradient(#fff0f7, #ffd1e6); border-bottom-color: #ff4f9a; box-shadow: 0 0 0 2px var(--pink); }
.result-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 76px; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; }
.result-row.winner { background: rgba(242, 193, 78, 0.16); }
.result-row.me { box-shadow: inset 0 0 0 2px var(--pink); }
.place { width: 26px; height: 30px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; background: rgba(255, 255, 255, 0.12); }
.winner .place { background: var(--gold); color: var(--ink); }
.res-name { font-weight: 800; min-width: 0; overflow-wrap: anywhere; }
.res-score { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.res-pts { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.empty-note { text-align: center; color: var(--muted); }
.more { align-self: center; }

/* Formulaires */
.narrow { width: 100%; max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.back-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 800; text-decoration: none; }
.page-title { font-size: 30px; font-weight: 800; line-height: 1.2; }
.score-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 0; border-top: 1px solid var(--glass-line); }
.score-row:first-child { border-top: none; padding-top: 0; }
.score-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.score-who label { font-weight: 800; font-size: 18px; }
.wind-tile {
  flex: none; width: 40px; height: 52px; border-radius: 7px; background: linear-gradient(var(--ivory), var(--ivory-2));
  border-bottom: 5px solid var(--jade); color: var(--ink); display: flex; align-items: center; justify-content: center;
  font-family: var(--jp); font-size: 22px;
}
.score-input-wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
input[type="text"], input[type="number"], input[type="password"], textarea {
  width: 100%; min-height: 52px; padding: 0 14px; font: inherit; color: var(--ink); background: var(--ivory);
  border: 2px solid rgba(242, 193, 78, 0.6); border-radius: 12px;
}
textarea { padding: 10px 14px; }
input.score-input { width: 150px; font-weight: 800; font-size: 22px; text-align: right; font-variant-numeric: tabular-nums; }
input.times-input { width: 120px; font-weight: 800; font-size: 18px; }
.score-total { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; padding-top: 14px; margin-top: 4px; border-top: 2px solid var(--gold); font-weight: 800; }
#total-status { color: var(--muted); font-variant-numeric: tabular-nums; }
#total-status.ok { color: var(--up); }
#total-status.bad { color: var(--neg); }
.hint-box { margin: 0; padding: 16px; border: 1px dashed rgba(255, 255, 255, 0.35); border-radius: 16px; color: var(--muted); text-align: center; }
.rules-note { margin: 0; font-size: 13px; color: var(--muted); }
.errorlist { list-style: none; margin: 4px 0 0; padding: 0; color: var(--neg); font-weight: 700; font-size: 14px; }
.form-errors { padding: 10px 14px; border-radius: 12px; background: rgba(255, 179, 200, 0.15); border: 1px solid var(--neg); }
.form-errors .errorlist { margin: 0; }
.field-error { width: 100%; text-align: right; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row-actions form { margin: 0; }
.season-form { display: flex; flex-direction: column; gap: 22px; }
.field { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; border: none; min-width: 0; }
.field > label, .field > legend { font-weight: 800; padding: 0; }
.chip-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; display: inline-flex; }
.chip-check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip-check span { display: inline-flex; align-items: center; min-height: 48px; padding: 0 18px; border-radius: 24px; border: 1px solid rgba(255, 255, 255, 0.3); font-weight: 700; }
.chip-check input:checked + span { background: var(--pink); color: #2a0b33; border-color: var(--pink); font-weight: 800; }
.chip-check input:checked + span::before { content: "✓ "; white-space: pre; }
.chip-check input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
details.advanced { border-radius: 16px; padding: 12px 16px; background: var(--glass); border: 1px solid var(--glass-line); }
details.advanced summary { min-height: 32px; font-weight: 800; cursor: pointer; }
.advanced-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.advanced-grid .field { gap: 4px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat-value { font-size: 34px; font-weight: 800; line-height: 1.1; color: var(--gold-light); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 14px; color: var(--muted); }
.season-hint { margin: 12px 0 0; font-size: 13px; color: var(--muted); }

/* Règles */
.formula { margin: 0; padding: 14px 16px; border-radius: 14px; background: rgba(0, 0, 0, 0.2); font-weight: 800; font-size: 18px; }
.uma-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.uma-tile {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 10px;
  background: linear-gradient(var(--ivory), var(--ivory-2)); border-bottom: 5px solid var(--jade); color: var(--ink);
}
.uma-jp { font-family: var(--jp); font-size: 15px; color: var(--pink-deep); }
.uma-place { font-size: 13px; font-weight: 700; }
.uma-value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rule-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.panel h3 { font-size: 18px; font-weight: 800; margin-bottom: 10px; }

/* Pied de page */
.site-footer { max-width: 1200px; margin: 0 auto; padding: 0 16px 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; font-size: 14px; color: var(--muted); }
.site-footer a, .site-footer .link-button { display: inline-flex; align-items: center; min-height: 44px; }
.site-footer form { margin: 0; }

@media (max-width: 600px) {
  .hero { padding: 20px; }
  .hero h1 { font-size: 28px; }
  .winds { gap: 8px; }
  .wind { width: 54px; height: 66px; }
  .wind-k { font-size: 24px; }
  .wind-s { font-size: 8px; white-space: nowrap; }
  .podium { gap: 12px; }
  .podium-card, .podium-card.p1 { padding: 16px; gap: 8px; }
  .avatar { width: 68px; height: 68px; }
  .big-pts { font-size: 26px; }
  .rank-score { width: auto; }
  .advanced-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-value { font-size: 28px; }
}
