:root {
  --ink: #173b3c;
  --muted: #788580;
  --paper: #f5f5ef;
  --teal: #087f79;
  --coral: #de775d;
  --line: #dce2d9;
  --player: #087f79;
}
* {
  box-sizing: border-box;
}
html {
  /* no double-tap zoom on phones (tapping the rotate button quickly used to zoom on iPhone);
     pinch zoom still works */
  touch-action: manipulation;
}
body {
  margin: 0;
  /* iPhone: a long press (holding to aim or to keep turning) used to select text on the page */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  background: var(--paper);
  color: var(--ink);
  font-family: 'DM Sans', 'Noto Sans JP', sans-serif;
  font-size: 14px;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}
button:focus-visible,
a:focus-visible,
input,
textarea {
  -webkit-user-select: text;
  user-select: text;
}
canvas:focus-visible {
  outline: 3px solid #e6ad54;
  outline-offset: 4px;
}
button:disabled {
  cursor: wait;
  opacity: 0.55;
}
a {
  color: inherit;
  text-decoration: none;
}
.topbar {
  height: 98px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1440px;
  margin: auto;
  padding: 0 4%;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.1;
}
.brand svg {
  width: 34px;
  height: 34px;
}
.brand small {
  display: block;
  font-size: 10px;
  letter-spacing: 3px;
  margin-top: 7px;
  font-weight: 500;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 23px;
  flex-shrink: 0;
}
.header-actions button,
.brand {
  white-space: nowrap;
}
.help-btn b {
  font-weight: inherit;
}
.icon-btn {
  font-size: 22px;
  position: relative;
  width: 35px;
  height: 35px;
}
.mute-dot {
  height: 5px;
  width: 5px;
  border-radius: 50%;
  background: var(--coral);
  position: absolute;
  right: 6px;
  bottom: 7px;
}
.lang-btn {
  font-size: 11px;
  font-weight: 600;
  color: #5d6d65;
  padding: 6px 8px;
  border: 1px solid #d3dbcf;
  border-radius: 999px;
}
.help-btn {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.help-btn span {
  border: 1px solid #9aa9a1;
  border-radius: 50%;
  height: 20px;
  width: 20px;
  display: grid;
  place-items: center;
}
.layout {
  max-width: 1360px;
  display: grid;
  grid-template-columns: 250px minmax(330px, 1fr) 188px;
  gap: 42px;
  margin: auto;
  padding: 32px 38px 22px;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 1.6px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.eyebrow > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
}
.intro {
  padding-top: 11px;
}
h1 {
  font-size: 35px;
  letter-spacing: -1.6px;
  line-height: 1.55;
  margin: 16px 0 10px;
  font-weight: 800;
}
.level-switch {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}
.level-switch[hidden] {
  display: none;
}
.level-switch button {
  flex: 1;
  padding: 6px 4px;
  border: 1px solid #dce1d7;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  color: #5d6d65;
}
.level-switch [data-level='extreme'] {
  color: #c4553b;
  font-weight: 800;
}
.level-switch .selected {
  border-color: var(--player, #de775d);
  color: var(--ink);
  background: #fff8;
}
.cpu-record {
  margin-top: 10px;
  font-size: 11px;
  color: #6f7e75;
}
.level-record {
  margin: 5px 0 0;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  color: #5d6d65;
}
.level-record:empty,
.cpu-record:empty {
  display: none;
}
.specimen-card {
  margin-top: 16px;
  border: 1px solid #d8dfd3;
  border-radius: 12px;
  padding: 17px;
  background: #eeefe5;
  overflow: hidden;
}
#specimen {
  display: block;
  width: 100%;
  height: 113px;
  margin: 0 auto 7px;
}
.bone-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.bone-title h2 {
  font-size: 20px;
  margin: 0;
  font-weight: 700;
}
.bone-title span {
  font-size: 9px;
  letter-spacing: 1px;
  color: #718178;
}
.specimen-bottom {
  border-top: 1px solid #d7decf;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  padding-top: 8px;
  height: 44px;
}
.specimen-bottom > span {
  color: #84917e;
}
.specimen-bottom strong {
  font-size: 11px;
  font-weight: 500;
}
#next-bone {
  height: 35px;
  width: 50px;
  margin-left: auto;
}
.arena-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
  margin-bottom: 9px;
}
.turn-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.7px;
  color: var(--player);
  transition: color 0.3s;
}
.turn-badge i {
  width: 7px;
  height: 7px;
  background: var(--player);
  border-radius: 50%;
}
.stats {
  display: flex;
  gap: 18px;
  font-size: 8px;
  color: #85958a;
  letter-spacing: 1px;
}
.stats strong {
  font-size: 21px;
  color: var(--ink);
  letter-spacing: -1px;
  margin-right: 4px;
  font-weight: 500;
}
.arena {
  position: relative;
  height: 540px;
  width: 100%;
  background: #e7eee5;
  border: 1px solid #d5e0d2;
  border-radius: 14px;
  overflow: hidden;
  isolation: isolate;
}
#game {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: ew-resize;
  outline-offset: -4px;
}
.arena-label {
  position: absolute;
  top: 18px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  letter-spacing: 2px;
  color: #93a18e;
  pointer-events: none;
}
.toast {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  color: #6f8373;
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.3s;
}
.controls {
  display: flex;
  gap: 10px;
  margin-top: 13px;
  height: 54px;
}
.rotate-group {
  display: flex;
  align-items: center;
  border: 1px solid #d4ded0;
  border-radius: 9px;
  overflow: hidden;
  min-width: 133px;
}
.controls button {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.rotate-group button {
  font-size: 29px;
  width: 44px;
  height: 100%;
  line-height: 1;
}
.rotate-group > span {
  text-align: center;
  color: #728170;
  font-size: 9px;
  min-width: 37px;
}
.rotate-group small {
  display: block;
  font-size: 8px;
  margin-top: 2px;
  color: #9aa493;
}
.rotate-group button:hover,
.reset-btn:hover {
  background: #e6ebe1;
}
.drop-btn > span:first-child {
  white-space: nowrap; /* one line even on narrow phones ("Game over", "対戦相手を待っています") */
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.drop-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  background: var(--ink);
  color: #fafbef;
  border-radius: 9px;
  padding: 0 22px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  box-shadow: 0 4px 0 #0e292b;
  transition:
    transform 0.1s,
    background 0.2s;
}
.drop-btn:hover {
  background: #225052;
}
.drop-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #0e292b;
}
.drop-arrow {
  font-size: 24px;
  font-weight: 400;
}
.reset-btn {
  width: 46px;
  font-size: 25px;
  border: 1px solid #d4ded0;
  border-radius: 9px;
}
kbd {
  font-family: inherit;
  border: 1px solid #d7dfd1;
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 8px;
  min-width: 16px;
  text-align: center;
}
.right-panel {
  padding-top: 49px;
}
.record {
  padding-top: 0;
  margin-top: 0;
}
.record p {
  margin: 10px 0 3px;
}
.record strong {
  font-size: 42px;
  font-weight: 400;
  letter-spacing: -2px;
}
.record p > span {
  font-size: 9px;
  letter-spacing: 1px;
  color: #899880;
}
.record small {
  font-size: 9px;
  color: #9aa48f;
}
.ad-slot {
  max-width: 980px;
  margin: 8px auto 0;
  padding: 0 16px;
  min-height: 90px;
}
.ad-slot[hidden] {
  display: none;
}
footer {
  max-width: 1284px;
  margin: 0 auto;
  padding: 18px 16px 24px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 22px;
  border-top: 1px solid var(--line);
  font-size: 11px;
}
footer a {
  color: #7e8c82;
  text-decoration: none;
}
.maker {
  color: #7e8c82;
}
footer a:hover {
  color: var(--ink);
  text-decoration: underline;
}
.loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #e7eee5;
  gap: 20px;
  font-size: 12px;
  z-index: 8;
}
/* loading: three bones drop one after another and stack, then start again */
.bone-pile {
  position: relative;
  width: 84px;
  height: 84px;
}
.bone-pile i {
  position: absolute;
  left: 12px;
  width: 60px;
  height: 60px;
  opacity: 0;
  animation: bone-drop 2.4s cubic-bezier(0.5, 0, 0.75, 1) infinite;
}
.bone-pile i:nth-child(1) {
  bottom: -8px;
  --turn: -45deg;
}
.bone-pile i:nth-child(2) {
  bottom: 9px;
  --turn: 40deg;
  animation-delay: 0.35s;
}
.bone-pile i:nth-child(3) {
  bottom: 26px;
  --turn: -50deg;
  animation-delay: 0.7s;
}
.bone-pile svg {
  width: 100%;
  height: 100%;
  fill: #d2bd8b;
  stroke: #a8925e;
  stroke-width: 1.2;
  transform: rotate(var(--turn));
}
@keyframes bone-drop {
  0% {
    opacity: 0;
    transform: translateY(-46px);
  }
  12% {
    opacity: 1;
  }
  30% {
    transform: translateY(0);
  }
  36% {
    transform: translateY(-3px);
  }
  42%,
  82% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .bone-pile i {
    animation: none;
    opacity: 1;
  }
}

