/* =====================================================================
   Hanamikoji — thème « rue des geishas », mobile first.
   ===================================================================== */

:root {
  color-scheme: dark;
  --ink: #0c0a08;
  --ink-2: #15110d;
  --ink-3: #1d1812;
  --paper: #f2e7d3;
  --paper-dim: #c9bca7;
  --muted: #948877;
  --gold: #d8b45f;
  --gold-2: #f0d48b;
  --gold-soft: rgba(216, 180, 95, 0.18);
  --green: #58b98b;
  --green-soft: rgba(88, 185, 139, 0.16);
  --red: #d0685f;
  --red-soft: rgba(208, 104, 95, 0.15);
  --blue: #74a9d8;
  --line: rgba(216, 180, 95, 0.24);
  --line-soft: rgba(255, 255, 255, 0.08);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --serif: Georgia, "Palatino Linotype", "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
}

body {
  color: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  background:
    radial-gradient(1200px 800px at 15% -10%, rgba(216, 180, 95, 0.12), transparent 60%),
    radial-gradient(900px 700px at 110% 20%, rgba(120, 40, 40, 0.18), transparent 62%),
    linear-gradient(160deg, #0d0b09 0%, #090807 70%, #0c0a08 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 74px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 74px);
  mask-image: radial-gradient(circle at 50% 30%, black, transparent 80%);
}

button,
input,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.86em;
  color: var(--gold-2);
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding:
    max(14px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.centered {
  justify-content: center;
  align-items: center;
}

.muted {
  color: var(--muted);
}

.hint {
  color: var(--muted);
  font-size: 0.84rem;
  margin: 0;
}

.eyebrow {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.68rem;
  font-weight: 700;
}

/* ------------------------------ Boutons ------------------------------ */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.055);
  color: var(--paper);
  border-radius: 999px;
  padding: 11px 18px;
  font-weight: 650;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  text-decoration: none;
}

.btn:hover:not(:disabled):not([aria-disabled="true"]) {
  transform: translateY(-1px);
  border-color: rgba(216, 180, 95, 0.6);
  background: rgba(255, 255, 255, 0.09);
}

.btn:active:not(:disabled) {
  transform: translateY(0) scale(0.99);
}

.btn:focus-visible,
.icon-btn:focus-visible,
.tab:focus-visible,
.action-btn:focus-visible,
.hand-card:focus-visible,
.choice-card:focus-visible {
  outline: 2px solid var(--gold-2);
  outline-offset: 2px;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: linear-gradient(135deg, var(--gold-2), #c99b3f);
  border-color: rgba(255, 237, 186, 0.7);
  color: #1a1308;
  box-shadow: 0 10px 30px rgba(216, 180, 95, 0.22);
}

.btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #ffe4a1, #d7a947);
  box-shadow: 0 14px 34px rgba(216, 180, 95, 0.32);
}

.btn.ghost {
  background: transparent;
  border-color: var(--line-soft);
  color: var(--paper-dim);
}

.btn.ghost:hover:not(:disabled) {
  color: var(--paper);
  border-color: var(--line);
}

.btn.danger {
  background: rgba(208, 104, 95, 0.16);
  border-color: rgba(208, 104, 95, 0.5);
  color: #ffd8d2;
}

.btn.small {
  padding: 7px 12px;
  font-size: 0.8rem;
}

.btn.large {
  min-height: 64px;
  padding: 13px 24px;
  border-radius: 18px;
  flex-direction: column;
  gap: 2px;
  font-size: 1.02rem;
}

.btn.large small {
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.62;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.btn.wide {
  width: 100%;
}

.icon-btn {
  appearance: none;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--paper-dim);
  font-size: 1.05rem;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: 0.16s ease;
}

.icon-btn:hover {
  color: var(--paper);
  border-color: var(--gold);
  background: var(--gold-soft);
}

.icon-btn.tiny {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  font-size: 0.9rem;
}

.link-btn {
  appearance: none;
  border: 0;
  background: none;
  color: var(--gold-2);
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: inherit;
}

.danger-text {
  color: var(--red);
}

/* ------------------------------ Statuts ------------------------------ */

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.status-chip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.status-chip.ok {
  color: var(--green);
  border-color: rgba(88, 185, 139, 0.35);
}

