/* Add after touch-layout.v1.css. Public lobby/garden only; existing theme retained. */
.phone-board-controls { margin-top: 14px; border: 1px solid var(--arcade-line); border-radius: 12px; }
.phone-board-controls > summary { min-height: 48px; padding: 12px; cursor: pointer; font-weight: 700; }
.phone-board-controls > [data-board-options] { padding: 0 12px 12px; }
.phone-board-controls h4 { margin: 12px 0 8px; font-size: 1rem; }
.phone-board-controls .phone-board-status { margin: 0; }
.phone-board-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.phone-board-option { min-width: 0; min-height: 56px; white-space: normal; text-align: left; padding: 10px; }
.phone-board-option strong, .phone-board-option span { display: block; overflow-wrap: anywhere; }
.phone-board-option strong { font-variant-numeric: tabular-nums; }
.phone-board-option span { font-size: .875rem; }
.phone-board-option[aria-pressed="true"] { outline: 2px solid var(--arcade-lime); outline-offset: -2px; }
.lounge-layout.match-focused { grid-template-columns: minmax(0, 1fr); }
.lounge-layout.match-focused [data-community],
.lounge-layout.match-focused > aside,
.lounge-layout.match-focused .lounge-games { display: none; }
.lounge-match-tools { justify-content: flex-end; }
.lounge-match-tools button { white-space: normal; }
.phone-board-controls :focus-visible { scroll-margin-block: 24px; }
.bud-scene canvas { touch-action: pan-y pinch-zoom; }
.bud-dialog[data-bud-playing="true"] .bud-scene canvas { touch-action: none; }
.bud-play-hud { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; min-height: 48px; padding: 10px 12px; margin-bottom: 8px; border: 1px solid #c9d3c3; border-radius: 10px; background: #fff; color: #244636; font-size: 16px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.bud-play-hud strong { font-size: 1.25em; }
.bud-play-area { scroll-margin-block-start: 16px; }
.bud-dialog[data-bud-playing="true"] .bud-play-message { font-size: 16px; }
.bud-dialog[data-bud-playing="true"] .bud-cancel-play { min-height: 48px; }

@media (max-width: 760px) {
  /* Full-width actions remain readable when a username or browser text grows. */
  [data-room-browser] > .lounge-row { display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  [data-room-browser] > .lounge-row > *,
  [data-signin-form] > *,
  .lounge-chat-form > * { min-width: 0; max-width: 100%; }
  [data-room-browser] > .lounge-row > button,
  [data-signin-form] > button { width: 100%; white-space: normal; }
  [data-capacity-label] { display: grid; gap: 6px; }
  [data-signin-form] { display: grid; grid-template-columns: minmax(0, 1fr); }
  [data-signin-form] > input { width: 100%; }
  [data-waiting] > button { width: 100%; white-space: normal; margin-top: 8px; }
  .lounge-message button { font-size: .875rem; }
  .lounge-chat-form { display: grid; grid-template-columns: minmax(0, 1fr); }
  .lounge-chat-form > :is(input, select, button) { width: 100%; margin-left: 0; }
  .lounge-ranking { table-layout: fixed; }
  .lounge-ranking td { overflow-wrap: anywhere; }
  .lounge-ranking td:first-child { width: 68%; }
  .lounge-room-row > div { flex: 1 1 160px; }
  .lounge-room-row > button { min-width: 96px; }
  .lounge-match-tools { width: 100%; justify-content: stretch; }
  .lounge-match-tools button { flex: 1 1 128px; }
  .lounge-choice .weed-card-art { margin-bottom: 6px; }
  .weed-guide-grid { grid-template-columns: minmax(0, 1fr); }
  .weed-board-caption { flex-wrap: wrap; }
}

@media (max-width: 600px) {
  /* Use the width already inside the shell instead of spending it on nested gutters. */
  .lounge-panel.phone-board-panel {
    width: calc(100% + 28px);
    max-width: none;
    margin-left: -14px;
    margin-right: -14px;
    padding-left: 6px;
    padding-right: 6px;
  }
  .phone-board-panel .weed-board-table { padding: 4px; }
  .arcade-tabs > button { flex: 1 1 0; min-width: 0; white-space: normal; padding-inline: 7px; }
  .arcade-library-heading { align-items: flex-start; flex-wrap: wrap; }
  .arcade-library-heading > span { max-width: none; text-align: left; }
  .phone-board-controls { margin-left: 4px; margin-right: 4px; }
  .lounge-room-row > button { flex: 1 1 100%; }
}

@media (max-width: 680px) {
  /* Keep the existing garden close/sound controls reachable through a long garden. */
  .bud-header { position: sticky; top: var(--touch-safe-top, 0px); z-index: 5; background: inherit; padding-bottom: 8px; }
  .bud-dialog { scroll-padding-top: calc(96px + var(--touch-safe-top, 0px)); }
  .bud-header-actions { margin-left: auto; }
  .bud-header { margin-bottom: 8px; }
  .bud-side > section { padding-top: 0; }
  .bud-care-actions, .bud-pots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bud-care-actions button { min-height: 72px; padding: 10px 8px; }
  .bud-care-actions button strong { white-space: normal; font-size: .875rem; }
  .bud-care-actions button small, .bud-pots button small { overflow-wrap: anywhere; }
  .bud-vitals label > span { flex-wrap: wrap; gap: 4px; }
  .bud-section-heading > :is(span, strong) { white-space: normal; }
  .bud-card { padding: 12px; }
  .bud-dialog :is(input, select, button) { scroll-margin-block: 24px; }
  .bud-side form > .bud-primary { white-space: normal; }
  .bud-rename button { width: 100%; white-space: normal; }
  .bud-rename input { flex-basis: 100%; }
}

/* During a phone round, keep the field and its readable HUD together. Care and
   collection panels return immediately afterward, with their state untouched. */
@media (max-width: 680px), (orientation: landscape) and (max-height: 520px) and (max-width: 1000px) {
  .bud-dialog[data-bud-playing="true"] :is(.bud-side, .bud-bottom, .bud-journal, .bud-footer, .bud-save-note) { display: none; }
  .bud-dialog[data-bud-playing="true"] .bud-layout { display: block; }
  .bud-dialog[data-bud-playing="true"] .bud-kicker { display: none; }
  .bud-dialog[data-bud-playing="true"] .bud-cancel-play { width: 100%; }
}

@media (orientation: landscape) and (max-height: 520px) and (max-width: 1000px) {
  .lounge-layout { grid-template-columns: minmax(0, 1fr); }
  .lounge-match-top { flex-wrap: wrap; }
  .lounge-messages { height: 180px; }
  .bud-header { position: sticky; top: 0; z-index: 5; background: inherit; padding-bottom: 8px; margin-bottom: 8px; }
  .bud-dialog { scroll-padding-top: 88px; }
  .bud-layout { align-items: start; }
  .bud-header h2 { font-size: 26px; }
  .bud-dialog[data-bud-playing="true"] { inset: 0; width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  .bud-dialog[data-bud-playing="true"] .bud-play-area { display: grid; grid-template-columns: minmax(0, 1fr) minmax(140px, 28%); gap: 8px 14px; align-items: start; }
  .bud-dialog[data-bud-playing="true"] .bud-scene { grid-column: 1; grid-row: 1 / span 3; justify-self: center; width: min(100%, max(180px, calc((100dvh - 112px - var(--touch-safe-top) - var(--touch-safe-bottom)) * 40 / 31))); max-height: none; }
  .bud-dialog[data-bud-playing="true"] .bud-scene canvas { height: auto; max-height: none; aspect-ratio: 40 / 31; }
  .bud-dialog[data-bud-playing="true"] .bud-play-hud { grid-column: 2; grid-row: 1; margin: 0; }
  .bud-dialog[data-bud-playing="true"] .bud-play-message { grid-column: 2; grid-row: 2; margin: 0; }
  .bud-dialog[data-bud-playing="true"] .bud-cancel-play { grid-column: 2; grid-row: 3; margin: 0; }
}
