/* =========================================================
   JASS DE SALON — design neutre, touches pastels d'été
   Fond gris très clair, accents menthe / pêche / lavande
   Zéro dégradé, couleurs unies uniquement
   ========================================================= */

:root {
  /* Fond et surfaces */
  --bg:        #f0eeeb;
  --surface:   #ffffff;
  --surface-2: #f7f6f3;
  --border:    #e0ddd8;

  /* Texte */
  --ink:       #2c2a27;
  --ink-mid:   #6e6a63;
  --ink-soft:  #a09b93;

  /* Accents pastels été — utilisés avec parcimonie */
  --mint:      #9dd5bb;
  --mint-dark: #c0a0d2;
  --peach:     #f4b896;
  --peach-dark:#d97040;
  --lavender:  #c4b8e8;
  --lav-dark:  #4324b4;
  --yellow:    #f0e080;
  --yellow-dark:#b8a800;

  /* Table */
  --table-border: #f4b896;
  --table-felt:   #f8eca8;

  /* Cartes */
  --red:       #c8384a;
  --black-suit:#2c2a27;

  --card-w: 76px;
  --card-h: 108px;
  --bot-card-w: 38px;
  --bot-card-h: 54px;
  --slot-w: 84px;
  --slot-h: 120px;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'Inter', system-ui, sans-serif;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  min-height: 100vh;
  background: var(--bg);
  font-family: var(--font-body);
  color: var(--ink);
}

