/* Play shell layout (SPEC_V1 5.2). Desktop first, phone must work. */
body.mc-play { min-height: 100vh; display: flex; flex-direction: column; }

.mc-bar { display: flex; align-items: center; gap: 16px; padding: 10px 20px; border-bottom: 1px solid var(--mc-border); background: var(--mc-surface); }
.mc-bar h1 { font-size: 20px; margin: 0; flex: 1; }
.mc-game-link { color: inherit; text-decoration: none; }
.mc-game-link:hover, .mc-game-link:focus-visible { text-decoration: underline; }
.mc-bar .button { min-height: 36px; padding: 6px 14px; }
.mc-muted { color: var(--mc-text-muted); font-size: 14px; }

.mc-layout { flex: 1; display: grid; grid-template-columns: 1fr 320px; gap: 20px; padding: 20px; max-width: 1400px; width: 100%; margin: 0 auto; }
.mc-view { background: var(--mc-surface); border: 1px solid var(--mc-border); border-radius: var(--mc-radius); box-shadow: var(--mc-shadow); padding: 16px; min-height: 420px; position: relative; overflow: hidden; }
.mc-panel { display: flex; flex-direction: column; gap: 14px; }

.mc-turn { margin: 0; font-weight: 800; font-size: 18px; min-height: 1.5em; }
.mc-seats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mc-seat { display: grid; grid-template-columns: 14px 1fr auto auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--mc-radius-sm); background: var(--mc-surface); border: 2px solid var(--mc-border); }
.mc-seat.is-turn { border-color: var(--mc-text); }
.mc-seat-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--mc-p0); }
.mc-p1 .mc-seat-dot { background: var(--mc-p1); }
.mc-p2 .mc-seat-dot { background: var(--mc-green); }
.mc-p3 .mc-seat-dot { background: var(--mc-magenta); }
.mc-seat-name { font-weight: 700; }
.mc-seat-id { color: var(--mc-text-muted); font-size: 13px; font-family: var(--mc-font-mono); }
.mc-seat-score { font-weight: 800; font-size: 20px; min-width: 2ch; text-align: right; }
/* D136: invite your own agent from a seat row (seat-invite.js): the name is a button with a small menu under the row. */
.mc-seat-menu-btn { display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 2px 6px; margin: -2px -6px; font: inherit; color: inherit; text-align: left; background: none; border: 0; border-radius: var(--mc-radius-sm); cursor: pointer; }
.mc-seat-menu-btn:hover, .mc-seat-menu-btn[aria-expanded="true"] { background: var(--mc-surface-2); }
.mc-seat-menu-btn:focus-visible { outline: 3px solid var(--mc-violet); outline-offset: 1px; }
.mc-seat-menu-caret { font-size: 12px; color: var(--mc-text-muted); }
.mc-seat-menu { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; }
.mc-seat-menu-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 8px 10px; font: inherit; color: inherit; text-align: left; background: var(--mc-surface-2); border: 2px solid var(--mc-border); border-radius: var(--mc-radius-sm); cursor: pointer; }
.mc-seat-menu-item:hover, .mc-seat-menu-item:focus-visible { border-color: var(--mc-text); outline: none; }
.mc-seat-menu-item .mc-muted { font-size: 13px; font-weight: 400; }
.mc-seat-confirm p { margin: 0 0 8px; }
.mc-seat-confirm-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.mc-result:empty { display: none; }
.mc-result { background: var(--mc-surface-2); border-radius: var(--mc-radius); padding: 16px; }
.mc-result h2 { margin: 0 0 6px; font-size: 24px; }
.mc-best { color: var(--mc-violet); font-weight: 800; }

