:root {
  font-family: Arial, "Noto Sans Hebrew", sans-serif;
  color: #252720;
  background: #f7f6f2;
  font-synthesis: none;
  line-height: 1.6;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: wait; opacity: 0.6; }
a { color: inherit; }

.shell {
  width: min(100% - 40px, 480px);
  margin: 56px auto 28px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 48px;
}

.brand {
  text-decoration: none;
  font-size: 29px;
  font-weight: 800;
  display: flex;
  gap: 12px;
  align-items: center;
}

.colors { display: flex; gap: 3px; direction: ltr; transform: rotate(-12deg); }
.colors i { display: block; width: 7px; height: 20px; border-radius: 3px; background: #db6554; }
.colors i:nth-child(2) { background: #e7b84e; }
.colors i:nth-child(3) { background: #71a388; }
.colors i:nth-child(4) { background: #6795c0; }

.tagline, footer, .muted { color: #787b71; font-size: 14px; }

main {
  background: #fff;
  border: 1px solid #e3e4dc;
  border-radius: 18px;
  padding: 32px;
  box-shadow: 0 8px 28px #24272005;
}

h1 { font-size: 29px; line-height: 1.3; margin: 0 0 12px; letter-spacing: -0.6px; }
p { margin: 0 0 24px; }

.eyebrow { font-size: 12px; color: #85897e; margin-bottom: 16px; display: flex; align-items: center; gap: 7px; }
.dot { height: 6px; width: 6px; border-radius: 50%; background: #6e9577; }

button, .button {
  border: 0;
  border-radius: 12px;
  padding: 14px 18px;
  min-height: 52px;
  width: 100%;
  background: #292e26;
  color: white;
  font-weight: 600;
  font-size: 17px;
  display: block;
  text-align: center;
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
}
button:active { transform: scale(0.98); }
@media (hover: hover) { button:hover { background: #454d3e; } }

.secondary { background: white; color: #33382e; border: 1px solid #dcdfd5; }
@media (hover: hover) { .secondary:hover { background: #f3f5ee; } }

input {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  border: 1px solid #dcded5;
  border-radius: 12px;
  padding: 13px 15px;
  background: #fff;
  color: #252720;
  font-size: 17px; /* 16px+ prevents iOS Safari zoom-on-focus */
  appearance: none;
  -webkit-appearance: none;
}
input::placeholder { color: #92958b; }
input:focus, button:focus-visible, a:focus-visible { outline: 3px solid #b8cdb0; outline-offset: 3px; }
/* The app moves focus to the screen heading for screen readers after a screen
   change; that programmatic focus must not paint a visible ring. */
h1:focus { outline: none; }

label { display: block; font-size: 14px; margin-bottom: 7px; }
form { display: grid; gap: 14px; }
form label { margin: 0 0 -8px; }

.divider { display: flex; align-items: center; gap: 12px; color: #92958b; font-size: 12px; margin: 24px 0; }
.divider:before, .divider:after { content: ""; height: 1px; flex: 1; background: #eceee7; }

.summary { border: 1px solid #e4e7dc; background: #f7f8f3; border-radius: 12px; padding: 14px 16px; font-size: 15px; margin-bottom: 24px; }

.invite { margin: 24px 0; }
.invite label { color: #787b71; }
.invite a {
  display: block;
  direction: ltr;
  text-align: left;
  font-family: monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
  text-decoration: none;
  padding: 13px;
  border: 1px dashed #cdd3c2;
  border-radius: 12px;
  background: #f9faf6;
  margin-bottom: 9px;
}
.invite button { font-size: 15px; min-height: 44px; padding: 9px; }

.list-title { font-size: 14px; color: #777e6e; margin: 26px 0 10px; }
.players { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 8px; }
.players li {
  border: 1px solid #e5e8de;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 52px;
}
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #edf1e7; color: #5e7152; font-size: 15px; }
.player-name { overflow-wrap: anywhere; min-width: 0; flex: 1; }
.badge { font-size: 12px; color: #7b836f; white-space: nowrap; }
.note { font-size: 12px; color: #858b7c; text-align: center; margin: 14px 0 0; }
.cpu-note { margin-bottom: 14px; }

.hello { text-align: center; padding: 36px 0 28px; }
.hello h1 { overflow-wrap: anywhere; font-size: 34px; margin: 20px 0 12px; }
.hello .colors { justify-content: center; transform: none; }
.hello .colors i { height: 30px; width: 11px; }
.hello p { color: #858b7c; font-size: 14px; }

footer { text-align: center; font-size: 12px; margin-top: 24px; }
#error { background: #fff0ed; color: #9b3629; border: 1px solid #ebccc5; border-radius: 12px; padding: 12px; margin-top: 14px; font-size: 14px; }
.full-hint { background: #fff0ed; color: #9b3629; border: 1px solid #ebccc5; border-radius: 12px; padding: 12px; margin-bottom: 14px; font-size: 15px; font-weight: 600; text-align: center; }
.back { display: block; text-align: center; font-size: 13px; margin-top: 18px; color: #7d8374; }
.connection { font-size: 12px; color: #97651e; margin-top: 14px; text-align: center; }
.you { color: #878c80; font-size: 12px; }

/* Phones: full-bleed app screen instead of a shrunken web card. */
@media (max-width: 540px) {
  body {
    /* Respect iPhone notch and home indicator. */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .shell { width: 100%; margin: 0; min-height: 100dvh; display: flex; flex-direction: column; }
  header { padding: 16px 20px 0; margin-bottom: 24px; }
  .tagline { font-size: 12px; }
  main { flex: 1; background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: 8px 20px 28px; display: flex; flex-direction: column; }
  main > * { width: 100%; }
  h1 { font-size: 30px; }
  .hello { padding: 22vh 0 28px; }
  footer { padding: 16px 20px calc(12px + env(safe-area-inset-bottom)); }
  #error { margin: 14px 20px 0; }
  form { gap: 16px; margin-top: 8px; }
  .invite { margin: 20px 0; }
}

/* ===== מסך המשחק — לפי הסקיצה המאושרת: מסך מלא, מטרות הקשה של 44px+, ומרווחי
   safe-area. שינוי יחיד בעיצוב הכללי: בזמן משחק הכרטיס הממורכז מפנה מקום
   למסך מלא. ===== */

body.in-game .shell { width: 100%; max-width: none; margin: 0; }
body.in-game header,
body.in-game footer { display: none; }
body.in-game main { background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: 0; }
body.in-game main > * { width: 100%; }
/* Reducer errors arrive as one floating toast, like a native alert. */
body.in-game #error {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  margin: 0;
  max-width: min(90vw, 420px);
  box-shadow: 0 8px 28px #24272022;
}

/* מסך המשחק בסכמת צבעים מינימלית (החלטת עסף): שולחן ירוק שטוח ושקט, צ'יפים
   שקופים בלי מסגרות — הצבעים הבהירים על פני הקלפים הם הדיבור. */
.game { min-height: 100dvh; display: flex; flex-direction: column; background: #37654f; }

.appbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
}
.appbar > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feedback-toggle { width: auto; flex: none; min-height: 44px; padding: 8px 10px; font-size: 12px; background: rgba(255, 255, 255, 0.12); color: #fff; margin-inline-start: 8px; }
@media (hover: hover) { .feedback-toggle:hover { background: rgba(255, 255, 255, 0.22); } }
@media (hover: hover) { .backstack:hover { background: none; } }

.table { flex: 1; display: grid; gap: 10px; align-content: start; padding: 12px 14px 18px; }

.opps { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.opp {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  min-height: 44px;
}
.opp.turn { box-shadow: 0 0 0 2px #f5b31b; font-weight: 700; }
.opp.me { background: rgba(255, 255, 255, 0.18); }
.opp .cnt { font-size: 11px; color: #fff; background: rgba(255, 255, 255, 0.16); border-radius: 8px; padding: 1px 7px; }
.flow { color: rgba(255, 255, 255, 0.6); font-size: 15px; }

.piles { display: flex; justify-content: center; gap: 36px; padding: 2px 0; }
.pile { display: grid; justify-items: center; gap: 6px; }
.cap { font-size: 11px; color: rgba(255, 255, 255, 0.72); }

.discard-history { width: min(100%, 420px); min-width: 0; justify-self: center; color: #fff; text-align: center; }
.discard-history summary { min-height: 44px; padding: 12px; cursor: pointer; font-size: 13px; }
.discard-history ol { display: flex; justify-content: safe center; gap: 8px; max-width: 100%; overflow-x: auto; list-style: none; margin: 0; padding: 8px 2px; }
.discard-history li { display: grid; justify-items: center; align-content: start; gap: 6px; flex: 0 0 64px; font-size: 11px; }
.discard-history .card { zoom: 0.75; }

.backstack { position: relative; width: 90px; height: 126px; border: 0; background: none; padding: 0; }
.backstack .back { position: absolute; top: 0; right: 0; margin: 0; }
.backstack .back:last-child { top: 10px; right: 10px; }
.backstack .back {
  width: 80px;
  height: 116px;
  border: 1px solid #d9d5cb;
  border-radius: 10px;
  box-shadow: 0 3px 8px #0000004d;
  background: #fcfbf7;
  display: inline-block;
}
.backstack .back::after {
  content: 'טאקי';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e8443a;
  font-weight: 900;
  font-size: 17px;
  -webkit-text-stroke: 1px #262626;
  text-shadow: 2px 2px 0 #a3261e;
  transform: rotate(-8deg);
}
.disc { position: relative; width: 90px; height: 126px; }
.disc .card { position: absolute; top: 0; right: 0; }

.card {
  --sym: #262626;
  --symd: #000000;
  width: 80px;
  height: 116px;
  min-height: 116px;
  flex: none;
  padding: 0;
  position: relative;
  overflow: hidden;
  border: 1px solid #d9d5cb;
  border-radius: 10px;
  background: #fcfbf7;
  color: #262626;
  box-shadow: 0 3px 8px #0000004d;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-weight: 900;
  line-height: 1;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
/* פנים לבנות כמו החפיסה האמיתית — הצבע נישא על הסמל הענק (החלטת עסף, 2026-11-24). */
.card.red { --sym: #e8443a; --symd: #a3261e; }
.card.blue { --sym: #3f8fd8; --symd: #1f5f9e; }
.card.green { --sym: #3aae4e; --symd: #1e7c30; }
.card.yellow { --sym: #f5b31b; --symd: #b57f0a; }
.card.wild { background: #fcfbf7; }
.card-symbol {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  gap: 2px;
  color: var(--sym);
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 800;
  font-size: 60px;
  letter-spacing: -0.02em;
  -webkit-text-stroke: 1px #262626;
  text-shadow: 2px 2px 0 var(--symd), 4px 4px 0 var(--symd), 6px 6px 0 var(--symd), 8px 8px 0 #00000040;
}
.kind-plus .card-symbol { font-size: 66px; }
.kind-plus2 .card-symbol { font-size: 48px; letter-spacing: -2px; }
.kind-changeDirection .card-symbol { font-size: 46px; }
.kind-changeDirection .card-symbol svg { width: 58px; height: 44px; }
.card-symbol svg { width: 52px; height: 54px; filter: drop-shadow(2px 2px 0 #00000045) drop-shadow(3px 3px 0 #00000030); }
/* ה-bdi עוטף את הפנים; בלי grid הוא מתנהג כשורת טקסט ומוסיף strut בגובה הגופן הענק. */
.card-symbol > bdi { display: grid; place-items: center; gap: 2px; }
.tkstack { display: flex; flex-direction: column; align-items: center; gap: 4px; direction: ltr; }
.tkrow { display: flex; gap: 2px; }
.tkc {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 800;
  font-size: 32px;
  line-height: 1;
  color: var(--tk);
  -webkit-text-stroke: 1px #262626;
  text-shadow: 2px 2px 0 var(--tkd), 4px 4px 0 var(--tkd), 6px 6px 0 #00000038;
  transform: rotate(var(--tkr, 0deg));
}
.tksuper {
  font-size: 15px;
  color: #3aae4e;
  -webkit-text-stroke: 1px #262626;
  text-shadow: 1.5px 1.5px 0 #1e7c30;
  transform: rotate(-3deg);
  margin-bottom: 2px;
}
.qcircle {
  display: inline-block;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: conic-gradient(#e8443a 0 25%, #f5b31b 0 50%, #3aae4e 0 75%, #3f8fd8 0);
  border: 2px solid #262626;
  box-shadow: 3px 3px 0 #00000040;
}
.kind-plus3 .card-symbol, .kind-plus3Breaker .card-symbol { font-size: 62px; --sym: #8f6bc7; --symd: #5b3d94; }
.pn { position: relative; display: inline-block; }
.pplus {
  position: absolute;
  top: -14px;
  inset-inline-end: -14px;
  font-size: 34px;
  font-style: normal;
  color: #e8443a;
  -webkit-text-stroke: 1px #262626;
  text-shadow: 2px 2px 0 #a3261e, 4px 4px 0 #a3261e, 6px 6px 0 #00000038;
}
.kind-plus3Breaker .card-symbol .pn { text-decoration: line-through; text-decoration-thickness: 5px; text-decoration-color: #262626; }
.card-corner {
  position: absolute;
  top: 6px;
  right: 5px;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 800;
  font-size: 13px;
  color: var(--sym);
  line-height: 1;
  -webkit-text-stroke-width: 0;
}
.card-corner .qdot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  vertical-align: -1px;
  background: conic-gradient(#e8443a 0 25%, #f5b31b 0 50%, #3aae4e 0 75%, #3f8fd8 0);
  border: 1.5px solid #262626;
}
.card-name { position: absolute; bottom: 7px; left: 0; right: 0; z-index: 1; text-align: center; font-size: 11px; font-weight: 900; color: #262626; }
.card-back {
  background: #fcfbf7;
  font-size: 19px;
  color: #e8443a;
  -webkit-text-stroke: 1px #262626;
  text-shadow: 2px 2px 0 #a3261e;
}
.dot { width: 11px; height: 11px; border-radius: 4px; display: inline-block; }
.dot.red { background: #ed3347; }
.dot.yellow { background: #ffd338; }
.dot.green { background: #05884f; }
.dot.blue { background: #086be0; }
/* Preserve readable faces while waiting; only playable cards lift and ring. */
.card.play { box-shadow: 0 0 0 2px #f5b31b, 0 9px 18px #00000066; transform: translateY(-6px); }
.card.dim { opacity: 0.86; cursor: default; }
.card.play:active { transform: translateY(-6px) scale(0.96); }
.card.receiving { visibility: hidden; }
.card-flight { position: fixed; top: 0; left: 0; width: 80px; height: 116px; z-index: 35; pointer-events: none; }
.card-flight .card { opacity: 1; visibility: visible; transform: none; }

.chiprow { display: flex; justify-content: center; }
.colorchip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 99px;
  padding: 5px 12px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  min-height: 32px;
}

.banner {
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  text-align: center;
  background: #fcfbf7;
  color: #1d4d32;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.banner.mine { box-shadow: 0 0 0 2px #f5b31b; font-weight: 700; }
.countdown { color: #97651e; }

.toast {
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  color: #fff;
  text-align: center;
  background: rgba(255, 255, 255, 0.14);
}

.bottombar {
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display: grid;
  gap: 10px;
}
.hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 126px;
  padding: 8px 0 2px;
}

.rowbtns { display: flex; gap: 8px; }
.btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 600;
  min-height: 48px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fcfbf7;
  color: #1d4d32;
}
.btn.ghost { background: rgba(255, 255, 255, 0.12); color: #fff; border: 0; }
@media (hover: hover) { .btn:hover { background: #fff; } .btn.ghost:hover { background: rgba(255, 255, 255, 0.22); } }
.btn:disabled { opacity: 0.5; }

.log { font-size: 12px; color: rgba(255, 255, 255, 0.75); text-align: center; min-height: 18px; }
.turn-clock { display: grid; gap: 5px; font-size: 10px; text-align: center; color: rgba(255, 255, 255, 0.7); }
.turn-timer { height: 4px; border-radius: 4px; overflow: hidden; background: rgba(255, 255, 255, 0.2); }
.turn-timer > span { display: block; height: 100%; background: #f5b31b; transform-origin: right; }
.winner-flash { animation: winner-flash 800ms ease-out; }
.winner-call { position: fixed; top: 42%; left: 5%; right: 5%; z-index: 36; padding: 22px 16px; border-radius: 18px; background: #fff8d8; color: #3b441d; box-shadow: 0 12px 60px #b99a3435; text-align: center; font-weight: 900; font-size: 26px; pointer-events: none; animation: winner-arrives 240ms ease-out; }
@keyframes winner-flash { 35% { background: #fff0a6; box-shadow: 0 0 28px #f7c94e88; transform: scale(1.08); } }
@keyframes winner-arrives { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  .winner-flash, .winner-call { animation: none; }
}

/* בורר הצבעים: גיליון תחתון, לא חלונית (סקיצה 3). */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(37, 39, 32, 0.35);
  display: flex;
  align-items: flex-end;
  z-index: 30;
}
.sheet {
  width: 100%;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 6px 14px calc(14px + env(safe-area-inset-bottom));
  display: grid;
  gap: 12px;
}
.grabber { width: 36px; height: 4px; border-radius: 2px; background: #dcdfd5; margin: 4px auto 0; }
.sheettitle { font-size: 15px; font-weight: 700; text-align: center; }
.sheet .colors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; transform: none; }
.sheet .btn.ghost { color: #1d4d32; background: #eef2eb; }
/* הכפתור כולו בצבע — בלי כיתוב (הערת עסף, 2026-11-24). */
.colbtn {
  min-height: 64px;
  border-radius: 14px;
  border: 2px solid #26262622;
  box-shadow: inset 0 -3px 0 #0000001f;
}
.colbtn:active { transform: scale(0.96); }
.colbtn[data-color="red"] { background: #e8443a; }
.colbtn[data-color="yellow"] { background: #f5b31b; }
.colbtn[data-color="green"] { background: #3aae4e; }
.colbtn[data-color="blue"] { background: #3f8fd8; }

/* מסך סיום הסיבוב (סקיצה 6). */
.end { display: grid; gap: 12px; padding-top: 10vh; }
.scores { display: grid; gap: 6px; }
.score {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #e3e4dc;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  min-height: 48px;
  background: #fff;
}
.score .win { font-size: 12px; color: #5e7152; font-weight: 700; }
.score .cnt { font-size: 12px; color: #787b71; }

/* מעל 768px השולחן מתמרכז עד 620px בלי לשנות את ההיררכיה (סקיצה 7). */
@media (min-width: 768px) {
  .appbar, .table, .bottombar { width: 100%; max-width: 620px; margin-inline: auto; }
}
