* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #d7dbe2;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
  font-family: ui-sans-serif, system-ui, sans-serif;
  color: #1c222c;
}

#arena {
  display: block;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  touch-action: none;
  cursor: crosshair;
}

#hint,
#live,
#score {
  position: fixed;
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(28, 34, 44, 0.72);
  color: #f4f7fb;
  font: 600 13px/1.2 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}

#hint {
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  opacity: 1;
  transition: opacity 0.6s ease;
}

#hint.hidden {
  opacity: 0;
}

#live {
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
}

#score {
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
}

#vitals {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 2;
  width: 190px;
  pointer-events: none;
}

.meter {
  height: 9px;
  margin-bottom: 6px;
  border-radius: 999px;
  background: rgba(28, 34, 44, 0.28);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  width: 0;
}

.meter.shield span {
  background: #38bdf8;
}

.meter.health span {
  background: #4ade80;
}

#vitals p {
  margin: 0;
  font: 700 12px/1.2 ui-sans-serif, system-ui, sans-serif;
  color: #1c222c;
}

.weapon-note {
  margin: 8px 2px 16px;
  color: #4b5565;
  font-size: 14px;
  line-height: 1.35;
}

#class .weapon-note:last-child {
  margin-bottom: 0;
}

#overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: safe center;
  padding: 20px;
  overflow: auto;
  background: rgba(215, 219, 226, 0.94);
  z-index: 3;
  touch-action: pan-y;
}

#overlay[hidden] {
  display: none;
}

[hidden] {
  display: none !important;
}

#summary.card {
  width: min(720px, 100%);
  padding: 16px 16px 14px;
}

#summary .mark {
  margin-bottom: 4px;
}

.summary-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.summary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

#summary .summary-actions button {
  min-height: 40px;
  margin-top: 0;
  font-size: 14px;
}

#summary #join-friends,
#summary #leave {
  background: transparent;
  color: #1c222c;
}

.score-title {
  margin: 0 2px 8px;
  color: #1c222c;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.stats th,
.stats td {
  padding: 2px 4px;
  border-bottom: 1px solid #e4e7ec;
  text-align: left;
}

.team-blue {
  color: #2563eb;
}

.team-red {
  color: #dc2626;
}

.stats tr.team-blue td {
  background: rgba(59, 130, 246, 0.14);
}

.stats tr.team-red td {
  background: rgba(239, 68, 68, 0.14);
}

.stats {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

.stats th:first-child,
.stats td:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats th:nth-child(n + 2),
.stats td:nth-child(n + 2) {
  width: 3.4rem;
  text-align: right;
}

.narrow-label {
  display: none;
}

@media (max-width: 560px) {
  .wide-label {
    display: none;
  }

  .narrow-label {
    display: inline;
  }

  .stats th:nth-child(n + 2),
  .stats td:nth-child(n + 2) {
    width: 1.5rem;
  }
}

.stats th {
  color: #6b7280;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.win-line {
  margin-top: 4px;
  color: #4b5565;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.3;
  text-transform: none;
}

.card {
  width: min(440px, 100%);
  padding: 28px 22px 22px;
  border-radius: 22px;
  background: #f7f8fa;
  box-shadow: 0 24px 60px rgba(28, 34, 44, 0.14);
  user-select: text;
  -webkit-user-select: text;
  touch-action: manipulation;
}

.card h1 {
  margin: 0 0 8px;
  font-size: 32px;
  letter-spacing: -0.04em;
}

.mark {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #667084;
}

.sub,
#gate-copy,
#status {
  margin: 0 0 16px;
  color: #4b5565;
  font-size: 15px;
  line-height: 1.4;
}

label {
  display: block;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 700;
  color: #667084;
}

input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid #d5dae3;
  border-radius: 12px;
  background: #fff;
  color: #1c222c;
  font: 600 16px/1.2 ui-sans-serif, system-ui, sans-serif;
}

button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: #1c222c;
  color: #f7f8fa;
  font: 700 15px/1 ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
}

#class-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

#class-list button {
  min-height: 42px;
  margin: 0;
  background: #1c222c;
  color: #f7f8fa;
  font-size: 12px;
  line-height: 1.2;
  white-space: normal;
}

button + button,
#solo,
#join-room {
  margin-top: 10px;
  background: transparent;
  color: #1c222c;
}

#gate-join {
  margin-top: 14px;
}

#gate-join-go {
  margin-top: 10px;
}

.code-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 8px;
}

#room-code {
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  color: #1c222c;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.copy-hint {
  opacity: 0;
  color: #667084;
  font-size: 13px;
  font-weight: 700;
}

.code-row:hover .copy-hint,
.code-row:focus-within .copy-hint,
.copy-hint.is-shown {
  opacity: 1;
}

.link-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.link-row input {
  margin: 0;
  min-width: 0;
}

.link-row button {
  width: auto;
  padding: 0 16px;
}

#online-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: min(32vh, 220px);
  overflow: auto;
}

#online-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #eef1f5;
  font-size: 14px;
}

#online-list .tag {
  flex: none;
  text-align: right;
}

#menu-join-box {
  margin-top: 14px;
}

#menu-join-go {
  margin-top: 10px;
}

#roster {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: min(46vh, 340px);
  overflow: auto;
}

#roster li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: #eef1f5;
}

#roster button.slot {
  width: auto;
  min-height: 32px;
  margin: 0;
  padding: 0 12px;
  background: #1c222c;
  color: #f7f8fa;
  font-size: 12px;
}

#roster li.open button.slot {
  width: 100%;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex: none;
}

.who {
  flex: 1;
  min-width: 0;
  font-weight: 700;
}

.tag {
  font-size: 12px;
  font-weight: 700;
  color: #667084;
}

.tag.ready {
  color: #15803d;
}

#ready.is-ready {
  background: #15803d;
}

#ready:disabled {
  opacity: 0.55;
  cursor: default;
}