.status-chip.wait {
  color: var(--gold);
  border-color: rgba(216, 180, 95, 0.35);
}

.status-chip.bad {
  color: var(--red);
  border-color: rgba(208, 104, 95, 0.35);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.04);
  color: var(--paper-dim);
  font-size: 0.7rem;
  white-space: nowrap;
}

.presence {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-left: auto;
}

.presence.on {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.presence.off {
  background: var(--red);
}

/* ------------------------------ Menu ------------------------------ */

.menu-screen {
  position: relative;
  min-height: 100dvh;
  max-width: none;
  width: 100%;
  padding: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
}

.menu-art,
.menu-veil {
  position: absolute;
  inset: 0;
}

.menu-art {
  z-index: -2;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2vw;
  padding: 2vw;
  opacity: 0.55;
  filter: saturate(0.82) contrast(1.04);
}

.menu-art-img {
  width: 30vw;
  height: 78vh;
  max-width: 430px;
  border-radius: 50% 50% 18px 18px / 30% 30% 18px 18px;
  background-size: cover;
  background-position: center top;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
  transform: translateY(8%) rotate(-2deg);
  mask-image: linear-gradient(to bottom, black 50%, transparent 96%);
}

.menu-art-img.b {
  transform: translateY(-2%) scale(1.04);
  z-index: 2;
}

.menu-art-img.c {
  transform: translateY(10%) rotate(2.5deg);
}

.menu-veil {
  z-index: -1;
  background:
    radial-gradient(circle at 50% 45%, rgba(10, 8, 6, 0.18), rgba(10, 8, 6, 0.82) 58%, #090807 90%),
    linear-gradient(to top, #090807 6%, transparent 46%);
}

.menu-content {
  width: min(590px, calc(100% - 28px));
  margin: 8vh auto;
  padding: clamp(22px, 4vw, 38px);
  text-align: center;
  background: linear-gradient(160deg, rgba(23, 19, 15, 0.9), rgba(11, 9, 7, 0.88));
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
}

.game-title {
  font-family: var(--serif);
  font-size: clamp(2.8rem, 9vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  margin: 8px 0 12px;
  background: linear-gradient(180deg, #fff0bd 10%, var(--gold) 55%, #a97c2f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 18px rgba(216, 180, 95, 0.16));
}

.lead {
  color: var(--paper-dim);
  font-size: 0.96rem;
  max-width: 36ch;
  margin: 0 auto 22px;
}

.menu-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.menu-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.menu-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 0.72rem;
  color: var(--muted);
}

.resume-card {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(216, 180, 95, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}

.resume-card strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.05rem;
}

.resume-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ------------------------------ Barre haute ------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
}

.topbar-title {
  flex: 1;
  font-family: var(--serif);
  font-size: 1.25rem;
  letter-spacing: 0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ------------------------------ Panneaux / formulaires ------------------------------ */

.panel {
  background: linear-gradient(165deg, rgba(27, 22, 17, 0.9), rgba(15, 12, 9, 0.92));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: clamp(16px, 2.6vw, 24px);
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.panel.narrow {
  width: min(520px, 100%);
}

.panel-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  margin: 0 0 12px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  font-family: var(--serif);
}

.panel-head h2 {
  font-size: 1.5rem;
}

.panel-head h3 {
  font-size: 1.05rem;
}

.small-head {
  margin-top: 18px;
}

.inline-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.field-label {
  display: block;
  color: var(--paper-dim);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 14px 0 6px;
}

.input {
  width: 100%;
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.24);
  color: var(--paper);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.input:focus {
  border-color: rgba(216, 180, 95, 0.65);
  box-shadow: 0 0 0 3px rgba(216, 180, 95, 0.1);
}

.input::placeholder {
  color: #6f6558;
}

select.input {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%),
    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 13px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.code-input {
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 1.6rem;
  letter-spacing: 0.33em;
  text-transform: uppercase;
  padding-left: 0.33em;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0;
  color: var(--paper-dim);
  font-size: 0.86rem;
  cursor: pointer;
}

.check-row input {
  accent-color: var(--gold);
  margin-top: 3px;
  width: 16px;
  height: 16px;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  margin: 16px 0;
}

.tab {
  flex: 1;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.16s ease;
}

.tab.active {
  background: var(--gold-soft);
  color: var(--gold-2);
  box-shadow: inset 0 0 0 1px rgba(216, 180, 95, 0.3);
}

.tab-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tab-content .btn {
  margin-top: 6px;
}

.server-hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.76rem;
  margin: 0;
}

.server-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.72rem;
}

.server-box code {
  word-break: break-all;
}

/* ------------------------------ En ligne ------------------------------ */

.online-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 14px;
  align-items: start;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.room-item strong {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 1rem;
  letter-spacing: 0.08em;
  color: var(--gold-2);
}

.room-item span {
  color: var(--muted);
  font-size: 0.74rem;
}

.room-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.empty {
  padding: 18px 12px;
  border: 1px dashed var(--line-soft);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty.error {
  color: #f0b4ac;
  border-color: rgba(208, 104, 95, 0.35);
}

/* ------------------------------ Salon ------------------------------ */

.lobby-card {
  width: min(760px, 100%);
  margin: 2vh auto 0;
  text-align: center;
}

.room-code-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 10px 0 4px;
}

.room-code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: clamp(2.3rem, 9vw, 4.2rem);
  letter-spacing: 0.18em;
  color: var(--gold-2);
  text-shadow: 0 0 28px rgba(216, 180, 95, 0.22);
  padding-left: 0.18em;
}

.lobby-players {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin: 26px 0;
}

.lobby-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.16);
  text-align: left;
}

