/* Sutom championship — feuille de style mobile (portrait d'abord). */

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

:root {
   --red: #df1438;
   --blue: #007bff;
   --blue-dark: #0056b3;
   --yellow: #f1aa00;
   --absent: #1976c9;
   --ink: #263238;
   --muted: #607d8b;
   --bg: #f3f5f7;
   --card: #ffffff;
   --line: #e0e5e8;
   --grey-btn: #aeb7bc;
   font-synthesis: none;
}

html, body {
   margin: 0;
   padding: 0;
   background: var(--bg);
   color: var(--ink);
   font-family: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
   -webkit-text-size-adjust: 100%;
}

body {
   min-height: 100dvh;
}

button { font-family: inherit; }
[hidden] { display: none !important; }

/* ================================================================== */
/* Porte d'accès                                                       */
/* ================================================================== */
.gate {
   display: flex;
   flex-direction: column;
   align-items: center;
   width: min(420px, 100vw);
   margin: 0 auto;
   padding: calc(env(safe-area-inset-top, 0px) + 34px) 24px 40px;
   text-align: center;
}

.gate-logo {
   width: 170px;
   height: auto;
   margin-bottom: 14px;
}

.gate-title {
   margin: 0 0 26px;
   font-size: 1.9rem;
   font-weight: 900;
   letter-spacing: .01em;
   line-height: 1.15;
}

.gate-title span {
   display: inline-grid;
   place-items: center;
   width: 1.15em;
   height: 1.15em;
   margin-right: .06em;
   border-radius: .16em;
   background: var(--red);
   color: #fff;
   transform: translateY(.12em);
}

.gate-form {
   display: flex;
   flex-direction: column;
   gap: 14px;
   width: 100%;
}

.gate-label {
   margin-bottom: -4px;
   color: var(--muted);
   font-size: .95rem;
   font-weight: 800;
   letter-spacing: .06em;
   text-transform: uppercase;
}

.gate-code {
   width: 100%;
   padding: 18px 16px;
   border: 3px solid var(--muted);
   border-radius: 16px;
   background: #fff;
   color: var(--ink);
   font-size: 2.1rem;
   font-weight: 900;
   letter-spacing: .5em;
   text-align: center;
}

.gate-code:focus {
   outline: none;
   border-color: var(--blue);
}

.gate-error {
   min-height: 1.3em;
   margin: 0;
   color: var(--red);
   font-size: 1rem;
   font-weight: 800;
}

.gate-install {
   width: 100%;
   min-height: 58px;
   padding: 12px 18px;
   border: 0;
   border-radius: 999px;
   background: var(--blue);
   color: #fff;
   font-size: 1.1rem;
   font-weight: 800;
   cursor: pointer;
}

.gate-install:disabled { opacity: .5; cursor: default; }

.gate-install-help {
   margin: -4px 0 0;
   color: var(--muted);
   font-size: .95rem;
   line-height: 1.4;
}

.gate-continue {
   width: 100%;
   min-height: 66px;
   border: 0;
   border-radius: 999px;
   background: var(--grey-btn);
   color: #eef1f2;
   font-size: 1.4rem;
   font-weight: 900;
   cursor: not-allowed;
   transition: background .15s ease, color .15s ease;
}

.gate-continue.is-ready {
   background: var(--red);
   color: #fff;
   cursor: pointer;
}

.gate-foot {
   margin: 28px 0 0;
   color: #90a4ae;
   font-size: .85rem;
}

/* ================================================================== */
/* Coquille du jeu                                                     */
/* ================================================================== */
.sutom {
   display: block;
   width: min(560px, 100vw);
   margin: 0 auto;
   padding: calc(env(safe-area-inset-top, 0px) + 12px) 12px calc(env(safe-area-inset-bottom, 0px) + 24px);
}

.sutom-header {
   display: flex;
   align-items: center;
   gap: 10px;
   margin-bottom: 10px;
}

