/* tw-board.css - game pieces layered on top of the index.php board (css/stlye.css). Board look is not changed here. */
:root { --accent: #c62828; --gold: #f2b705; --muted: #6b7280; }
.board .space { position: relative; }
.board .space.here { outline: 3px solid var(--gold); outline-offset: -3px; z-index: 2; }
.board .space.mortgaged { opacity: .55; }

/* figure layer */
.figure-layer { position: absolute; inset: 0; pointer-events: none; z-index: 15; }
.fig { position: absolute; left: 0; top: 0; will-change: transform; filter: drop-shadow(0 3px 3px rgba(0,0,0,.55)); }
.fig img { width: 100%; height: 100%; object-fit: contain; display: block; }
.fig.current { filter: drop-shadow(0 0 6px var(--gold)) drop-shadow(0 4px 4px rgba(0,0,0,.6)); }
.fig.jailed img { filter: grayscale(.8) brightness(.85); }
.fig.fallback { border-radius: 50%; background: var(--ring, #999); color: #fff; font-weight: 900; display: flex; align-items: center; justify-content: center; }

/* buildings layer */
.board .space img.bld { position: absolute; left: 10%; top: 22%; width: 80%; max-height: 55%; object-fit: contain; z-index: 3;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); pointer-events: none; animation: bld-pop .35s ease-out; }
.board .space.has-hotel::after { content: 'H'; position: absolute; top: 4%; right: 4%; z-index: 4; background: var(--accent); color: #fff; font-weight: 900;
  font-size: .7rem; width: 1.3em; height: 1.3em; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
@keyframes bld-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* dice tumble on a new roll, using the board's own dice */
.board .center .dice .die.tumble { animation: die-tumble .75s cubic-bezier(.2,.8,.25,1.1); }
@keyframes die-tumble {
  0% { transform: translateY(-40px) rotate(0deg) scale(.7); }
  60% { transform: translateY(6px) rotate(540deg) scale(1.1); }
  100% { transform: translateY(0) rotate(720deg) scale(1); }
}
.tw-status { font-size: .8rem; text-transform: none; max-width: 24rem; text-align: center; margin-top: .3rem; }
.board .center .main-action #actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }

/* news card */
.news-card { background: #fff; border: 2px solid #090A0E; border-radius: 10px; padding: .6rem .9rem; max-width: 22rem; text-transform: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.3); margin-top: .5rem; font-family: Arial, sans-serif; }
.news-card.deck-chance { border-color: #e65100; }
.news-card.deck-community { border-color: #1565c0; }
.nc-deck { font-size: .7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; }
.nc-logo { height: 1.6em; max-width: 5em; object-fit: contain; margin: .3em 0; }
.nc-title { font-weight: 800; font-size: .95rem; margin: .2em 0; }
.nc-desc { font-size: .85rem; }
.nc-link { display: inline-block; margin-top: .4em; font-size: .8rem; }

/* side panel under the board (same spot as the index.php tabletop) */
.tw-side { width: 47.5rem; max-width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; font-family: Arial, sans-serif; }
.tw-side .panel { background: #fff; border-radius: 10px; padding: 12px 14px; box-shadow: 0 0 10px rgba(0,0,0,.1); }
.tw-side h3 { margin: 0 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .5px; }
.tw-side button { font: inherit; padding: 7px 12px; border-radius: 8px; border: 1px solid #b0b7c3; background: #f3f4f6; }
.tw-side button.danger { color: var(--accent); border-color: var(--accent); background: #fff; margin-top: 8px; }
.tw-side button.mini { padding: 3px 7px; font-size: 12px; }
.tw-side input, .tw-side select { font: inherit; padding: 6px 8px; border: 1px solid #b0b7c3; border-radius: 8px; width: 100%; box-sizing: border-box; }
.muted { color: var(--muted); font-size: 13px; }
.players { list-style: none; margin: 0; padding: 0; }
.players li { display: grid; grid-template-columns: 14px 1fr auto; column-gap: 8px; padding: 6px; border-radius: 8px; align-items: center; }
.players li.current { background: #fff6d6; }
.players li.out { opacity: .5; text-decoration: line-through; }
.players .dot { width: 12px; height: 12px; border-radius: 50%; grid-row: 1 / 3; }
.players .pn { font-weight: 700; } .players .pm { font-weight: 800; }
.players .ps { grid-column: 2 / 4; font-size: 12px; color: var(--muted); }
.props .prop { display: grid; grid-template-columns: 10px 1fr auto; column-gap: 8px; row-gap: 4px; align-items: center; padding: 6px 0; border-bottom: 1px solid #eee; font-size: 13px; }
.props .sw { width: 10px; height: 24px; border-radius: 3px; grid-row: 1 / 3; }
.props .pl { font-size: 12px; color: var(--muted); }
.props .tools { grid-column: 2 / 4; display: flex; gap: 4px; flex-wrap: wrap; }
.trade { background: #f3f6fb; border-radius: 8px; padding: 8px; margin-bottom: 8px; font-size: 13px; }
.trade-btns { display: flex; gap: 6px; margin-top: 6px; }
#trade-form { display: grid; gap: 8px; margin-top: 8px; font-size: 13px; }
#trade-form .pick { display: grid; gap: 2px; max-height: 140px; overflow-y: auto; background: #fafafa; border-radius: 8px; padding: 6px; }
#trade-form .pick input { width: auto; }
.log { list-style: none; margin: 0; padding: 0; font-size: 13px; max-height: 220px; overflow-y: auto; }
.log li { padding: 4px 0; border-bottom: 1px dashed #e5e7eb; }
.pick-title { margin: 10px 0 6px; font-size: 13px; text-transform: uppercase; }
.figures { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 6px; }
.figures .figure { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; background: #f6f7f9; border: 2px solid transparent; border-radius: 10px; font-size: 11px; }
.figures .figure img { width: 48px; height: 48px; object-fit: contain; }
.figures .figure.mine { border-color: var(--accent); background: #fff1f1; font-weight: 700; }
.figures .figure.taken { opacity: .35; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #111; color: #fff; padding: 10px 18px; border-radius: 999px; z-index: 50; font-family: Arial, sans-serif; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 16px; }
.modal .modal-body { background: #fff; border-radius: 12px; padding: 18px; width: 100%; max-width: 340px; font-family: Arial, sans-serif; }
.modal .modal-body table { width: 100%; border-collapse: collapse; font-size: 14px; }
.modal .modal-body td { padding: 3px 0; border-bottom: 1px solid #eee; }
.modal .modal-body td:last-child { text-align: right; font-weight: 700; }
.tw-topbar { width: 47.5rem; max-width: 100%; display: flex; justify-content: space-between; font-family: Arial, sans-serif; font-size: 14px; }

/* spotlight: the player whose turn it is */
.tw-side.solo { grid-template-columns: 1fr; }
.spotlight .sl-main { display: flex; align-items: center; gap: 16px; }
.spotlight .sl-fig { width: 130px; height: 130px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,.45)); animation: bld-pop .4s ease-out; }
.spotlight .sl-turn { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.spotlight .sl-name { font-size: 26px; font-weight: 900; }
.spotlight .sl-cash { font-size: 15px; font-weight: 700; margin-top: 2px; }
.spotlight .sl-props { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 12px; font-size: 13px; }
.spotlight .sl-props li { display: flex; align-items: center; gap: 6px; padding: 3px 0; border-bottom: 1px solid #eee; }
.spotlight .sl-props li.mort .pn { text-decoration: line-through; color: var(--muted); }
.spotlight .sl-props li.none { color: var(--muted); border: 0; }
.spotlight .sl-props .sw { width: 10px; height: 18px; border-radius: 3px; flex: 0 0 auto; }
.spotlight .sl-props .pn { font-weight: 600; flex: 1; }
.spotlight .sl-props .pl { font-size: 11px; color: var(--muted); }
.spotlight .sl-others { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; font-size: 12px; color: #444; }
.spotlight .sl-others .mini { display: inline-flex; align-items: center; gap: 4px; }
.spotlight .sl-others .mini img { width: 26px; height: 26px; object-fit: contain; }
.spotlight .sl-others .mini.out { opacity: .4; text-decoration: line-through; }

/* live page: card + game detail left, board middle, player right */
.tw-stage { display: flex; gap: 1rem; align-items: flex-start; justify-content: center; flex-wrap: wrap; }
.tw-left, .tw-right { width: 300px; display: grid; gap: 1rem; font-family: Arial, sans-serif; }
.tw-left .panel, .tw-right .panel { background: #fff; border-radius: 10px; padding: 12px 14px; box-shadow: 0 0 10px rgba(0,0,0,.1); }
.tw-left h3, .tw-right h3 { margin: 0 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .5px; }
.tw-left .news-card { margin: 0; max-width: none; box-shadow: none; }
.tw-left .player-info { font-family: "Josefin Sans", sans-serif; text-transform: uppercase; font-size: 14px; }
.tw-left .tw-status { text-align: left; font-size: 14px; max-width: none; }
.recent { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; color: #444; }
.recent li { padding: 4px 0; border-top: 1px dashed #e5e7eb; }
.tw-right .spotlight .sl-main { flex-direction: column; text-align: center; }
.tw-right .spotlight .sl-fig { width: 170px; height: 170px; }
.tw-right .spotlight .sl-props { grid-template-columns: 1fr; }
.tw-topbar { width: auto; min-width: 47.5rem; }

/* desktop: always 3 columns, board scaled to fit the screen height */
@media (min-width: 1000px) {
  body:has(.tw-stage) .wrapper { gap: .5rem; padding-top: .5rem; min-height: 0; }
  .tw-stage { flex-wrap: nowrap; width: 100%; padding: 0 12px; box-sizing: border-box; }
  .tw-left, .tw-right { width: auto; flex: 1 1 0; min-width: 220px; max-width: 340px; max-height: calc(100vh - 60px); overflow-y: auto; }
  .tw-stage main.container { flex: 0 0 auto; padding: .5rem; }
  .tw-topbar { min-width: 0; width: 100%; padding: 0 16px; box-sizing: border-box; }
}

/* live page v2: nothing above the board, side tabs on phones */
body:has(.tw-stage) .wrapper { gap: 0; padding-top: 8px; min-height: 0; }
.tw-tab { display: none; }
.tw-play { display: block; text-align: center; background: #ED1B24; color: #fff; font: 800 16px Arial, sans-serif; padding: 12px; border-radius: 10px; text-decoration: none; text-transform: uppercase; letter-spacing: 1px; }
@media (min-width: 1000px) {
  .tw-stage { flex-wrap: nowrap; width: 100%; padding: 0 12px; box-sizing: border-box; }
  .tw-left, .tw-right { max-height: calc(100vh - 16px); }
}
@media (max-width: 999px) {
  .tw-stage { display: block; width: 100%; }
  .tw-stage main.container { padding: 2px; margin: 0 auto; width: max-content; border-radius: 0; }
  .board { width: 47.5rem !important; height: 47.5rem !important; max-width: none !important; }
  .tw-left, .tw-right { position: fixed; top: 0; bottom: 0; width: 82vw; max-width: 340px; max-height: none; overflow-y: auto; z-index: 60;
    background: #f2f2f2; padding: 12px; box-sizing: border-box; transition: transform .3s ease; align-content: start; }
  .tw-left { left: 0; transform: translateX(-100%); }
  .tw-right { right: 0; transform: translateX(100%); }
  .tw-left.open, .tw-right.open { transform: none; box-shadow: 0 0 24px rgba(0,0,0,.35); }
  .tw-tab { display: block; position: absolute; top: 40%; padding: 10px 6px; writing-mode: vertical-rl; background: #ED1B24; color: #fff; border: 0;
    font: 800 13px Arial, sans-serif; letter-spacing: 1px; text-transform: uppercase; cursor: pointer; }
  .tw-left .tw-tab { left: 100%; border-radius: 0 8px 8px 0; }
  .tw-right .tw-tab { right: 100%; border-radius: 8px 0 0 8px; transform: rotate(180deg); }
  .tw-right .tw-tab { border-radius: 0 8px 8px 0; }
  .tw-left, .tw-right { overflow: visible; }
  .tw-left > .panel, .tw-right > .panel { max-height: 80vh; overflow-y: auto; }
}

/* donate */
.tw-donate { text-align: center; font-family: Arial, sans-serif; }
.tw-paypal { display: block; background: #FFC439; color: #003087; font: 800 16px Arial, sans-serif; padding: 11px; border-radius: 10px; text-decoration: none; }
.tw-paypal:hover { background: #f2b51f; }
.tw-donate p { margin: 6px 4px 0; font-size: 13px; color: #444; font-style: italic; }

/* donate list */
button.tw-paypal { width: 100%; border: 0; cursor: pointer; }
.tw-addme { margin-top: 8px; background: none; border: 0; color: #003087; text-decoration: underline; font: 700 13px Arial, sans-serif; cursor: pointer; }
.tw-dcount { font-size: 12px; color: #666; margin-top: 2px; }
.tw-dform { display: grid; gap: 10px; text-align: left; }
.tw-dform h3 { margin: 0; }
.tw-dform label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
.tw-dform input[type=text] { font: inherit; padding: 8px 10px; border: 1px solid #b0b7c3; border-radius: 8px; }
.tw-dform .tw-agree { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.tw-dmsg { font-size: 14px; min-height: 18px; }
.tw-dmsg.ok { color: #1b7f3a; } .tw-dmsg.bad { color: #c62828; }
.tw-dbtns { display: flex; gap: 8px; }
.tw-dbtns button { flex: 1; padding: 10px; border-radius: 10px; font: 700 15px Arial, sans-serif; }
.tw-dbtns button[type=button] { background: #f3f4f6; border: 1px solid #b0b7c3; }

/* about link */
.tw-about { display: block; text-align: right; font: 700 14px Arial, sans-serif; color: #003087; text-decoration: none; padding: 2px 4px; }
.tw-about:hover { text-decoration: underline; }

/* footer links */
.tw-foot { text-align: center; font: 13px Arial, sans-serif; color: #666; padding: 14px 8px; }
.tw-foot a { color: #003087; text-decoration: none; }
.tw-foot a:hover { text-decoration: underline; }
.tw-left .tw-foot { padding: 4px 0; text-align: left; }

/* card layer: cards over the board. Change these two numbers to adjust how much of the board shows through */
:root { --card-bg-opacity: .45; --card-text-opacity: .9; }
.card-layer { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 30; }
.tw-card { width: 46%; max-width: 360px; background: rgba(255,255,255,var(--card-bg-opacity)); border: 3px solid #090A0E; border-radius: 14px;
  padding: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.45); pointer-events: auto; cursor: pointer; font-family: Arial, sans-serif; text-transform: none;
  -webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px); animation: tc-in .45s cubic-bezier(.2,.9,.3,1.2); }
.tw-card.out { animation: tc-out .35s ease-in forwards; }
.tw-card .tc-bar { color: #fff; font: 900 20px "Josefin Sans", Arial, sans-serif; text-transform: uppercase; text-align: center; padding: 10px 8px;
  border-radius: 8px; text-shadow: 0 1px 2px rgba(0,0,0,.6); letter-spacing: .5px; }
.tw-card .tc-bar.tc-chance { background: #e65100; }
.tw-card .tc-bar.tc-world { background: #1565c0; }
.tw-card .tc-body { margin-top: 8px; background: rgba(255,255,255,var(--card-text-opacity)); border-radius: 8px; padding: 12px 14px; color: #111; }
.tw-card .tc-who { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: #555; font-weight: 700; margin-bottom: 6px; }
.tw-card .tc-logo { height: 26px; max-width: 90px; object-fit: contain; display: block; margin-bottom: 6px; }
.tw-card .tc-title { font-weight: 800; font-size: 17px; margin-bottom: 6px; line-height: 1.25; }
.tw-card .tc-desc { font-size: 14px; line-height: 1.4; }
.tw-card .tc-link { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 700; color: #003087; }
.tw-card .tc-rents { width: 100%; border-collapse: collapse; font-size: 14px; }
.tw-card .tc-rents td { padding: 3px 0; border-bottom: 1px solid rgba(0,0,0,.12); }
.tw-card .tc-rents td:last-child { text-align: right; font-weight: 700; }
.tw-card .tc-status { margin-top: 8px; font-weight: 800; text-align: center; }
@keyframes tc-in { from { transform: scale(.6) rotate(-4deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tc-out { to { transform: scale(.85); opacity: 0; } }

/* phone tab bar: two big buttons under the board */
.tw-tabbar { display: none; }
@media (max-width: 999px) {
  .tw-left > .tw-tab, .tw-right > .tw-tab { display: none; }
  .tw-tabbar { display: flex; gap: 10px; padding: 12px 10px 16px; }
  .tw-tabbar .tw-tabbig { display: block; position: static; flex: 1; writing-mode: horizontal-tb; transform: none; border-radius: 12px;
    padding: 16px 10px; font: 800 18px Arial, sans-serif; letter-spacing: 1px; text-transform: uppercase; background: #ED1B24; color: #fff;
    border: 3px solid #090A0E; box-shadow: 0 4px 0 #090A0E; }
  .tw-tabbar .tw-tabbig[data-side="tw-right"] { background: #0072BB; }
  .tw-tabbar .tw-tabbig:active { transform: translateY(3px); box-shadow: 0 1px 0 #090A0E; }
}

/* phone v3: news card only over the board, player info under the board, one tab each side */
.tw-drawer-r { display: none; }
@media (max-width: 999px) {
  #left-card { display: none; }
  .tw-tabbar { justify-content: space-between; }
  .tw-tabbar .tw-tabbig { flex: 0 0 auto; width: auto; padding: 14px 18px; font-size: 16px; }
  .tw-right { position: static; transform: none; width: auto; max-width: none; background: none; padding: 0 10px 16px; box-shadow: none; display: grid; gap: 10px; }
  .tw-right > .panel { max-height: none; overflow: visible; }
  .tw-right .spotlight .sl-main { flex-direction: row; text-align: left; }
  .tw-right .spotlight .sl-fig { width: 110px; height: 110px; }
  .tw-right .tw-about { text-align: center; }
  .tw-drawer-r { display: grid; gap: 14px; align-content: start; position: fixed; top: 0; bottom: 0; right: 0; width: 82vw; max-width: 340px;
    background: #f2f2f2; padding: 16px 12px; box-sizing: border-box; z-index: 60; transform: translateX(100%); transition: transform .3s ease; overflow-y: auto; }
  .tw-drawer-r.open { transform: none; box-shadow: 0 0 24px rgba(0,0,0,.35); }
  .card-layer .tw-card { width: 78%; }
}

/* cards same size: every card is the same width and height; long text scrolls inside the card */
.card-layer .tw-card { width: 52%; max-width: 400px; aspect-ratio: 5 / 6; box-sizing: border-box; display: flex; flex-direction: column; }
.card-layer .tw-card .tc-bar { flex: 0 0 auto; }
.card-layer .tw-card .tc-body { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; justify-content: center; }
@media (max-width: 999px) { .card-layer .tw-card { width: 74%; max-width: none; } }

/* phone: Now Playing panel uses the full screen width */
@media (max-width: 999px) {
  body:has(.tw-stage) .wrapper { width: 100%; align-items: stretch; padding-left: 0; padding-right: 0; }
  .tw-stage .tw-right { width: 100% !important; max-width: none !important; min-width: 0; box-sizing: border-box; padding: 0 0 16px; }
  .tw-stage .tw-right .spotlight { width: 100%; box-sizing: border-box; border-radius: 0; }
}

/* phone buttons: red on the left edge, blue on the right edge */
@media (max-width: 999px) {
  .tw-tabbar { justify-content: space-between; padding-left: 10px; padding-right: 10px; }
  .tw-tabbar .tw-tabbig[data-side="tw-left"] { background: #ED1B24; margin-right: auto; }
  .tw-tabbar .tw-tabbig[data-side="tw-drawer-r"] { background: #0072BB; margin-left: auto; }
}

/* phone: full-bleed button bar and Now Playing panel (always the full screen width, whatever the parent's width) */
@media (max-width: 999px) {
  .tw-stage { display: block !important; width: 100% !important; }
  .tw-stage > .tw-tabbar, .tw-stage > .tw-right {
    width: 100vw !important; max-width: 100vw !important; margin-left: calc(50% - 50vw) !important; margin-right: 0 !important;
    box-sizing: border-box !important; align-self: auto;
  }
  .tw-stage > .tw-tabbar { display: flex !important; justify-content: space-between !important; padding: 12px 10px 14px !important; }
  .tw-stage > .tw-right { padding: 0 10px 16px !important; }
  .tw-stage > .tw-right .spotlight { width: 100% !important; border-radius: 10px; }
  .tw-stage > .tw-right .spotlight .sl-main { justify-content: center; }
  .tw-stage > .tw-right .spotlight .sl-props { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .tw-stage > .tw-right .spotlight .sl-others { justify-content: center; }
}

/* phone card size */
@media (max-width: 999px) { .card-layer .tw-card { width: 66% !important; } .card-layer .tw-card .tc-bar { font-size: 17px; padding: 8px; } }

/* phone: player section centered */
@media (max-width: 999px) {
  .tw-stage > .tw-right .spotlight { text-align: center; }
  .tw-stage > .tw-right .spotlight .sl-main { flex-direction: column !important; align-items: center; justify-content: center; text-align: center !important; gap: 6px; }
  .tw-stage > .tw-right .spotlight .sl-info { text-align: center; }
  .tw-stage > .tw-right .spotlight .sl-props { max-width: 420px; margin-left: auto; margin-right: auto; grid-template-columns: 1fr !important; text-align: left; }
  .tw-stage > .tw-right .spotlight .sl-others { justify-content: center; }
  .tw-stage > .tw-right .tw-about { text-align: center; }
}

/* cards centered on the screen (news, world report, country cards and the ads between turns) */
.card-layer { position: fixed !important; inset: 0 !important; z-index: 70 !important; display: flex; align-items: center; justify-content: center; pointer-events: none; padding: 16px; box-sizing: border-box; }
.card-layer .tw-card { width: 420px !important; max-width: 88vw !important; max-height: 82vh; aspect-ratio: 5 / 6; }
@media (max-width: 999px) { .card-layer .tw-card { width: 88vw !important; } }

/* cards over the board v2: the layer is placed over the board by the script; big, near the top, easy to read */
.card-layer { inset: auto !important; align-items: flex-start !important; padding: 4% 3% !important; }
.card-layer .tw-card { width: 94% !important; max-width: 520px !important; aspect-ratio: auto !important; max-height: 92% !important; }
@media (max-width: 999px) {
  .card-layer .tw-card { width: 96% !important; max-width: none !important; }
  .card-layer .tw-card .tc-bar { font-size: 22px !important; padding: 10px 8px !important; }
  .card-layer .tw-card .tc-who { font-size: 13px; }
  .card-layer .tw-card .tc-rents { font-size: 17px; }
  .card-layer .tw-card .tc-rents td { padding: 4px 0; }
  .card-layer .tw-card .tc-status { font-size: 18px; }
  .card-layer .tw-card .tc-title { font-size: 21px; }
  .card-layer .tw-card .tc-desc { font-size: 17px; line-height: 1.45; }
}

/* cards over the board v3: whole card fits on the board, text starts at the top */
.card-layer .tw-card .tc-body { justify-content: flex-start !important; }
@media (max-width: 999px) {
  .card-layer { padding: 3% 2% !important; }
  .card-layer .tw-card { padding: 8px !important; max-height: 96% !important; }
  .card-layer .tw-card .tc-bar { font-size: 19px !important; padding: 7px 8px !important; }
  .card-layer .tw-card .tc-body { padding: 8px 12px !important; margin-top: 6px !important; }
  .card-layer .tw-card .tc-who { font-size: 12px; margin-bottom: 4px; }
  .card-layer .tw-card .tc-rents { font-size: 15px; }
  .card-layer .tw-card .tc-rents td { padding: 2px 0; }
  .card-layer .tw-card .tc-status { font-size: 16px; margin-top: 6px; }
  .card-layer .tw-card .tc-title { font-size: 19px; }
  .card-layer .tw-card .tc-desc { font-size: 16px; }
}

/* phone layout: three rows
   row 1 = the board, full screen width
   row 2 = three columns: red GAME button (left) | empty, widest | blue PLAY button (right), 5px padding
   row 3 = the player section, 90% of the screen width, centered */
@media (max-width: 999px) {
  .tw-stage > .tw-tabbar {
    display: grid !important; grid-template-columns: auto 1fr auto !important; align-items: center;
    width: 100vw !important; max-width: 100vw !important; margin-left: calc(50% - 50vw) !important; margin-right: 0 !important;
    padding: 10px 0 !important; gap: 0 !important; box-sizing: border-box !important;
  }
  .tw-stage > .tw-tabbar .tw-col { padding: 5px; box-sizing: border-box; }
  .tw-stage > .tw-tabbar .tw-col-left { justify-self: start; text-align: left; }
  .tw-stage > .tw-tabbar .tw-col-right { justify-self: end; text-align: right; }
  .tw-stage > .tw-tabbar .tw-tabbig { margin: 0 !important; width: auto !important; min-width: 120px; padding: 14px 22px !important; font-size: 18px !important; }
  .tw-stage > .tw-tabbar .tw-tabbig[data-side="tw-left"] { background: #ED1B24 !important; }
  .tw-stage > .tw-tabbar .tw-tabbig[data-side="tw-drawer-r"] { background: #0072BB !important; }
  .tw-stage > .tw-right {
    width: 90vw !important; max-width: 90vw !important; margin-left: calc(50% - 45vw) !important; margin-right: 0 !important;
    padding: 0 0 16px !important; box-sizing: border-box !important;
  }
  .tw-stage > .tw-right .spotlight { width: 100% !important; }
}

/* phone row 2: 15% | 70% | 15% = the full screen width; each button fills its column (5px padding), left one aligned left, right one aligned right */
@media (max-width: 999px) {
  .tw-stage > .tw-tabbar { grid-template-columns: 15% 70% 15% !important; padding: 8px 0 !important; }
  .tw-stage > .tw-tabbar .tw-col { padding: 5px !important; width: 100%; box-sizing: border-box; }
  .tw-stage > .tw-tabbar .tw-col-left { justify-self: stretch; text-align: left; }
  .tw-stage > .tw-tabbar .tw-col-right { justify-self: stretch; text-align: right; }
  .tw-stage > .tw-tabbar .tw-tabbig { width: 100% !important; min-width: 0 !important; padding: 12px 0 !important; font-size: 13px !important;
    letter-spacing: .5px !important; border-width: 2px !important; border-radius: 9px !important; }
}

/* phone row 3 v2: buttons on each side of the player section, blank row 2, card 70% of the player section */
.tw-row2 { display: none; }
@media (max-width: 999px) {
  .tw-row2 { display: block; height: 14px; }
  .tw-stage > .tw-tabbar { align-items: start !important; padding: 0 0 16px !important; }
  .tw-col-mid { padding: 5px 0 !important; min-width: 0; }
  .tw-col-mid > .tw-right { width: 100% !important; max-width: 100% !important; margin: 0 !important; padding: 0 !important; position: static !important;
    transform: none !important; display: grid; gap: 8px; box-sizing: border-box; }
  .tw-col-mid > .tw-right .spotlight { width: 100% !important; padding: 10px 8px !important; text-align: center; box-sizing: border-box; }
  .tw-col-mid > .tw-right .spotlight .sl-main { flex-direction: column !important; align-items: center; text-align: center !important; }
  .tw-col-mid > .tw-right .spotlight .sl-fig { width: 90px; height: 90px; }
  .tw-col-mid > .tw-right .spotlight .sl-name { font-size: 22px; }
  .tw-col-mid > .tw-right .spotlight .sl-cash { font-size: 13px; }
  .tw-col-mid > .tw-right .spotlight .sl-props { grid-template-columns: 1fr !important; font-size: 13px; }
  .tw-col-mid > .tw-right .spotlight .sl-others { justify-content: center; font-size: 11px; }
  .tw-col-mid > .tw-right .tw-about { text-align: center; font-size: 13px; }
  .card-layer .tw-card { width: var(--card-w, 70%) !important; max-width: none !important; padding: 6px !important; border-width: 2px !important; }
  .card-layer .tw-card .tc-bar { font-size: 14px !important; padding: 6px 4px !important; }
  .card-layer .tw-card .tc-body { padding: 6px 8px !important; margin-top: 5px !important; }
  .card-layer .tw-card .tc-who { font-size: 9px !important; }
  .card-layer .tw-card .tc-rents { font-size: 11.5px !important; }
  .card-layer .tw-card .tc-rents td { padding: 1px 0 !important; }
  .card-layer .tw-card .tc-status { font-size: 12.5px !important; }
  .card-layer .tw-card .tc-title { font-size: 14px !important; }
  .card-layer .tw-card .tc-desc { font-size: 12.5px !important; line-height: 1.35 !important; }
  .card-layer .tw-card .tc-logo { height: 18px; }
  .card-layer .tw-card .tc-link { font-size: 11px; }
  .card-layer { align-items: flex-start !important; }
}

/* phone row 3: letter T - the two buttons and the player section share the same top edge */
@media (max-width: 999px) {
  .tw-stage > .tw-tabbar { align-items: start !important; }
  .tw-stage > .tw-tabbar .tw-col { padding: 0 5px 5px !important; align-self: start !important; }
  .tw-stage > .tw-tabbar .tw-col-mid { padding: 0 !important; }
  .tw-stage > .tw-tabbar .tw-tabbig { margin-top: 0 !important; }
  .tw-col-mid > .tw-right { gap: 0 !important; }
  .tw-col-mid > .tw-right .spotlight { margin-top: 0 !important; order: -1; }
  .tw-col-mid > .tw-right .tw-about { margin-top: 8px; }
  /* active player: bigger figure and name (about 40% more) */
  .tw-col-mid > .tw-right .spotlight .sl-fig { width: 126px !important; height: 126px !important; }
  .tw-col-mid > .tw-right .spotlight .sl-name { font-size: 31px !important; }
}
.fig.current { z-index: 5; }

/* phone: card is a tall vertical rectangle, lowered to the middle of the board; more space in row 2 */
@media (max-width: 999px) {
  .card-layer { align-items: center !important; padding: 4% 2% !important; }
  .card-layer .tw-card { aspect-ratio: 5 / 8 !important; max-height: 94% !important; height: auto; }
  .card-layer .tw-card .tc-body { justify-content: center !important; }
  .tw-row2 { height: 32px !important; }
}

/* phone player section: figure and name 50% bigger and centered; everything else aligned left;
   country list 30% bigger with its own scroll bar when it doesn't fit */
@media (max-width: 999px) {
  .tw-col-mid > .tw-right .spotlight { text-align: left !important; }
  .tw-col-mid > .tw-right .spotlight .sl-main { flex-direction: column !important; align-items: stretch !important; text-align: left !important; }
  .tw-col-mid > .tw-right .spotlight .sl-fig { width: 189px !important; height: 189px !important; align-self: center; }
  .tw-col-mid > .tw-right .spotlight .sl-info { text-align: left !important; }
  .tw-col-mid > .tw-right .spotlight .sl-name { font-size: 46px !important; line-height: 1.05; text-align: center !important; }
  .tw-col-mid > .tw-right .spotlight .sl-turn, .tw-col-mid > .tw-right .spotlight .sl-cash { text-align: left !important; }
  .tw-col-mid > .tw-right .spotlight .sl-props { font-size: 17px !important; text-align: left !important; max-height: 190px; overflow-y: auto;
    padding-right: 4px; scrollbar-width: thin; scrollbar-color: #9aa3b2 #eef0f3; }
  .tw-col-mid > .tw-right .spotlight .sl-props::-webkit-scrollbar { width: 6px; }
  .tw-col-mid > .tw-right .spotlight .sl-props::-webkit-scrollbar-thumb { background: #9aa3b2; border-radius: 3px; }
  .tw-col-mid > .tw-right .spotlight .sl-props .pn { text-align: left !important; }
  .tw-col-mid > .tw-right .spotlight .sl-others { justify-content: flex-start !important; }
}

@media (max-width: 999px) { .tw-col-mid > .tw-right .spotlight .sl-name { overflow-wrap: anywhere; } }

/* phone card: 15% shorter, and 25px lower so it sits in the center of the board */
@media (max-width: 999px) {
  .card-layer .tw-card { aspect-ratio: 25 / 34 !important; position: relative; top: 25px; }
}

/* card expand: tap a card to show it at the top of the screen, full width; X closes it */
.tw-card { position: relative; }
.tw-card .tc-close { position: absolute; top: -12px; right: -12px; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #090A0E;
  background: #fff; color: #090A0E; font: 900 20px/24px Arial, sans-serif; padding: 0; cursor: pointer; z-index: 2; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.card-layer.is-expanded { align-items: flex-start !important; padding: 0 !important; pointer-events: auto; }
.card-layer.is-expanded .tw-card { width: 100% !important; max-width: none !important; aspect-ratio: auto !important; max-height: 100% !important;
  top: 0 !important; border-radius: 0 0 16px 16px !important; padding: 12px !important; overflow-y: auto; animation: tc-grow .3s ease-out; }
.card-layer.is-expanded .tw-card .tc-close { top: 8px; right: 8px; width: 36px; height: 36px; font-size: 24px; line-height: 30px; }
.card-layer.is-expanded .tw-card .tc-bar { font-size: 26px !important; padding: 12px 44px !important; }
.card-layer.is-expanded .tw-card .tc-body { padding: 14px 16px !important; }
.card-layer.is-expanded .tw-card .tc-who { font-size: 14px !important; }
.card-layer.is-expanded .tw-card .tc-rents { font-size: 20px !important; }
.card-layer.is-expanded .tw-card .tc-rents td { padding: 5px 0 !important; }
.card-layer.is-expanded .tw-card .tc-status { font-size: 21px !important; }
.card-layer.is-expanded .tw-card .tc-title { font-size: 23px !important; }
.card-layer.is-expanded .tw-card .tc-desc { font-size: 19px !important; line-height: 1.45 !important; }
.card-layer.is-expanded .tw-card .tc-logo { height: 32px !important; }
.card-layer.is-expanded .tw-card .tc-link { font-size: 16px !important; }
@keyframes tc-grow { from { transform: scale(.85); opacity: .6; } to { transform: none; opacity: 1; } }

/* houses on the color bar: green houses (1 to 4) or a red hotel, sitting on top of the country's color band */
.board .row .space.property .container { position: relative; }
.board .space .houses { position: absolute; top: 0; left: 0; right: 0; height: 1.25rem; display: flex; align-items: center; justify-content: center;
  gap: 2px; z-index: 4; pointer-events: none; }
.board .space .houses i { display: block; width: .62rem; height: .62rem; background: #1b9e3e; border: 1px solid #0b4a1c;
  clip-path: polygon(50% 0, 100% 40%, 100% 100%, 0 100%, 0 40%); box-shadow: 0 1px 1px rgba(0,0,0,.4); }
.board .space .houses i.hotel { width: 1.6rem; height: .8rem; background: #d62020; border-color: #6d0d0d; clip-path: polygon(50% 0, 100% 35%, 100% 100%, 0 100%, 0 35%); }
.board .space .houses.pop i { animation: house-drop .5s cubic-bezier(.2,.9,.3,1.3); }
@keyframes house-drop { from { transform: translateY(-14px) scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.board .space[data-group="4"] .houses i.hotel { background: #8b0000; outline: 2px solid #fff; }

/* expanded card keeps the same shape as the card that popped up, just bigger: as large as the screen allows, at the top */
.card-layer.is-expanded { justify-content: center !important; }
.card-layer.is-expanded .tw-card { aspect-ratio: var(--card-ratio, 25 / 34) !important;
  width: min(calc(100vw - 16px), calc((100vh - 16px) * var(--card-r, .735))) !important;
  max-width: none !important; max-height: none !important; height: auto !important; margin-top: 8px; border-radius: 16px !important; }

/* flag on country cards: top-right corner of the color bar */
.tw-card .tc-bar { position: relative; }
.tw-card .tc-flag { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); height: 70%; max-height: 34px; width: auto;
  border: 1px solid rgba(0,0,0,.35); border-radius: 3px; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.card-layer .tw-card .tc-bar { padding-left: 44px !important; padding-right: 44px !important; }

/* card zoom: tapping a card scales the whole card up (like zooming in); the board behind is dimmed */
.card-layer.is-zoomed { pointer-events: auto; background: rgba(0,0,0,.35); }
.tw-card.zoomed { z-index: 5; }

/* phone: the page must never be wider than the screen (the slide-out panels sit off-screen and used to widen the page) */
@media (max-width: 999px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  @supports (overflow: clip) { html, body { overflow-x: clip; } }
  .tw-stage { overflow-x: clip; }
}

/* store ads between turns: over the middle of the board */
.tw-ad { position: fixed; z-index: 60; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.tw-ad-card { pointer-events: auto; position: relative; width: min(80%, 360px); max-height: 92%; overflow: auto; background: #fff; border-radius: 14px;
  border: 3px solid #003087; box-shadow: 0 10px 30px rgba(0,0,0,.45); padding: 14px; text-align: center; font-family: Arial, sans-serif; box-sizing: border-box;
  animation: twAdIn .35s ease; }
@keyframes twAdIn { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.tw-ad-top { font: 700 11px Arial, sans-serif; color: #777; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.tw-ad-img { width: 100%; max-height: 180px; object-fit: contain; margin-bottom: 8px; }
.tw-ad-name { font: 800 18px Arial, sans-serif; color: #1b1b1b; line-height: 1.2; }
.tw-ad-head { font-size: 14px; color: #333; margin-top: 4px; }
.tw-ad-biz { font: 700 13px Arial, sans-serif; color: #003087; margin: 6px 0 10px; }
.tw-ad-btn { display: block; margin: 6px 0; padding: 10px; border-radius: 10px; border: 2px solid #090A0E; box-shadow: 0 3px 0 #090A0E;
  font: 800 14px Arial, sans-serif; text-transform: uppercase; text-decoration: none; color: #fff; }
.tw-ad-buy { background: #ED1B24; }
.tw-ad-store { background: #0072BB; }
.tw-ad-mine { display: block; margin-top: 8px; font-size: 12px; color: #003087; }
.tw-ad .tc-close { position: absolute; top: 6px; right: 6px; }
/* store ads: always the top layer; on phones use the whole screen so the buttons always show */
.tw-ad { z-index: 100000 !important; }
@media (max-width: 999px) {
  .tw-ad { top: 0 !important; left: 0 !important; width: 100vw !important; height: 100vh !important; height: 100dvh !important; background: rgba(0,0,0,.55); pointer-events: auto; }
  .tw-ad-card { width: 88vw; max-width: 380px; max-height: 92vh; max-height: 92dvh; padding: 12px; }
  .tw-ad-img { max-height: 32vh; }
  .tw-ad-name { font-size: 17px; }
  .tw-ad-btn { padding: 12px; font-size: 15px; }
}
/* phone: one consistent card style, every size taken from the card width (--card-w) */
@media (max-width: 999px) {
  .card-layer:not(.is-expanded) .tw-card { --u: calc(var(--card-w, 200px) / 100); }
  .card-layer:not(.is-expanded) .tw-card .tc-bar { font-size: calc(var(--u) * 7) !important; line-height: 1.15 !important; padding: calc(var(--u) * 3) calc(var(--u) * 14) !important;
    min-height: calc(var(--u) * 14); display: flex !important; align-items: center; justify-content: center; box-sizing: border-box; overflow-wrap: anywhere; }
  .card-layer:not(.is-expanded) .tw-card .tc-flag { height: auto !important; width: calc(var(--u) * 11) !important; max-height: none !important; right: calc(var(--u) * 2) !important; }
  .card-layer:not(.is-expanded) .tw-card .tc-who,
  .card-layer:not(.is-expanded) .tw-card .tc-status { font-size: calc(var(--u) * 5.5) !important; line-height: 1.25 !important; }
  .card-layer:not(.is-expanded) .tw-card .tc-rents { font-size: calc(var(--u) * 5.2) !important; }
  .card-layer:not(.is-expanded) .tw-card .tc-rents td { padding: calc(var(--u) * 0.6) 0 !important; }
  .card-layer:not(.is-expanded) .tw-card .tc-title { font-size: calc(var(--u) * 7) !important; line-height: 1.2 !important; }
  .card-layer:not(.is-expanded) .tw-card .tc-desc { font-size: calc(var(--u) * 5.5) !important; line-height: 1.3 !important; }
  .card-layer:not(.is-expanded) .tw-card .tc-link { font-size: calc(var(--u) * 5) !important; }
}

/* phone cards: lighter type */
@media (max-width: 999px) {
  .card-layer:not(.is-expanded) .tw-card .tc-bar { font-weight: 700 !important; font-family: Arial, sans-serif !important; letter-spacing: .2px; }
  .card-layer:not(.is-expanded) .tw-card .tc-rents td, .card-layer:not(.is-expanded) .tw-card .tc-who,
  .card-layer:not(.is-expanded) .tw-card .tc-status, .card-layer:not(.is-expanded) .tw-card .tc-desc { font-weight: 400 !important; }
  .card-layer:not(.is-expanded) .tw-card .tc-rents td:last-child { font-weight: 600 !important; }
  .card-layer:not(.is-expanded) .tw-card .tc-title { font-weight: 700 !important; }
}

/* store ads: buttons always visible - the card is a column, the picture shrinks first, text is cut to 2 lines */
.tw-ad-card { display: flex !important; flex-direction: column; overflow: hidden !important; max-height: 94% !important; }
.tw-ad-top, .tw-ad-biz, .tw-ad-btn, .tw-ad-mine { flex: 0 0 auto; }
.tw-ad-img { flex: 1 1 auto; min-height: 60px; max-height: 200px; height: auto; width: 100%; object-fit: contain; margin-bottom: 6px; }
.tw-ad-name { flex: 0 0 auto; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 16px !important; line-height: 1.2; }
.tw-ad-head { flex: 0 0 auto; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px !important; line-height: 1.25; }
.tw-ad-biz { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 4px 0 6px !important; }
.tw-ad-btn { margin: 4px 0 !important; padding: 9px 6px !important; font-size: 14px !important; white-space: nowrap; }
.tw-ad-mine { margin-top: 4px !important; }
@media (max-width: 999px) {
  .tw-ad-card { max-height: 88vh !important; max-height: 88dvh !important; }
  .tw-ad-img { max-height: 28vh; }
}
@media (max-height: 520px) {
  .tw-ad-img { max-height: 90px; }
  .tw-ad-head, .tw-ad-mine { display: none !important; }
}

/* store ads: the two buttons float over the bottom of the ad, side by side, always on screen */
.tw-ad-card { position: relative; padding-bottom: 64px !important; }
.tw-ad-btns { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; padding: 10px; box-sizing: border-box;
  background: linear-gradient(to top, rgba(255,255,255,.97) 70%, rgba(255,255,255,0)); border-radius: 0 0 12px 12px; z-index: 2; }
.tw-ad-btns .tw-ad-btn { flex: 1 1 0; margin: 0 !important; padding: 10px 4px !important; font-size: 13px !important; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tw-ad-img { max-height: none; }
@media (max-width: 999px) { .tw-ad-img { max-height: 40vh; } }