.lobby-player.you {
  border-color: rgba(88, 185, 139, 0.3);
}

.lobby-player strong {
  display: block;
}

.player-state {
  color: var(--muted);
  font-size: 0.72rem;
}

.versus {
  font-family: var(--serif);
  color: var(--gold);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
}

.avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 750;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  color: #20170a;
  background: linear-gradient(140deg, #f2d68c, #b98834);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 6px 18px rgba(0, 0, 0, 0.3);
}

.avatar.small {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  font-size: 0.62rem;
}

.avatar.small.you {
  background: linear-gradient(140deg, #8fe0b7, #3d8d68);
}

.lobby-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.waiting-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--paper-dim);
  font-size: 0.86rem;
  padding: 10px;
}

.lobby-rules {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.76rem;
}

.loading-panel {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* ------------------------------ Plateau ------------------------------ */

.game-shell {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  min-height: 100dvh;
  height: 100dvh;
  padding:
    max(6px, env(safe-area-inset-top))
    max(8px, env(safe-area-inset-right))
    max(6px, env(safe-area-inset-bottom))
    max(8px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

.game-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px;
  flex-shrink: 0;
}

.round-info {
  display: flex;
  flex-direction: column;
  min-width: 66px;
  line-height: 1.15;
}

.round-no {
  font-family: var(--serif);
  font-size: 0.94rem;
  color: var(--gold-2);
}

.round-info .muted {
  font-size: 0.66rem;
}

.scoreboard {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: center;
  min-width: 0;
}

.score-pill {
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.22);
  border-radius: 10px;
  padding: 4px 9px;
  min-width: 0;
  font-size: 0.72rem;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.score-pill.you {
  border-color: rgba(88, 185, 139, 0.3);
}

.score-pill.opponent {
  border-color: rgba(208, 104, 95, 0.3);
}

.score-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 18ch;
}

.score-pill b {
  color: var(--gold-2);
}

.timer {
  flex: 0 0 auto;
  min-width: 54px;
  text-align: center;
  padding: 6px 9px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.22);
  color: var(--paper-dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.8rem;
}

.timer.urgent {
  color: #ffb3a8;
  border-color: rgba(208, 104, 95, 0.55);
  animation: pulse-red 1s infinite;
}

@keyframes pulse-red {
  50% {
    box-shadow: 0 0 0 4px rgba(208, 104, 95, 0.12);
  }
}

.opponent-bar,
.player-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(15, 12, 9, 0.7);
  flex-shrink: 0;
}

.opponent-bar {
  border-color: rgba(208, 104, 95, 0.18);
}

.player-bar {
  border-color: rgba(88, 185, 139, 0.18);
}

