:root {
  --paper: #faf5ec;
  --paper-card: #fffdf9;
  --paper-muted: #ece2d2;
  --ink: #1d2233;
  --ink-soft: #54596e;
  --turquoise: #0e8388;
  --turquoise-light: #e0f3f3;
  --rose: #c9385a;
  --rose-light: #fce6ec;
  --saffron: #efa924;
  --saffron-light: #fff5d9;
  --cypress: #2a8553;
  --cypress-light: #e2f5ea;

  --font-display: "Space Grotesk", "Plus Jakarta Sans", sans-serif;
  --font-body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

button {
  font-family: inherit;
  touch-action: manipulation;
}

#app {
  width: 100%;
  height: 100%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'%3E%3Cpolygon points='22,13 24.5,19.5 31,22 24.5,24.5 22,31 19.5,24.5 13,22 19.5,19.5' fill='none' stroke='%230e8388' stroke-opacity='0.09' stroke-width='1'/%3E%3Ccircle cx='22' cy='22' r='1.4' fill='%23c9385a' fill-opacity='0.14'/%3E%3C/svg%3E"),
    var(--paper);
  display: flex;
  flex-direction: column;
  position: relative;
}

.view {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
  min-height: 0;
}
.view.active { display: flex; }
.hidden { display: none !important; }

/* LOADING & LOCKED SCREENS */
.state-screen {
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.state-box {
  width: 100%;
  max-width: 360px;
  background: var(--paper-card);
  border: 2.5px solid var(--ink);
  border-radius: 2px;
  padding: 18px;
  box-shadow: 5px 5px 0 var(--ink);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.state-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.state-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.state-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}
.state-copy {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink-soft);
}
.loading-bar {
  width: 100%;
  height: 10px;
  background: var(--paper-muted);
  border: 2px solid var(--ink);
  overflow: hidden;
  position: relative;
}
.loading-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 45%;
  background: var(--turquoise);
  animation: loadSlide 1.05s ease-in-out infinite alternate;
}
@keyframes loadSlide {
  from { transform: translateX(0); }
  to { transform: translateX(125%); }
}

