:root {
  color-scheme: dark;
  --bg: #141a20;
  --panel: #192128;
  --ink: #e4e9e7;
  --muted: #8b969e;
  --line: #303b43;
  --accent: #a9c6d2;
  --error: #e5b7ab;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.45;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
[hidden] {
  display: none !important;
}
.shell {
  max-width: 1240px;
  margin: auto;
  padding: 0 48px;
}
header {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand {
  text-decoration: none;
  color: var(--ink);
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-icon {
  color: var(--accent);
  font-size: 30px;
  transform: rotate(-13deg);
}
.edition {
  font:
    11px ui-monospace,
    monospace;
  border: 1px solid var(--line);
  padding: 4px;
  letter-spacing: 0;
  margin-left: 2px;
}
.subtle,
.text-button,
.icon-button,
.close {
  background: none;
  color: var(--muted);
  border: 0;
}
.subtle {
  font-size: 13px;
}
.subtle span {
  margin-left: 15px;
}
.intro {
  text-align: center;
  padding: 48px 0 38px;
}
.eyebrow,
.note-label {
  font:
    10px ui-monospace,
    SFMono-Regular,
    monospace;
  letter-spacing: 1.5px;
  color: var(--muted);
}
.dot,
.small-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
  vertical-align: middle;
}
.intro h1 {
  font-size: clamp(36px, 4.2vw, 54px);
  font-weight: 450;
  letter-spacing: -2px;
  margin: 16px 0 14px;
}
.intro h1 em {
  font-style: normal;
  color: var(--accent);
}
p {
  line-height: 1.7;
}
.intro p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}
.play-layout {
  display: grid;
  grid-template-columns: 1fr 420px 1fr;
  gap: 54px;
  align-items: start;
  max-width: 1050px;
  margin: auto;
}
.left-notes,
.right-notes {
  padding-top: 56px;
  font-size: 14px;
}
.left-notes p,
.right-notes p {
  margin: 18px 0;
}
.muted {
  color: var(--muted);
  font-size: 12px;
}
.keys {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 24px 0;
}
.keys span {
  font-size: 11px;
  color: var(--muted);
  margin-left: 5px;
}
kbd {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
}
.fine-rule {
  width: 35px;
  height: 1px;
  background: var(--line);
  margin: 28px 0;
}
.game-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 16px 60px #00000015;
}
.scoreboard {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 34px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
}
.scoreboard div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.scoreboard span {
  font:
    9px ui-monospace,
    monospace;
  letter-spacing: 1px;
  color: var(--muted);
}
.scoreboard strong {
  font:
    17px ui-monospace,
    monospace;
  font-weight: 400;
}
.scoreboard .lives-block {
  margin-left: auto;
}
.lives-block strong {
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--accent);
}
.icon-button {
  font-size: 22px;
  padding: 8px;
  margin-right: -10px;
}
.canvas-wrap {
  position: relative;
  aspect-ratio: 420/580;
  overflow: hidden;
  background: #141c22;
}
canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #141c22dd;
  padding: 24px;
  text-align: center;
}
.overlay-symbol {
  font:
    44px ui-monospace,
    monospace;
  color: var(--accent);
  margin-bottom: 10px;
}
.game-overlay h2 {
  font-size: 28px;
  letter-spacing: -0.8px;
  font-weight: 450;
  margin: 8px 0;
}
.game-overlay p {
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 25px;
}
.primary {
  background: var(--accent);
  color: #18232a;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 13px 20px;
  font-weight: 550;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 35px;
  align-items: center;
}
.primary:hover {
  background: #c1d6df;
}
.game-overlay small {
  margin-top: 20px;
  font-size: 10px;
  color: var(--muted);
}
.game-bottom {
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: var(--muted);
}
.text-button {
  font-size: 11px;
  padding: 8px 0;
}
.text-button:hover,
.subtle:hover {
  color: var(--ink);
}
.record-box {
  display: flex;
  flex-direction: column;
  gap: 17px;
}
.record-box strong {
  font:
    40px ui-monospace,
    monospace;
  letter-spacing: -2px;
  font-weight: 350;
}
.record-box .muted {
  font-size: 10px;
}
.outline {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  padding: 11px 13px;
  font-size: 11px;
}
.outline:hover {
  border-color: var(--muted);
}
.right-notes .outline {
  margin-top: 17px;
  width: 100%;
  text-align: left;
}
.level-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 35px;
}
.level-picker label {
  font-size: 11px;
  color: var(--muted);
}
select {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 5px;
  padding: 8px;
  width: 70px;
}
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 45px;
  padding: 23px 0;
  border-top: 1px solid var(--line);
  font:
    9px ui-monospace,
    monospace;
  letter-spacing: 1px;
  color: var(--muted);
}
footer button span {
  margin-left: 15px;
}
dialog {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  width: calc(100% - 32px);
  max-width: 420px;
  max-height: 90dvh;
  overflow: auto;
  box-shadow: 0 20px 100px #0005;
}
dialog::backdrop {
  background: #080e14c9;
  backdrop-filter: blur(4px);
}
dialog h2 {
  font-size: 26px;
  font-weight: 450;
  letter-spacing: -0.6px;
  margin: 20px 0 12px;
}
.dialog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.close {
  font-size: 25px;
  line-height: 1;
  padding: 0 4px;
}
form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  margin-top: 20px;
}
input,
textarea {
  background: #121a20;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 12px;
  min-width: 0;
  width: 100%;
  font-size: 16px;
}
input::placeholder,
textarea::placeholder {
  color: #687782;
}
form .primary {
  width: 100%;
  margin-top: 18px;
}
form small {
  display: block;
  font-size: 10px;
  line-height: 1.7;
  color: var(--muted);
  margin-top: 16px;
}
.form-error {
  font-size: 12px;
  line-height: 1.5;
  color: var(--error);
  min-height: 16px;
  margin: 10px 0;
}
.privacy-note {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.chat-dialog {
  max-width: 500px;
}
.chat-dialog h2 {
  font-size: 20px;
  margin: 8px 0 0;
}
.messages {
  height: 36dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 2px;
}
.bubble {
  max-width: 86%;
  border: 1px solid var(--line);
  padding: 10px 13px;
  border-radius: 8px;
  align-self: flex-start;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.5;
}
.bubble.mine {
  align-self: flex-end;
  background: #263640;
  border-color: #3b515e;
}
.bubble small {
  display: block;
  font-size: 9px;
  color: var(--muted);
  margin-top: 5px;
}
.message-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.message-form textarea {
  resize: none;
}
.message-form .primary {
  margin: 0;
  width: 45px;
  justify-content: center;
  padding: 10px;
  font-size: 22px;
}
.invite-result {
  font:
    14px ui-monospace,
    monospace;
  overflow-wrap: anywhere;
  user-select: all;
}
.conversations {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 15px;
}
.conversation {
  display: flex;
  justify-content: space-between;
  text-align: left;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #141c22;
  color: var(--ink);
}
.conversation span {
  color: var(--accent);
  font-size: 11px;
}
.toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 13px 20px;
  border-radius: 6px;
  font-size: 12px;
  max-width: 90%;
  z-index: 10;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
@media (min-width: 1000px) and (max-height: 900px) {
  header {
    height: 78px;
  }
  .intro {
    padding: 30px 0;
  }
  .canvas-wrap {
    aspect-ratio: 420/480;
  }
  .play-layout {
    grid-template-columns: 1fr 370px 1fr;
  }
  .intro h1 {
    font-size: 43px;
  }
  footer {
    margin-top: 28px;
  }
}
@media (max-width: 1000px) {
  .shell {
    padding: 0 28px;
  }
  .play-layout {
    grid-template-columns: 1fr minmax(290px, 420px);
    gap: 35px;
  }
  .left-notes {
    display: none;
  }
  .right-notes {
    grid-column: 1;
    grid-row: 1;
  }
  .game-panel {
    grid-column: 2;
  }
  .intro {
    padding-top: 35px;
  }
  header {
    height: 78px;
  }
}
@media (max-width: 650px) {
  .shell {
    padding: 0 18px;
  }
  header {
    height: 62px;
  }
  .brand {
    font-size: 15px;
    gap: 7px;
  }
  .brand-icon {
    font-size: 25px;
  }
  .intro {
    padding: 22px 0;
  }
  .eyebrow {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .intro h1 {
    font-size: 35px;
    margin: 10px 0;
    letter-spacing: -1.4px;
  }
  .intro p {
    font-size: 11px;
  }
  .play-layout {
    display: flex;
    flex-direction: column;
    gap: 17px;
    max-width: 420px;
  }
  .game-panel {
    width: 100%;
  }
  .canvas-wrap {
    aspect-ratio: 420/550;
    max-height: 58dvh;
  }
  .scoreboard {
    height: 57px;
    padding: 0 16px;
    gap: 27px;
  }
  .scoreboard strong {
    font-size: 15px;
  }
  .scoreboard span {
    font-size: 8px;
  }
  .game-bottom {
    height: 36px;
    padding: 0 14px;
  }
  .right-notes {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
  }
  .right-notes .fine-rule,
  .right-notes p,
  .right-notes .record-box .muted {
    display: none;
  }
  .record-box {
    gap: 5px;
  }
  .record-box strong {
    font-size: 23px;
  }
  .record-box .note-label {
    font-size: 8px;
    letter-spacing: 0.5px;
  }
  .right-notes .outline {
    margin: 0;
    width: auto;
    font-size: 10px;
    max-width: 170px;
  }
  .right-notes #admin-open {
    max-width: 110px;
  }
  footer {
    margin-top: 24px;
    padding: 15px 0;
    font-size: 7px;
    letter-spacing: 0.5px;
  }
  .game-overlay h2 {
    font-size: 25px;
  }
  .game-overlay p {
    font-size: 11px;
  }
  .game-overlay small {
    font-size: 9px;
  }
  dialog {
    padding: 22px;
  }
  .messages {
    height: 40dvh;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.account-button {
  border-color: var(--accent);
  color: var(--accent);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 650px) {
  .account-actions {
    gap: 6px;
  }
  .account-actions .outline {
    padding: 9px 10px;
  }
  .account-button {
    max-width: 100px;
  }
}
.staff-dialog {
  max-width: 620px;
}
.panel-tabs {
  display: flex;
  gap: 8px;
  margin: 20px 0;
}
.panel-tabs [aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
}
.code-label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  margin: 20px 0 8px;
}
.code-row {
  display: flex;
  gap: 8px;
}
.code-row input {
  flex: 1;
  min-width: 0;
}
.code-row button {
  white-space: nowrap;
}
#owner-filter,
.create-user-form select,
.chat-picker select {
  width: 100%;
  max-width: 100%;
}
.managed-users {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.managed-user {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.managed-user-info {
  min-width: 0;
  overflow-wrap: anywhere;
}
.managed-user-info strong {
  font-size: 13px;
  font-weight: 500;
  display: block;
}
.managed-user-info small {
  color: var(--muted);
  font-size: 11px;
}
.user-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.danger {
  color: var(--error);
}
.create-user-form {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
h3 {
  font-size: 15px;
  font-weight: 500;
}
.conversation {
  gap: 12px;
}
.conversation > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.conversation small {
  font-size: 10px;
  color: var(--muted);
}
.chat-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 15px;
}
@media (max-width: 650px) {
  .managed-user {
    align-items: flex-start;
  }
  .managed-user-info {
    max-width: 45%;
  }
  .code-row {
    flex-wrap: wrap;
  }
  .code-row input {
    flex-basis: 100%;
  }
}
.attachment-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}
#selected-file {
  min-width: 0;
  overflow-wrap: anywhere;
  flex: 1;
}
.media-hint {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
  margin: 8px 0;
}
.upload-state {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11px;
  margin: 10px 0;
}
.upload-state progress {
  width: 100%;
  accent-color: var(--accent);
}
.chat-media {
  display: block;
  width: 100%;
  max-width: 330px;
  max-height: 270px;
  object-fit: contain;
  margin: 7px 0;
  border-radius: 5px;
  background: #11171d;
}
.attachment-download {
  display: block;
  color: var(--accent);
  font-size: 11px;
  margin-top: 7px;
  overflow-wrap: anywhere;
}
.bubble:has(.chat-media) {
  width: 86%;
}
#security-panel {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 20px;
}
#security-events {
  max-height: 250px;
  overflow-y: auto;
}
.security-event {
  padding: 12px;
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 11px;
  overflow-wrap: anywhere;
}
.security-event.unread {
  border-color: var(--error);
}
.security-event strong {
  color: var(--error);
  font-weight: 500;
}
.security-event div {
  margin-top: 6px;
  color: var(--muted);
}
.security-event p {
  margin: 6px 0;
  line-height: 1.5;
}