.player-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.player-meta strong {
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-meta span {
  color: var(--muted);
  font-size: 0.64rem;
}

.used-actions {
  display: flex;
  gap: 3px;
  margin-left: auto;
}

.used-mark {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line-soft);
  opacity: 0.35;
}

.used-mark.used {
  opacity: 1;
  background: rgba(216, 180, 95, 0.08);
  border-color: rgba(216, 180, 95, 0.3);
}

.used-mark b {
  position: absolute;
  right: -2px;
  bottom: -4px;
  font-size: 0.48rem;
  color: var(--green);
}

.mini-badges {
  display: flex;
  gap: 5px;
  font-size: 0.7rem;
  color: var(--paper-dim);
  white-space: nowrap;
}

.offline-dot {
  color: var(--red);
  font-size: 0.55rem;
}

.board-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 2px 0;
  position: relative;
  isolation: isolate;
}

.board-wrap::before {
  content: "花";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--serif);
  font-size: clamp(8rem, 24vw, 20rem);
  line-height: 1;
  color: rgba(216, 180, 95, 0.035);
  pointer-events: none;
  user-select: none;
}

.table-stage {
  width: 100%;
  max-width: 1000px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(3px, 0.9vh, 10px);
  position: relative;
}

.table-caption,
.table-meta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
  font-size: 0.64rem;
  letter-spacing: 0.04em;
}

.table-caption {
  justify-content: space-between;
  padding: 0 3px;
}

.table-turn {
  color: var(--gold-2);
  font-family: var(--serif);
  font-size: 0.8rem;
  letter-spacing: 0.01em;
}

.table-objective {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.board {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(3px, 0.65vw, 9px);
  width: 100%;
  max-width: 1000px;
  margin: auto;
}

.geisha {
  min-width: 0;
  padding: 2px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.geisha.win-you {
  background: linear-gradient(to bottom, transparent, rgba(88, 185, 139, 0.1), transparent);
}

.geisha.win-opponent {
  background: linear-gradient(to bottom, transparent, rgba(208, 104, 95, 0.1), transparent);
}

.pile {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  align-content: flex-start;
  min-height: clamp(16px, 2.8vh, 28px);
  padding: 2px;
  border-radius: 6px;
}

.pile.opp {
  background: rgba(208, 104, 95, 0.05);
}

.pile.you {
  background: rgba(88, 185, 139, 0.05);
}

.card-mini {
  display: inline-block;
  width: clamp(10px, 1.7vw, 20px);
  aspect-ratio: 335 / 456;
  border-radius: 2px;
  background-size: cover;
  background-position: center top;
  border: 1px solid rgba(0, 0, 0, 0.55);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  flex: 0 0 auto;
  position: relative;
}

.card-mini.opp {
  border-color: rgba(208, 104, 95, 0.55);
}

.card-mini.you {
  border-color: rgba(88, 185, 139, 0.5);
}

.card-mini.secret {
  background: linear-gradient(145deg, #4b3a1d, #221a0c);
  border: 1px dashed var(--gold);
  color: var(--gold-2);
  display: grid;
  place-items: center;
  font-size: clamp(6px, 0.9vw, 10px);
  font-weight: 700;
}

.geisha-art {
  position: relative;
  width: 100%;
  aspect-ratio: 0.68;
  border-radius: 9px;
  border: 1px solid rgba(216, 180, 95, 0.34);
  background-size: cover;
  background-position: center top;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.geisha-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.46), transparent 40%);
  pointer-events: none;
}

.geisha.win-you .geisha-art {
  border: 2px solid var(--green);
  box-shadow: 0 0 16px rgba(88, 185, 139, 0.42);
}

.geisha.win-opponent .geisha-art {
  border: 2px solid var(--red);
  box-shadow: 0 0 16px rgba(208, 104, 95, 0.36);
}

.charm {
  position: absolute;
  top: 3px;
  left: 3px;
  z-index: 2;
  width: clamp(14px, 1.8vw, 20px);
  height: clamp(14px, 1.8vw, 20px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(8, 6, 4, 0.82);
  border: 1px solid var(--line);
  color: var(--gold-2);
  font-size: clamp(0.5rem, 0.8vw, 0.68rem);
  font-weight: 700;
  font-family: var(--serif);
}

.control-badge {
  position: absolute;
  z-index: 2;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 4px);
  padding: 1px 4px;
  border-radius: 999px;
  background: rgba(8, 6, 4, 0.84);
  border: 1px solid currentColor;
  color: var(--paper);
  font-size: clamp(0.42rem, 0.65vw, 0.58rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.geisha.win-you .control-badge {
  color: var(--green);
}

.geisha.win-opponent .control-badge {
  color: var(--red);
}

.counts {
  display: flex;
  justify-content: center;
  gap: 3px;
  font-size: clamp(0.5rem, 0.75vw, 0.66rem);
  color: var(--muted);
}

.counts .you {
  color: var(--green);
}

.counts .opp {
  color: var(--red);
}

.game-bottom {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-line {
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.82rem;
  color: var(--gold-2);
  padding: 0 6px;
}

.action-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.action-btn {
  appearance: none;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.035);
  color: var(--paper-dim);
  border-radius: 11px;
  padding: 7px 8px;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  position: relative;
  transition: 0.16s ease;
  text-align: left;
}

.action-btn:hover:not([aria-disabled="true"]):not(.used) {
  border-color: var(--line);
  background: rgba(216, 180, 95, 0.07);
  color: var(--paper);
}

.action-btn.active {
  border-color: var(--gold);
  background: rgba(216, 180, 95, 0.13);
  color: var(--paper);
  box-shadow: inset 0 0 0 1px rgba(216, 180, 95, 0.2), 0 0 18px rgba(216, 180, 95, 0.1);
}

.action-btn.used,
.action-btn[aria-disabled="true"] {
  opacity: 0.32;
  cursor: not-allowed;
}

.action-icon {
  font-size: 1rem;
  flex: 0 0 auto;
}

.action-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  font-size: 0.72rem;
  font-weight: 650;
  min-width: 0;
}

.action-text small {
  font-size: 0.56rem;
  font-weight: 500;
  color: var(--muted);
}

.action-check {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.55rem;
  color: var(--green);
}

.selection-hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.7rem;
  padding: 1px 0 3px;
}

.selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(216, 180, 95, 0.07);
}

