@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+JP:wght@400;500;600;700&display=swap");
:root {
  font-family: "DM Sans", "Noto Sans JP", sans-serif;
  color: #30462e;
  background: #fafbf7;
  font-synthesis: none;
  --green: #2d6344;
  --muted: #7b8972;
  --line: #dfe5d8;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
  color: inherit;
}
button:disabled {
  opacity: 0.38;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid #9dba6d;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
#board {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  outline: none;
}
#board.dragging {
  cursor: grabbing;
}
.glass {
  background: #fbfcf4ec;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid #ffffffc7;
  box-shadow:
    0 5px 24px #34472a15,
    0 1px 3px #34472a0c;
  border-radius: 16px;
}
.topbar {
  position: fixed;
  top: 20px;
  left: 24px;
  right: 24px;
  display: grid;
  grid-template-columns: 1fr 340px 1fr;
  gap: 30px;
  align-items: center;
  padding: 16px 20px;
  z-index: 20;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: var(--green);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.7px;
  width: max-content;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--green);
  color: #fff;
  border-radius: 12px;
  font-size: 27px;
  font-weight: 500;
}
.brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 2px;
  font-weight: 600;
  margin-top: 1px;
}
.world-progress {
  min-width: 0;
}
.progress-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 10px;
}
.progress-heading > span:last-child {
  margin-left: auto;
  color: var(--muted);
}
.progress-heading > span:last-child b {
  font-weight: 500;
}
#percent {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.5px;
}
.progress-track {
  height: 5px;
  background: #dfe8d4;
  border-radius: 5px;
  overflow: hidden;
  margin: 7px 0;
}
#progress {
  height: 100%;
  background: #7c9d5d;
  transition: width 0.4s;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--muted);
}
.live-dot,
.connection-status i {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7e9d5c;
  margin-right: 4px;
}
.name-form {
  justify-self: end;
  width: 210px;
  position: relative;
}
.name-form label {
  display: block;
  font-size: 9px;
  color: var(--muted);
  margin-bottom: 4px;
}
.name-form > div {
  display: flex;
  gap: 6px;
  align-items: center;
}
.name-form input {
  min-width: 0;
  width: 100%;
  background: #fff9;
  border: 1px solid #dce5d3;
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--green);
  font-size: 12px;
}
.name-form button {
  background: #e5eddc;
  border-radius: 6px;
  padding: 8px 10px;
  white-space: nowrap;
  font-size: 10px;
}
#name-status {
  position: absolute;
  right: 0;
  top: 100%;
  font-size: 9px;
  color: var(--green);
  margin-top: 3px;
}
.ranking-panel {
  position: fixed;
  top: 130px;
  right: 24px;
  width: 275px;
  z-index: 12;
  padding: 19px 20px;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.panel-heading h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.5px;
}
.panel-heading button {
  font-size: 10px;
  color: var(--muted);
  padding: 4px;
}
.ranking-panel ol {
  list-style: none;
  margin: 14px 0;
  padding: 0;
  max-height: min(45vh, 410px);
  overflow: auto;
}
.ranking-panel li {
  display: grid;
  grid-template-columns: 25px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.rank-place {
  color: #8a987e;
  font-size: 13px;
}
.rank-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-score {
  font-size: 18px;
  font-weight: 500;
}
.ranking-panel li:first-child {
  padding: 10px 0 14px;
}
.ranking-panel li:first-child .rank-place {
  color: #a98734;
  font-size: 21px;
}
.ranking-panel li:first-child .rank-name {
  font-size: 14px;
  font-weight: 600;
}
.ranking-panel li:first-child .rank-score {
  font-size: 31px;
  color: var(--green);
}
.ranking-panel:not(.expanded) li:nth-child(n + 4) {
  display: none;
}
.ranking-panel li.you .rank-name {
  color: var(--green);
}
.ranking-panel li.empty-ranking {
  display: block;
  font-size: 12px;
  color: var(--muted);
  padding: 14px 0;
}
.your-rank {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}
.your-rank strong {
  font-size: 19px;
  color: var(--green);
  font-weight: 500;
}
.your-rank small {
  font-size: 10px;
}
.notifications {
  position: fixed;
  top: 130px;
  left: 50%;
  transform: translateX(-50%);
  width: min(430px, calc(100% - 40px));
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}
.solve-toast {
  pointer-events: auto;
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 15px 19px;
  border-radius: 12px;
  background: #f7fbeeff;
  border: 1px solid #d3e1bd;
  box-shadow: 0 8px 35px #4a653628;
  text-align: left;
  animation: toast-in 0.25s ease-out;
  cursor: pointer;
}
.solve-toast.leaving {
  opacity: 0;
  transform: translateY(-10px);
  transition:
    opacity 0.25s,
    transform 0.25s;
}
.toast-icon {
  font-size: 26px;
  color: #648b44;
}
.toast-content {
  min-width: 0;
  flex: 1;
}
.toast-content strong {
  font-size: 14px;
  font-weight: 600;
  display: block;
}
.toast-content small {
  display: block;
  font-size: 10px;
  color: #839170;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}
.toast-arrow {
  color: #829b69;
  font-size: 18px;
}
.utility-bar {
  position: fixed;
  left: 24px;
  bottom: 34px;
  display: flex;
  gap: 8px;
  z-index: 15;
}
.icon-button {
  width: 43px;
  height: 43px;
  font-size: 23px;
  border-radius: 11px;
}
.icon-button:last-child {
  font-size: 18px;
}
.view-controls {
  position: fixed;
  right: 24px;
  bottom: 34px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  z-index: 15;
  border-radius: 12px;
}
.view-controls button {
  width: 30px;
  height: 30px;
  font-size: 20px;
}
.view-controls span {
  font-size: 10px;
  min-width: 37px;
  text-align: center;
}
.view-controls .control-divider {
  min-width: 0;
  height: 17px;
  border-left: 1px solid var(--line);
  margin: 0 3px;
}
.composer {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  width: 410px;
  padding: 15px 18px;
  z-index: 16;
}
.composer-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 11px;
}
#position {
  font-weight: 600;
}
#cell-kind {
  font-size: 9px;
  color: var(--muted);
}
#lives {
  margin-left: auto;
  font-size: 18px;
  color: #759359;
  white-space: nowrap;
  letter-spacing: 2px;
}
#recovery {
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
}
#number-form {
  display: flex;
  gap: 8px;
}
#number-input {
  min-width: 0;
  flex: 1;
  width: 100px;
  background: #ffffffe8;
  border: 1px solid #d8e2cd;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 20px;
  color: var(--green);
}
#number-input::placeholder {
  color: #aebba2;
}
#number-form button {
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 12px;
  white-space: nowrap;
}
.primary {
  background: var(--green);
  color: white;
}
#hint {
  background: #e8eddf;
  color: #657952;
  padding: 9px 12px !important;
}
#candidate-info {
  font-size: 10px;
  color: #7e8f6d;
  margin-top: 9px;
  max-height: 35px;
  overflow: auto;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
