:root {
  color-scheme: light;
  --bg: #eef1ee;
  --ink: #18201d;
  --muted: #626d68;
  --line: #c6cec8;
  --panel: #ffffff;
  --panel-soft: #f7f9f6;
  --accent: #0f766e;
  --accent-dark: #0b5f5a;
  --wood-a: #e4bb68;
  --wood-b: #c98e3e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.multi-popup .lobby,
body.multi-popup .lobby-backdrop,
body.multi-popup .lobby-toggle,
body.multi-popup .tabs {
  display: none !important;
}

body.multi-popup .app,
body.multi-popup .app.workspace-active {
  display: block;
}

body.multi-popup .workspace-bar {
  justify-content: flex-end;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--accent-dark);
  border-radius: 6px;
  min-height: 36px;
  padding: 0 12px;
  color: white;
  background: var(--accent);
  cursor: pointer;
}

button:hover,
button.active {
  background: var(--accent-dark);
}

button.secondary {
  color: var(--ink);
  border-color: var(--line);
  background: var(--panel-soft);
}

button.danger {
  border-color: #8f2e24;
  background: #b44438;
}

button.danger:hover {
  background: #963327;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  min-height: 36px;
  padding: 7px 9px;
}

textarea {
  resize: vertical;
}

.multi-mode-link {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 600;
}

.app {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  min-height: 100vh;
}

.app.workspace-active {
  display: block;
}

.lobby-backdrop {
  display: none;
}

.app.workspace-active .lobby-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: block;
  pointer-events: none;
  background: rgb(24 32 29 / 0%);
  transition: background 160ms ease;
}

.app.workspace-active.lobby-open .lobby-backdrop {
  pointer-events: auto;
  background: rgb(24 32 29 / 26%);
}

.lobby {
  height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: auto;
}

.app.workspace-active .lobby {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: min(340px, calc(100vw - 28px));
  background: rgb(255 255 255 / 88%);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  overflow: auto;
  box-shadow: 16px 0 34px rgb(24 32 29 / 18%);
  pointer-events: none;
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 180ms ease, visibility 0s linear 180ms;
}

.app.workspace-active.lobby-open .lobby {
  pointer-events: auto;
  transform: translateX(0);
  visibility: visible;
  transition: transform 180ms ease;
}

.lobby h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.lobby-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.lobby-close {
  display: none;
}

.app.workspace-active .lobby-close {
  display: inline-flex;
  align-items: center;
}

.auth-form {
  display: grid;
  gap: 8px;
}

.auth-form.authenticated {
  gap: 6px;
}

.auth-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px;
}

.auth-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.lobby-authed-content {
  display: grid;
  gap: 10px;
}

