#coop-button {
  min-height: 40px;
  padding: 4px 10px;
  gap: 9px;
  background: #26372e;
  border-color: #6b8975;
  color: #c9e6d2;
  font: 800 17px/1 var(--head);
  text-transform: uppercase;
  letter-spacing: .5px;
}
#coop-button:hover { background: #354a39; }
#coop-button[data-mode="waiting"], #coop-button[data-mode="playing"] {
  color: var(--acid);
  border-color: #9abb72;
}
#coop-button[data-mode="lost"] { color: var(--gold); border-color: #bc9856; }
.coop-pair {
  position: relative;
  display: inline-block;
  width: 21px;
  height: 17px;
  flex: none;
  color: inherit;
}
.coop-pair::before, .coop-pair::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 14px;
  background: currentColor;
  clip-path: polygon(33% 0,67% 0,75% 8%,75% 40%,66% 48%,34% 48%,25% 40%,25% 8%,33% 0,
    33% 48%,17% 56%,17% 62%,0 67%,0 100%,100% 100%,100% 67%,83% 62%,83% 56%,67% 48%,33% 48%);
}
.coop-pair::before { right: 0; top: 0; opacity: .55; }
.coop-pair::after { left: 0; bottom: 0; }

#coop-dialog {
  width: min(510px, calc(100vw - 26px));
  max-height: min(560px, calc(100vh - 24px));
  max-height: min(560px, calc(100dvh - 24px));
  overflow: hidden;
}
.coop-window { max-height: inherit; display: flex; flex-direction: column; }
.coop-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 17px;
  background: #233127;
  border-bottom: 1px solid #536849;
}
.coop-head > .coop-pair { color: var(--aqua); }
.coop-head h2 { margin-right: auto; }
.coop-body {
  min-height: 0;
  padding: 15px 17px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #687d5b #19241c;
}
.coop-status {
  margin: 0 0 13px;
  color: var(--dim);
  font-size: 15px;
}
.coop-options {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}
.coop-options > section, .coop-options > form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 12px;
  background: #242f25;
  border: 1px solid #4b5d48;
  border-radius: 2px;
}
.coop-options h3, .coop-join label { font: 800 22px/1.1 var(--head); }
.coop-options p { margin: 0; color: var(--dim); font-size: 14px; line-height: 1.3; }
.coop-options button { margin-top: auto; }
#coop-dialog input {
  min-width: 0;
  padding: 7px 9px;
  color: var(--text);
  background: #171f19;
  border: 1px solid #65765b;
  border-radius: 2px;
  font: 400 16px/1.25 var(--mono);
  user-select: text;
  -webkit-user-select: text;
}
#coop-dialog input:focus-visible { outline: 2px solid var(--aqua); outline-offset: 1px; }
#coop-code { width: 100%; }
#coop-code::placeholder { color: #acb7a9; font-size: 13px; }
.coop-room label { color: var(--aqua); font: 700 12px var(--mono); text-transform: uppercase; letter-spacing: .6px; }
.coop-code-line { display: flex; align-items: stretch; gap: 7px; margin: 5px 0 13px; }
#coop-dialog #coop-room-code { flex: 1; font: 700 23px/1.2 var(--mono); letter-spacing: 1.5px; color: var(--acid); }
.coop-room-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid #495844; padding-top: 12px; }
.coop-leave { min-height: 39px; padding: 5px 10px; background: #342c26; color: #efc49d; border-color: #716454; font: 700 12px var(--mono); }
.coop-leave:hover { background: #47372d; }
.coop-notice { margin-top: 10px; color: var(--gold); font: 400 13px/1.4 var(--mono); }
.coop-manual { display: block; width: 100%; margin-top: 10px; }
@media (max-height: 600px) and (orientation: landscape) {
  #coop-button { min-height: 36px; padding: 3px 8px; font-size: 15px; gap: 5px; }
  .coop-head { padding: 6px 12px; }
  .coop-head h2 { font-size: 24px; }
  .coop-head .icon-button { width: 35px; height: 35px; }
  .coop-body { padding: 9px 12px 12px; }
  .coop-options > section, .coop-options > form { padding: 9px; gap: 5px; }
  .coop-status { margin-bottom: 8px; font-size: 14px; }
  .coop-options h3, .coop-join label { font-size: 20px; }
}
@media (max-width: 810px) and (orientation: landscape) {
  .command-bar .location { display: none; }
}
@media (max-width: 430px) {
  .coop-options { grid-template-columns: 1fr; }
  #coop-dialog #coop-room-code { font-size: 18px; }
  .coop-room-actions { flex-wrap: wrap; }
}
