/* ===== Salle de jeux ===== */
.stage-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.stage-bar h1 { font-size: clamp(1.4rem, 5vw, 2rem); margin: 0; }
.stage-bar .back { text-decoration: none; padding: 8px 16px; box-shadow: none; }
.tile .chip { margin-top: 12px; display: inline-block; }
.game-box { max-width: 560px; margin: 0 auto; display: grid; gap: 12px; }
.game-box.page, .game-box.mot { max-width: 620px; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.seg .tab { padding: 6px 14px; font-size: .92rem; }
.status { display: flex; justify-content: space-between; margin: 0; font-weight: 800; color: var(--ink-soft); }
.wd-msg { text-align: center; min-height: 1.6em; margin: 0; font-weight: 700; }

/* confettis */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 300; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 16px; border-radius: 80% 0 80% 0; animation: fall linear forwards; }

/* sudoku */
.sk-grid { display: grid; grid-template-columns: repeat(9, 1fr); border: 3px solid var(--ink); border-radius: 12px; overflow: hidden; background: var(--card); aspect-ratio: 1; touch-action: manipulation; }
.cell { font: inherit; font-weight: 800; font-size: clamp(1.1rem, 5.2vw, 1.7rem); color: var(--pink-deep); background: var(--card); border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; cursor: pointer; display: grid; place-items: center; min-width: 0; }
.cell.br { border-right: 2px solid var(--ink); } .cell.bb { border-bottom: 2px solid var(--ink); }
.cell:nth-child(9n) { border-right: 0; } .cell:nth-child(n+73) { border-bottom: 0; }
.cell.given { color: var(--ink); font-weight: 900; }
.cell.peer { background: color-mix(in srgb, var(--pink) 16%, var(--card)); }
.cell.same { background: color-mix(in srgb, var(--gold) 38%, var(--card)); }
.cell.sel { background: color-mix(in srgb, var(--pink) 55%, var(--card)); }
.cell.bad { color: #d6336c; background: color-mix(in srgb, #ff4d6d 24%, var(--card)); }
.nt { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; height: 100%; font-size: clamp(.5rem, 2.2vw, .72rem); font-weight: 700; color: var(--ink-soft); line-height: 1; }
.nt i { font-style: normal; display: grid; place-items: center; }
.sk-pad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; }
.sk-pad button { font: inherit; font-weight: 900; font-size: 1.3rem; padding: 8px 0 3px; border: 2px solid var(--line); background: var(--card); color: var(--ink); border-radius: 12px; cursor: pointer; display: grid; line-height: 1.1; }
.sk-pad button small { font-size: .62rem; color: var(--ink-soft); font-weight: 700; }
.sk-pad button.full { opacity: .35; }
.row-actions .btn.ghost.on, .btn.ghost[aria-pressed="true"] { background: var(--pink); color: #5a1d36; border-color: var(--pink); }
.game-box .row-actions { justify-content: center; margin-top: 4px; }
.game-box .row-actions .btn { padding: 9px 16px; box-shadow: none; }
.game-box .row-actions .btn:not(.ghost) { box-shadow: 0 5px 0 #b94d70; }

/* mot du jour */
.wd-grid { display: grid; gap: 6px; width: min(320px, 100%); margin: 0 auto; }
.wd-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.wd-cell { aspect-ratio: 1; display: grid; place-items: center; font-weight: 900; font-size: clamp(1.4rem, 7vw, 2rem); text-transform: uppercase; border: 2px solid var(--line); border-radius: 10px; background: var(--card); }
.wd-cell.filled { border-color: var(--ink-soft); animation: bump .12s; }
.wd-cell.s-g { background: #78b98a; border-color: #78b98a; color: #fff; animation: flip .5s both; }
.wd-cell.s-y { background: var(--gold); border-color: var(--gold); color: #4a3406; animation: flip .5s both; }
.wd-cell.s-x { background: var(--ink-soft); border-color: var(--ink-soft); color: #fff; animation: flip .5s both; }
@keyframes flip { from { transform: rotateX(90deg); } to { transform: rotateX(0); } }
@keyframes bump { 50% { transform: scale(1.1); } }
.wd-row.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.wd-kb { display: grid; gap: 6px; margin-top: 4px; }
.wd-kb div { display: flex; justify-content: center; gap: 4px; }
.wd-kb button { font: inherit; font-weight: 800; flex: 1 1 0; max-width: 42px; height: 50px; border: 0; border-radius: 9px; background: var(--bg-2); color: var(--ink); cursor: pointer; padding: 0; }
.wd-kb button.wide { flex: 1.6 1 0; max-width: 64px; }
.wd-kb .k-g { background: #78b98a; color: #fff; } .wd-kb .k-y { background: var(--gold); color: #4a3406; } .wd-kb .k-x { background: var(--ink-soft); color: #fff; opacity: .55; }

/* devine la page */
.pg-text p { margin: 0 0 .8em; }
.pg-title { margin-bottom: .6em; }
.pw { white-space: normal; }
.pw.hid { display: inline-block; width: calc(var(--n) * .6ch + .2ch); height: .9em; background: var(--ink); opacity: .82; border-radius: 4px; vertical-align: -.1em; margin: 0 .05em; }
.pw.hit { background: color-mix(in srgb, var(--gold) 55%, transparent); border-radius: 4px; padding: 0 2px; }
.pg-form { display: flex; gap: 8px; }
.pg-form input { flex: 1; min-width: 0; font-size: 1rem; }
.pg-hist { display: flex; flex-wrap: wrap; gap: 6px; }
.pg-result { font-family: var(--font-title); font-size: 1.2rem; margin: 10px 0; }
.pg-img { max-width: 100%; max-height: 260px; border-radius: 14px; display: block; margin: 8px 0; }

/* mots mêlés */
.mm-grid { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); max-width: 100%; box-sizing: border-box; gap: 2px; touch-action: none; user-select: none; -webkit-user-select: none; background: var(--card); padding: 8px; border-radius: 16px; border: 1px solid var(--line); }
.mm-c { aspect-ratio: 1; display: grid; place-items: center; font-weight: 900; font-size: clamp(.7rem, calc(42vw / var(--n)), 1.35rem); border-radius: 8px; color: var(--ink); min-width: 0; }
.mm-c.pick { background: var(--pink); color: #5a1d36; }
.mm-c.ok { background: color-mix(in srgb, var(--green) 55%, transparent); }
.mm-words { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.mm-words li { background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; font-weight: 800; font-size: .88rem; }
.mm-words li.found { text-decoration: line-through; opacity: .5; }
@media (max-width: 640px) { .sk-pad { grid-template-columns: repeat(5, 1fr); gap: 6px; } .sk-pad button { font-size: 1.25rem; min-height: 48px; } .wd-kb button { height: 48px; } }
.sk-pad button, .wd-kb button, .cell { -webkit-tap-highlight-color: transparent; }
.btn { min-height: 44px; }
/* duo */
.duo-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-weight: 800; }
.duo-pres { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); font-size: .9rem; }
.duo-pres::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ink-soft); }
.duo-pres.on::before { background: #5aa56e; }
.duo-code { font-family: var(--font-title); font-size: 2.4rem; letter-spacing: .25em; text-align: center; margin: 4px 0; }
.duo-form { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.duo-form input { font: inherit; font-weight: 800; text-transform: uppercase; letter-spacing: .2em; text-align: center; width: 9ch; min-height: 44px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); color: var(--ink); }
.duo-score { display: flex; justify-content: center; gap: 18px; font-weight: 900; font-size: 1.1rem; }
.duo-score b { color: var(--pink-deep); }
.tt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(320px, 100%); margin: 0 auto; }
.tt-c { aspect-ratio: 1; font: inherit; font-size: 2.6rem; font-weight: 900; border: 2px solid var(--line); background: var(--card); color: var(--ink); border-radius: 16px; cursor: pointer; }
.tt-c:disabled { cursor: default; }
.tt-c.win { background: color-mix(in srgb, var(--green) 55%, var(--card)); }
.c4-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; width: min(380px, 100%); margin: 0 auto; background: #4a6fa5; padding: 8px; border-radius: 16px; }
.c4-col { display: grid; gap: 4px; padding: 0; border: 0; background: transparent; cursor: pointer; min-height: 44px; }
.c4-col:disabled { cursor: default; }
.c4-d { aspect-ratio: 1; border-radius: 50%; background: var(--bg); }
.c4-d.a { background: #e0698f; } .c4-d.b { background: #f2c14e; } .c4-d.win { box-shadow: 0 0 0 3px #fff; }
.mm-c.mine { background: color-mix(in srgb, var(--pink) 60%, transparent); }
.mm-c.theirs { background: color-mix(in srgb, var(--gold) 60%, transparent); }
.mm-words li.mine { opacity: 1; text-decoration: none; background: color-mix(in srgb, var(--pink) 50%, var(--card)); }
.mm-words li.theirs { opacity: 1; text-decoration: none; background: color-mix(in srgb, var(--gold) 50%, var(--card)); }
.chip.mine { background: color-mix(in srgb, var(--pink) 50%, var(--card)); }
.chip.theirs { background: color-mix(in srgb, var(--gold) 50%, var(--card)); }
.wd-grid.small { width: min(170px, 100%); gap: 3px; margin: 8px 0 0; }
.wd-grid.small .wd-row { gap: 3px; } .wd-grid.small .wd-cell { border-radius: 5px; font-size: .8rem; border-width: 1px; }
.wd-row.mini { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
@media (prefers-reduced-motion: reduce) { .wd-cell, .wd-row.shake { animation: none !important; } }

/* mots fléchés */
.fl-def { margin: 0; min-height: 3.2em; padding: 8px 12px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); font-weight: 700; }
.fl-grid { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 2px; padding: 6px; border-radius: 14px; background: var(--fl-block); touch-action: manipulation; }
.fl-c { aspect-ratio: 1; display: grid; place-items: center; min-width: 0; padding: 0; border: 0; border-radius: 5px; font: inherit; font-weight: 900; font-size: clamp(1rem, 4.8vw, 1.4rem); color: var(--ink); background: var(--fl-cell); cursor: pointer; }
.fl-x { background: var(--fl-block); cursor: default; }
.fl-k { background: color-mix(in srgb, var(--pink) 35%, var(--card)); font-size: .8rem; line-height: 1; grid-template-rows: auto auto; align-content: center; gap: 1px; }
.fl-k i { font-style: normal; font-size: .85rem; color: var(--pink-deep); }
.fl-k.on { background: var(--pink); }
.fl-l.inw { background: color-mix(in srgb, var(--pink) 22%, var(--card)); }
.fl-l.sel { background: color-mix(in srgb, var(--pink) 60%, var(--card)); }
.fl-l.bad { color: #d6336c; background: color-mix(in srgb, #ff4d6d 24%, var(--card)); }
.fl-l.hinted { color: var(--ink-soft); }
.fl-l.mine { color: var(--pink-deep); } .fl-l.theirs { color: #b8860b; }
.fl-lists { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; font-size: .88rem; }
.fl-lists h3 { font-size: 1rem; margin: 0 0 4px; } .fl-lists ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.fl-lists li { padding: 4px 6px; border-radius: 8px; cursor: pointer; line-height: 1.3; } .fl-lists li.cur { background: var(--bg-2); } .fl-lists li.ok { opacity: .5; text-decoration: line-through; }
@media (max-width: 520px) { .fl-lists { grid-template-columns: 1fr; } }
.fl-grid { --fl-block: #4a2c3a; --fl-cell: #ffffff; }
:root[data-theme="dark"] .fl-grid { --fl-block: #1d1017; --fl-cell: #5a3547; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fl-grid { --fl-block: #1d1017; --fl-cell: #5a3547; } }
.fl-k { background: color-mix(in srgb, var(--pink) 45%, var(--fl-cell)); color: #3b1d2b; }
.fl-k i { color: #8a2f55; }

/* Carnet */
.cn-cal { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; justify-content: start; }
.cn-cal i { width: 18px; height: 18px; border-radius: 5px; background: var(--bg-2); border: 1px solid var(--line); }
.cn-cal i.blank { visibility: hidden; }
.cn-cal i.d1 { background: color-mix(in srgb, var(--pink) 55%, var(--card)); }
.cn-cal i.d2 { background: var(--pink); }
.cn-cal i.d3 { background: var(--pink-deep, #e0698f); }
.cn-bar { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.cn-bar span { width: 1.2em; font-weight: 800; }
.cn-bar b { display: block; background: var(--pink); color: #5a1d36; border-radius: 6px; padding: 2px 8px; min-width: 2em; }
.cn-link { display: inline-block; margin-top: 18px; }
#cn-games { grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px; }
#cn-games .tile { padding: 14px; } #cn-games .ico { font-size: 1.8rem; } #cn-games h3 { font-size: 1.05rem; } #cn-games p { font-size: .88rem; }

/* Quiz, Mémo, Plus ou moins */
.qz-q { font-size: 1.25rem; margin: .6em 0; }
.qz-choices { display: grid; gap: 10px; }
.qz-c { text-align: left; min-height: 48px; }
.qz-c.good { background: #cfe8cf; border-color: #7fb685; color: #20401f; }
.qz-c.bad { background: #f6cdd3; border-color: #e0698f; color: #5a1d36; }
.mo-grid { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 8px; margin: 12px 0; }
.mo-c { aspect-ratio: 1; font-size: 1.8rem; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; min-height: 44px; }
.mo-c.up { background: var(--card); } .mo-c.ok { background: color-mix(in srgb, var(--pink) 40%, var(--card)); }
.mo-c:disabled { opacity: 1; }
.pm input[type=number] { width: 100%; }

/* Finitions : tactile, champs lisibles sans zoom iPhone, transitions courtes, aide repliable */
button, .btn, .tab, a.tile { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
input, select, textarea { font-size: 16px; }
.btn, .tab, .mo-c, .qz-c, .cell, .tile { transition: background-color .18s, transform .18s, border-color .18s; }
.btn:active, .tab:active, .mo-c:active, .qz-c:active { transform: scale(.97); }
.how { margin: 0 0 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px 14px; }
.how summary { cursor: pointer; font-weight: 800; min-height: 40px; display: flex; align-items: center; }
.how ul { margin: 0 0 10px; padding-left: 1.2em; color: var(--ink-soft); }
.tile.done { border-color: var(--pink-deep); }
@media (prefers-reduced-motion: reduce) { .btn, .tab, .mo-c, .qz-c, .cell, .tile { transition: none; } .btn:active, .tab:active, .mo-c:active, .qz-c:active { transform: none; } }
.pm input[type=number], .pg-form input { border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; background: var(--card); color: var(--ink); min-height: 44px; font-family: inherit; }
