:root {
  --paper: #f3efe4;
  --ink: #17372b;
  --muted: #7e8677;
  --gold: #dcc08a;
  --red: #e9684f;
  --blue: #72b1ec;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, sans-serif;
}
button,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
button:focus-visible,
select:focus-visible,
canvas:focus-visible {
  outline: 3px solid #e7ac52;
  outline-offset: 3px;
}
button {
  transition:
    background 0.15s,
    transform 0.15s;
}
button:active {
  transform: translateY(1px);
}
header {
  height: 100px;
  max-width: 1500px;
  margin: auto;
  padding: 0 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #d8d9cc;
}
.brand {
  font-size: 24px;
  letter-spacing: -1px;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 7px;
}
.brand i {
  font-family: Georgia, serif;
  font-weight: 400;
}
.brandmark {
  font-size: 42px;
  margin-right: 6px;
}
.edition,
.eyebrow {
  font-family: monospace;
  font-size: 10px;
  letter-spacing: 1.6px;
  font-weight: 600;
}
nav {
  display: flex;
  gap: 22px;
}
nav button {
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 12px;
}
kbd {
  font-family: monospace;
  font-size: 10px;
  padding: 4px 6px;
  border: 1px solid #ffffff25;
  border-radius: 3px;
  white-space: nowrap;
}
nav kbd {
  border-color: #17372b33;
  margin-left: 9px;
}
main {
  max-width: 1500px;
  margin: auto;
  padding: 42px 48px 0;
}
.intro {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 29px;
}
.eyebrow {
  color: #667767;
  margin: 0 0 13px;
}
h1 {
  font-size: clamp(36px, 4.2vw, 62px);
  font-weight: 500;
  letter-spacing: -2.8px;
  margin: 0;
  line-height: 1.08;
}
h1 em,
h2 em {
  font-family: Georgia, serif;
  font-weight: 400;
}
.intro-note {
  font-size: 12px;
  line-height: 1.8;
  color: #7a8074;
  text-align: right;
  margin: 0 0 5px;
}
.console {
  background: #10271e;
  border: 1px solid #203f30;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 22px 45px #172d231c,
    0 3px 4px #14231d1a;
  color: var(--paper);
}
.scoreboard {
  height: 96px;
  background: #11231c;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 38px;
  border-bottom: 1px solid #ffffff12;
  gap: 24px;
}
.score-team {
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 130px;
  position: relative;
}
.score-team small {
  font: 10px monospace;
  letter-spacing: 1.8px;
  display: block;
  color: #b5beb0;
}
.score-team strong {
  font: 36px monospace;
  letter-spacing: 2px;
  line-height: 1.1;
}
.score-team.home {
  text-align: right;
  justify-content: end;
}
.team-dot {
  width: 10px;
  height: 34px;
  background: var(--red);
  border-radius: 2px;
}
.home .team-dot {
  background: var(--blue);
}
.at-bat {
  font: 8px monospace;
  color: var(--gold);
  letter-spacing: 1px;
  position: absolute;
  bottom: -13px;
  left: 25px;
}
.home .at-bat {
  left: auto;
  right: 25px;
}
.line-score {
  flex: 1;
  max-width: 500px;
}
.line-score table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  font: 11px monospace;
  color: #bcc6b6;
}
.line-score th {
  font-weight: 400;
  color: #6f8678;
  padding-bottom: 8px;
  font-size: 9px;
}
.line-score td {
  padding: 3px 1px;
}
.line-score td.active {
  color: var(--gold);
  background: #ffffff07;
}
.line-score td:first-child {
  text-align: left;
  width: 48px;
}
.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 278px;
}
.field-column {
  min-width: 0;
  background: #173d2c;
}
.field-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: 9px monospace;
  letter-spacing: 0.8px;
  height: 43px;
  padding: 0 24px;
  color: #c4d0b8;
  border-bottom: 1px solid #ffffff0b;
}
.count {
  display: flex;
  gap: 19px;
}
.count b {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--gold);
  margin-left: 6px;
}
.canvas-wrap {
  position: relative;
  line-height: 0;
}
.canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  outline-offset: -5px;
}
.start-screen,
.pause-screen {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #082a205d;
  line-height: 1.4;
  backdrop-filter: blur(3px);
}
[hidden] {
  display: none !important;
}
.start-card {
  background: #f3efe4f5;
  color: var(--ink);
  padding: 32px 36px 28px;
  max-width: 410px;
  width: 88%;
  border-radius: 4px;
  box-shadow: 0 12px 60px #001f1a66;
  position: relative;
}
.start-card:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(to right, var(--red) 50%, var(--blue) 50%);
}
.start-card h2 {
  font:
    36px/1.08 Georgia,
    serif;
  letter-spacing: -1.2px;
  margin: 17px 0;
}
.start-card p:not(.eyebrow) {
  font-size: 12px;
  color: #758070;
  line-height: 1.7;
}
.setup {
  display: flex;
  gap: 14px;
  margin: 24px 0 18px;
}
.setup label {
  font: 9px monospace;
  letter-spacing: 1px;
  flex: 1;
}
select {
  background: transparent;
  color: var(--ink);
  border: 0;
  border-bottom: 1px solid #c5c9b9;
  border-radius: 0;
  display: block;
  font-size: 11px;
  padding: 10px 0;
  width: 100%;
}
.primary {
  background: var(--ink);
  color: var(--paper);
  padding: 15px 18px;
  border: 0;
  width: 100%;
  font-size: 13px;
  text-align: left;
  border-radius: 3px;
}
.primary span {
  float: right;
}
.primary:hover {
  background: #28563e;
}
.start-card > small {
  display: block;
  text-align: center;
  margin-top: 13px;
  font-size: 10px;
  color: #7a8275;
}
.call-strip {
  min-height: 48px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 24px;
  background: #132d22;
  border-top: 1px solid #ffffff0c;
  font: 10px monospace;
}
.call-strip strong {
  color: var(--gold);
  font-weight: 400;
  letter-spacing: 0.8px;
  white-space: nowrap;
}
.call-strip > span:last-child {
  color: #93a78e;
  font:
    10px "Helvetica Neue",
    sans-serif;
}
.live-dot,
.controller-light {
  background: #ccba7c;
  width: 5px;
  height: 5px;
  display: inline-block;
  border-radius: 50%;
}
.controller {
  background: #1b3027;
  padding: 26px 24px 0;
  border-left: 1px solid #ffffff0c;
}
.controller-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.controller .eyebrow {
  font-size: 9px;
  color: #92a18b;
  margin: 0;
}
.controller-light {
  background: #9ab76f;
  box-shadow: 0 0 9px #9ab76f55;
}
.controller h2 {
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: -0.7px;
  font-weight: 400;
  margin: 21px 0 12px;
}
.controller h2 em {
  color: var(--gold);
}
.controller > p {
  font-size: 10px;
  line-height: 1.7;
  color: #9eae99;
  margin-bottom: 22px;
}
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.keypad button {
  background: #263e32;
  border: 1px solid #47604765;
  border-bottom: 3px solid #12241a;
  border-radius: 5px;
  color: var(--paper);
  height: 49px;
  padding: 7px 0 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.keypad button:hover {
  background: #385442;
}
.keypad button.selected {
  border-color: #d5bc80;
  background: #3d503a;
  box-shadow: 0 0 0 1px #d5bc8030;
}
.keypad button b {
  font: 17px monospace;
  font-weight: 400;
}
.keypad button span {
  font: 7px monospace;
  letter-spacing: 0.2px;
  color: #a5b49b;
}
.keypad-diamond {
  display: grid;
  place-items: center;
  font-size: 30px;
  color: #bda26d55;
}
.controller .keypad-note {
  font: 8px/1.5 monospace;
  text-align: center;
  margin: 10px -8px 18px;
  color: #758c77;
}
.control-list {
  border-top: 1px solid #ffffff12;
  padding-top: 14px;
}
.control-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: #afbaa5;
  font-size: 10px;
}
.control-list kbd {
  color: #e3dec7;
}
.touch-actions {
  display: flex;
  gap: 7px;
  margin-top: 16px;
}
.touch-actions button {
  background: #d5bd8c;
  border: 0;
  border-bottom: 3px solid #9b855b;
  border-radius: 4px;
  color: #243529;
  font-size: 10px;
  padding: 10px;
  flex: 1;
}
.direction-pad {
  display: flex;
  gap: 5px;
  margin-top: 7px;
}
.direction-pad button {
  touch-action: none;
  background: #293f31;
  border: 1px solid #ffffff15;
  color: #b9c6ac;
  border-radius: 3px;
  height: 29px;
  flex: 1;
}
.controller-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #ffffff12;
  margin-top: 18px;
  padding: 16px 0;
  color: #6d8472;
  font: 8px monospace;
}
.controller-footer button {
  color: #aab69f;
  border: 0;
  background: none;
  font-size: 10px;
  padding: 0;
}
.bottom-notes {
  display: flex;
  justify-content: space-between;
  font: 10px monospace;
  color: #808779;
  padding: 23px 0;
}
.tiny-diamond {
  font-size: 16px;
  vertical-align: middle;
  margin-right: 8px;
  color: #527552;
}
footer {
  max-width: 1404px;
  margin: 12px auto 0;
  border-top: 1px solid #d6dacb;
  padding: 21px 0 28px;
  display: flex;
  justify-content: space-between;
  font: 9px monospace;
  letter-spacing: 0.4px;
  color: #73806d;
}
.muted {
  color: #9b9e91;
}
.pause-screen {
  flex-direction: column;
  gap: 15px;
}
.pause-screen h2 {
  font:
    48px Georgia,
    serif;
  margin: 0;
}
.pause-screen button {
  max-width: 220px;
  text-align: center;
}
.pause-screen > button:not(.primary) {
  background: none;
  color: var(--paper);
  border: 0;
  padding: 8px;
}
dialog {
  max-width: 800px;
  width: 90vw;
  background: var(--paper);
  color: var(--ink);
  border: 0;
  border-radius: 8px;
  padding: 40px;
  box-shadow: 0 30px 100px #0005;
}
dialog::backdrop {
  background: #061b15bb;
  backdrop-filter: blur(6px);
}
dialog h2 {
  font:
    36px/1.15 Georgia,
    serif;
  margin: 12px 0 24px;
}
.close {
  position: absolute;
  right: 20px;
  top: 15px;
  background: none;
  border: 0;
  font-size: 28px;
  color: var(--ink);
}
.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 30px;
}
.help-grid h3 {
  font-size: 13px;
}
.help-grid p {
  font-size: 12px;
  line-height: 1.8;
  color: #5c6e5d;
}
.help-grid kbd {
  border-color: #17372b33;
}
.help-grid strong {
  color: var(--ink);
}
@media (min-width: 1450px) {
  .controller {
    padding-top: 34px;
  }
  .keypad button {
    height: 56px;
  }
  .controller > p {
    margin-bottom: 28px;
  }
  .controller h2 {
    font-size: 32px;
  }
  .controller-footer {
    margin-top: 26px;
  }
}
@media (max-width: 1100px) {
  header {
    padding: 0 26px;
    height: 80px;
  }
  .edition {
    display: none;
  }
  main {
    padding: 30px 24px 0;
  }
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 240px;
  }
  .controller {
    padding: 20px 16px 0;
  }
  .controller h2 {
    font-size: 25px;
    margin: 15px 0 10px;
  }
  .controller > p {
    margin-bottom: 14px;
  }
  .keypad button {
    height: 43px;
  }
  .control-list > div {
    margin-bottom: 9px;
  }
  .touch-actions {
    margin-top: 10px;
  }
  .controller-footer {
    margin-top: 10px;
  }
  .start-card {
    padding: 23px 28px;
  }
  .start-card h2 {
    font-size: 30px;
  }
  .setup {
    margin: 16px 0;
  }
  footer {
    margin: 10px 24px 0;
  }
  .field-top {
    padding: 0 14px;
  }
  .count {
    gap: 10px;
  }
  #role {
    display: none;
  }
}
@media (max-width: 760px) {
  header {
    height: 70px;
    padding: 0 18px;
  }
  .brand {
    font-size: 20px;
  }
  .brandmark {
    font-size: 33px;
  }
  nav {
    gap: 12px;
  }
  nav button {
    font-size: 10px;
  }
  nav kbd {
    display: none;
  }
  main {
    padding: 28px 12px 0;
  }
  .intro {
    padding: 0 6px;
    margin-bottom: 22px;
  }
  .intro .eyebrow {
    font-size: 8px;
    letter-spacing: 1px;
  }
  h1 {
    font-size: 38px;
    letter-spacing: -1.8px;
  }
  .intro-note {
    display: none;
  }
  .scoreboard {
    height: 84px;
    padding: 0 15px;
    gap: 10px;
  }
  .score-team {
    min-width: 74px;
    gap: 8px;
  }
  .score-team small {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .score-team strong {
    font-size: 28px;
  }
  .team-dot {
    width: 6px;
    height: 26px;
  }
  .at-bat {
    left: 14px;
    font-size: 7px;
    bottom: -12px;
  }
  .home .at-bat {
    right: 14px;
  }
  .line-score table {
    font-size: 9px;
  }
  .line-score th {
    font-size: 8px;
  }
  .line-score td:first-child {
    display: none;
  }
  .line-score th:first-child {
    display: none;
  }
  .game-layout {
    display: block;
  }
  .controller {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 22px;
    padding: 20px;
    border-left: 0;
    border-top: 1px solid #ffffff15;
  }
  .controller-heading {
    grid-column: 1/-1;
    margin-bottom: 15px;
  }
  .controller h2 {
    display: none;
  }
  .controller > p#controller-tip {
    grid-column: 2;
    grid-row: 2;
    margin: 0 0 12px;
  }
  .keypad {
    grid-column: 1;
    grid-row: 2/6;
  }
  .keypad button {
    height: 45px;
  }
  .keypad-note {
    grid-column: 1;
    grid-row: 6;
  }
  .control-list {
    grid-column: 2;
    grid-row: 3;
  }
  .touch-actions {
    grid-column: 2;
    grid-row: 4;
    align-self: end;
  }
  .direction-pad {
    grid-column: 2;
    grid-row: 5;
  }
  .controller-footer {
    grid-column: 1/-1;
    margin: 0;
    padding-bottom: 0;
  }
  .bottom-notes {
    font-size: 8px;
    justify-content: center;
  }
  .bottom-notes > span:last-child {
    display: none;
  }
  footer {
    margin: 8px 18px 0;
    font-size: 8px;
    gap: 18px;
    line-height: 1.7;
  }
  footer > span:last-child {
    text-align: right;
  }
  .start-card {
    padding: 18px 22px;
    width: 80%;
    max-width: 340px;
  }
  .start-card h2 {
    font-size: 26px;
    margin: 10px 0;
  }
  .start-card p:not(.eyebrow) {
    font-size: 10px;
    margin: 8px 0;
  }
  .start-card .eyebrow {
    font-size: 8px;
  }
  .setup {
    margin: 12px 0;
  }
  .setup select {
    font-size: 10px;
    padding: 6px 0;
  }
  .primary {
    padding: 12px 15px;
  }
  .start-card > small {
    font-size: 9px;
    margin-top: 8px;
  }
  .call-strip {
    padding: 10px 13px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .call-strip > span:last-child {
    font-size: 9px;
  }
  .field-top {
    font-size: 8px;
    height: 35px;
  }
  .count b {
    font-size: 9px;
  }
  .help-grid {
    grid-template-columns: 1fr;
  }
  dialog {
    padding: 26px;
  }
  .pause-screen h2 {
    font-size: 36px;
  }
}
@media (min-width: 761px) {
  body.playing header {
    height: 56px;
  }
  body.playing main {
    padding-top: 16px;
  }
  body.playing .intro {
    display: none;
  }
  body.playing .scoreboard {
    height: 70px;
  }
  body.playing .canvas-wrap canvas {
    height: max(380px, calc(100dvh - 248px));
    object-fit: contain;
  }
  body.playing .controller {
    max-height: max(471px, calc(100dvh - 157px));
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #5b735a #1b3027;
  }
  body.playing .bottom-notes {
    padding: 12px 0;
  }
  body.playing footer {
    display: none;
  }
}

.keypad .keypad-zero {
  grid-column: span 2;
}

#online-setup {
  margin-top: 16px;
}
#online-setup label {
  font: 8px monospace;
  letter-spacing: 1px;
}
#online-setup input {
  min-width: 0;
  width: 100%;
  padding: 10px;
  border: 1px solid #b8c0ad;
  background: #fff8;
  border-radius: 3px;
  color: var(--ink);
  font: 12px monospace;
}
#online-setup #invite-link {
  margin: 8px 0;
  font-size: 10px;
}
.join-row {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}
.join-row button {
  flex-shrink: 0;
  padding: 10px 14px;
  border: 1px solid #b8c0ad;
  border-radius: 3px;
  font-size: 11px;
}
#online-setup #online-status {
  line-height: 1.5;
  font-size: 11px;
}
#leave-room {
  background: none;
  border: 0;
  text-decoration: underline;
  color: var(--ink);
  font-size: 11px;
}
#network-bar {
  padding: 12px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font: 10px monospace;
  color: var(--gold);
  border-bottom: 1px solid #ffffff22;
}
#network-bar button {
  color: var(--paper);
  background: #304b39;
  border: 1px solid #ffffff22;
  border-radius: 3px;
  padding: 6px 10px;
  font-size: 10px;
}
#network-status {
  flex: 1;
  color: #b7c5ac;
}
#pause-detail {
  max-width: 300px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
}
body.online-lobby .start-card {
  max-width: 440px;
}
body.online-lobby .start-card h2 {
  font-size: 27px;
  margin: 10px 0;
}
body.online-lobby .start-card > p:not(.eyebrow) {
  display: none;
}
body.online-lobby .start-card .setup {
  margin: 12px 0;
}
@media (min-width: 761px) {
  body.online-playing .canvas-wrap canvas {
    height: max(380px, calc(100dvh - 296px));
  }
}
@media (max-width: 760px) {
  body.online-lobby .canvas-wrap {
    min-height: 415px;
  }
  #network-bar {
    padding: 10px;
    gap: 8px;
  }
}

#phone-dialog {max-width:520px;text-align:center;}
#phone-dialog p {line-height:1.6;}
#phone-dialog button {padding:12px 18px; margin:6px;border:1px solid #718174;border-radius:5px;background:#213f31;color:#fff6dd;cursor:pointer;}
#phone-qr {background:white;border-radius:8px;}
#phone-link {color:#214e38;}
