.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:root {
  --community-ink: #effbff;
  --community-muted: #9bb7c7;
  --community-panel: rgba(7, 16, 32, 0.94);
  --community-line: rgba(79, 231, 255, 0.24);
  --community-cyan: #4fe7ff;
  --community-magenta: #e94fff;
  --community-gold: #ffc748;
  --community-red: #ff8178;
  --community-deep: #02050e;
  --community-navy: #071225;
}

html {
  scroll-behavior: smooth;
  overflow-anchor: none;
  background: #05080c;
}

body {
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  touch-action: pan-y;
  color: var(--community-ink);
  background:
    linear-gradient(rgba(79, 231, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 231, 255, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 12% 0%, rgba(79, 231, 255, 0.14), transparent 38rem),
    radial-gradient(circle at 88% 10%, rgba(233, 79, 255, 0.10), transparent 34rem),
    var(--community-deep);
  background-size: 44px 44px, 44px 44px, auto, auto, auto;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#game-shell {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  min-height: min(540px, 100vh);
  min-height: min(540px, 100dvh);
  overflow: hidden;
  background: var(--community-deep);
  border-bottom: 1px solid var(--community-line);
}

#game-shell #canvas {
  width: 100%;
  height: 100%;
  touch-action: none;
}

#game-shell #status {
  position: absolute;
  background: var(--community-deep);
}

#status-progress {
  height: 7px;
  overflow: hidden;
  border: 1px solid rgba(79, 231, 255, 0.5);
  border-radius: 999px;
  accent-color: var(--community-gold);
  background: rgba(4, 14, 28, 0.92);
}

.mobile-play-controls {
  position: absolute;
  z-index: 90;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: 50%;
  width: min(420px, calc(100% - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 24px));
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

#mobile-fullscreen-button {
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid rgba(101, 229, 255, 0.62);
  border-radius: 999px;
  color: #061016;
  background: rgba(101, 229, 255, 0.94);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.52);
  font-weight: 850;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}

#mobile-fullscreen-button:focus-visible,
#mobile-fullscreen-button:hover {
  background: #d9f9ff;
  outline: 3px solid rgba(255, 202, 97, 0.72);
  outline-offset: 2px;
}

#mobile-fullscreen-status {
  width: fit-content;
  max-width: 100%;
  margin: 8px auto 0;
  padding: 7px 10px;
  border-radius: 9px;
  color: #edf7ff;
  background: rgba(2, 8, 14, 0.86);
  font-size: 0.78rem;
  line-height: 1.35;
  pointer-events: none;
}

#mobile-fullscreen-status:empty {
  display: none;
}

#mobile-fullscreen-status[data-tone="warning"] {
  color: #ffe4a3;
  border: 1px solid rgba(255, 202, 97, 0.55);
}

body.prismward-iphone-setup {
  overflow-y: auto;
}

body.prismward-iphone-setup #game-shell {
  top: 132px;
  margin-bottom: 132px;
}

body.prismward-iphone-setup #canvas {
  scroll-margin-top: 132px;
}

body.prismward-iphone-setup .mobile-play-controls {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  width: min(700px, calc(100% - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 24px));
}

@media (orientation: portrait) {
  body.prismward-iphone-setup #game-shell {
    top: 220px;
    margin-bottom: 220px;
  }

  body.prismward-iphone-setup #canvas {
    scroll-margin-top: 220px;
  }
}

#game-shell:fullscreen,
#game-shell:-webkit-full-screen,
body.prismward-fullscreen #game-shell,
body.prismward-standalone #game-shell {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin-top: 0;
  margin-bottom: 0;
  top: 0;
  min-height: 0;
  border: 0;
}

body.prismward-fullscreen,
body.prismward-standalone {
  overflow: hidden;
  background: #000;
}

body.prismward-fullscreen .community-jump,
body.prismward-standalone .community-jump,
body.prismward-standalone .community-shell {
  display: none;
}