.mc-log-wrap summary { cursor: pointer; font-weight: 700; }
.mc-log { list-style: none; margin: 8px 0 0; padding: 0; max-height: 320px; overflow: auto; font-size: 14px; font-family: var(--mc-font-mono); }
.mc-log li { padding: 4px 0; border-bottom: 1px dashed var(--mc-border); }
.mc-log-error { color: #c0262d; }

.mc-fatal { grid-column: 1 / -1; text-align: center; padding: 60px 20px; }

/* Default view */
.mc-default-view { display: flex; flex-direction: column; gap: 16px; }
.mc-describe { font-size: 18px; margin: 0; white-space: pre-wrap; }
.mc-action { border: 1px solid var(--mc-border); border-radius: var(--mc-radius-sm); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.mc-action h3 { margin: 0; font-size: 16px; }
.mc-field { display: grid; grid-template-columns: 140px 1fr 90px; align-items: center; gap: 10px; }
.mc-field input[type="range"] { width: 100%; }
.mc-num { width: 90px; padding: 6px; border: 1px solid var(--mc-border); border-radius: 6px; font: inherit; }
.mc-choices { display: flex; flex-wrap: wrap; gap: 8px; grid-column: 2 / -1; }
.mc-choice { min-width: 44px; min-height: 44px; border-radius: 10px; border: 2px solid var(--mc-text); background: var(--mc-surface); font: inherit; font-weight: 700; cursor: pointer; }
.mc-choice:hover, .mc-choice.is-on { background: var(--mc-yellow); }
.mc-json pre { max-height: 260px; overflow: auto; background: var(--mc-surface-2); padding: 10px; border-radius: 8px; font-size: 13px; }

button.button { cursor: pointer; font: inherit; font-weight: 700; }

@media (max-width: 1023px) {
  .mc-layout { grid-template-columns: 1fr 280px; }
}
@media (max-width: 767px) {
  .mc-bar { padding: 8px 12px; gap: 10px; flex-wrap: wrap; }
  .mc-bar .brand { font-size: 0; gap: 0; }
  #mc-seed { display: none; }
  .mc-layout { grid-template-columns: 1fr; padding: 10px; gap: 12px; }
  .mc-view { min-height: 0; padding: 10px; }
  .mc-field { grid-template-columns: 1fr 80px; }
  .mc-field > span { grid-column: 1 / -1; }
  .mc-log-wrap:not([open]) .mc-log { display: none; }
}

/* Replay bar, agent view, rules dialog (F3) */
.mc-replay-bar:empty { display: none; }
.mc-replay-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 20px; background: var(--mc-surface-2); border-bottom: 1px solid var(--mc-border); }
.mc-replay-bar .button { min-height: 36px; padding: 6px 14px; }
.mc-speed.is-on { background: var(--mc-yellow); }
.mc-result-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.mc-history-note { font-size: 13px; margin: 4px 0 8px; }
.mc-history-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 12px; }
.mc-history-tools input[type="date"] { min-height: 36px; padding: 4px 8px; border: 1px solid var(--mc-border); border-radius: 8px; font: inherit; }
.mc-agent-view summary { cursor: pointer; font-weight: 700; }
.mc-agent-view pre { white-space: pre-wrap; font-size: 13px; background: var(--mc-surface-2); padding: 10px; border-radius: 8px; max-height: 300px; overflow: auto; }
.mc-visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: pre; border: 0; }
.mc-dialog { max-width: min(720px, 92vw); border: 1px solid var(--mc-border); border-radius: var(--mc-radius); padding: 18px; }
.mc-dialog pre { white-space: pre-wrap; font-family: var(--mc-font); font-size: 15px; }
.mc-dialog::backdrop { background: rgba(29, 22, 48, 0.4); }

/* Watch page */
.mc-replay-list { list-style: none; padding: 0; margin: 0 0 32px; display: flex; flex-direction: column; gap: 10px; }
.mc-replay-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--mc-surface); border: 1px solid var(--mc-border); border-radius: var(--mc-radius-sm); padding: 12px 16px; }
.mc-replay-item p { margin: 2px 0 0; }