#candidate-info:empty,
#message:empty {
  display: none;
}
#message {
  font-size: 10px;
  line-height: 1.7;
  color: #61784d;
  margin-top: 6px;
}
#message.error {
  color: #b84539;
}
.connection-status {
  position: fixed;
  left: 25px;
  bottom: 12px;
  font-size: 8px;
  color: #849178;
  z-index: 10;
}
.connection-status.offline i {
  background: #c0955f;
}
.timer {
  position: fixed;
  right: 28px;
  bottom: 12px;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  color: #8e9b82;
  z-index: 10;
}
.floating-panel {
  position: fixed;
  left: 24px;
  bottom: 88px;
  width: 280px;
  padding: 18px;
  z-index: 30;
}
.floating-panel h2 {
  font-size: 14px;
}
.floating-panel .panel-heading button {
  font-size: 22px;
}
#minimap {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  margin-top: 13px;
}
#minimap button {
  aspect-ratio: 1;
  background: #e1e9d8;
  border: 1px solid #d7e1cb;
  border-radius: 2px;
  padding: 0;
}
#minimap button.active {
  outline: 2px solid #507040;
  outline-offset: 0;
}
#minimap button.complete {
  background: #96b57a;
}
.help-panel {
  font-size: 11px;
  line-height: 1.9;
  color: #778568;
  max-height: 65vh;
  overflow: auto;
}
.help-panel h3 {
  font-size: 12px;
}
.completion-banner {
  position: fixed;
  z-index: 26;
  top: 130px;
  left: 50%;
  transform: translateX(-50%);
  padding: 20px;
  width: min(480px, 90%);
  text-align: center;
  line-height: 1.9;
  font-size: 14px;
}
#challenge {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}
#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}
#confetti i {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 14px;
  animation: confetti-fall 3.5s ease-in forwards;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes confetti-fall {
  to {
    transform: translateY(110vh) rotate(550deg);
  }
}
@media (max-width: 1050px) {
  .topbar {
    grid-template-columns: auto 1fr 180px;
    gap: 20px;
  }
  .brand {
    font-size: 19px;
  }
  .name-form {
    width: 180px;
  }
  .ranking-panel {
    width: 240px;
  }
  .notifications {
    left: 24px;
    transform: none;
    width: 360px;
  }
  .composer {
    width: 380px;
  }
  .utility-bar {
    gap: 5px;
  }
  .view-controls {
    gap: 0;
  }
}
@media (max-width: 700px) {
  .topbar {
    top: max(10px, env(safe-area-inset-top));
    left: 10px;
    right: 10px;
    padding: 12px 13px;
    grid-template-columns: 1fr 155px;
    gap: 10px;
    border-radius: 13px;
  }
  .brand {
    font-size: 18px;
    gap: 8px;
  }
  .brand-mark {
    width: 33px;
    height: 33px;
    font-size: 22px;
    border-radius: 9px;
  }
  .brand small {
    font-size: 7px;
    letter-spacing: 1.2px;
  }
  .name-form {
    width: 155px;
  }
  .name-form label {
    font-size: 8px;
  }
  .name-form input {
    font-size: 11px;
    padding: 7px 8px;
  }
  .name-form button {
    font-size: 9px;
    padding: 8px;
  }
  .name-form > div {
    gap: 4px;
  }
  .world-progress {
    grid-column: 1/-1;
    grid-row: 2;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
  }
  .progress-heading {
    font-size: 9px;
  }
  #percent {
    font-size: 16px;
  }
  .progress-heading > span:last-child {
    font-size: 9px;
  }
  .progress-track {
    margin: 5px 0;
  }
  .progress-meta {
    font-size: 8px;
  }
  .ranking-panel {
    top: 164px;
    left: 10px;
    right: auto;
    width: 205px;
    padding: 12px 14px;
    border-radius: 12px;
  }
  .panel-heading h2 {
    font-size: 14px;
  }
  .panel-heading button {
    font-size: 9px;
  }
  .ranking-panel ol {
    margin: 6px 0 8px;
    max-height: 28vh;
  }
  .ranking-panel li {
    padding: 6px 0;
    font-size: 10px;
    gap: 5px;
    grid-template-columns: 19px 1fr auto;
  }
  .ranking-panel li:first-child {
    padding: 4px 0 8px;
  }
  .ranking-panel li:first-child .rank-name {
    font-size: 11px;
  }
  .ranking-panel li:first-child .rank-score {
    font-size: 24px;
  }
  .ranking-panel li:first-child .rank-place {
    font-size: 16px;
  }
  .rank-place {
    font-size: 11px;
  }
  .rank-score {
    font-size: 14px;
  }
  .your-rank {
    font-size: 9px;
  }
  .your-rank strong {
    font-size: 16px;
  }
  .ranking-panel li.empty-ranking {
    font-size: 10px;
    padding: 7px 0;
  }
  .notifications {
    top: 164px;
    left: auto;
    right: 10px;
    width: calc(100% - 235px);
    min-width: 125px;
  }
  .solve-toast {
    padding: 10px;
    gap: 6px;
    border-radius: 10px;
  }
  .toast-icon {
    font-size: 17px;
  }
  .toast-content strong {
    font-size: 10px;
    line-height: 1.7;
  }
  .toast-content small {
    font-size: 8px;
    line-height: 1.5;
  }
  .toast-arrow {
    display: none;
  }
  .composer {
    bottom: calc(14px + env(safe-area-inset-bottom));
    width: calc(100% - 20px);
    padding: 12px 14px;
    border-radius: 13px;
  }
  .composer-top {
    gap: 6px;
    margin-bottom: 8px;
    font-size: 10px;
  }
  #cell-kind {
    font-size: 8px;
  }
  #lives {
    font-size: 17px;
    letter-spacing: 1px;
  }
  #recovery {
    font-size: 8px;
  }
  #number-input {
    font-size: 18px;
    padding: 9px 10px;
  }
  #number-form button {
    padding: 8px 13px;
    font-size: 11px;
  }
  #candidate-info {
    max-height: 29px;
    font-size: 9px;
    margin-top: 7px;
  }
  #message {
    font-size: 9px;
    max-height: 34px;
    overflow: auto;
  }
  .utility-bar {
    left: 10px;
    bottom: calc(210px + env(safe-area-inset-bottom));
    gap: 6px;
  }
  .icon-button {
    width: 36px;
    height: 36px;
    font-size: 21px;
    border-radius: 10px;
  }
  .view-controls {
    right: 10px;
    bottom: calc(210px + env(safe-area-inset-bottom));
    padding: 3px 5px;
    border-radius: 10px;
  }
  .view-controls button {
    width: 26px;
    height: 29px;
    font-size: 18px;
  }
  .view-controls span {
    font-size: 9px;
    min-width: 33px;
  }
  .connection-status {
    left: 13px;
    bottom: calc(192px + env(safe-area-inset-bottom));
    font-size: 7px;
  }
  .timer {
    right: 14px;
    bottom: calc(194px + env(safe-area-inset-bottom));
    font-size: 8px;
  }
  .floating-panel {
    left: 10px;
    bottom: calc(254px + env(safe-area-inset-bottom));
    width: 260px;
    max-height: calc(100dvh - 420px);
    overflow: auto;
  }
  .completion-banner {
    top: 164px;
    font-size: 12px;
  }
  .help-panel p {
    font-size: 10px;
  }
}
@media (max-height: 560px) {
  .ranking-panel {
    max-height: calc(100dvh - 235px);
    overflow: auto;
  }
  .composer {
    bottom: 10px;
  }
  .utility-bar,
  .view-controls {
    bottom: 15px;
  }
  .connection-status,
  .timer {
    display: none;
  }
  .notifications {
    top: 120px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
