#intro.lb #ohw-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-self: center;
  width: min(100%, 28rem);
  gap: 10px;
  margin: 24px 0 max(36px, 6svh);
}
body.lb-reading #intro.lb #ohw-modes { visibility: hidden; }

#ohw-modes .ohw-frame, #ohw-room .ohw-frame, #ohw-toolbar .ohw-frame, #ohw-speed-vote .ohw-frame {
  min-width: 0;
  min-height: 44px;
  padding: 0 8px;
  border: 7px solid transparent;
  border-image: var(--lbPL) 14 fill / 12px / 0 stretch;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--text);
  font: 500 14px var(--lbF);
}
#ohw-modes .ohw-frame { min-height: 52px; font-size: clamp(13px, 3.55vw, 18px); }
#ohw-modes .primary, #ohw-room .primary, #ohw-room [aria-pressed='true'], #ohw-toolbar .primary,
#ohw-speed-vote :is(.primary, [aria-pressed='true']) {
  border-image-source: var(--lbPR);
  color: var(--gold2);
}
#ohw-modes button:focus-visible, #ohw-room :is(button, input, select):focus-visible,
#ohw-toolbar button:focus-visible, #ohw-speed-vote button:focus-visible {
  outline: 2px solid var(--gold2);
  outline-offset: 2px;
}
#ohw-modes button:hover, #ohw-room button:not(:disabled):hover { color: var(--gold2); }

#lb2 #ohw-room { display: none; }
body.lb-multiplayer #lb2 #ohw-room { display: block; }
body.lb-multiplayer #lb2 :is(.l2-born, .l2-cont, .l2-bondw, .l2-scnw, .l2-newsw, .l2-keys) { display: none !important; }
#ohw-room [hidden], #ohw-toolbar[hidden], #ohw-toolbar [hidden], #ohw-timer[hidden],
#ohw-speed-vote[hidden], #ohw-speed-vote [hidden], .ctrl [data-sp][hidden] { display: none !important; }

#ohw-room {
  border: 10px solid transparent;
  border-image: var(--lbPL) 14 fill / 14px / 0 stretch;
  padding: 4px 5px 8px;
  min-width: 0;
}
#ohw-room h3 { margin: 2px 0 10px; font: 700 18px var(--lbF); color: var(--gold2); }
#ohw-room form, #ohw-room label { display: grid; gap: .4rem; }
#ohw-room form { margin: 8px 0 10px; gap: 10px; }
#ohw-room label { color: var(--dim); font-size: 13px; }
#ohw-room input:not([type='checkbox']), #ohw-room select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  box-sizing: border-box;
  font: 16px var(--lbF);
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  color: var(--text);
}
#ohw-room input[name='code'] { text-transform: uppercase; }
#ohw-room button:disabled, #ohw-toolbar button:disabled, #ohw-speed-vote button:disabled { opacity: .5; cursor: default; }
.ohw-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#ohw-room .ohw-entry-actions .btn { flex: 1 1 auto; }
#ohw-room #ohw-enter-form { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
#ohw-room .ohw-checkbox { display: flex; align-items: center; gap: .5rem; min-height: 32px; cursor: pointer; }
#ohw-room .ohw-checkbox input { accent-color: var(--gold2); }
#ohw-room .ohw-room-dialog {
  box-sizing: border-box;
  width: min(30rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  overflow: auto;
  margin: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  text-align: start;
}
#ohw-room .ohw-room-dialog::backdrop { background: rgb(0 0 0 / .66); }
#ohw-room .ohw-room-dialog h4, #ohw-lobby-name { margin: 0 0 .35rem; color: var(--gold2); font: 700 17px var(--lbF); overflow-wrap: anywhere; }
#ohw-room .ohw-dialog-heading h4 { margin: 0 auto 0 0; }
#ohw-create-form .ohw-actions { justify-content: flex-end; }
#ohw-open-rooms { list-style: none; margin: 0; padding: 0; max-height: min(19rem, 45dvh); overflow-y: auto; }
#ohw-open-rooms li { display: flex; align-items: center; gap: .75rem; padding: 6px 0; border-bottom: 1px solid var(--line); }
#ohw-open-rooms li div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#ohw-open-rooms li small { display: block; margin-top: 2px; color: var(--dim); }
#ohw-open-status { margin: 4px 0; color: var(--dim); font-size: 13px; }
#ohw-open-error, #ohw-create-error { margin: 0; color: var(--gold2); font-size: 13px; }
#ohw-open-status:empty, #ohw-open-rooms:empty, #ohw-open-error:empty, #ohw-create-error:empty { display: none; }
#ohw-open-pages { margin-top: 6px; justify-content: space-between; }
#ohw-players { list-style: none; margin: 8px 0 12px; padding: 0; }
#ohw-players li { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 7px 2px; border-bottom: 1px solid var(--line); }
#ohw-players li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#ohw-players small { color: var(--dim); white-space: nowrap; }
#ohw-code, #ohw-room-code { color: var(--gold2); }
#ohw-status, #ohw-room-error { color: var(--gold2); overflow-wrap: anywhere; }
#ohw-status:empty, #ohw-room-error:empty { display: none; }
#ohw-toolbar { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; border-bottom: 1px solid var(--line); padding: 7px 10px; font: 13px var(--lbF); color: var(--dim); }
#ohw-room-wait:empty { display: none; }
#ohw-room-wait { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#ohw-duel-seats { display: flex; flex-wrap: wrap; gap: .5rem; }
#ohw-duel-seats select { color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 3px; min-height: 32px; }
#ohw-timer { margin: .3rem 0; color: var(--gold2); font-size: .9rem; font-variant-numeric: tabular-nums; }
#ohw-speed-vote {
  box-sizing: border-box;
  flex: 1 0 100%;
  margin: 6px 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: var(--panel);
  font: 13px var(--lbF);
  color: var(--dim);
}
#ohw-speed-vote p { margin: 0; }
#ohw-speed-vote .ohw-actions { margin-top: 3px; }
#ohw-speed-text { color: var(--gold2); overflow-wrap: anywhere; }
#ohw-lobby-speeds button[aria-pressed='true'], #ohw-speed-vote button[aria-pressed='true'] { opacity: 1; }