/* TOP NAV */
.top-nav {
  height: 54px;
  padding: 0 12px;
  padding-top: env(safe-area-inset-top, 0px);
  min-height: calc(54px + env(safe-area-inset-top, 0px));
  background: var(--paper-card);
  border-bottom: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: relative;
  z-index: 4;
}
.brand-lock {
  display: flex;
  align-items: center;
  gap: 8px;
}
.floral-mark {
  flex-shrink: 0;
  color: var(--ink);
}
.brand-text {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-btn {
  height: 36px;
  padding: 0 11px;
  background: var(--paper-card);
  border: 2px solid var(--ink);
  border-radius: 2px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.nav-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}
.lang-toggle {
  background: var(--rose-light);
  color: var(--rose);
}
.help-btn {
  background: var(--saffron);
  color: var(--ink);
}

/* SCORE STRIP — Deep Indigo Ceramic Strip */
.score-strip {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
  background: var(--ink);
  color: var(--paper-card);
  padding: 8px 12px;
  flex-shrink: 0;
  position: relative;
  z-index: 4;
}
.score-side {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.bmo-side {
  justify-content: flex-end;
}
.score-label {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #cfd3e4;
  white-space: nowrap;
}
.team-side .score-label {
  color: #7ce6e8;
}
.score-num {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  background: var(--turquoise);
  color: #fff;
  padding: 2px 7px;
  border-radius: 2px;
  flex-shrink: 0;
}
.bmo-side .score-num {
  background: var(--rose);
}
.score-goal {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--saffron);
  text-align: center;
  padding: 0 4px;
  white-space: nowrap;
}

/* OPPONENTS ROW */
.seats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px 12px 6px;
  flex-shrink: 0;
  position: relative;
  z-index: 3;
}
.seats-row.single-seat {
  grid-template-columns: 1fr;
}
.seat-box {
  background: var(--paper-card);
  border: 2px solid var(--ink);
  border-radius: 2px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 3px 3px 0 var(--ink);
  min-width: 0;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.seat-box.is-partner { border-top: 5px solid var(--turquoise); }
.seat-box.is-bot { border-top: 5px solid var(--rose); }
.seat-box.turn-now {
  background: var(--saffron-light);
  box-shadow: 4px 4px 0 var(--rose);
}
.seat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.seat-name {
  font-size: 14.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  min-width: 0;
}
.sq-led {
  width: 8px;
  height: 8px;
  background: var(--cypress);
  border: 1.5px solid var(--ink);
  display: inline-block;
  flex-shrink: 0;
}
.sq-led.bot { background: var(--rose); }
.sq-led.offline { background: var(--paper-muted); }

.seat-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 2px;
  background: var(--paper-muted);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  white-space: nowrap;
  flex-shrink: 0;
}
.seat-tag.active-tag {
  background: var(--rose);
  color: #fff;
  animation: pulseTag 0.85s ease-in-out infinite;
}
@keyframes pulseTag {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.seat-cards-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
}
.fan-bars {
  display: flex;
  gap: 3px;
  align-items: center;
}
.fan-bar {
  width: 9px;
  height: 14px;
  background: var(--turquoise);
  border: 1.5px solid var(--ink);
  border-radius: 1px;
}
.seat-books {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* CENTER PLAYMAT + Gol-o-Morgh Geometric Garden Corners */
.felt-main {
  flex: 1;
  padding: 6px 12px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-height: 0;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
}
.garden-bg-tl, .garden-bg-br {
  position: absolute;
  width: 110px;
  height: 110px;
  color: var(--ink);
  pointer-events: none;
  z-index: 0;
}
.garden-bg-tl { top: 0; left: 0; opacity: 0.9; }
.garden-bg-br { bottom: 0; right: 0; opacity: 0.9; }

.play-area, .setup-card {
  position: relative;
  z-index: 2;
}

/* CELEBRATORY BOOK / LUCKY CATCH STAMP */
.book-stamp {
  background: var(--cypress);
  color: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 2px;
  padding: 9px 14px;
  text-align: center;
  box-shadow: 4px 4px 0 var(--ink);
  margin-bottom: 10px;
  animation: stampPop 0.45s cubic-bezier(0.2, 1.35, 0.4, 1) forwards;
}
.book-stamp.bot-book {
  background: var(--rose);
}
.book-stamp.lucky-stamp {
  background: var(--turquoise);
}
@keyframes stampPop {
  0% { transform: scale(0.84) rotate(-2deg); opacity: 0; }
  65% { transform: scale(1.03) rotate(0.5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.stamp-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--saffron-light);
}
.book-stamp strong {
  font-size: 15.5px;
  font-weight: 800;
}

.table-split {
  display: grid;
  grid-template-columns: 114px 1fr;
  gap: 10px;
  align-items: stretch;
}

/* DRAW PILE — Isfahan Turquoise Star Tile Back + Shiraz Rose Alert */
.draw-module {
  background: var(--paper-card);
  border: 2px solid var(--ink);
  border-radius: 2px;
  padding: 10px 8px;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: default;
}
.draw-module.can-draw {
  background: var(--rose-light);
  border: 2.5px solid var(--ink);
  cursor: pointer;
  animation: roseBounce 0.8s ease-in-out infinite;
}
@keyframes roseBounce {
  0%, 100% { transform: translate(0, 0); box-shadow: 3px 3px 0 var(--rose); }
  50% { transform: translate(-2px, -3px); box-shadow: 6px 6px 0 var(--rose); }
}
.pile-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
}
.draw-module.can-draw .pile-kicker {
  color: var(--rose);
}

.deck-cards {
  position: relative;
  width: 62px;
  height: 84px;
}
.deck-card {
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18'%3E%3Cpolygon points='9,1 11.2,6.8 17,9 11.2,11.2 9,17 6.8,11.2 1,9 6.8,6.8' fill='none' stroke='%23fff5d9' stroke-opacity='0.55' stroke-width='1.1'/%3E%3Ccircle cx='9' cy='9' r='1.6' fill='%23efa924'/%3E%3C/svg%3E"),
    var(--turquoise);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
.draw-module.can-draw .deck-card {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18'%3E%3Cpolygon points='9,1 11.2,6.8 17,9 11.2,11.2 9,17 6.8,11.2 1,9 6.8,6.8' fill='none' stroke='%23fff5d9' stroke-opacity='0.6' stroke-width='1.1'/%3E%3Ccircle cx='9' cy='9' r='1.6' fill='%23efa924'/%3E%3C/svg%3E"),
    var(--rose);
}
.back-b { transform: translate(-4px, 4px); }
.back-a {
  display: flex;
  align-items: center;
  justify-content: center;
}
.draw-module.can-draw .back-a {
  animation: cardLift 0.65s ease-in-out infinite;
}
@keyframes cardLift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.pile-num {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  background: var(--paper-card);
  color: var(--ink);
  padding: 2px 8px;
  border: 2px solid var(--ink);
}
.pile-cta {
  width: 100%;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  padding: 4px;
  color: var(--ink-soft);
  border-radius: 2px;
}
.draw-module.can-draw .pile-cta {
  background: var(--rose);
  color: #fff;
  border: 1.5px solid var(--ink);
  font-size: 12.5px;
}

/* LIVE FEED */
.feed-card {
  background: var(--paper-card);
  border: 2px solid var(--ink);
  border-radius: 2px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  box-shadow: 3px 3px 0 var(--ink);
}
.feed-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--rose);
}
.feed-main {
  font-size: 14.5px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--ink);
}
.feed-main.highlight {
  color: var(--cypress);
}
.private-card-banner {
  background: var(--cypress-light);
  border: 2px solid var(--ink);
  border-inline-start: 5px solid var(--cypress);
  padding: 6px 9px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}