.community-jump {
  position: absolute;
  z-index: 3;
  right: 14px;
  bottom: 14px;
  padding: 10px 14px;
  border: 1px solid rgba(101, 229, 255, 0.55);
  border-radius: 999px;
  color: #031017;
  background: rgba(101, 229, 255, 0.92);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.42);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.community-jump:focus-visible,
.community-jump:hover {
  background: #d9f9ff;
  outline: 3px solid rgba(255, 202, 97, 0.6);
  outline-offset: 2px;
}

.community-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 72px 0 96px;
}

.community-shell::before {
  content: "";
  display: block;
  width: 96px;
  height: 3px;
  margin-bottom: 28px;
  background: linear-gradient(90deg, var(--community-cyan), var(--community-gold), var(--community-magenta));
  box-shadow: 0 0 24px rgba(79, 231, 255, 0.34);
}

.community-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 26px;
}

.community-brand-lockup {
  display: flex;
  gap: 20px;
  align-items: center;
}

.community-brand-lockup > div {
  min-width: 0;
}

#tester-downloads {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

#tester-downloads .download-button {
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
  text-align: center;
}

#tester-downloads .download-meta {
  min-width: 0;
  overflow-wrap: anywhere;
}

.community-brand-mark {
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  border-radius: 20px;
  box-shadow: 0 0 38px rgba(79, 231, 255, 0.22);
}

.download-callout {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(255, 199, 72, 0.34);
  border-radius: 14px;
  background: rgba(255, 199, 72, 0.055);
}

.download-button {
  display: inline-flex;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 1px solid rgba(255, 199, 72, 0.72);
  border-radius: 999px;
  color: #061016;
  background: var(--community-gold);
  font-weight: 900;
  text-decoration: none;
}

.download-button:focus-visible,
.download-button:hover {
  background: #ffe39a;
  outline: 3px solid rgba(79, 231, 255, 0.66);
  outline-offset: 3px;
}

