:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #e6fff5;
  background: #06110e;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: radial-gradient(ellipse at 80% 0, #14382b, transparent 55%);
}
a {
  color: #a7fbd6;
  text-decoration: none;
}
button,
select {
  font: inherit;
  color: #dcfff1;
  background: #102a20;
  border: 1px solid #426d58;
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
}
button:hover {
  background: #224c35;
}
button:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: 2px solid #b6ff68;
  outline-offset: 4px;
}
header {
  max-width: 1200px;
  margin: auto;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #284336;
  font-size: 12px;
  letter-spacing: 2px;
}
.brand {
  font-size: 20px;
  font-weight: 800;
}
.brand i {
  color: #b6ff68;
  font-size: 10px;
  font-style: normal;
}
main {
  max-width: 1200px;
  margin: auto;
  padding: 28px 24px;
}
.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 24px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 3px;
  color: #bcfc8c;
}
h1 {
  font-size: clamp(32px, 5vw, 58px);
  letter-spacing: -2px;
  margin: 10px 0;
}
p {
  color: #a9c3b5;
  line-height: 1.6;
  margin: 8px 0;
}
.saved {
  min-width: 160px;
  border-left: 1px solid #486747;
  padding-left: 28px;
  display: flex;
  flex-direction: column;
}
.saved span {
  font-size: 11px;
  letter-spacing: 2px;
}
.saved strong {
  font-size: 44px;
  color: #c4ff9c;
}
.saved small {
  color: #a9c3b5;
}
.arena {
  position: relative;
  border: 1px solid #486747;
  border-radius: 22px;
  overflow: hidden;
  background: #091b13;
  height: 540px;
  box-shadow: 0 20px 80px #0004;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 20px;
  background: linear-gradient(#07150fe8, transparent);
}
.hud div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hud small {
  font-size: 10px;
  letter-spacing: 1px;
  color: #a0baad;
}
.hud strong {
  font-size: 18px;
}
.bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(transparent, #06120ff5);
  font-size: 12px;
}
.bottom span {
  color: #b9dac6;
}
.bottom button {
  font-size: 11px;
  padding: 8px 12px;
}
#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #03110b99;
  backdrop-filter: blur(6px);
  padding: 20px;
}
#overlay[hidden] {
  display: none;
}
.panel {
  max-width: 440px;
  text-align: center;
  padding: 30px;
  background: #0c2019ec;
  border: 1px solid #477c54;
  border-radius: 20px;
  box-shadow: 0 0 90px #6af29115;
}
.panel h2 {
  font-size: 30px;
  margin: 12px 0;
}
.panel button {
  display: block;
  margin: 22px auto;
  background: #c4ff8b;
  color: #10200a;
  font-weight: 800;
  border: 0;
  padding: 14px 35px;
}
.panel small {
  font-size: 11px;
  color: #92b6a2;
}
.guide {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  margin: 30px 0;
}
.guide article {
  border-top: 1px solid #375442;
  padding-top: 18px;
}
.guide b {
  font-size: 11px;
  color: #c4ff8b;
}
.guide h3 {
  font-size: 16px;
  margin: 10px 0;
}
.guide p {
  font-size: 13px;
}
footer {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  justify-content: space-between;
  font-size: 12px;
  padding: 20px 0;
  border-top: 1px solid #284336;
}
.notice {
  font-size: 11px;
  max-width: 760px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
@media (max-width: 600px) {
  header {
    padding: 16px;
    font-size: 10px;
    letter-spacing: 1px;
  }
  .brand {
    font-size: 15px;
  }
  select {
    padding: 8px;
  }
  main {
    padding: 20px 12px;
  }
  .intro {
    gap: 12px;
  }
  .saved {
    min-width: 85px;
    padding-left: 12px;
  }
  .saved strong {
    font-size: 32px;
  }
  .saved span {
    letter-spacing: 0;
  }
  .intro p {
    font-size: 12px;
  }
  h1 {
    letter-spacing: -1px;
  }
  .arena {
    height: 520px;
  }
  .hud {
    padding: 15px 10px;
    gap: 5px;
  }
  .hud strong {
    font-size: 14px;
  }
  .hud small {
    font-size: 8px;
  }
  .guide {
    gap: 12px;
  }
  .guide h3 {
    font-size: 13px;
  }
  .guide p {
    font-size: 11px;
  }
  .panel {
    padding: 20px;
  }
  .bottom span {
    max-width: 230px;
    font-size: 10px;
  }
}

#roomPanel {
  position: absolute;
  top: 72px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  z-index: 2;
}
#roomPanel input {
  width: 130px;
  padding: 9px;
  color: #ecffe5;
  background: #11291d;
  border: 1px solid #527347;
  border-radius: 9px;
}
#roomPanel select,
#roomPanel button {
  padding: 8px;
}
#roomPanel a {
  margin-left: auto;
}
#roomPanel input:focus {
  outline: 2px solid #d3ff90;
}
.arena:has(#roomPanel) {
  height: 620px;
}
#leaderboard {
  font-size: 12px;
}
#leaderboard span {
  color: #ceff8e;
}
@media (max-width: 600px) {
  #roomPanel {
    left: 10px;
    right: 10px;
    gap: 6px;
  }
  #roomPanel label {
    display: none;
  }
  #roomPanel input {
    width: 100px;
  }
  header:has(#onlineLink) {
    flex-wrap: wrap;
    gap: 12px;
  }
  #onlineLink {
    order: 4;
    width: 100%;
    text-align: center;
  }
}