.sutom-header-logo { flex: 0 0 auto; width: 40px; height: 40px; }

.sutom-header h1 {
   flex: 1;
   margin: 0;
   font-size: 1.9rem;
   font-weight: 900;
   letter-spacing: .12em;
   line-height: 1;
}

.sutom-header h1 span {
   display: inline-grid;
   place-items: center;
   width: 1.05em;
   height: 1.05em;
   margin-right: .06em;
   border-radius: .12em;
   background: var(--red);
   color: #fff;
}

.sutom-rules-open { flex: 0 0 auto; }

.sutom-active-player {
   display: flex;
   align-items: baseline;
   justify-content: center;
   gap: 8px;
   margin: 2px 0 12px;
   font-weight: 900;
}

.sutom-active-player span { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.sutom-active-player strong { color: var(--red); font-size: 1.5rem; }

.sutom-loading, .sutom-error {
   margin: 48px auto;
   text-align: center;
   font-size: 1.1rem;
}

.sutom-error {
   padding: 16px;
   border-radius: 14px;
   background: #ffebee;
   color: #b6102c;
   font-weight: 700;
}

/* ---- Boutons génériques ---- */
.sutom-primary, .sutom-validate {
   min-height: 56px;
   border: 0;
   border-radius: 999px;
   background: var(--blue);
   color: #fff;
   font-size: 1.15rem;
   font-weight: 900;
   cursor: pointer;
}

.sutom-primary { width: 100%; padding: 12px 20px; }
.sutom-validate { background: var(--red); }
.sutom-primary:disabled, .sutom-validate:disabled { opacity: .35; cursor: default; }

.sutom-secondary {
   min-height: 46px;
   padding: 9px 18px;
   border: 0;
   border-radius: 999px;
   background: var(--blue);
   color: #fff;
   font-size: 1rem;
   font-weight: 800;
   cursor: pointer;
}

.sutom-play-start { background: var(--red); font-size: 1.3rem; min-height: 62px; margin-top: 4px; }
.sutom-play-start:disabled { background: var(--grey-btn); color: #eef1f2; opacity: 1; cursor: default; }

/* ---- Lobby ---- */
.sutom-lobby {
   display: flex;
   flex-direction: column;
   gap: 14px;
}

.sutom-card {
   padding: 18px;
   border: 1px solid var(--line);
   border-radius: 20px;
   background: var(--card);
   box-shadow: 0 8px 22px rgba(38, 50, 56, .07);
}

.sutom-card h2 { margin: .15em 0 .45em; font-size: 1.4rem; line-height: 1.15; }
.sutom-card p { margin: .3em 0; color: var(--muted); font-size: 1rem; line-height: 1.4; }

.sutom-eyebrow {
   color: #b6102c;
   font-size: .82rem;
   font-weight: 900;
   letter-spacing: .09em;
   text-transform: uppercase;
}

.sutom-card-heading { display: flex; justify-content: space-between; gap: 14px; }

.sutom-six {
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   width: 74px;
   height: 74px;
   flex: 0 0 auto;
   border-radius: 50%;
   background: var(--ink);
   color: #fff;
   font-size: 2rem;
   font-weight: 900;
   line-height: .8;
}

.sutom-six small { margin-top: .35em; font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; }

.sutom-lobby-secondary-actions {
   display: grid;
   grid-template-columns: 1fr 1fr;
   gap: 10px;
   margin-top: 12px;
}

.sutom-history-start { width: 100%; min-height: 50px; font-size: .95rem; }
.sutom-history-start:disabled { background: var(--grey-btn); color: #eef1f2; cursor: default; }

/* ---- Carte identité ---- */
.sutom-identity-card .sutom-name-list {
   min-height: 62px;
   margin: 10px 0 4px;
}

.sutom-player-name { color: var(--red); font-weight: 900; }

.sutom-name-list {
   display: flex;
   flex-wrap: wrap;
   gap: 6px;
   align-content: flex-start;
}

.sutom-name-button {
   min-height: 44px;
   padding: 8px 16px;
   border: 0;
   border-radius: 999px;
   background: var(--blue);
   color: #fff;
   font-size: 1rem;
   font-weight: 800;
   cursor: pointer;
}

.sutom-name-button.is-selected {
   background: var(--red);
   box-shadow: inset 0 0 0 3px #ff9daf;
}

.sutom-identity-actions {
   display: flex;
   align-items: center;
   gap: 10px;
   margin-top: 12px;
}

.sutom-other-players {
   flex: 1;
   min-height: 48px;
   padding: 8px 18px;
   border: 0;
   border-radius: 999px;
   background: var(--blue);
   color: #fff;
   font-size: 1rem;
   font-weight: 900;
   cursor: pointer;
}

.sutom-player-round-button {
   width: 48px;
   height: 48px;
   flex: 0 0 auto;
   display: grid;
   place-items: center;
   border: 0;
   border-radius: 50%;
   background: var(--muted);
   color: #fff;
   font-size: 1.7rem;
   font-weight: 900;
   line-height: 1;
   cursor: pointer;
}

.sutom-create-player { background: var(--blue); margin-left: auto; }
.sutom-clear-player:disabled { opacity: .3; cursor: default; }

/* ---- Classements ---- */
.sutom-ranking-day-nav {
   display: grid;
   grid-template-columns: 48px 1fr 48px;
   align-items: center;
   gap: 8px;
   margin: 6px 0 12px;
}

.sutom-ranking-day-nav button {
   min-height: 44px;
   padding: 6px 10px;
   border: 0;
   border-radius: 999px;
   background: var(--blue);
   color: #fff;
   font-size: 1rem;
   font-weight: 900;
   cursor: pointer;
}

#sutomRankingPrevious, #sutomRankingNext { font-size: 1.6rem; line-height: 1; }
.sutom-ranking-day-nav button:disabled { background: #d6dde1; color: #9aa6ac; cursor: default; }

.sutom-ranking { width: 100%; border-collapse: collapse; }
.sutom-ranking th, .sutom-ranking td {
   padding: 9px 6px;
   border-bottom: 1px solid #edf0f2;
   text-align: left;
}
.sutom-ranking th { color: #78909c; font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; }
.sutom-ranking td { font-size: 1rem; }
.sutom-ranking td:first-child { width: 26px; color: #b6102c; font-weight: 900; }

.sutom-ranking-sort {
   padding: 0;
   border: 0;
   background: transparent;
   color: var(--blue);
   font: inherit;
   font-weight: 900;
   letter-spacing: inherit;
   text-transform: inherit;
   cursor: pointer;
}
.sutom-ranking-sort.is-active { text-decoration: underline; text-underline-offset: 3px; }

.sutom-ranking-empty {
   display: block;
   padding: 18px 6px;
   color: #90a4ae;
   text-align: center;
   font-size: 1rem;
}

/* ================================================================== */
/* Feuilles (overlays plein écran)                                     */
/* ================================================================== */
.sutom-sheet-backdrop {
   position: fixed;
   inset: 0;
   z-index: 900;
   background: rgba(38, 50, 56, .6);
}

.sutom-sheet {
   position: fixed;
   z-index: 1000;
   left: 50%;
   top: 50%;
   transform: translate(-50%, -50%);
   width: min(520px, calc(100vw - 20px));
   max-height: calc(100dvh - 40px);
   padding: 26px 20px 22px;
   overflow-y: auto;
   border: 1px solid var(--line);
   border-radius: 22px;
   background: var(--card);
   box-shadow: 0 0 0 100vmax rgba(38, 50, 56, .6), 0 20px 60px rgba(15, 23, 42, .5);
   text-align: center;
}

.sutom-sheet h2 { margin: .1em 0 .5em; font-size: 1.6rem; }
.sutom-sheet h3 { margin: 0 0 14px; font-size: 1.5rem; }
.sutom-sheet p { margin: .5em 0; color: #455a64; font-size: 1.02rem; line-height: 1.4; }

.sutom-sheet-close {
   position: absolute;
   top: 12px;
   right: 12px;
   width: 46px;
   height: 46px;
   border: 0;
   border-radius: 50%;
   background: var(--blue);
   color: #fff;
   font-size: 1.7rem;
   font-weight: 900;
   cursor: pointer;
}

.sutom-rule-red, .sutom-rule-yellow, .sutom-rule-blue {
   display: inline-block;
   padding: 3px 10px;
   border-radius: 999px;
   color: #fff;
   font-weight: 800;
}
.sutom-rule-red { background: var(--red); }
.sutom-rule-yellow { background: var(--yellow); }
.sutom-rule-blue { background: var(--absent); }

.sutom-points-table {
   width: 100%;
   margin-top: 12px;
   border-collapse: collapse;
   font-size: .92rem;
}
.sutom-points-table th, .sutom-points-table td {
   padding: 6px 4px;
   border-bottom: 1px solid #dfe5e8;
   text-align: center;
}
.sutom-points-table th { background: var(--ink); color: #fff; }
.sutom-points-table td:first-child { text-align: left; }
.sutom-points-table td:not(:first-child) { color: #b6102c; font-weight: 900; }

.sutom-good-luck { margin-top: 14px !important; color: #b6102c !important; font-weight: 900; font-size: 1.15rem !important; }

.sutom-all-player-list {
   display: flex;
   flex-wrap: wrap;
   gap: 10px;
   justify-content: center;
   max-height: 60dvh;
   overflow-y: auto;
}
.sutom-all-player-list .sutom-name-button { min-height: 52px; font-size: 1.05rem; }

.sutom-day-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.sutom-day {
   padding: 12px 18px;
   border: 0;
   border-radius: 999px;
   background: var(--blue);
   color: #fff;
   font-size: 1rem;
   font-weight: 800;
   cursor: pointer;
}

.sutom-day-pager {
   display: flex;
   align-items: center;
   justify-content: center;
   gap: 12px;
   margin-top: 12px;
}
.sutom-day-pager button {
   width: 64px;
   height: 56px;
   border: 0;
   border-radius: 999px;
   background: var(--blue);
   color: #fff;
   font-size: 2rem;
   font-weight: 900;
   cursor: pointer;
}
.sutom-day-pager button:disabled { opacity: .3; cursor: default; }
.sutom-day-pager span { color: var(--muted); font-size: .82rem; font-weight: 800; }

.sutom-choice-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.sutom-choice-actions button { min-height: 60px; }

.sutom-confirm-message { font-weight: 900; white-space: pre-line; }
.sutom-confirm-message.is-left-aligned { text-align: left; }
#sutomConfirmAccept, #sutomConfirmStart { background: var(--red); }

.sutom-random-warning {
   padding: 10px 14px;
   border-radius: 12px;
   background: #fff1f2;
   color: #b6102c !important;
   font-weight: 900;
}
.sutom-random-lengths {
   display: grid;
   grid-template-columns: repeat(3, 1fr);
   gap: 10px;
   margin: 14px 0;
}
.sutom-random-lengths button {
   min-height: 60px;
   border: 0;
   border-radius: 16px;
   background: var(--blue);
   color: #fff;
   font-size: 1.3rem;
   font-weight: 900;
   cursor: pointer;
}
.sutom-random-lengths button:last-child { font-size: .95rem; }
.sutom-random-cancel { width: 100%; background: #64748b; }

/* ---- Clavier de saisie du prénom ---- */
.sutom-new-name output {
   display: block;
   min-height: 1.4em;
   margin-bottom: 14px;
   padding: 12px 16px;
   border: 3px solid var(--muted);
   border-radius: 999px;
   background: #f8fafb;
   font-size: 1.6rem;
   font-weight: 900;
}
.sutom-name-error {
   min-height: 1.3em;
   margin: -6px 0 12px;
   color: #b6102c;
   font-size: 1rem;
   font-weight: 900;
}
.sutom-name-error:empty { visibility: hidden; }
.sutom-name-keyboard { display: grid; gap: 8px; margin-bottom: 16px; }
.sutom-name-key-row { display: flex; gap: 6px; justify-content: center; }
.sutom-name-keyboard button {
   flex: 1 1 0;
   min-width: 0;
   height: 52px;
   border: 0;
   border-radius: 10px;
   background: var(--blue);
   color: #fff;
   font-size: 1.2rem;
   font-weight: 900;
   cursor: pointer;
}
.sutom-name-keyboard .sutom-name-backspace { flex: 0 0 64px; background: var(--blue-dark); }
.sutom-new-name-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; }
.sutom-new-name-actions button { min-height: 58px; font-size: 1.05rem; }
#sutomSaveName { background: var(--red); }
#sutomSaveName:disabled { background: var(--grey-btn); color: #eef1f2; opacity: 1; cursor: default; }

/* ================================================================== */
/* Écran de jeu                                                        */
/* ================================================================== */
.sutom-game { display: flex; flex-direction: column; gap: 10px; }

.sutom-game-topline {
   display: grid;
   grid-template-columns: auto 1fr auto auto;
   align-items: center;
   gap: 6px;
}

.sutom-game-nav-button {
   display: inline-flex;
   align-items: center;
   justify-content: center;
   gap: 6px;
   height: 44px;
   padding: 0 12px;
   border: 0;
   border-radius: 999px;
   color: #fff;
   font-size: .92rem;
   font-weight: 800;
   line-height: 1;
   cursor: pointer;
}
.sutom-quit { background: var(--blue); padding-left: 8px; }
.sutom-quit-icon {
   display: grid;
   place-items: center;
   width: 1.7em;
   height: 1.7em;
   border-radius: 50%;
   background: #fff;
   color: var(--blue);
   font-size: .8em;
}
.sutom-abandon { background: var(--muted); }
.sutom-abandon:disabled { opacity: .4; cursor: default; }

.sutom-game-day {
   justify-self: center;
   padding: 6px 10px;
   border: 2px solid #90a4ae;
   border-radius: 10px;
   background: #fff;
   font-size: .82rem;
   font-weight: 700;
   text-align: center;
}

.sutom-play-area { display: flex; flex-direction: column; gap: 12px; }
.sutom-board-column { display: flex; flex-direction: column; align-items: center; }

.sutom-board {
   --length: 6;
   --cell-size: min(58px, calc((100vw - 22px - (var(--length) - 1) * 6px) / var(--length)));
   display: grid;
   gap: 6px;
   width: max-content;
   max-width: 100%;
   margin: 0 auto;
}
.sutom-row {
   display: grid;
   gap: 6px;
   grid-template-columns: repeat(var(--length), var(--cell-size));
}
.sutom-cell {
   display: grid;
   place-items: center;
   width: var(--cell-size);
   height: var(--cell-size);
   border: 3px solid #b7c2c8;
   border-radius: 5px;
   background: #fff;
   color: var(--ink);
   font-size: calc(var(--cell-size) * .58);
   font-weight: 900;
   text-transform: uppercase;
}
.sutom-cell.is-current { border-color: var(--muted); }
.sutom-cell.correct { border-color: var(--red); background: var(--red); color: #fff; }
.sutom-cell.present { border-color: var(--yellow); border-radius: 50%; background: var(--yellow); color: #fff; }
.sutom-cell.absent { border-color: var(--absent); background: var(--absent); color: #fff; }
.sutom-row.is-future .sutom-cell { border-color: #c8d0d4; background: #edf0f2; color: #a6afb4; }
.sutom-row.is-future .sutom-cell.correct { border-color: #b7c0c5; background: #cbd2d6; color: #899399; }

.sutom-message {
   display: flex;
   align-items: center;
   justify-content: center;
   min-height: 3.4rem;
   margin: 10px 0 2px;
   padding: 0 4px;
   color: #b6102c;
   font-size: 1rem;
   font-weight: 800;
   line-height: 1.2;
   text-align: center;
}
.sutom-message.is-dictionary-error,
.sutom-message.is-game-error { font-size: 1.25rem; }

.sutom-controls { display: flex; flex-direction: column; gap: 10px; }

.sutom-keyboard { display: grid; gap: 7px; }
.sutom-key-row { display: flex; gap: 5px; justify-content: center; }
.sutom-key {
   flex: 1 1 0;
   min-width: 0;
   height: 52px;
   border: 0;
   border-radius: 8px;
   background: var(--blue);
   color: #fff;
   font-size: 1.15rem;
   font-weight: 900;
   cursor: pointer;
}
.sutom-key.correct { background: var(--red); }
.sutom-key.present { background: var(--yellow); }
.sutom-key.absent { background: #e2e7ea; color: #9ba7ad; box-shadow: inset 0 0 0 2px #d3dade; }

.sutom-game-actions {
   display: grid;
   grid-template-columns: 84px 1fr;
   gap: 10px;
}
.sutom-backspace {
   min-height: 60px;
   border: 0;
   border-radius: 12px;
   background: var(--blue);
   color: #fff;
   font-size: 1.6rem;
   font-weight: 900;
   cursor: pointer;
}
.sutom-validate { min-height: 60px; border-radius: 12px; font-size: 1.4rem; }

/* ---- Overlays de fin de partie ---- */
.sutom-finish {
   position: fixed;
   z-index: 1100;
   left: 50%;
   top: 50%;
   transform: translate(-50%, -50%);
   width: min(460px, calc(100vw - 24px));
   max-height: calc(100dvh - 40px);
   overflow-y: auto;
   padding: 24px 20px;
   border: 1px solid var(--line);
   border-radius: 22px;
   background: #fff;
   box-shadow: 0 0 0 100vmax rgba(38, 50, 56, .62), 0 20px 60px rgba(38, 50, 56, .35);
   text-align: center;
}
.sutom-finish h2 { margin: 0 0 .3em; font-size: 1.7rem; }
.sutom-finish p { font-size: 1.05rem; color: #455a64; }
.sutom-finish-icon {
   display: grid;
   width: 60px;
   height: 60px;
   place-items: center;
   margin: 0 auto 10px;
   border-radius: 50%;
   background: #e8f7f5;
   color: #08736c;
   font-size: 2.1rem;
   font-weight: 900;
}
.sutom-revealed-word { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 6px auto 16px; }
.sutom-revealed-letter {
   display: grid;
   width: 44px;
   height: 50px;
   place-items: center;
   border: 3px solid var(--red);
   border-radius: 5px;
   background: var(--red);
   color: #fff;
   font-size: 1.7rem;
   font-weight: 900;
}
.sutom-saved { color: #08736c !important; font-weight: 900; white-space: pre-line; }
.sutom-finish .sutom-primary { margin-top: 14px; }

.sutom-version { margin: 18px 0 0; color: #b0bec5; font-size: .78rem; text-align: center; }

/* ================================================================== */
/* Écrans larges (appli installée sur PC / tablette)                   */
/* ================================================================== */
@media (min-width: 600px) {
   .sutom-board { --cell-size: min(64px, calc((520px - (var(--length) - 1) * 6px) / var(--length))); }
   .sutom-lobby { display: grid; grid-template-columns: 1fr 1fr; }
   .sutom-play-card, .sutom-identity-card { grid-column: 1 / -1; }
}