.selection-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.72rem;
  color: var(--paper-dim);
  min-width: 0;
}

.selection-main strong {
  color: var(--gold-2);
  font-size: 0.8rem;
}

.action-guidance {
  margin: 0;
  color: var(--paper-dim);
  font-size: 0.7rem;
  line-height: 1.3;
  max-width: 76ch;
}

.selection-count {
  color: var(--gold-2);
  font-size: 0.68rem;
}

.selection-actions {
  display: flex;
  gap: 5px;
  flex: 0 0 auto;
}

.lot-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  color: var(--muted);
  font-size: 0.65rem;
}

.lot-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 4px;
}

.lot-dot.one {
  background: var(--green);
}

.lot-dot.two {
  background: var(--blue);
}

.hand-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 7px 2px 1px;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
  min-height: 0;
}

.hand-scroll::-webkit-scrollbar {
  height: 4px;
}

.hand-scroll::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

.hand-card {
  appearance: none;
  flex: 0 0 auto;
  width: clamp(48px, 10vw, 70px);
  aspect-ratio: 335 / 456;
  border-radius: 7px;
  border: 2px solid rgba(216, 180, 95, 0.22);
  background-color: #231a10;
  background-size: cover;
  background-position: center top;
  padding: 0;
  position: relative;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
  scroll-snap-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.hand-card:hover {
  transform: translateY(-3px);
  border-color: rgba(216, 180, 95, 0.6);
}

.hand-card.selected {
  transform: translateY(-8px);
  border-color: var(--gold-2);
  box-shadow: 0 0 0 1px var(--gold), 0 10px 22px rgba(216, 180, 95, 0.28);
}

.hand-card.dim {
  opacity: 0.48;
}

.hand-card.lot-one {
  border-color: var(--green);
}

.hand-card.lot-two {
  border-color: var(--blue);
}

.sel-order {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold-2);
  color: #1a1308;
  font-size: 0.66rem;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.hand-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 8px;
}