/* The same arena fills the display without restarting the round. */
.arena:fullscreen,
.arena.expanded {
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  border: 0;
  border-radius: 0;
  background: #091b13;
}
.arena.expanded {
  position: fixed;
  inset: 0;
  z-index: 1000;
}
body.game-expanded {
  overflow: hidden;
}
.arena:fullscreen .hud,
.arena.expanded .hud {
  padding-top: max(20px, env(safe-area-inset-top));
}
.arena:fullscreen .bottom,
.arena.expanded .bottom {
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}
.bottom #hint {
  margin-right: auto;
}
.bottom #fullscreen {
  white-space: nowrap;
}
@media (max-width: 600px) {
  .bottom {
    flex-wrap: wrap;
  }
  .bottom #hint {
    flex-basis: 100%;
    max-width: none;
  }
  .arena:fullscreen .panel,
  .arena.expanded .panel {
    max-height: calc(100dvh - 170px);
    overflow: auto;
  }
  .arena:fullscreen #roomPanel,
  .arena.expanded #roomPanel {
    top: max(72px, calc(env(safe-area-inset-top) + 62px));
  }
}
#profilePanel {
  position: absolute;
  top: 65px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  z-index: 2;
}
#profilePanel input,
#profilePanel select {
  padding: 7px;
  color: #ecffe5;
  background: #11291d;
  border: 1px solid #527347;
  border-radius: 9px;
  font: inherit;
}
#nickname {
  width: 105px;
}
#country {
  width: 120px;
}
#profilePanel #color,
#roomPanel #color {
  width: 36px;
  height: 31px;
  padding: 3px;
  cursor: pointer;
}
#profilePanel label,
#roomPanel label {
  color: #bcd7c8;
}
#roomPanel #country {
  width: 112px;
}
#roomPanel {
  top: 65px;
  gap: 7px;
}
#roomPanel #nickname {
  width: 100px;
}
#objectives {
  position: absolute;
  bottom: 60px;
  left: 18px;
  right: 18px;
  display: flex;
  gap: 20px;
  pointer-events: none;
  font-size: 10px;
  color: #c9e7d0;
  z-index: 1;
}
#objectives > div {
  flex: 1;
  max-width: 210px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