.feed-history {
  border-top: 1.5px solid var(--paper-muted);
  padding-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.3;
}
.log-entry {
  word-break: break-word;
}

.books-strip {
  margin-top: 10px;
  background: var(--turquoise-light);
  border: 2px solid var(--ink);
  border-inline-start: 5px solid var(--turquoise);
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}

/* HAND DOCK + ISFAHAN TURQUOISE & SAFFRON KINETIC TURN BAR */
.hand-dock {
  background: var(--paper-card);
  border-top: 2.5px solid var(--ink);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  z-index: 4;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.hand-dock.my-turn {
  background: var(--turquoise-light);
}
.hand-dock.waiting-turn .hand-rail {
  opacity: 0.65;
  transform: translateY(3px);
}

.turn-banner {
  padding: 11px 14px;
  font-size: 14.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  background: var(--paper-muted);
  color: var(--ink-soft);
  border-bottom: 2px solid var(--ink);
  line-height: 1.3;
}
.hand-dock.my-turn .turn-banner {
  background: var(--turquoise);
  color: #fff;
}
.hand-dock.my-turn .turn-banner::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: repeating-linear-gradient(90deg, var(--saffron) 0 14px, var(--turquoise) 14px 28px);
  background-size: 28px 4px;
  animation: stripeMove 0.6s linear infinite;
}
@keyframes stripeMove {
  from { background-position: 0 0; }
  to { background-position: 28px 0; }
}