/* Full window mode (fullwindow.js): the game fills the browser window. */
body.mc-full { overflow: hidden; }
body.mc-full .chroma-bar, body.mc-full .mc-bar, body.mc-full .mc-panel, body.mc-full .mc-replay-bar:empty { display: none; }
body.mc-full .mc-layout { display: block; padding: 0; max-width: none; }
body.mc-full .mc-view { position: fixed; inset: 0; border: 0; border-radius: 0; box-shadow: none; min-height: 0; padding: 56px 16px 16px; overflow: auto; display: flex; align-items: center; justify-content: center; z-index: 1; }
body.mc-full .mc-view > * { margin: auto; }
.mc-full-bar { position: fixed; top: 8px; right: 8px; left: 8px; z-index: 2; display: flex; align-items: center; justify-content: flex-end; gap: 8px; pointer-events: none; }
.mc-full-bar > * { pointer-events: auto; }
.mc-full-bar[hidden] { display: none; }
.mc-full-status { margin-right: auto; padding: 6px 12px; border-radius: 999px; background: rgba(29, 22, 48, 0.78); color: #fff; font-weight: 700; font-size: 14px; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-full-status:empty { visibility: hidden; }
.mc-full-bar .button { min-height: 34px; padding: 4px 12px; background: rgba(255, 255, 255, 0.9); }
#mc-full[aria-pressed="true"] { background: var(--mc-surface-2); }
.mc-preview-badge { font-size: 13px; font-weight: 800; padding: 2px 10px; border-radius: 999px; background: #fff1c2; color: #7a5600; vertical-align: middle; }
.mc-blind { margin: auto; max-width: 420px; padding: 24px; text-align: center; color: var(--mc-text-muted); }

/* Agent panel for turn-based kit games (D103, kit/shell/arena-agents.js): the Arcade panel (css/arcade.css .ac-agents),
   Robokade's. Docked at the top of the side column (ac-at-tr, the default) or floating in a corner of the window
   (Move: ac-at-tl, ac-at-bl, ac-at-br); folded to a pill while the agents just play. At 900px and below it stays in the
   page's flow (the side column; under the game on a phone) and never covers the board. */
.mc-agent-bar:empty, .mc-agent-bar:not(:has(> :not([hidden]))) { display: none; }
body.mc-full .mc-agent-bar { display: none; }
.mc-panel > .mc-agent-bar { order: -1; }
/* Agent queue (D129): finding an AI agent in the view's place, and the match panel in the agent bar's place. */
.mc-aq-card { margin: auto; max-width: 460px; padding: 24px 16px; text-align: center; }
.mc-aq-card .mc-result-actions { justify-content: center; }
.mc-aq-finding { font-size: 18px; font-variant-numeric: tabular-nums; }
.mc-aq-panel { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--mc-border); border-radius: 10px; background: var(--mc-surface); }
.mc-aq-panel p { margin: 0; overflow-wrap: anywhere; }
.mc-aq-panel [hidden], .mc-aq-card [hidden], #mc-restart[hidden] { display: none !important; }
.mc-play .ac-agents { position: relative; inset: auto; width: auto; max-width: none; max-height: none; overflow: visible; z-index: 20; }
.mc-play .ac-agents.ac-at-tl, .mc-play .ac-agents.ac-at-bl, .mc-play .ac-agents.ac-at-br { position: fixed; width: min(400px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow-y: auto; overscroll-behavior: contain; }
.mc-play .ac-agents.ac-at-tl { top: 12px; left: 12px; }
.mc-play .ac-agents.ac-at-bl { bottom: 12px; left: 12px; }
.mc-play .ac-agents.ac-at-br { bottom: 12px; right: 12px; }
/* head: title, summary, unread count, Move and Hide / Show first; the intro, Start, help and status on the next line */
.mc-play .ac-agents-head > strong { order: 0; }
.mc-play .ac-summary { order: 1; }
.mc-play .ac-unread { order: 2; }
.mc-play .ac-agents .ac-move { order: 3; margin-left: auto; }
.mc-play .ac-agents .ac-collapse { order: 4; margin-left: 0; }
.mc-play .ac-agents-head::after { content: ""; order: 5; flex-basis: 100%; height: 0; }
.mc-play .ac-agent-intro { order: 6; }
.mc-play .ac-agents-head > .button { order: 7; }
.mc-play .ac-help { order: 8; }
.mc-play .ac-agents-status { order: 9; }
/* folded: a small card in the side column, a pill in a window corner */
.mc-play .ac-agents.ac-collapsed { width: fit-content; max-width: 100%; }
.mc-play .ac-agents.ac-collapsed:is(.ac-at-tl, .ac-at-bl, .ac-at-br) { max-width: calc(100vw - 24px); }
.mc-play .ac-agents.ac-collapsed.ac-at-tr { width: auto; border-radius: var(--mc-radius); padding: 8px 12px; }
.mc-play .ac-agents.ac-collapsed .ac-agents-head { flex-wrap: wrap; }
.mc-play .ac-agents.ac-collapsed .ac-agents-head::after, .mc-play .ac-agents.ac-collapsed .ac-help { display: none; }
.mc-play .ac-seat { flex-direction: column; gap: 4px; }
.mc-play .ac-seat-body > .ac-seat-line:not(.ac-seat-ask) { display: block; }
.mc-play .ac-seat-id { display: flex; align-items: center; gap: 7px; min-width: 0; padding-top: 0; font-family: inherit; overflow-wrap: anywhere; }
.ac-dot { flex: none; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--mc-p0); }
.ac-dot-p1 { background: var(--mc-p1); }
.ac-dot-p2 { background: var(--mc-green); }
.ac-dot-p3 { background: var(--mc-magenta); }
.ac-unread { font-size: 12px; font-weight: 800; padding: 1px 8px; border-radius: 999px; background: #5b3fd1; color: #fff; white-space: nowrap; }
.mc-play .ac-chat { display: grid; gap: 6px; padding-top: 8px; margin-top: 6px; border-top: 1px solid var(--mc-border); }
.mc-play .ac-chat-log { max-height: 7.8em; }
.ac-chat-seat { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-style: normal; margin-right: 4px; }
.ac-chat-to .ac-prompt-tab { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; font-size: 13px; }
@media (max-width: 900px) {
  .mc-play .ac-agents[class] { position: relative; inset: auto; width: auto; max-width: none; max-height: none; overflow: visible; }
  .mc-play .ac-agents.ac-collapsed[class] { width: auto; border-radius: var(--mc-radius); padding: 8px 12px; }
  .mc-play .ac-agents .ac-move { display: none; }
  .mc-play .ac-agents .ac-collapse { margin-left: auto; }
  .mc-play .ac-agent-intro { display: inline; } /* arcade.css hides the Arcade intro here; the play page keeps its notice */
}

/* Room chat, seat clocks and the watch label (D108; play.html room/watch mode and room.html) */
.mc-chat-lines { list-style: none; margin: 0 0 8px; padding: 8px 10px; max-height: 260px; overflow-y: auto; background: var(--mc-surface-2); border-radius: 10px; font-size: 15px; overflow-wrap: anywhere; }
.mc-chat-lines li { margin: 3px 0; }
.mc-chat-sys { color: var(--mc-text-muted); font-style: italic; }
.mc-chat-tool { margin-left: 6px; font-size: 12px; background: none; border: 0; color: var(--mc-blue); text-decoration: underline; cursor: pointer; padding: 0; }
.mc-chat-text { display: flex; gap: 6px; margin: 0 0 8px; }
.mc-chat-text input { flex: 1; min-width: 0; font: inherit; padding: 6px 8px; border: 1px solid var(--mc-border); border-radius: 8px; }
.mc-chat-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.mc-chat-preset { font: inherit; font-size: 14px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--mc-border); background: var(--mc-surface); cursor: pointer; }
.mc-chat-line { font-size: 13px; margin: 6px 0 0; }
.mc-room-label { font-weight: 700; margin: 0 0 6px; }
.mc-seat-clock { font-size: 13px; color: var(--mc-text-muted); white-space: nowrap; grid-column: 1 / -1; }
.mc-seat-clock:empty { display: none; }
.mc-chat { margin-top: 12px; }