progress {
  height: 5px;
  width: 100%;
  accent-color: #b6ff68;
}
#objectives span {
  background: #091b13bb;
  padding: 3px 5px;
  border-radius: 4px;
}
#personalGarden {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  margin-top: 28px;
  padding: 22px 0;
  border-bottom: 1px solid #375442;
}
#personalGarden h2 {
  font-size: 21px;
  margin: 10px 0;
}
#personalGarden p {
  font-size: 12px;
}
#personalGarden > div:last-child {
  min-width: 220px;
  max-width: 360px;
}
.panel #share {
  background: #14382b;
  color: #ceffd8;
  border: 1px solid #527347;
  font-size: 12px;
  padding: 9px 18px;
  margin: 10px auto;
}
.panel #share[hidden] {
  display: none;
}
#shareFallback {
  width: 100%;
  min-height: 110px;
  background: #091b13;
  color: #ceffd8;
  border: 1px solid #527347;
  border-radius: 8px;
}
#shareStatus {
  font-size: 11px;
}
#color:focus-visible,
input:focus-visible {
  outline: 2px solid #b6ff68;
  outline-offset: 3px;
}
@media (max-width: 600px) {
  #profilePanel {
    left: 10px;
    right: 10px;
    gap: 5px;
    top: 59px;
  }
  #profilePanel label,
  #roomPanel label {
    display: none;
  }
  #profilePanel #nickname,
  #roomPanel #nickname {
    width: 85px;
  }
  #profilePanel #country,
  #roomPanel #country {
    width: 88px;
  }
  #profilePanel #mode {
    max-width: 126px;
  }
  .hud {
    gap: 3px;
  }
  .hud strong {
    font-size: 13px;
  }
  .hud small {
    font-size: 7px;
    letter-spacing: 0;
  }
  #objectives {
    bottom: 95px;
    left: 10px;
    right: 10px;
    gap: 8px;
    font-size: 8px;
  }
  #personalGarden {
    flex-direction: column;
    gap: 10px;
  }
  #personalGarden > div:last-child {
    min-width: 0;
    max-width: none;
  }
  .panel {
    max-height: calc(100% - 145px);
    overflow: auto;
  }
}
.agent-link {
  font: 11px system-ui;
  color: #a1dec9;
  text-decoration: none;
  border: 1px solid #375440;
  border-radius: 8px;
  padding: 7px 10px;
}
#socialPanel {
  position: absolute;
  z-index: 6;
  right: 12px;
  top: 112px;
  bottom: 64px;
  width: min(390px, calc(100% - 24px));
  box-sizing: border-box;
  padding: 14px;
  background: #071b16f5;
  border: 1px solid #6be6b866;
  border-radius: 16px;
  box-shadow: 0 18px 60px #0008;
  overflow: auto;
  backdrop-filter: blur(12px);
  font: 12px/1.5 system-ui;
  color: #d7e9de;
}
#socialPanel[hidden] {
  display: none;
}
.social-head,
.wallet-actions,
.shop-controls,
#chatForm,
#shopItems > div {
  display: flex;
  align-items: center;
  gap: 8px;
}
.social-head {
  justify-content: space-between;
  font-size: 14px;
}
.wallet-actions {
  flex-wrap: wrap;
  margin-top: 12px;
}
#socialPanel button,
#socialPanel select,
#socialPanel input {
  font: 11px system-ui;
  padding: 9px 10px;
  border: 1px solid #5bd1a455;
  border-radius: 9px;
  background: #0c2a20;
  color: #c5f8da;
  min-width: 0;
}
#socialPanel button {
  cursor: pointer;
}
#socialPanel button:disabled {
  opacity: 0.45;
  cursor: default;
}
#socialPanel p {
  font-size: 10px;
  color: #a5bdb0;
}
#chatLog {
  list-style: none;
  padding: 8px;
  margin: 0 0 8px;
  height: 110px;
  overflow: auto;
  background: #020b0880;
  border-radius: 10px;
  overflow-wrap: anywhere;
}
#chatLog li {
  padding: 4px 0;
}
#chatLog b {
  color: #94e6c0;
}
#chatInput {
  flex: 1;
  width: 0;
}
#socialPanel h3 {
  font-size: 13px;
  margin: 18px 0 9px;
}
#shopItems > div {
  justify-content: space-between;
  margin: 8px 0;
  padding: 8px;
  border-radius: 10px;
  background: #0d271d;
}
#shopItems > div span {
  max-width: 110px;
}
#shopItems button {
  font-size: 10px;
  max-width: 210px;
}
#invoiceDetails {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#invoice button {
  margin: 4px;
}
#invoice a {
  color: #9adef2;
}
#socialStatus {
  min-height: 20px;
  color: #c7ec89 !important;
}
.bottom {
  gap: 8px;
  flex-wrap: wrap;
}
.bottom button {
  white-space: nowrap;
}
@media (max-width: 650px) {
  #socialPanel {
    top: 145px;
    bottom: 94px;
  }
  .bottom {
    padding: 10px;
  }
  .bottom span {
    flex-basis: 100%;
    font-size: 10px;
  }
  .bottom button {
    font-size: 10px;
    padding: 7px;
  }
  #roomPanel {
    flex-wrap: wrap;
  }
  #roomPanel #nickname {
    width: 90px;
  }
  #roomPanel #country {
    max-width: 110px;
  }
}