.hand-dock.fish-turn .turn-banner {
  background: var(--rose);
  color: #fff;
}
.turn-arrow {
  display: inline-block;
  font-size: 14px;
  flex-shrink: 0;
}
.hand-dock.my-turn .turn-arrow {
  animation: arrowNudge 0.75s ease-in-out infinite;
}
html[data-lang="fa"] .hand-dock.my-turn .turn-arrow {
  animation: arrowNudgeRtl 0.75s ease-in-out infinite;
}
.hand-dock.fish-turn .turn-arrow {
  animation: arrowUp 0.65s ease-in-out infinite;
}
@keyframes arrowNudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(5px); }
}
@keyframes arrowNudgeRtl {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-5px); }
}
@keyframes arrowUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* CONFIRM DRAWER */
.ask-drawer {
  background: var(--saffron-light);
  border-bottom: 2px solid var(--ink);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ask-summary {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.35;
}
.ask-actions {
  display: flex;
  gap: 8px;
}
.ask-btn {
  flex: 1;
  min-height: 42px;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  border-radius: 2px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 800;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.ask-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}
.ask-btn.partner { background: var(--turquoise); color: #fff; }
.ask-btn.bot { background: var(--rose); color: #fff; }
.ask-btn.cancel { flex: 0 0 42px; background: var(--paper-card); color: var(--ink); padding: 0; }

/* PLAYING CARDS */
.hand-rail {
  display: flex;
  gap: 10px;
  padding: 20px 12px 10px;
  overflow-x: auto;
  overflow-y: visible;
  align-items: flex-end;
  min-height: 136px;
  transition: opacity 0.25s, transform 0.25s;
}
.hand-placeholder {
  width: 100%;
  text-align: center;
  padding: 22px 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
}
.card-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 0;
  flex-shrink: 0;
  cursor: default;
  transition: transform 0.16s ease;
}
.card-stack.can-tap {
  cursor: pointer;
}
.hand-dock.my-turn .card-stack {
  transform: translateY(-2px);
}
.card-stack.selected {
  transform: translateY(-12px) !important;
  animation: none !important;
}
.card-stack.near-book {
  animation: springNear 1.3s ease-in-out infinite;
}
@keyframes springNear {
  0%, 100% { transform: translateY(-2px); }
  50% { transform: translateY(-7px); }
}

.cards-row {
  display: flex;
  align-items: center;
}
.pcard {
  width: 62px;
  height: 88px;
  background: var(--paper-card);
  border: 2px solid var(--ink);
  border-radius: 3px;
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  padding: 5px 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-left: -34px;
  text-align: left;
}
.pcard:first-child { margin-left: 0; }
.pcard.red { color: var(--rose); }
.card-stack.selected .pcard {
  border-color: var(--turquoise);
  box-shadow: 3px 4px 0 var(--turquoise);
  background: #ffffff;
}

.c-top {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
}
.c-mid {
  font-size: 28px;
  line-height: 1;
  text-align: center;
}
.c-bot {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  text-align: right;
  opacity: 0.8;
}

.meter {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: 2px;
  background: var(--paper-card);
  border: 2px solid var(--ink);
  color: var(--ink-soft);
  white-space: nowrap;
}
.meter.pair {
  background: var(--turquoise-light);
  color: var(--turquoise);
}
.meter.triple {
  background: var(--saffron);
  color: var(--ink);
}

/* FOOTER META STRIP */
.dock-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--paper);
  border-top: 1.5px solid var(--paper-muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-soft);
}
.conn-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}
.meta-link {
  background: var(--paper-card);
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
}
.meta-link:active {
  background: var(--paper-muted);
}

/* LOBBY & SETUP */
.lobby-body {
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  flex: 1;
}
.kicker {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--turquoise);
  letter-spacing: 0.06em;
}
.kicker-rose {
  color: var(--rose);
}
.lobby-hero h1 {
  margin: 4px 0 6px;
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--ink);
}
.lobby-hero p {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.45;
}

.game-tile {
  width: 100%;
  padding: 0;
  text-align: start;
  background: var(--paper-card);
  border: 2px solid var(--ink);
  border-radius: 2px;
  display: flex;
  overflow: hidden;
  box-shadow: 4px 4px 0 var(--ink);
  color: var(--ink);
}
.game-tile.featured {
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.game-tile.featured:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}
.game-tile.muted-tile {
  opacity: 0.65;
  box-shadow: 2px 2px 0 var(--ink);
}
.tile-accent {
  width: 8px;
  background: var(--rose);
  border-inline-end: 2px solid var(--ink);
  flex-shrink: 0;
}
.tile-content {
  padding: 14px;
  flex: 1;
  min-width: 0;
  text-align: start;
}
.tile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.tile-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
}
.tile-status {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border: 1.5px solid var(--ink);
  color: var(--ink-soft);
  background: var(--paper-muted);
  white-space: nowrap;
}
.tile-status.live {
  background: var(--turquoise);
  color: #fff;
}
.tile-sub {
  font-size: 13px;
  font-weight: 800;
  color: var(--rose);
  margin-bottom: 6px;
}
.tile-desc {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.45;
}
.tile-desc.muted-desc {
  margin-bottom: 0;
}
.tile-cta {
  display: inline-block;
  background: var(--turquoise);
  color: #fff;
  border: 2px solid var(--ink);
  font-size: 13.5px;
  font-weight: 800;
  padding: 9px 14px;
  box-shadow: 2px 2px 0 var(--ink);
}

