.staggy-canvas {
  width: min(100%, 760px);
  margin-inline: auto;
}

.staggy-window {
  min-width: 0;
  padding: 3px;
  background: #d4d0c8;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  box-shadow: inset 1px 1px #e9e7e3, inset -1px -1px #808080, 3px 4px #12174026;
}

.staggy-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  color: #fff;
  background: linear-gradient(90deg, #10186f, #3759a3);
}

.staggy-titlebar img {
  flex: none;
  object-fit: contain;
}

.staggy-titlebar h1 {
  margin: 0;
  color: inherit;
  font: 700 1rem/1.3 Arial, sans-serif;
  text-transform: none;
}

.staggy-titlebar a {
  margin-inline-start: auto;
  color: inherit;
  font: 700 .8125rem/1.3 Arial, sans-serif;
}

.staggy-titlebar a:focus-visible { outline: 2px solid #fff; }

.staggy-window-body {
  background: #eaeaea;
  padding: clamp(7px, 2vw, 16px);
}

.staggy-toolbar,
.staggy-game-links,
.staggy-actions,
.staggy-statusbar,
.staggy-score-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.staggy-toolbar,
.staggy-statusbar {
  width: min(100%, 660px);
  justify-content: space-between;
  margin-inline: auto;
}

.staggy-toolbar { margin-bottom: 10px; }

.staggy-button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 4px 11px;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  border-radius: 0;
  color: #10184f;
  background: #dedede;
  box-shadow: inset -1px -1px #a0a0a0, inset 1px 1px #f5f5f5;
  font: 700 .875rem/1.2 Arial, sans-serif;
  text-decoration: none;
  cursor: pointer;
}

.staggy-button:hover { background: #f3f3f3; }
.staggy-button[aria-current="page"] {
  background: #10186f;
  color: #fff;
  border-color: #10143c #dfe4ff #dfe4ff #10143c;
  box-shadow: none;
}
.staggy-button:disabled { cursor: wait; opacity: .65; }

#stage {
  width: min(100%, 660px);
  aspect-ratio: 550 / 400;
  margin-inline: auto;
  background: #000;
  outline: 2px solid #555;
}

#stage ruffle-player { display: block; width: 100%; height: 100%; }
#stage:focus-within { outline: 2px solid #294aac; }
#stage:fullscreen { width: 100%; height: 100%; aspect-ratio: auto; }

#score-dialog {
  box-sizing: border-box;
  width: min(440px, calc(100vw - 32px));
  max-height: min(650px, calc(100dvh - 32px));
  padding: 16px;
  overflow: auto;
  color: #10184f;
  background: #f4f1e8;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  box-shadow: 4px 4px #10184f44;
}
#score-dialog::backdrop { background: #0c12328c; }
.staggy-dialog-actions { display: flex; justify-content: flex-end; }
#score-dialog .staggy-leaderboard { margin-top: 16px; }

.staggy-statusbar {
  margin-top: 12px;
  padding: 6px 8px;
  border: 1px solid;
  border-color: #909090 #fff #fff #909090;
  background: #dedede;
  font-size: .875rem;
}

.staggy-statusbar p { margin: 0; }

.staggy-leaderboard { margin-top: 24px; }
.staggy-leaderboard h2 { margin: 0 0 8px; font-size: 1.25rem; }
.staggy-leaderboard p { margin: 8px 0; }
.staggy-leaderboard [role="status"]:empty { display: none; }
.staggy-leaderboard table { width: 100%; border-collapse: collapse; }
.staggy-leaderboard th, .staggy-leaderboard td {
  border-bottom: 1px solid #c5c2b7;
  padding: 8px;
  text-align: left;
  overflow-wrap: anywhere;
}
.staggy-leaderboard th:last-child, .staggy-leaderboard td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.staggy-score-entry input { min-width: 0; max-width: 100%; padding: 6px; font: inherit; }

@media (max-width: 600px) {
  .staggy-button { min-height: 44px; }
  .staggy-statusbar { align-items: flex-start; }
}