.game-panel {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(150deg, rgba(36, 28, 20, 0.86), rgba(14, 11, 8, 0.9));
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.game-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.game-panel-head > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.game-panel-head strong {
  font-family: var(--serif);
  font-size: 1.02rem;
  color: var(--paper);
}

.inline-scores {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--muted);
  font-size: 0.7rem;
  text-align: right;
}

.inline-scores .you {
  color: var(--green);
}

.panel-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.panel-actions .waiting-line {
  padding: 0;
}

.waiting-panel {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  color: var(--paper-dim);
  font-size: 0.8rem;
}

.choice-panel .choice-cards {
  margin: 2px 0 0;
  gap: 8px;
}

.choice-panel .choice-img {
  width: clamp(54px, 8vw, 82px);
}

.choice-panel .lots {
  margin: 2px 0 0;
}

.choice-panel .lot {
  padding: 8px;
}

.round-panel .changed-list {
  margin: 0;
  justify-content: flex-start;
}

.result-panel.victory {
  border-color: rgba(88, 185, 139, 0.48);
}

.result-panel.defeat {
  border-color: rgba(208, 104, 95, 0.45);
}

.result-panel.draw {
  border-color: rgba(116, 169, 216, 0.45);
}

.game-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.64rem;
  padding: 0 2px;
}

/* ------------------------------ Modales ------------------------------ */

#overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}

#overlay.open {
  pointer-events: auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  background: rgba(5, 4, 3, 0.74);
  backdrop-filter: blur(8px);
  animation: fade-in 0.18s ease both;
  overflow-y: auto;
}

.modal {
  width: min(540px, 100%);
  max-height: calc(100dvh - 34px);
  overflow-y: auto;
  background: linear-gradient(160deg, #211a13, #100d09 70%);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(18px, 3vw, 28px);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-align: center;
  animation: modal-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.modal.wide {
  width: min(760px, 100%);
}

.modal h2 {
  font-family: var(--serif);
  font-size: clamp(1.55rem, 4vw, 2.15rem);
  margin: 6px 0 8px;
  color: var(--paper);
}

.modal-text {
  color: var(--paper-dim);
  font-size: 0.88rem;
  margin: 0 auto 16px;
  max-width: 52ch;
}

.modal-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.choice-cards {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.choice-card {
  appearance: none;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.03);
  color: var(--paper);
  border-radius: 14px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: 0.16s ease;
}

.choice-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
  background: var(--gold-soft);
}

.choice-img {
  display: block;
  width: clamp(62px, 17vw, 92px);
  aspect-ratio: 335 / 456;
  border-radius: 8px;
  border: 2px solid rgba(216, 180, 95, 0.3);
  background-size: cover;
  background-position: center top;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.4);
}

.lots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}

.lot {
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.lot-title {
  font-family: var(--serif);
  color: var(--gold-2);
  font-size: 1.05rem;
}

.lot-cards {
  display: flex;
  gap: 6px;
}

.lot-value {
  color: var(--muted);
  font-size: 0.72rem;
}

.choice-timer {
  color: var(--muted);
  font-size: 0.76rem;
}

.choice-timer strong {
  color: var(--gold-2);
}

.modal-quit {
  display: block;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 0.74rem;
  text-decoration: none;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 2px;
}

.modal-quit:hover {
  color: var(--paper);
}

.score-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 14px 0;
  text-align: left;
}

.score-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.84rem;
}

.score-row.you {
  border-color: rgba(88, 185, 139, 0.25);
}

.score-row.opponent {
  border-color: rgba(208, 104, 95, 0.22);
}

.score-row strong {
  font-size: 0.78rem;
  color: var(--paper-dim);
  white-space: nowrap;
}

.score-row strong:last-child {
  color: var(--gold-2);
}

.changed-list {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.changed-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--paper-dim);
  font-size: 0.72rem;
}

.changed-chip i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent, var(--gold));
  box-shadow: 0 0 6px var(--accent, var(--gold));
}

.result-ornament {
  font-size: 2.8rem;
  line-height: 1;
  margin-bottom: 4px;
}

.game-over.victory {
  border-color: rgba(88, 185, 139, 0.5);
}