.panel {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.panel h2,
.room-side h2 {
  margin: 0;
  font-size: 15px;
}

.room-title-block {
  position: relative;
  display: grid;
  gap: 6px;
}

.room-title-name-button {
  min-height: 0;
  border: 0;
  padding: 0;
  color: var(--accent-dark);
  background: transparent;
  font: inherit;
  font-weight: inherit;
  text-align: left;
}

.room-title-name-button:hover {
  text-decoration: underline;
}

.room-rename-popover {
  position: fixed;
  top: 0;
  right: auto;
  left: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  width: min(360px, calc(100vw - 16px));
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: var(--panel);
  box-shadow: 0 8px 20px rgb(24 32 29 / 16%);
}

.room-rename-popover.hidden {
  display: none;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 8px;
}

.create-room-form {
  display: grid;
  gap: 10px;
}

.create-room-dialog {
  width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 16px 42px rgb(24 32 29 / 26%);
}

.create-room-dialog::backdrop {
  background: rgb(24 32 29 / 32%);
}

.room-preview-dialog {
  width: min(420px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 16px 42px rgb(24 32 29 / 26%);
}

.room-preview-dialog::backdrop {
  background: rgb(24 32 29 / 32%);
}

.room-preview-content,
.room-preview-details {
  display: grid;
  gap: 10px;
}

.room-preview-content h2 {
  margin: 0;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.room-preview-message {
  color: var(--muted);
  min-height: 1.4em;
}

.room-preview-details > div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.room-preview-details span {
  color: var(--muted);
  font-size: 13px;
}

.room-preview-members {
  display: grid;
  gap: 3px;
  max-height: 180px;
  overflow-y: auto;
  font-weight: 600;
}

.room-preview-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.create-room-dialog h2 {
  margin: 0;
  font-size: 18px;
}

.create-room-dialog label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.create-room-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.wide-button {
  width: 100%;
}

.lobby-entry-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.record-search {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.record-date-row,
.record-search-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.record-date-field {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
}

.record-date-field input {
  width: 100%;
}

.record-pagination {
  display: grid;
  grid-template-columns: auto minmax(80px, auto) auto;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.record-pagination button {
  min-width: 76px;
}

.record-pagination span {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.record-limit-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.room-list,
.record-result-list,
.user-list,
.member-list,
.seat-status,
.lobby-chat-panel {
  display: grid;
  gap: 6px;
}

.lobby .room-list {
  grid-template-columns: minmax(0, 1fr);
  max-height: 264px;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 2px;
}

.lobby .user-list {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  max-height: 132px;
  overflow: auto;
  padding-right: 2px;
}

.game-settings {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.game-settings.review-room-settings {
  grid-template-columns: 1fr;
}

.time-control-block {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.time-label {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
  word-break: keep-all;
}

.time-settings-popover {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 70;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  width: min(300px, calc(100vw - 16px));
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: var(--panel);
  box-shadow: 0 8px 20px rgb(24 32 29 / 16%);
}

.time-settings-popover.hidden {
  display: none;
}

.room-owner-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.room-owner-controls.not-owner #roomLockBtn {
  opacity: 0.65;
}

.room-row {
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.room-name-button {
  display: block;
  width: 100%;
  min-height: 0;
  border: 0;
  padding: 2px 0;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-weight: 700;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-name-button:not(:disabled):hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.room-name-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.room-name-button.locked-room {
  color: var(--muted);
}

.room-row span,
.member-list span,
.seat-line span,
#turnLabel {
  color: var(--muted);
  font-size: 13px;
}

.user-name-button {
  width: 100%;
  min-height: 0;
  border: 0;
  padding: 4px 2px;
  color: var(--accent-dark);
  background: transparent;
  text-align: left;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-name-button:hover {
  background: transparent;
  text-decoration: underline;
}

.user-name-button:disabled {
  color: var(--muted);
  opacity: 1;
}

.record-link {
  color: var(--accent-dark);
  font-weight: 600;
  text-decoration: none;
}

.record-link:hover {
  text-decoration: underline;
}

.seat-line {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--panel-soft);
  text-align: left;
}

.seat-line.mine {
  border-color: var(--accent);
  background: #ecf7f4;
}

button.seat-line:not(:disabled):hover {
  border-color: var(--accent);
  background: #ecf7f4;
}

button.seat-line:disabled {
  opacity: 1;
}

.seat-line strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  height: 100vh;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px;
}

.workspace-bar {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}

.lobby-toggle {
  display: none;
  flex: 0 0 auto;
}

.app.workspace-active .lobby-toggle {
  display: inline-flex;
  align-items: center;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.leave-room-top {
  flex: 0 0 auto;
}

.tab {
  color: var(--ink);
  border-color: var(--line);
  background: var(--panel);
}

.tab.active {
  color: white;
}

.empty-state {
  display: grid;
  place-content: center;
  min-height: calc(100vh - 120px);
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 22px;
}

.record-search-view {
  display: grid;
  gap: 16px;
  max-width: 920px;
}

.record-search-view.hidden {
  display: none;
}

.record-search-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.record-search-head h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.record-search-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.record-search-view .record-search {
  grid-template-columns: minmax(150px, 1fr) minmax(110px, 0.6fr) minmax(280px, 1.5fr) auto;
  align-items: start;
  margin-bottom: 0;
}

.record-search-view .record-search-actions {
  grid-template-columns: auto auto;
}

.record-result-list {
  max-width: 100%;
}

.room-view {
  display: grid;
  grid-template-columns: minmax(260px, min(720px, calc(100vh - 320px))) 200px;
  gap: 12px;
  align-items: stretch;
}

.board-column {
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
}

.board-shell {
  position: relative;
  width: min(100%, 720px, max(260px, calc(100vh - 320px)));
}

.board-prisoner-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: min(100%, 720px, max(260px, calc(100vh - 320px)));
}

.hidden {
  display: none;
}

#board {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border: 1px solid #6d4b21;
  background: var(--wood-a);
  cursor: crosshair;
}

.prisoner-overlay {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  border: 1px solid rgb(70 48 19 / 32%);
  border-radius: 6px;
  padding: 7px 9px;
  background: rgb(255 250 239 / 92%);
  box-shadow: 0 2px 8px rgb(41 28 11 / 12%);
  color: #2d2418;
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
}

.prisoner-overlay.hidden {
  display: none;
}

.prisoner-label {
  color: #5e4a2d;
  font-size: 12px;
  font-weight: 700;
}

.stone-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: inset -3px -3px 5px rgb(0 0 0 / 22%), inset 2px 2px 4px rgb(255 255 255 / 34%);
}

.black-stone {
  background: radial-gradient(circle at 35% 30%, #555 0, #111 48%, #050505 100%);
}

.white-stone {
  border: 1px solid #9d9381;
  background: radial-gradient(circle at 35% 30%, #fff 0, #eee8dc 55%, #d5cbbb 100%);
}

.board-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.board-actions.hidden {
  display: none;
}

.record-controls {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
}

.record-controls.hidden {
  display: none;
}

.compact-record-btn {
  min-height: 24px;
  padding: 0 3px;
  font-size: 12px;
  line-height: 1;
}

#reviewMainLineBtn,
#reviewScoreBtn,
#sgfExportBtn {
  grid-column: span 2;
}

.record-controls.review-room #reviewScoreBtn,
.record-controls.review-room #reviewRememberBtn,
.record-controls.review-room #reviewReplayBtn {
  grid-column: span 2;
}

.record-controls.review-room #sgfExportBtn,
.record-controls.review-room #sgfImportBtn {
  grid-column: span 3;
}

.sgf-dialog {
  width: min(620px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 16px 42px rgb(24 32 29 / 26%);
}

.sgf-dialog::backdrop {
  background: rgb(24 32 29 / 32%);
}

.undo-dialog {
  width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 16px 42px rgb(24 32 29 / 26%);
}

.undo-dialog::backdrop {
  background: rgb(24 32 29 / 32%);
}

.undo-content {
  display: grid;
  gap: 12px;
}

.undo-content h2,
.undo-content p {
  margin: 0;
}

.undo-content p {
  color: var(--muted);
  line-height: 1.5;
}

.undo-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.help-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 16px 42px rgb(24 32 29 / 26%);
}

.help-dialog::backdrop {
  background: rgb(24 32 29 / 32%);
}

.help-content {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 80px);
  overflow: auto;
  line-height: 1.65;
}

.help-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.help-head h2,
.help-content h3,
.help-content p {
  margin: 0;
}

.help-content h3 {
  font-size: 15px;
}

.help-content section {
  display: grid;
  gap: 6px;
}

.help-content p {
  color: var(--muted);
  font-size: 14px;
}

.sgf-import-form {
  display: grid;
  gap: 10px;
}

.sgf-import-form h2,
.sgf-import-form p {
  margin: 0;
}

.sgf-import-form p,
.sgf-import-status {
  color: var(--muted);
  font-size: 13px;
}

.sgf-import-status {
  min-height: 18px;
}

.sgf-import-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#board.read-only {
  cursor: default;
}

.room-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.room-side .member-list {
  flex: 1 1 auto;
  min-height: 40px;
  overflow-x: hidden;
  overflow-y: auto;
  align-content: start;
  border-block: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #f4f7f2;
}

.room-side .member-list::before {
  content: "入室者";
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.room-chat-wide {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.room-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.chat-log {
  height: 300px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 7px;
  border-block: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f7f2;
  padding: 10px;
}

.lobby-chat-log {
  height: 260px;
}

.room-chat-wide .chat-log {
  height: 140px;
}

.chat-line {
  line-height: 1.35;
  word-break: break-word;
}

.chat-line strong {
  color: var(--accent-dark);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.room-chat-wide .chat-form {
  position: relative;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.greeting-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 12;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: min(620px, calc(100vw - 32px));
  max-height: min(430px, calc(100vh - 80px));
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgb(24 32 29 / 22%);
}

.greeting-popover.hidden {
  display: none;
}

.greeting-option {
  min-height: 34px;
  height: auto;
  padding: 6px 9px;
  line-height: 1.3;
  text-align: left;
  white-space: normal;
}

.dm-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}

.dm-window {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: min(480px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  justify-items: start;
  gap: 10px;
  background: var(--panel);
  box-shadow: 0 14px 32px rgb(24 32 29 / 22%);
  cursor: grab;
  pointer-events: auto;
}

.dm-window.dragging {
  cursor: grabbing;
}

.dm-window h2 {
  margin: 0;
  font-size: 15px;
  cursor: auto;
  max-width: 100%;
  user-select: text;
}

.dm-profile,
.dm-message {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: auto;
  max-width: 100%;
  user-select: text;
}

.dm-message {
  color: var(--ink);
}

.dm-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  justify-self: stretch;
  width: 100%;
}

.dm-actions input {
  user-select: text;
}

.dm-moderation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.dm-actions,
.dm-actions *,
.dm-moderation-actions,
.dm-moderation-actions * {
  cursor: auto;
}

@media (max-width: 768px) {
  button {
    min-height: 32px;
    padding: 0 10px;
  }

  .app {
    grid-template-columns: 1fr;
  }

  .lobby {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .app.workspace-active .lobby {
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .room-view {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .room-chat-wide {
    grid-column: auto;
    gap: 6px;
  }

  .room-side {
    gap: 8px;
    height: auto;
  }

  .room-side .member-list {
    flex: none;
    max-height: 132px;
  }

  .board-actions,
  .record-controls,
  .game-settings {
    gap: 6px;
  }

  .room-status {
    min-height: 16px;
  }

  .room-chat-wide .chat-log {
    height: 86px;
  }

  .record-search-view .record-search {
    grid-template-columns: 1fr;
  }

  .greeting-popover {
    grid-template-columns: 1fr;
    width: min(420px, calc(100vw - 24px));
  }

  .board-shell,
  .board-prisoner-row {
    width: min(100%, max(180px, calc(100vh - 440px)));
  }

  .board-prisoner-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .prisoner-overlay {
    justify-self: end;
  }

  #board {
    max-height: none;
  }
}

@media (min-width: 390px) and (max-width: 768px) {
  .workspace {
    padding: 8px;
  }

  .workspace-bar {
    margin-bottom: 8px;
  }

  .room-view {
    --mobile-room-side-width: 104px;
    --mobile-board-size: min(
      720px,
      calc(100vw - 126px),
      max(180px, calc(100vh - 250px))
    );
    grid-template-columns: var(--mobile-board-size) var(--mobile-room-side-width);
    gap: 6px;
  }

  .board-shell,
  .board-prisoner-row {
    width: 100%;
  }

  .room-side {
    gap: 4px;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
  }

  .room-chat-wide {
    grid-column: 1 / -1;
  }

  .room-side h2 {
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .room-title-block,
  .room-owner-controls,
  .game-settings,
  .seat-status,
  .board-actions {
    gap: 3px;
  }

  .room-side button,
  .room-side select {
    min-height: 26px;
    padding: 0 3px;
    font-size: 11px;
  }

  .room-side .game-settings {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .time-control-block {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 2px;
  }

  .time-label {
    overflow-wrap: anywhere;
    font-size: 9px;
  }

  .room-side .seat-line {
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 3px;
    min-height: 26px;
    padding: 3px;
  }

  .room-side .seat-line span,
  .room-side .seat-line strong {
    font-size: 10px;
  }

  .record-controls {
    gap: 2px;
  }

  .room-side .compact-record-btn {
    min-height: 22px;
    padding: 0;
    font-size: 10px;
  }

  .room-side .member-list {
    flex: 1 1 auto;
    min-height: 38px;
    max-height: none;
    gap: 2px;
    padding: 4px;
  }

  .room-side .member-list::before,
  .room-side .user-name-button {
    font-size: 10px;
  }

  .room-side .user-name-button {
    padding: 2px 0;
  }

  .room-rename-popover,
  .time-settings-popover {
    right: 0;
    left: auto;
  }

  .room-rename-popover {
    width: min(300px, calc(100vw - 24px));
  }
}