.download-meta {
  min-width: min(100%, 290px);
  flex: 1 1 360px;
  margin: 0;
  color: var(--community-muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.download-meta code {
  color: var(--community-cyan);
}

.download-meta a {
  color: var(--community-cyan);
  text-underline-offset: 0.18em;
}

.community-kicker {
  margin: 0 0 8px;
  color: var(--community-cyan);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.community-hero h1 {
  margin: 0;
  font-size: clamp(2.35rem, 6vw, 5rem);
  line-height: 0.88;
  letter-spacing: 0.075em;
  text-shadow: 0 0 30px rgba(79, 231, 255, 0.18);
}

.community-deck {
  margin: 14px 0 0;
  color: var(--community-gold);
  font-size: 0.86rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.community-intro {
  max-width: 72ch;
  margin: 16px 0 0;
  color: var(--community-muted);
  line-height: 1.65;
}

.community-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(340px, 0.82fr);
  gap: 20px;
  align-items: start;
}

.community-panel {
  overflow: hidden;
  border: 1px solid var(--community-line);
  border-radius: 14px;
  background: var(--community-panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38), inset 0 1px rgba(255, 255, 255, 0.025);
}

.panel-header,
.panel-body {
  padding: 22px;
}

.panel-header {
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
  border-bottom: 1px solid var(--community-line);
  background: linear-gradient(135deg, rgba(101, 229, 255, 0.055), rgba(255, 202, 97, 0.02));
}

.panel-header h2 {
  margin: 0;
  font-size: 1.22rem;
}

.panel-header p {
  margin: 6px 0 0;
  color: var(--community-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

label {
  display: grid;
  gap: 7px;
  color: #c7d7e3;
  font-size: 0.8rem;
  font-weight: 750;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(157, 177, 194, 0.28);
  border-radius: 9px;
  color: var(--community-ink);
  background: rgba(1, 7, 12, 0.8);
  padding: 10px 12px;
}

textarea {
  min-height: 126px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid var(--community-cyan);
  outline-offset: 2px;
}

.primary-button,
.secondary-button,
.text-button {
  border: 0;
  cursor: pointer;
}

.primary-button,
.secondary-button {
  border-radius: 9px;
  padding: 10px 14px;
  font-weight: 800;
}

.primary-button {
  color: #061016;
  background: var(--community-cyan);
}

.secondary-button {
  border: 1px solid rgba(101, 229, 255, 0.3);
  color: var(--community-cyan);
  background: rgba(101, 229, 255, 0.08);
}

.text-button {
  padding: 4px 0;
  color: var(--community-muted);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.table-wrap {
  overflow-x: auto;
}

.community-table {
  width: 100%;
  min-width: 610px;
  border-collapse: collapse;
}

.community-table th,
.community-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(157, 177, 194, 0.12);
  text-align: right;
}

.community-table th {
  color: var(--community-muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.community-table th:nth-child(2),
.community-table td:nth-child(2),
.community-table th:nth-child(5),
.community-table td:nth-child(5) {
  text-align: left;
}

.community-table .rank,
.community-table .score {
  color: var(--community-gold);
  font-variant-numeric: tabular-nums;
}

.community-table .player-name {
  color: white;
  font-weight: 850;
  letter-spacing: 0.04em;
}

.status-line {
  min-height: 1.4em;
  margin: 14px 0 0;
  color: var(--community-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.status-line[data-tone="success"] { color: #8ff0bc; }
.status-line[data-tone="warning"] { color: var(--community-gold); }
.status-line[data-tone="busy"] { color: var(--community-cyan); }

.feedback-form {
  display: grid;
  gap: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 0.8fr;
  gap: 12px;
}

.comment-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.comment-card {
  padding: 15px;
  border: 1px solid rgba(157, 177, 194, 0.14);
  border-radius: 12px;
  background: rgba(2, 9, 14, 0.65);
}

.comment-heading,
.comment-footer {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}

.comment-category {
  color: var(--community-cyan);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.1em;
}

.comment-body {
  margin: 12px 0;
  color: #dce8ef;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.comment-footer {
  color: var(--community-muted);
  font-size: 0.72rem;
}

.empty-state {
  color: var(--community-muted);
  line-height: 1.55;
  text-align: center;
}

.community-fine-print {
  margin: 22px 0 0;
  color: #7990a1;
  font-size: 0.78rem;
  line-height: 1.6;
}

@media (pointer: coarse) {
  .community-jump {
    display: none;
  }

  #mobile-fullscreen-button {
    min-width: 154px;
    min-height: 48px;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .mobile-play-controls {
    top: max(8px, env(safe-area-inset-top, 0px));
    left: max(8px, env(safe-area-inset-left, 0px));
    width: auto;
    transform: none;
    text-align: left;
  }

  #mobile-fullscreen-button {
    min-width: 132px;
    min-height: 40px;
    padding: 7px 12px;
    font-size: 0.82rem;
  }

  #mobile-fullscreen-status[data-tone="info"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
}

@media (max-width: 1000px) and (max-height: 600px) {
  .community-jump {
    display: none;
  }
}

@media (max-width: 850px) {
  .community-grid,
  .community-hero {
    grid-template-columns: 1fr;
  }

  .community-hero {
    align-items: start;
  }

  .community-hero .secondary-button {
    justify-self: start;
  }
}

@media (max-width: 560px) {
  .community-brand-lockup {
    flex-direction: column;
    align-items: flex-start;
  }

  .community-brand-mark {
    width: 64px;
    height: 64px;
  }

  .download-button {
    flex: 1 1 100%;
    max-width: 100%;
    box-sizing: border-box;
    text-align: center;
  }

  #tester-downloads .download-button {
    width: 100%;
  }

  .community-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 50px;
  }

  .panel-header,
  .panel-body {
    padding: 16px;
  }

  .panel-header,
  .form-row {
    grid-template-columns: 1fr;
  }

  .panel-header {
    display: grid;
    align-items: start;
  }

  .community-jump {
    right: 10px;
    bottom: 10px;
    font-size: 0.74rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