[hidden] {
  display: none !important;
}
.result-layer {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  background: #173b3c66;
  backdrop-filter: blur(5px);
  padding: 20px;
}
.result-card {
  background: #fafbf4;
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 325px;
  text-align: center;
  box-shadow: 0 20px 80px #16383033;
}
.result-kicker {
  color: var(--teal);
  font-size: 9px;
  letter-spacing: 2px;
}
.result-icon {
  font-size: 49px;
  color: #d2aa61;
  margin: 5px;
}
.result-card h2 {
  font-size: 25px;
  margin: 8px 0;
}
.result-card > p {
  font-size: 10px;
  line-height: 1.8;
  color: #778875;
}
.result-numbers {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 18px 0 25px;
}
.result-numbers strong {
  display: block;
  font-size: 37px;
  font-weight: 500;
}
.result-numbers span {
  font-size: 9px;
  color: #8c9984;
}
.primary {
  background: var(--ink);
  color: white;
  padding: 14px 20px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
}
.result-card .primary {
  width: 100%;
  display: flex;
  justify-content: space-between;
}
.share-btn {
  width: 100%;
  margin-top: 8px;
  padding: 11px;
  border: 1px solid #d3dbcf;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}
.share-btn:hover {
  background: #fff8;
}
dialog {
  border: none;
  border-radius: 15px;
  background: #fafbf5;
  color: var(--ink);
  max-width: 480px;
  width: calc(100% - 35px);
  padding: 33px;
  box-shadow: 0 20px 100px #0e2d3244;
}
dialog::backdrop {
  background: #173b3c77;
  backdrop-filter: blur(3px);
}
dialog h2 {
  font-size: 25px;
  line-height: 1.6;
}
dialog p,
dialog li {
  font-size: 12px;
  line-height: 1.95;
  color: #6f806d;
}
dialog ul {
  padding-left: 18px;
}
dialog li {
  margin-bottom: 10px;
}
.dialog-close:not(.primary) {
  position: absolute;
  right: 16px;
  top: 8px;
  font-size: 26px;
  color: #86947d;
}
.dialog-note {
  padding-top: 15px;
  border-top: 1px solid #dce4d5;
  font-size: 10px !important;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 20px;
  padding-top: 15px;
}
@media (min-width: 1450px) {
  .layout {
    padding-top: 45px;
    padding-bottom: 35px;
  }
  .arena {
    height: 580px;
  }
}
@media (max-width: 1150px) {
  .layout {
    grid-template-columns: 220px minmax(310px, 1fr);
    max-width: 980px;
    gap: 30px;
  }
  .right-panel {
    display: none;
  }
  .topbar {
    height: 82px;
  }
  footer {
    margin: 0 38px;
  }
  .arena {
    height: min(540px, 64vh);
  }
  h1 {
    font-size: 32px;
  }
}
@media (max-width: 700px) {
  .topbar {
    height: 68px;
    padding: 0 18px;
  }
  .brand {
    font-size: 17px;
    gap: 8px;
  }
  .brand svg {
    width: 26px;
  }
  .brand small {
    font-size: 8px;
    margin-top: 4px;
    letter-spacing: 2px;
  }
  .header-actions {
    gap: 10px;
  }
  .help-btn {
    font-size: 10px;
  }
  .brand {
    min-width: 0;
  }
}
@media (max-width: 480px) {
  .topbar {
    padding: 0 14px;
  }
  /* phones: the help button is just the "?" circle (its aria-label still says 遊び方) */
  .help-btn b {
    display: none;
  }
  .help-btn span {
    width: 26px;
    height: 26px;
  }
  .layout {
    display: flex;
    flex-direction: column;
    padding: 15px 16px 10px;
    gap: 5px;
  }
  .intro {
    padding: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0 15px;
  }
  .level-switch {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 6px;
  }
  .level-record {
    grid-column: 1 / -1;
    grid-row: 3;
    margin-top: 3px;
  }
  .specimen-card {
    margin-top: 0;
    grid-column: 1 / -1;
    grid-row: 1;
    padding: 0;
    border: 0;
    background: transparent;
    max-width: 220px;
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 0 7px;
    align-items: center;
  }
  .specimen-bottom {
    display: none;
  }

  #specimen {
    grid-column: 1;
    width: 40px;
    height: 39px;
    margin: 0;
  }
  .bone-title {
    display: block;
  }
  .bone-title h2 {
    font-size: 12px;
    white-space: nowrap;
  }
  .bone-title span {
    font-size: 6px;
    letter-spacing: 0.4px;
  }
  .arena-top {
    height: 35px;
    margin: 4px 2px;
  }
  .arena {
    height: clamp(340px, calc(100svh - 315px), 620px);
    border-radius: 10px;
  }
  .arena-label {
    top: 14px;
    left: 15px;
    right: 15px;
    font-size: 7px;
  }
  .controls {
    height: 51px;
    margin-top: 10px;
    gap: 8px;
  }
  .drop-btn {
    padding: 0 18px;
    font-size: 12px;
  }
  .rotate-group {
    min-width: 126px;
  }
  .rotate-group button {
    width: 40px;
  }
  .toast {
    bottom: 17px;
    font-size: 9px;
  }
  footer {
    margin: 5px 16px 0;
    padding: 13px 0;
    font-size: 10px;
  }
  .result-card {
    padding: 22px;
  }
  .stats strong {
    font-size: 19px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

.photo-credits {
  font-size: 12px;
  line-height: 1.7;
  margin: 18px 0;
  color: #56665b;
}
.photo-credits summary {
  cursor: pointer;
  color: #087f79;
  font-weight: 600;
}
.photo-credits a {
  color: #087f79;
}
.photo-credits ul {
  padding-left: 20px;
}
.photo-credits li {
  margin: 4px 0;
}

/* ---------- world match (online) ---------- */
/* ---------- start menu ---------- */
.menu-layer {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  background: #e7eee5e6;
  backdrop-filter: blur(3px);
  padding: 16px;
  overflow-y: auto;
}
.menu-layer[hidden] {
  display: none;
}
.menu-card {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.menu-name-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fafbf4;
  border: 1px solid var(--teal);
  box-shadow: 0 4px 14px #16383012;
}
.menu-name-form[hidden],
.menu-name-line[hidden] {
  display: none !important;
}
.menu-name-form label {
  font-size: 15px;
  font-weight: 800;
}
.bone-pick-label {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 700;
}
.bone-pick {
  display: flex;
  gap: 6px;
}
.bone-pick button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  border: 1px solid #d3dbcf;
  border-radius: 10px;
  background: white;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  touch-action: manipulation;
}
.bone-pick button:hover,
.bone-pick button:focus-visible {
  border-color: var(--teal);
}
.bone-pick button:disabled {
  opacity: 0.45;
}
.bone-pick i {
  display: block;
  width: 34px;
  height: 34px;
  margin: 4px 0 2px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 -3px 0 #0002;
}
.menu-name-error {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: #c4553b;
}
.menu-name-error:empty {
  display: none;
}
.menu-name-form small {
  font-size: 11px;
  color: #6f7e75;
}
.menu-name-row {
  display: flex;
  gap: 6px;
}
.menu-name-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid #d3dbcf;
  border-radius: 8px;
  font-size: 16px; /* 16px: iPhone does not zoom into the field */
  user-select: text;
  -webkit-user-select: text;
}
.menu-name-row .primary {
  padding: 0 16px;
  border-radius: 8px;
}
.menu-name-row .primary:disabled {
  opacity: 0.45;
}
.menu-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.menu-name-line {
  margin: 0;
  font-size: 12px;
  color: #5d6d65;
  min-width: 0;
  display: flex;
  align-items: baseline;
  white-space: nowrap;
}
.menu-name-line strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-name-line .link-btn {
  flex-shrink: 0;
}
.menu-name-line .link-btn {
  margin: 0 0 0 6px;
}
/* until a nickname is chosen, only the name form shows */
.menu-card.needs-name > :not(.menu-name-form) {
  display: none;
}
.menu-ranking {
  flex-shrink: 0;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid #d3dbcf;
  background: #fafbf4;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  touch-action: manipulation;
}
.menu-ranking:hover {
  border-color: var(--teal);
}
.menu-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 14px 18px;
  border: 1px solid #d3dbcf;
  border-radius: 12px;
  background: #fafbf4;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 4px 14px #16383012;
  touch-action: manipulation;
}
.menu-btn strong {
  font-size: 17px;
}
.menu-btn small {
  font-size: 11px;
  color: #6f7e75;
}
.menu-btn.main {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}
.menu-btn.main small {
  color: #cfe0da;
}
.menu-btn:hover {
  border-color: var(--teal);
}
.menu-sub {
  display: flex;
  gap: 8px;
  margin: -2px 0 2px 14px;
}
.menu-sub[hidden] {
  display: none;
}
.menu-sub button {
  flex: 1;
  padding: 11px 8px;
  border-radius: 10px;
  border: 1px solid var(--teal);
  color: var(--teal);
  background: white;
  font-weight: 700;
  font-size: 13px;
  touch-action: manipulation;
}
.menu-open {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  padding: 6px 10px;
  border: 1px solid #d3dbcf;
  border-radius: 999px;
}
.online-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background: #e7eee5cc;
  backdrop-filter: blur(3px);
  padding: 16px;
}
.online-layer[hidden] {
  display: none;
}
.online-card {
  background: #fafbf4;
  border: 1px solid #d8dfd3;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 14px 50px #16383022;
}
.online-card h2 {
  font-size: 22px;
  margin: 6px 0 14px;
}
.online-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  color: #758378;
  text-align: left;
}
.online-name span {
  flex: none;
}
.online-name input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  padding: 8px 10px;
  border: 1px solid #d3dbcf;
  border-radius: 7px;
  background: white;
}
.online-stats {
  display: flex;
  justify-content: space-around;
  padding: 16px 0 6px;
}
.online-stats strong {
  display: block;
  font-size: 22px;
  font-weight: 500;
}
.online-stats span {
  font-size: 9px;
  color: #8c9984;
}
.online-status {
  min-height: 3em;
  font-size: 11px;
  line-height: 1.6;
  color: #6f7e75;
  margin: 8px 0 12px;
}
.online-card .primary {
  width: 100%;
  display: flex;
  justify-content: space-between;
}
.online-card .primary:disabled {
  opacity: 0.45;
}
.online-card .primary.waiting {
  background: #de775d;
}
.online-room {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.online-room input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 13px;
  padding: 9px 10px;
  border: 1px solid #d3dbcf;
  border-radius: 7px;
  background: white;
  color: var(--ink);
}
.online-room button {
  flex: none;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  background: var(--teal);
  color: white;
}
.online-room button:disabled {
  opacity: 0.45;
}
.online-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.online-row button {
  flex: 1;
  padding: 10px 4px;
  border: 1px solid #d3dbcf;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  color: #4d5f57;
}
.result-rating {
  font-size: 11px;
  color: var(--ink);
  background: #eef1e8;
  border-radius: 8px;
  padding: 9px;
  margin: -10px 0 16px;
  line-height: 1.6;
}
.transfer-dialog h3 {
  font-size: 13px;
  margin: 18px 0 6px;
}
.transfer-code {
  font:
    700 min(22px, 5.6vw) / 1.2 'DM Sans',
    monospace;
  white-space: nowrap;
  letter-spacing: 2px;
  margin: 4px 0 8px;
  user-select: text;
  -webkit-user-select: text;
}
.transfer-dialog button:not(.dialog-close) {
  padding: 9px 14px;
  border: 1px solid #d3dbcf;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
}
.transfer-row {
  display: flex;
  gap: 6px;
}
.transfer-row input {
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #d3dbcf;
  border-radius: 7px;
  font:
    600 15px 'DM Sans',
    monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.transfer-status {
  min-height: 1.4em;
  font-size: 12px;
  color: var(--teal);
  white-space: pre-line;
}
.link-btn {
  margin-top: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--teal);
  padding: 0;
}
.rank-tabs {
  display: flex;
  gap: 4px;
  margin: 10px 0 8px;
}
.rank-tabs button {
  flex: 1;
  padding: 7px 4px;
  border: 1px solid #dce1d7;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #5d6d65;
}
.rank-tabs [aria-selected='true'] {
  border-color: var(--teal);
  color: var(--ink);
  background: #087f7914;
  font-weight: 800;
}
.online-row button[hidden] {
  display: none;
}
.rank-sub {
  font-size: 11px;
  color: #758378;
}
.rank-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 20px;
  max-height: min(55vh, 460px);
  overflow-y: auto;
}
.rank-list li {
  display: grid;
  grid-template-columns: 3em 1fr auto;
  gap: 8px;
  align-items: baseline;
  padding: 8px 6px;
  border-bottom: 1px solid #e5e9df;
  font-size: 13px;
  margin: 0;
}
.rank-list li.you {
  background: #087f7914;
  border-radius: 6px;
  font-weight: 700;
}
.rank-list li.gap {
  display: block;
  text-align: center;
  color: #a0ab9c;
  border: 0;
}
.rank-list .r {
  color: #8c9984;
  font-variant-numeric: tabular-nums;
}
.rank-list .n {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-list .s {
  font-variant-numeric: tabular-nums;
}
.rank-list .s small {
  color: #8c9984;
  font-weight: 400;
  margin-left: 6px;
}
.result-layer {
  overflow-y: auto;
}
@media (max-width: 700px) {
  .result-card {
    padding: 20px;
  }
  .result-icon {
    display: none;
  }
  .result-card h2 {
    font-size: 22px;
    margin: 4px 0;
  }
  .result-numbers {
    padding: 4px 0 10px;
  }
  .result-numbers strong {
    font-size: 28px;
  }
  .result-rating {
    margin: -4px 0 12px;
  }
  .online-card {
    padding: 18px;
  }
  .online-stats {
    padding: 10px 0 2px;
  }
}
@media (max-width: 360px) {
  .topbar {
    padding: 0 10px;
  }
  .brand {
    font-size: 15px;
    letter-spacing: 0;
    gap: 5px;
    overflow: hidden;
  }
  .brand svg {
    width: 20px;
    flex-shrink: 0;
  }
  .header-actions {
    gap: 6px;
  }
  .menu-open,
  .lang-btn {
    padding: 5px 7px;
  }
}

/* phones: the menu fits in the game area without scrolling */
@media (max-width: 700px) {
  .menu-card {
    gap: 7px;
  }
  .menu-btn {
    padding: 10px 15px;
  }
  .menu-btn strong {
    font-size: 15px;
  }
  .menu-btn small {
    font-size: 10px;
  }
}