.app {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 18px 18px 90px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ===================== EN-TÊTE ===================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 20px;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 2.4vw, 2.1rem);
  margin: 0;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.brand span {
  color: var(--ink-mid);
  font-style: italic;
  font-weight: 400;
  font-size: 0.7em;
  margin-left: 6px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.link-btn {
  cursor: pointer;
  color: var(--ink-mid);
  font-size: 0.88rem;
  text-decoration: underline dotted var(--border);
  text-underline-offset: 4px;
  transition: color .15s;
}
.link-btn:hover { color: var(--ink); }

.btn-gold, .btn-ghost {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity .15s, transform .1s;
}
.btn-gold {
  background: var(--mint-dark);
  color: #fff;
  border-color: var(--mint-dark);
}
.btn-gold:hover { opacity: 0.88; }
.btn-gold:active { transform: scale(0.97); }

.btn-ghost {
  background: var(--surface);
  color: var(--ink-mid);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

/* ===================== SCORE-PAD ===================== */
.scorepad {
  position: absolute;
  top: 88px;
  right: 14px;
  width: 168px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: var(--r-md);
  padding: 14px 14px 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transform: rotate(-2deg);
  z-index: 5;
}
.scorepad-pin {
  position: absolute;
  top: -7px; left: 50%;
  transform: translateX(-50%);
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--peach);
  border: 2px solid var(--peach-dark);
}
.scorepad h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  text-align: center;
  color: var(--ink);
  border-bottom: 1px dashed var(--border);
  padding-bottom: 6px;
}
.scorepad ul { list-style: none; margin: 0; padding: 0; }
.scorepad li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
  padding: 4px 0;
  color: var(--ink);
}
.scorepad li strong {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot-south { background: var(--peach); }
.dot-west  { background: var(--mint); }
.dot-north { background: var(--lavender); }
.dot-east  { background: var(--yellow); }

/* ===================== TABLE DE JEU ===================== */
.table-wrap {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr min(620px, 70vw) 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    ".    north  ."
    "west center east"
    ".    south  .";
  align-items: center;
  justify-items: center;
  gap: 6px;
  min-height: 560px;
  padding: 6px 0;
}

.seat { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.seat-north { grid-area: north; }
.seat-west  { grid-area: west; }
.seat-east  { grid-area: east; }
.seat-south { grid-area: south; }

.seat-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.82rem;
  color: var(--ink-mid);
  font-weight: 500;
}
.seat-tag-you {
  border-color: var(--peach);
  color: var(--peach-dark);
  background: #fff8f4;
}
.card-count {
  background: var(--mint-dark);
  color: #fff;
  font-weight: 700;
  font-size: 0.72rem;
  border-radius: 50%;
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---- bord pêche, feutre jaune ---- */
.table-frame {
  grid-area: center;
  width: 100%;
  height: 100%;
  min-height: 420px;
  border-radius: 50% / 42%;
  padding: 16px;
  background: var(--table-border);
  box-shadow: 0 12px 36px rgba(0,0,0,0.12);
  display: flex;
}
.table-felt {
  position: relative;
  flex: 1;
  border-radius: 50% / 42%;
  background: var(--table-felt);
}

/* ---- médaillon atout ---- */
.medallion {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 108px; height: 108px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.medallion-symbol {
  font-size: 2.1rem;
  line-height: 1;
  color: var(--ink);
  font-family: var(--font-display);
}
.medallion-label {
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 3px;
  font-weight: 600;
}

/* ---- zone des plis ---- */
.trick-area { position: absolute; inset: 0; }
.trick-slot {
  position: absolute;
  width: var(--slot-w);
  height: var(--slot-h);
  border-radius: 8px;
}
.slot-north { top: 14%;    left: 50%;   transform: translate(-50%,-50%); }
.slot-south { bottom: 14%; left: 50%;   transform: translate(-50%,50%); }
.slot-west  { left: 16%;   top: 50%;    transform: translate(-50%,-50%); }
.slot-east  { right: 16%;  top: 50%;    transform: translate(50%,-50%); }

/* ===================== CARTES ===================== */
.hand-fan {
  display: flex;
  justify-content: center;
  min-height: calc(var(--card-h) + 14px);
  position: relative;
}
.bot-hand   { min-height: calc(var(--bot-card-h) + 10px); }
.bot-hand-v { flex-direction: column; }

.card {
  width: var(--card-w);
  height: var(--card-h);
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  position: relative;
  margin-left: -30px;
  flex-shrink: 0;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
  font-family: var(--font-display);
  color: var(--black-suit);
  cursor: default;
  user-select: none;
}
.card:first-child { margin-left: 0; }

.card .pip {
  position: absolute;
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1;
  display: flex; flex-direction: column; align-items: center;
}
.card .pip.top    { top: 6px;    left: 7px; }
.card .pip.bottom { bottom: 6px; right: 7px; transform: rotate(180deg); }
.card .pip-symbol { font-size: 0.95em; }
.card .center-symbol {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.1rem;
}
.card.red   { color: var(--red); }
.card.black { color: var(--black-suit); }

.card.playable { cursor: pointer; }
.card.playable:hover {
  transform: translateY(-16px) scale(1.04);
  box-shadow: 0 10px 20px rgba(0,0,0,0.15), 0 0 0 2px var(--mint-dark);
  z-index: 3;
}
.card.disabled { filter: grayscale(0.5) brightness(0.9); }
.card.shake { animation: shake .32s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

.card.dealt  { animation: dealIn .32s ease both; }
@keyframes dealIn {
  from { opacity: 0; transform: translateY(-26px) scale(0.85); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.card.played { animation: dropIn .28s ease both; margin-left: 0; position: absolute; }
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-18px) scale(0.8); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.card.collecting { animation: collect .4s ease forwards; }
@keyframes collect {
  to { opacity: 0; transform: scale(0.5) translateY(10px); }
}

/* ---- dos de carte — violet clair uni ---- */
.card-back {
  width: var(--bot-card-w);
  height: var(--bot-card-h);
  border-radius: 6px;
  margin-left: -22px;
  flex-shrink: 0;
  background: #ccc0e8;
  border: 1px solid #b0a2d4;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  position: relative;
}
.bot-hand .card-back:first-child { margin-left: 0; }
.card-back::after {
  content: "J";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: #8a78c0;
  font-size: 0.78rem;
}

/* cartes dans emplacements de pli */
.trick-slot .card { width: var(--slot-w); height: var(--slot-h); margin: 0; }
.trick-slot .card .center-symbol { font-size: 2.4rem; }

/* ===================== BANDEAU MESSAGE ===================== */
.message-bar {
  position: fixed;
  left: 50%; bottom: 18px;
  transform: translateX(-50%);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  padding: 10px 24px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  max-width: 90vw;
  text-align: center;
  z-index: 4;
}

/* ===================== MODALES ===================== */
.overlay {
  position: fixed; inset: 0;
  background: rgba(30,28,25,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 16px;
}
.overlay[hidden] { display: none; }

.dialog-card {
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  padding: 28px 30px;
  max-width: 600px;
  width: 100%;
  box-shadow: 0 16px 48px rgba(0,0,0,0.16);
  position: relative;
  max-height: 88vh;
  overflow: auto;
}
.dialog-card h2 {
  font-family: var(--font-display);
  margin: 0 0 6px;
  font-size: 1.45rem;
  color: var(--ink);
}
.dialog-sub { margin: 0 0 16px; color: var(--ink-mid); font-size: 0.92rem; }
.dialog-sub.small { font-size: 0.82rem; margin-top: 14px; }

.trump-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.suit-btn {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.suit-btn span { font-size: 1.5rem; }
.suit-btn.suit-red   { color: var(--red); }
.suit-btn.suit-black { color: var(--black-suit); }
.suit-btn:hover {
  background: var(--surface);
  border-color: var(--mint-dark);
  transform: translateY(-1px);
}

.summary-list { list-style: none; margin: 0 0 18px; padding: 0; }
.summary-list li {
  display: flex; justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
.summary-list li strong {
  font-variant-numeric: tabular-nums;
  color: var(--mint-dark);
}

/* ---- modale règles ---- */
.modal-toggle-input { position: absolute; opacity: 0; pointer-events: none; }
.rules-overlay { display: none; position: fixed; }
.modal-toggle-input:checked ~ .rules-overlay { display: flex; }
.overlay-bg { position: absolute; inset: 0; cursor: pointer; }
.rules-card { position: relative; z-index: 1; }
.close-x {
  position: absolute; top: 10px; right: 14px;
  font-size: 1.6rem; line-height: 1;
  cursor: pointer; color: var(--ink-soft);
  transition: color .15s;
}
.close-x:hover { color: var(--ink); }
.rules-svg { width: 100%; height: auto; display: block; margin-top: 6px; }
.rules-col-title {
  font-family: var(--font-body);
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.08em;
  fill: #5a5550;
}
.rcard      { fill: #ffffff;  stroke: var(--border); stroke-width: 1.4; }
.rcard-zero { fill: var(--surface-2); stroke: var(--border); }
.rrank { font-family: var(--font-display); font-weight: 700; font-size: 15px; fill: var(--ink); }
.rname { font-family: var(--font-body); font-size: 12px; fill: var(--ink-mid); }
.rpts  { font-family: var(--font-body); font-weight: 700; font-size: 13px; fill: var(--mint-dark); text-anchor: end; }
.rules-foot { font-family: var(--font-body); font-size: 12px; fill: var(--ink-soft); }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 760px) {
  :root {
    --card-w: 52px; --card-h: 76px;
    --bot-card-w: 28px; --bot-card-h: 40px;
    --slot-w: 58px; --slot-h: 84px;
  }
  .scorepad { position: static; transform: none; width: auto; margin: 0 0 6px; }
  .table-wrap { grid-template-columns: 1fr 1fr 1fr; min-height: 460px; }
  .medallion { width: 74px; height: 74px; }
  .medallion-symbol { font-size: 1.4rem; }
  .card .center-symbol { font-size: 1.4rem; }
  .card .pip { font-size: 0.7rem; }
}

/* ---- Aperçu main dans modale atout ---- */
.trump-hand-preview {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 8px;
  margin-bottom: 14px;
}
.trump-hand-preview:empty { display: none; }
.preview-card {
  width: 52px !important;
  height: 74px !important;
  margin-left: 0 !important;
  border-radius: 6px;
  flex-shrink: 0;
}
.preview-card .center-symbol { font-size: 1.5rem; }
.preview-card .pip { font-size: 0.75rem; }

/* ---- Bouton passer ---- */
.btn-pass {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border-radius: var(--r-sm);
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-pass:hover {
  background: var(--surface-2);
  color: var(--ink-mid);
  border-color: var(--ink-soft);
}
