:root {
  --table: #14213D;
  --table-2: #1D2E55;
  --board: #DCEBE2;
  --board-line: #8FAE9C;
  --ink: #15203A;
  --muted: #5A6882;
  --sun: #F2B705;
  --sun-dark: #D29E00;
  --coral: #E4572E;
  --panel: #EEF4F0;
  --display: 'Secular One', 'Assistant', 'Arial Hebrew', sans-serif;
  --body: 'Assistant', 'Segoe UI', 'Arial Hebrew', Arial, sans-serif;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--table) radial-gradient(circle at 50% 0%, #22386a 0%, transparent 60%) no-repeat;
  color: var(--ink);
  font: 16px/1.5 var(--body);
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
input, select {
  font-size: 16px; /* מונע זום אוטומטי באייפון */
  border: 2px solid #c6d6cc; border-radius: 10px; padding: 10px 12px; background: #fff; width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

.muted { color: var(--muted); }
.center { text-align: center; }
.neg { color: var(--coral); }
.error { color: var(--coral); min-height: 1.5em; margin: 8px 0 0; font-weight: 600; }
.note { font-size: .85rem; color: var(--muted); margin: 6px 0 0; }

/* כפתורים */
.btn {
  border: 2px solid var(--ink); background: #fff; border-radius: 12px;
  padding: 9px 16px; font-weight: 700; cursor: pointer; line-height: 1.2;
  box-shadow: 0 3px 0 var(--ink); transition: transform .08s, box-shadow .08s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--sun); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--coral); color: #fff; }
.btn.big { font-size: 1.1rem; padding: 12px 22px; width: 100%; }
.btn.small { font-size: .88rem; padding: 6px 12px; box-shadow: 0 2px 0 var(--ink); }
.link { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: 4px; font-size: .9rem; }
.icon-btn { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: .9rem; padding: 2px 6px; border-radius: 6px; }
.icon-btn:hover { background: #0001; color: var(--coral); }
.row { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 8px; }
.row.wrap { flex-wrap: wrap; }

/* דף הבית ולובי */
.screen.home, .screen.lobby { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.home-card {
  width: min(420px, 100%); background: var(--board); border-radius: 20px; padding: 28px 24px;
  border: 3px solid var(--ink); box-shadow: 0 8px 0 #0a1224;
}
.logo {
  font-family: var(--display); font-weight: 400; font-size: clamp(2.6rem, 11vw, 3.6rem);
  line-height: 1; margin: 0; text-align: center; color: var(--ink);
  text-shadow: 3px 3px 0 var(--sun);
}
.tagline { text-align: center; margin: 10px 0 22px; color: var(--muted); }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 700; margin-bottom: 4px; font-size: .9rem; }
.field.inline { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.field.inline > span { margin: 0; white-space: nowrap; }
.field.inline input { width: 110px; padding: 6px 8px; }
.or { display: flex; align-items: center; gap: 10px; margin: 22px 0 12px; color: var(--muted); font-size: .9rem; }
.or::before, .or::after { content: ''; flex: 1; height: 2px; background: #c6d6cc; }
.join-row { display: flex; gap: 8px; }
.code-input { text-transform: uppercase; letter-spacing: .25em; font-weight: 800; text-align: center; }
.home-card .link { display: block; margin: 10px auto 0; }

.big-code {
  font-family: var(--display); font-size: 3.4rem; letter-spacing: .15em; text-align: center; line-height: 1.1;
  margin: 0 0 14px; color: var(--ink);
}
.lobby .home-card > .muted:first-child { text-align: center; margin: 0; }
#shareBtn { width: 100%; }
.section-title { font-family: var(--display); font-weight: 400; font-size: 1.15rem; margin: 20px 0 8px; }
.lobby-players, .players { list-style: none; margin: 0 0 16px; padding: 0; }
.lobby-players li, .players li {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: #fff; margin-bottom: 6px;
}
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 2px solid var(--ink); flex: none; }
.pname { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: .75rem; background: var(--sun); border-radius: 6px; padding: 1px 6px; font-weight: 700; }
.badge.off { background: #d5dde2; color: var(--muted); }

/* מסך המשחק */
.screen.game {
  display: grid; gap: 14px; padding: 10px; max-width: 1400px; margin: 0 auto;
  grid-template-columns: 1fr;
}
@media (min-width: 1000px) {
  .screen.game { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; height: 100vh; padding: 14px; }
  .side { height: calc(100vh - 28px); overflow-y: auto; }
}
.board-area { display: flex; justify-content: center; }
.board {
  width: min(100%, calc(100vh - 28px)); aspect-ratio: 1; container-type: inline-size;
  display: grid; grid-template-columns: 1.55fr repeat(9, 1fr) 1.55fr; grid-template-rows: 1.55fr repeat(9, 1fr) 1.55fr;
  background: var(--board); border: 3px solid var(--ink); border-radius: 10px; overflow: hidden;
  box-shadow: 0 10px 0 #0a1224;
}

.cell {
  position: relative; border: .5px solid var(--board-line); display: flex; overflow: hidden; min-width: 0; min-height: 0;
  background: var(--board);
}
.cell.clickable { cursor: pointer; }
.cell.clickable:hover { background: #eaf4ee; }
.cell.bottom { flex-direction: column; }
.cell.top { flex-direction: column-reverse; }
.cell.left { flex-direction: row; }       /* הפס בצד הפנימי (ימין) */
.cell.right { flex-direction: row-reverse; }
.band { flex: none; display: flex; align-items: center; justify-content: center; gap: 1px; }
.bottom .band, .top .band { height: 22%; }
.left .band, .right .band { width: 22%; flex-direction: column; }
.house { width: 1.4cqw; height: 1.4cqw; background: #2BA84A; border: .5px solid #0006; border-radius: 1px; display: block; }
.hotel { width: 3cqw; height: 1.6cqw; background: #D93A2B; border: .5px solid #0006; border-radius: 1px; display: block; }
.left .hotel, .right .hotel { width: 1.6cqw; height: 3cqw; }
.cell-body {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: .3cqw; gap: .2cqw; min-width: 0;
}
.cname { font-weight: 700; font-size: 1.25cqw; line-height: 1.1; overflow-wrap: anywhere; }
.cprice { font-size: 1.1cqw; color: var(--muted); font-weight: 600; }
.icon { font-size: 2.2cqw; line-height: 1; }
.cell.chance .icon { font-family: var(--display); color: var(--coral); font-size: 3.2cqw; }
.cell.corner .icon { font-size: 3.6cqw; }
.cell.corner .cname { font-family: var(--display); font-weight: 400; font-size: 1.5cqw; }
.cell.mort::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(45deg, #15203a22 0 4px, transparent 4px 9px);
}
.owner {
  position: absolute; width: 1.5cqw; height: 1.5cqw; border-radius: 50%; background: var(--c);
  border: .3cqw solid #fff; box-shadow: 0 0 0 .5px var(--ink);
}
.bottom .owner { bottom: .4cqw; left: .4cqw; }
.top .owner { top: .4cqw; left: .4cqw; }
.left .owner { bottom: .4cqw; left: .4cqw; }
.right .owner { bottom: .4cqw; right: .4cqw; }

.toks { position: absolute; inset: 0; padding: .4cqw; display: flex; flex-wrap: wrap; align-content: flex-end; justify-content: center; gap: .3cqw; pointer-events: none; }
.toks.jailed { inset: auto 0 0 auto; width: 60%; height: 60%; background: #15203a22; border-top-left-radius: 8px; }
.tok {
  width: 2.8cqw; height: 2.8cqw; border-radius: 50%; background: var(--c); color: #fff; border: .35cqw solid #fff;
  box-shadow: 0 .3cqw 0 var(--ink); display: grid; place-items: center; font-weight: 800; font-size: 1.4cqw; line-height: 1;
}
.tok.active { animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-.6cqw); } }

/* מרכז הלוח */
.center {
  grid-row: 2 / 11; grid-column: 2 / 11; display: flex; align-items: center; justify-content: center;
  padding: 2cqw; direction: rtl; overflow-y: auto;
}
.center-inner { width: 100%; max-width: 440px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.brand {
  font-family: var(--display); font-size: 6.5cqw; line-height: 1; color: var(--ink);
  transform: rotate(-4deg); text-shadow: .4cqw .4cqw 0 var(--sun); margin-bottom: 1cqw;
}
.prompt { margin: 0; font-size: 1rem; }
.actions { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.actions .btn.big { max-width: 260px; }
.dice { display: flex; gap: 12px; justify-content: center; }
.die {
  width: 52px; height: 52px; background: #fff; border: 2.5px solid var(--ink); border-radius: 12px;
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 6px; box-shadow: 0 4px 0 var(--ink);
}
.die i { border-radius: 50%; margin: 2px; }
.die i.on { background: var(--ink); }
.die.rolling { animation: roll .55s cubic-bezier(.3, 1.4, .5, 1); }
.die.rolling + .die.rolling { animation-delay: .06s; }
@keyframes roll { 0% { transform: rotate(-200deg) scale(.4); opacity: 0; } 100% { transform: none; opacity: 1; } }
.card {
  background: #fff; border: 2.5px solid var(--ink); border-radius: 12px; padding: 10px 14px; max-width: 320px;
  font-weight: 600; box-shadow: 0 4px 0 var(--ink); font-size: .95rem;
}
.card span { display: block; font-family: var(--display); font-weight: 400; font-size: .85rem; color: var(--coral); }
.card.chest span { color: #2B4DA8; }
.debt { background: #fde6df; border: 2px solid var(--coral); border-radius: 12px; padding: 8px 12px; }
.debt p { margin: 0 0 6px; }
.winner { font-family: var(--display); font-size: 1.8rem; }

@media (prefers-reduced-motion: reduce) {
  .tok.active, .die.rolling { animation: none; }
}

/* צד ימין */
.side { display: flex; flex-direction: column; gap: 12px; }
.side-top { display: flex; align-items: center; gap: 10px; color: #dfe8f5; }
.side-top .room-tag { font-weight: 800; letter-spacing: .08em; flex: 1; }
.panel { background: var(--panel); border-radius: 14px; padding: 12px 14px; border: 2px solid var(--ink); }
.panel .section-title { margin-top: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.panel-head .section-title { margin: 0; }
.players { margin: 0; }
.players li { flex-wrap: wrap; row-gap: 2px; }
.players li.cur { outline: 3px solid var(--sun); }
.players li.out { opacity: .5; }
.players li.out .pname { text-decoration: line-through; }
.pmeta { display: flex; gap: 4px; align-items: center; font-size: .8rem; }
.money { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 64px; text-align: left; }
.money.neg { color: var(--coral); }
.my-props { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 2px solid var(--ink); border-radius: 999px; background: #fff; padding: 3px 10px 3px 10px; cursor: pointer;
  font-weight: 700; font-size: .85rem; border-inline-start: 10px solid var(--c);
}
.chip.mort { opacity: .55; text-decoration: line-through; }
.chip.tiny { font-size: .78rem; padding: 1px 8px; cursor: default; }
.trade.for-me { background: #fff6d6; border-color: var(--sun-dark); }
.trade p { margin: 4px 0; line-height: 1.8; }
.log-panel { display: flex; flex-direction: column; }
.log {
  list-style: none; margin: 0; padding: 0; height: 220px; overflow-y: auto; font-size: .88rem;
  display: flex; flex-direction: column; gap: 3px;
}
.log li { padding: 2px 0; border-bottom: 1px dashed #c6d6cc; }
.log li.chat-line { background: #fff; border-radius: 6px; padding: 3px 6px; border: 0; }
.chat { display: flex; gap: 6px; margin-top: 8px; }
.chat input { padding: 7px 10px; }

/* חלון */
.modal { position: fixed; inset: 0; background: #0a1224b3; display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal-box {
  position: relative; width: min(480px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--panel); border: 3px solid var(--ink); border-radius: 18px; padding: 20px; box-shadow: 0 8px 0 #0a1224;
}
.modal-x { position: absolute; top: 10px; left: 10px; background: #fff; border: 2px solid var(--ink); border-radius: 50%; width: 34px; height: 34px; cursor: pointer; z-index: 1; }
.modal-title { font-family: var(--display); font-weight: 400; margin: 0 0 12px; }
.deed-head {
  background: var(--c); color: #fff; font-family: var(--display); font-size: 1.6rem; text-align: center;
  border-radius: 10px; padding: 10px; margin: 0 0 10px; text-shadow: 0 2px 0 #0005; border: 2px solid var(--ink);
}
.deed-price { text-align: center; font-weight: 800; margin: 0; }
.deed { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: .95rem; }
.deed td { padding: 4px 6px; border-bottom: 1px solid #c6d6cc; }
.deed td:last-child { text-align: left; font-weight: 700; font-variant-numeric: tabular-nums; }
.deed tr.now td { background: #fff3c4; }
.trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.trade-cols h3 { font-size: 1rem; margin: 8px 0; }
.pick { display: flex; align-items: center; gap: 6px; margin: 4px 0; cursor: pointer; }
.pick input { width: auto; }
.rules p { margin: 0 0 10px; }

.toast {
  position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; font-weight: 700; z-index: 60;
  max-width: calc(100% - 32px); text-align: center; box-shadow: 0 4px 0 #000;
}
.conn {
  position: fixed; top: 0; left: 0; right: 0; background: var(--coral); color: #fff; text-align: center;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 10px 6px; font-weight: 700; z-index: 70;
}

/* לוח קטן: שמות נעלמים, מקישים על משבצת לפרטים */
@container (max-width: 560px) {
  .cell:not(.corner) .cname { display: none; }
  .cprice { font-size: 1.9cqw; }
  .icon { font-size: 3.4cqw; }
  .cell.corner .cname { font-size: 2cqw; }
  .tok { width: 4.2cqw; height: 4.2cqw; font-size: 2.2cqw; }
  .owner { width: 2.4cqw; height: 2.4cqw; }
  .house { width: 2cqw; height: 2cqw; }
  .brand { font-size: 8cqw; }
  .die { width: 40px; height: 40px; padding: 4px; border-radius: 9px; }
  .center-inner { gap: 6px; }
  .center .btn.big { font-size: 1rem; padding: 9px 16px; }
  .card { font-size: .8rem; padding: 6px 10px; }
  .prompt { font-size: .88rem; }
}
@media (max-width: 480px) {
  .trade-cols { grid-template-columns: 1fr; }
}

/* חזרה לעמוד המשחקים של AlexFunny — קיים בכל משחק */
.back-link {
  display: inline-block; margin: -10px 0 14px; font-size: .9rem; font-weight: 700;
  color: var(--muted); text-decoration: none;
}
.back-link:hover { color: var(--ink); text-decoration: underline; }