.setup-card {
  background: var(--paper-card);
  border: 2px solid var(--ink);
  border-radius: 2px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  box-shadow: 4px 4px 0 var(--ink);
}
.setup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.setup-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink);
}
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mode-opt {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 2px;
  padding: 12px 10px;
  color: var(--ink-soft);
  text-align: inherit;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.mode-opt strong {
  font-size: 14.5px;
  color: var(--ink);
}
.mode-opt span {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
}
.mode-opt.active {
  background: var(--turquoise);
  color: #dcf7f7;
  box-shadow: 3px 3px 0 var(--ink);
}
.mode-opt.active strong {
  color: #fff;
}
.roster-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.roster-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
}
.roster-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 2px solid var(--paper-muted);
  border-bottom: 2px solid var(--paper-muted);
  padding: 10px 0;
}
.roster-item {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 800;
}
.roster-ok { color: var(--cypress); }
.roster-wait { color: var(--ink-soft); }

.tally-headline {
  font-size: 16px;
  font-weight: 800;
  color: var(--turquoise);
}
.tally-breakdown {
  background: var(--paper);
  border: 2px solid var(--ink);
  padding: 10px 12px;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.65;
  color: var(--ink);
}
.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.deal-cta {
  width: 100%;
  height: 46px;
  background: var(--turquoise);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 2px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 800;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.deal-cta:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}
.secondary-cta {
  width: 100%;
  height: 46px;
  background: var(--paper-card);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 2px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 800;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
}
.secondary-cta:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}

/* HELP MODAL */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(29, 34, 51, 0.76);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 50;
}
.help-dialog {
  width: 100%;
  max-width: 376px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--paper-card);
  border: 2.5px solid var(--ink);
  border-radius: 2px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 6px 6px 0 var(--ink);
}
.help-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 10px;
}
.help-head h3 {
  margin: 2px 0 0;
  font-size: 20px;
  font-weight: 800;
}
.help-close {
  width: 34px;
  height: 34px;
  background: var(--paper-muted);
  border: 2px solid var(--ink);
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  border-radius: 2px;
  cursor: pointer;
}
.help-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.help-row {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}
.step-badge {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 2px;
  border: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
}
.step-badge.s1 { background: var(--saffron); color: var(--ink); }
.step-badge.s2 { background: var(--turquoise); color: #fff; }
.step-badge.s3 { background: var(--rose); color: #fff; }
.help-row strong {
  display: block;
  font-size: 14.5px;
  margin-bottom: 3px;
  color: var(--ink);
}
.help-row p {
  margin: 0;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--ink-soft);
}
.help-coop-box {
  background: var(--turquoise-light);
  border: 2px solid var(--ink);
  border-inline-start: 5px solid var(--turquoise);
  padding: 10px 12px;
}
.help-coop-box strong {
  display: block;
  font-size: 13.5px;
  color: var(--ink);
  margin-bottom: 3px;
}
.help-coop-box p {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.45;
}

/* NOTICE / TOAST */
.notice-bar {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  max-width: 380px;
  margin: 0 auto;
  background: var(--rose);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 2px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 800;
  text-align: center;
  box-shadow: 4px 4px 0 var(--ink);
  z-index: 80;
}

.ltr-iso {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}

/* FARSI (RTL + Vazirmatn — keep ligatures crisp with zero letter-spacing) */
html[data-lang="fa"] body,
html[data-lang="fa"] button,
html[data-lang="fa"] .kicker,
html[data-lang="fa"] .roster-kicker,
html[data-lang="fa"] .score-label,
html[data-lang="fa"] .score-goal,
html[data-lang="fa"] .pile-kicker,
html[data-lang="fa"] .feed-kicker,
html[data-lang="fa"] .stamp-kicker,
html[data-lang="fa"] .tile-status,
html[data-lang="fa"] .dock-meta-bar,
html[data-lang="fa"] .state-title,
html[data-lang="fa"] .lobby-hero h1,
html[data-lang="fa"] .tile-title,
html[data-lang="fa"] .setup-card h2 {
  font-family: "Vazirmatn", sans-serif !important;
  letter-spacing: 0 !important;
}