.game-over.defeat {
  border-color: rgba(208, 104, 95, 0.45);
}

.game-over.draw {
  border-color: rgba(116, 169, 216, 0.45);
}

.rules-panel {
  width: min(840px, 100%);
  margin: 0 auto;
}

.rules-text {
  text-align: left;
  color: var(--paper-dim);
  font-size: 0.9rem;
}

.rules-text h3 {
  font-family: var(--serif);
  color: var(--gold-2);
  font-size: 1.14rem;
  margin: 20px 0 6px;
}

.rules-text p {
  margin: 7px 0;
}

.rules-text ul {
  margin: 7px 0;
  padding-left: 20px;
}

.rules-text li {
  margin: 5px 0;
}

.rule-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
}

.rule-actions > div {
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.rule-actions span {
  font-size: 1.1rem;
}

.rule-actions strong {
  display: block;
  color: var(--paper);
  font-size: 0.84rem;
  margin: 3px 0;
}

.rule-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

/* ------------------------------ Profil / réglages ------------------------------ */

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
  gap: 14px;
  align-items: start;
}

.account-panel {
  min-width: 0;
}

.profile-help {
  color: var(--paper-dim);
}

.profile-help h3 {
  font-family: var(--serif);
  margin: 0 0 10px;
}

.profile-help .hint {
  margin-bottom: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.stat-card {
  padding: 12px 8px;
  text-align: center;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.stat-card strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.35rem;
  color: var(--gold-2);
}

.stat-card span {
  color: var(--muted);
  font-size: 0.68rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.history-item {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.history-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
}

.history-item summary::-webkit-details-marker {
  display: none;
}

.history-result {
  flex: 0 0 auto;
  min-width: 60px;
  text-align: center;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  border: 1px solid;
}

.history-result.win {
  color: var(--green);
  border-color: rgba(88, 185, 139, 0.35);
  background: var(--green-soft);
}

.history-result.loss {
  color: var(--red);
  border-color: rgba(208, 104, 95, 0.35);
  background: var(--red-soft);
}

.history-result.draw {
  color: var(--blue);
  border-color: rgba(116, 169, 216, 0.35);
  background: rgba(116, 169, 216, 0.1);
}

.history-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.history-main strong {
  font-size: 0.84rem;
}

.history-main small,
.history-score small {
  color: var(--muted);
  font-size: 0.68rem;
}

.history-score {
  text-align: right;
  display: flex;
  flex-direction: column;
}

.history-score strong {
  color: var(--gold-2);
  font-size: 0.84rem;
}

.history-detail {
  padding: 0 10px 10px;
  border-top: 1px solid var(--line-soft);
}

.ranking {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 9px 0;
  color: var(--paper-dim);
  font-size: 0.76rem;
}

.round-list {
  margin: 6px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.74rem;
}

.settings-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  align-items: start;
}

/* ------------------------------ Toast / spinner ------------------------------ */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  max-width: min(92vw, 520px);
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(22, 18, 13, 0.96);
  color: var(--paper);
  box-shadow: var(--shadow);
  font-size: 0.84rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 2000;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  border-color: rgba(208, 104, 95, 0.5);
  color: #ffd8d2;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

.spinner.small {
  width: 17px;
  height: 17px;
  border-width: 2px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
}

/* ------------------------------ Responsive ------------------------------ */

@media (min-width: 900px) {
  /* Sur PC, les cartes posées ne doivent plus être des timbres-poste face
     aux cartes de la main. */
  .card-mini {
    width: clamp(20px, 2.1vw, 28px);
  }

  .pile {
    min-height: clamp(24px, 3.2vh, 32px);
  }

  .hand-card {
    width: clamp(52px, 5vw, 64px);
  }

  .hand-scroll {
    justify-content: center;
  }

  .board {
    max-width: 1080px;
  }
}

@media (max-width: 860px) {
  .online-layout,
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .menu-art-img {
    width: 42vw;
    height: 64vh;
    opacity: 0.8;
  }

  .menu-art-img.c {
    display: none;
  }
}

@media (max-width: 620px) {
  .screen {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }

  .menu-content {
    margin: 4vh auto;
    padding: 22px 16px;
    border-radius: 22px;
  }

  .menu-actions {
    grid-template-columns: 1fr;
  }

  .menu-art {
    gap: 0;
  }

  .menu-art-img {
    width: 62vw;
    height: 58vh;
    opacity: 0.5;
  }

  .menu-art-img.b {
    display: none;
  }

  .menu-art-img.a {
    transform: translateY(6%);
  }

  .menu-foot {
    flex-direction: column;
    gap: 8px;
  }

  .scoreboard {
    order: 4;
    flex-basis: 100%;
  }

  /* Sur téléphone, les sept geishas passent sur deux rangées (4 + 3) pour
     rester lisibles sans réduire le plateau à des timbres-poste. */
  .table-stage {
    max-width: 430px;
  }

  .board {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px 6px;
    max-width: 430px;
  }

  .geisha {
    flex: 0 0 calc((100% - 18px) / 4);
  }

  /* Un peu plus large que haut pour que les deux rangées tiennent dans la
     zone de plateau sans rogner les compteurs sur les téléphones 16:9. */
  .geisha-art {
    aspect-ratio: 0.76;
  }

  .card-mini {
    width: clamp(13px, 3.4vw, 20px);
  }

  .table-caption {
    font-size: 0.6rem;
  }

  .table-turn {
    font-size: 0.74rem;
  }

  /* Le pied de plateau est déjà repris dans la barre inférieure. */
  .table-meta {
    display: none;
  }

  .board-wrap::before {
    font-size: 60vw;
  }

  /* Panneaux de choix/décompte compacts pour laisser le plateau visible. */
  .game-panel {
    padding: 7px 9px;
    gap: 5px;
  }

  .game-panel-head strong {
    font-size: 0.92rem;
  }

  .panel-help {
    display: none;
  }

  .choice-panel .choice-img {
    width: 56px;
  }

  .choice-panel .choice-card {
    padding: 5px;
    font-size: 0.66rem;
  }

  .choice-panel .choice-cards,
  .choice-panel .lots {
    gap: 6px;
  }

  .choice-panel .lot {
    padding: 6px;
  }

  .choice-panel .lot-cards .choice-img {
    width: 48px;
  }

  .round-panel .changed-list,
  .result-panel .changed-list {
    gap: 4px;
  }

  .panel-actions {
    justify-content: space-between;
  }

  .game-top {
    flex-wrap: wrap;
    gap: 5px;
  }

  .round-info {
    min-width: 54px;
  }

  .score-pill {
    flex: 1;
    padding: 3px 7px;
    font-size: 0.66rem;
  }

  .score-name {
    max-width: 12ch;
  }

  .action-text small {
    display: none;
  }

  .action-btn {
    padding: 6px 5px;
    gap: 4px;
    min-height: 40px;
    justify-content: center;
  }

  .action-text {
    font-size: 0.64rem;
  }

  .used-actions {
    gap: 2px;
  }

  .used-mark {
    width: 18px;
    height: 18px;
    font-size: 0.62rem;
  }

  .player-meta strong {
    font-size: 0.72rem;
  }

  .mini-badges {
    font-size: 0.62rem;
  }

  .status-line {
    font-size: 0.76rem;
  }

  .selection-bar {
    flex-wrap: wrap;
  }

  .selection-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .hand-card {
    width: clamp(44px, 13vw, 60px);
  }

  .lobby-players {
    grid-template-columns: 1fr;
  }

  .versus {
    text-align: center;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .lots {
    grid-template-columns: 1fr;
  }

  .rule-actions {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 18px 14px;
    border-radius: 18px;
  }
}

@media (max-height: 650px) {
  .menu-content {
    margin: 2vh auto;
    padding: 16px;
  }

  .game-title {
    font-size: clamp(2.2rem, 7vw, 3.6rem);
  }

  .lead {
    margin-bottom: 14px;
  }

  .btn.large {
    min-height: 54px;
  }

  .game-shell {
    gap: 3px;
  }

  .status-line {
    min-height: 18px;
  }

  .action-btn {
    min-height: 38px;
    padding: 4px 6px;
  }

  .hand-card {
    width: clamp(40px, 8vw, 54px);
  }

  .geisha-art {
    border-radius: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