#ohw-report-issue {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 70;
  min-height: 44px;
  background: var(--panel);
}
body:has(#game:not(.hidden)) #ohw-report-issue { bottom: calc(62px + env(safe-area-inset-bottom)); }
body.lb-hideui #ohw-report-issue { visibility: hidden; }
:is(#ohw-issue-dialog, #ohw-playtest-notice) {
  box-sizing: border-box;
  width: min(30rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  overflow: auto;
  margin: auto;
  padding: 1.25rem;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel);
  font: 16px var(--lbF);
}
:is(#ohw-issue-dialog, #ohw-playtest-notice)::backdrop { background: rgb(0 0 0 / .66); }
:is(#ohw-issue-dialog, #ohw-playtest-notice) form { display: grid; gap: .65rem; }
:is(#ohw-issue-dialog, #ohw-playtest-notice) :is(h2, p) { margin: 0; }
:is(#ohw-issue-dialog, #ohw-playtest-notice) h2 { color: var(--gold2); font-size: 1.3rem; }
#ohw-playtest-notice p { line-height: 1.55; }
#ohw-playtest-notice .ohw-notice-signature { color: var(--gold2); }
#ohw-playtest-notice button { justify-self: end; }
#ohw-issue-dialog textarea {
  box-sizing: border-box;
  width: 100%;
  padding: .6rem;
  resize: vertical;
  border: 1px solid var(--line);
  background: var(--bg);
  color: inherit;
  font: inherit;
}
#ohw-issue-dialog output { text-align: right; font-variant-numeric: tabular-nums; color: var(--dim); }
#ohw-issue-dialog [role='status']:empty { display: none; }
:is(#ohw-issue-dialog, #ohw-playtest-notice) button { min-height: 44px; }

#ohw-choice-hint {
  margin: 0;
  color: var(--gold2);
  font: 13px var(--lbF);
}
#ohw-choice-hint:not(:empty) { margin-top: .6rem; }
#ohw-truce-offers {
  min-width: 0;
  margin: .65rem 0;
  padding: .4rem .75rem;
  border: 1px solid var(--line);
  text-align: left;
}
#ohw-truce-offers legend { padding: 0 .25rem; color: var(--gold2); }
#ohw-truce-offers label { display: flex; align-items: center; gap: .5rem; min-height: 2.25rem; cursor: pointer; }
#ohw-truce-offers input { flex: none; accent-color: var(--gold2); }
#ohw-birth-gender { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
#ohw-birth-gender[hidden] { display: none; }
#ohw-birth-sex {
  min-height: 36px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
}
#ohw-birth-sex:focus-visible { outline: 2px solid var(--gold2); outline-offset: 2px; }
#dlg #dChoices .ohw-choice-preview {
  border-image-source: var(--lbPR) !important;
  filter: drop-shadow(0 0 9px rgba(224, 178, 92, .65));
  animation: ohw-choice-glow 1.15s ease-in-out infinite alternate;
}
#dlg #dChoices .ohw-choice-confirmed {
  border-image-source: var(--lbPL) !important;
  filter: none;
  transition: none;
  cursor: default;
}
#dlg #dChoices .ohw-choice-muted {
  border-image-source: var(--lbPLd) !important;
  filter: grayscale(1);
  opacity: .35;
  transition: none;
  cursor: default;
}
@keyframes ohw-choice-glow {
  to { filter: drop-shadow(0 0 15px rgba(224, 178, 92, .9)); }
}
@media (prefers-reduced-motion: reduce) {
  #dlg #dChoices .ohw-choice-preview { animation: none; }
}