/* Touch screens: readable controls, safe areas and compact in-round HUD. */
.arena {
  overscroll-behavior: contain;
}
.arena:fullscreen,
.arena.expanded {
  padding: 0;
}
@media (pointer: coarse), (max-width: 1024px) {
  button,
  select,
  input {
    min-height: 44px;
  }
  input,
  select,
  #socialPanel input,
  #socialPanel select {
    font-size: 16px;
  }
  .arena {
    height: min(680px, 80svh);
    min-height: 430px;
  }
  .arena:has(#roomPanel) {
    height: min(740px, 85svh);
  }
  .arena:has(#overlay[hidden]) #roomPanel,
  .arena:has(#overlay[hidden]) #profilePanel {
    display: none;
  }
  .arena:fullscreen,
  .arena.expanded {
    height: 100dvh;
    min-height: 0;
  }
  .hud {
    padding: max(12px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right)) 12px
      max(12px, env(safe-area-inset-left));
  }
  .bottom {
    padding: 8px max(10px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    gap: 5px;
  }
  .bottom #hint {
    display: none;
  }
  .bottom button {
    flex: 1;
    min-height: 44px;
    font-size: 10px;
    padding: 6px;
  }
  #socialPanel {
    top: max(65px, calc(env(safe-area-inset-top) + 56px));
    bottom: max(65px, calc(env(safe-area-inset-bottom) + 56px));
    backdrop-filter: none;
  }
  #socialPanel button {
    min-height: 44px;
  }
  #overlay {
    padding-top: 155px;
    backdrop-filter: none;
  }
  .panel {
    padding: 15px;
    max-height: 100%;
  }
  .panel h2 {
    font-size: 22px;
  }
  .panel p {
    font-size: 12px;
  }
  .panel button {
    margin: 12px auto;
  }
  #objectives {
    bottom: max(65px, calc(env(safe-area-inset-bottom) + 56px));
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  #roomPanel,
  #profilePanel {
    top: 52px;
  }
  #overlay {
    padding-top: 105px;
  }
  .panel .eyebrow,
  .panel small {
    display: none;
  }
  .panel h2 {
    margin: 4px;
    font-size: 18px;
  }
  .panel p {
    line-height: 1.25;
    margin: 4px;
  }
  .panel button {
    margin: 8px auto;
    padding: 10px 25px;
  }
}
/* The room selector must not override the expanded arena height. */
.arena:has(#roomPanel):fullscreen,
.arena.expanded:has(#roomPanel) {
  height: 100dvh;
  min-height: 0;
}
