/* BALKANOPOLY — phone / tablet layout: board on top, quick-access dock at the bottom */
#dock {
  display: none;
}
.only-mobile {
  display: none !important;
}
@media (max-width: 900px), (max-aspect-ratio: 1/1) {
  .only-mobile {
    display: inline-flex !important;
  }
  #sidebar {
    display: none;
  }
  #boardWrap {
    flex: 1 1 auto;
  }
  #stage {
    padding: 4px;
    gap: 0;
  }
  #topbar {
    height: 44px;
    padding: 0 8px;
    gap: 6px;
  }
  #topbar .brand {
    font-size: 17px;
  }
  .banner {
    top: 44px;
  }
  #dock {
    display: block;
    flex: none;
    background: var(--paper2);
    border-top: 1px solid var(--rule);
    box-shadow:
      0 -2px 0 var(--paper),
      0 -3px 0 var(--rule);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    z-index: 20;
  }
  .dstatus {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .dstatus .who {
    flex: 1;
    min-width: 0;
  }
  .dstatus .who b {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 17px;
  }
  .dstatus .who small {
    color: var(--muted);
    font-size: 14px;
    font-style: italic;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .dstatus .timer {
    font-size: 22px;
  }
  .dstatus .mycash {
    font-weight: 700;
    font-size: 17px;
    background: var(--paper3);
    border: 1px solid var(--rule);
    padding: 3px 8px;
    font-variant-numeric: tabular-nums;
  }
  .minidice {
    display: flex;
    gap: 3px;
    font-weight: 700;
  }
  .minidice span {
    background: var(--paper3);
    border: 1px solid var(--rule);
    color: var(--ink);
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    font-size: 15px;
  }
  #dock .actions {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    margin-top: 6px;
  }
  #dock .hint {
    margin: 5px 0 0;
    font-size: 14px;
  }
  #dock .alert {
    margin: 6px 0 0;
    padding: 7px 10px;
    font-size: 14px;
  }
  .tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    margin-top: 6px;
  }
  .tabs button {
    background: var(--paper3);
    border: 1px solid var(--light);
    padding: 5px 2px;
    font-size: 18px;
    line-height: 1.1;
    min-height: 46px;
    color: var(--ink);
  }
  .tabs button span {
    display: block;
    font-size: 13px;
    font-style: italic;
    color: var(--muted);
  }
  #toast {
    bottom: 210px;
  }
}
@media (max-width: 420px) {
  #topbar .hide-xs,
  #topbar #musicBtn {
    display: none; /* (v9.8: room for the chat button; music stays in Settings) */
  }
  .btn {
    padding: 9px 10px;
    font-size: 16px;
  }
}

/* ---- phones: everyone's money in a thin bar under the top bar; it stays above pop-up windows ---- */
.moneybar {
  display: none;
}
@media (max-width: 900px), (max-aspect-ratio: 1/1) {
  .moneybar {
    display: flex;
    gap: 6px;
    padding: 4px 8px;
    overflow-x: auto;
    scrollbar-width: none;
    background: var(--paper2);
    border-bottom: 1px solid var(--rule);
    position: relative;
    z-index: 101;
    flex: none;
  }
  .moneybar::-webkit-scrollbar {
    display: none;
  }
  .mchip {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: none;
    padding: 2px 9px 2px 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--pc) 14%, var(--paper));
    box-shadow: inset 0 0 0 1.5px var(--pc);
    font: 14px var(--body);
    color: var(--ink);
    cursor: pointer;
    white-space: nowrap;
  }
  .mchip i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--pc);
  }
  .mchip b {
    font-weight: 600;
    max-width: 78px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mchip span {
    font-family: var(--mono);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }
  .mchip.cur {
    box-shadow: inset 0 0 0 2.5px var(--pc), 0 0 0 2px rgba(59, 45, 29, 0.25);
  }
  .mchip.away {
    opacity: 0.55;
  }
  /* pop-up windows start below the money bar, so it stays readable during a trade */
  #game:not(.hidden) ~ #modalRoot .ov {
    padding-top: 96px;
  }
  #game:not(.hidden) ~ #modalRoot .modal {
    max-height: calc(100dvh - 110px);
  }
}

/* ---- phones (also when saved to the home screen): a top bar that always fits ---- */
@media (max-width: 900px), (max-aspect-ratio: 1/1) {
  #game {
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  #dock {
    padding-bottom: env(safe-area-inset-bottom);
  }
  #topbar {
    overflow: hidden;
  }
  #topbar > * {
    flex: none;
  }
  #topbar .sp {
    flex: 1 1 0;
    min-width: 0;
  }
  #roomPill {
    min-width: 0;
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
@media (max-width: 600px) {
  #topbar .hide-xs,
  #zoomBtn .zl {
    display: none;
  }
  #topbar .pill {
    padding: 3px 8px;
    font-size: 14px;
  }
  #topbar .btn.sm {
    padding: 6px 8px;
  }
}

/* ---- v8.1d: phone game layout polish ---- */
.zinfo {
  display: none;
}
@media (max-width: 900px), (max-aspect-ratio: 1/1) {
  /* the board zoomed out (whole board): board on top, the players list fills the space underneath */
  body:not(.zoomed) #stage {
    flex-direction: column;
    gap: 6px;
  }
  body:not(.zoomed) #boardWrap {
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: calc(100% - 96px);
  }
  body:not(.zoomed) .zinfo {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    margin: 0 4px 2px;
    padding: 8px 12px;
    box-shadow: none;
  }
  .zinfo h4 {
    margin: 0 0 4px;
    font-size: 15px;
  }
  /* bottom strip in two clean lines: whose turn + timer, then the dice + your money */
  .dstatus {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      'av who timer'
      'av dice cash';
    column-gap: 10px;
    row-gap: 3px;
    align-items: center;
  }
  .dstatus > .av {
    grid-area: av;
  }
  .dstatus .who {
    grid-area: who;
  }
  .dstatus .timer {
    grid-area: timer;
    justify-self: end;
  }
  .dstatus .minidice {
    grid-area: dice;
    justify-self: start;
  }
  .dstatus .mycash {
    grid-area: cash;
    justify-self: end;
  }
  /* money chips share the width (no more names running off the screen); two lines: name, money */
  .moneybar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
    overflow-x: visible;
  }
  .mchip {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    min-width: 0;
    padding: 3px 8px 3px 10px;
    border-radius: 3px;
    background: var(--paper3);
    box-shadow: inset 4px 0 0 var(--pc), inset 0 0 0 1px var(--rule);
    line-height: 1.15;
  }
  .mchip i {
    display: none;
  }
  .mchip b {
    max-width: 100%;
    font-size: 13px;
  }
  .mchip span {
    font-size: 14px;
  }
  .mchip.cur {
    box-shadow: inset 4px 0 0 var(--pc), inset 0 0 0 2px var(--good);
  }
}
