[hidden] {
  display: none !important;
}
:root {
  --ink: #17252b;
  --muted: #637178;
  --paper: #f7f4ed;
  --surface: #fffdf8;
  --line: #d9ded8;
  --dark: #112328;
  --accent: #e65d36;
  --gold: #f0b84b;
  --mint: #a9d7bf;
  --radius: 8px;
  --shadow: 0 12px 28px rgba(23, 37, 43, 0.09);
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font:
    16px/1.5 Inter,
    "Noto Sans SC",
    "PingFang SC",
    system-ui,
    sans-serif;
}
button,
input,
select {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
}
.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--dark);
  color: #fff;
  padding: 0.5rem 0.75rem;
  z-index: 10;
}
.skip-link:focus {
  top: 1rem;
}
.site-header {
  min-height: 72px;
  padding: 0 max(1.25rem, calc((100vw - 1200px) / 2));
  display: flex;
  align-items: center;
  gap: 2rem;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 244, 237, 0.94);
  position: sticky;
  top: 0;
  z-index: 4;
  backdrop-filter: blur(12px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--dark);
  font-weight: 850;
  letter-spacing: -0.025em;
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: 1.15rem;
  line-height: 1;
}
nav {
  display: flex;
  gap: 1.35rem;
  margin-right: auto;
}
nav a {
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
}
nav a:hover {
  color: var(--accent);
}
.account,
.control-actions,
.dialog-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.button {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 5px;
  padding: 0.56rem 0.82rem;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.15;
}
.button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(230, 93, 54, 0.35);
  outline-offset: 2px;
}
.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.button-primary:hover {
  background: #c94c2c;
}
.button-quiet {
  border-color: var(--line);
  background: var(--surface);
}
.button-quiet:hover {
  border-color: #9ea9a4;
}
.button-outline {
  border-color: var(--dark);
  color: var(--dark);
}
.button.disabled {
  opacity: 0.45;
  pointer-events: none;
}
main {
  max-width: 1200px;
  margin: auto;
  padding: 0 1.25rem 5rem;
}
.intro {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  padding: 3.2rem 0 2.6rem;
  align-items: end;
}
.eyebrow {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin: 0 0 0.55rem;
}
.intro h1 {
  font-size: clamp(2.55rem, 6vw, 5.5rem);
  line-height: 0.96;
  letter-spacing: -0.065em;
  margin: 0;
  max-width: 800px;
}
.intro h1 em {
  font-family: Georgia, "Noto Serif SC", serif;
  font-weight: 400;
  color: var(--accent);
}
.intro-copy {
  color: var(--muted);
  max-width: 540px;
  margin: 1.5rem 0 0;
}
.intro-stat {
  min-width: 175px;
  padding: 1.2rem 0 0 1.2rem;
  border-left: 2px solid var(--accent);
  display: grid;
  gap: 0.15rem;
}
.intro-stat strong {
  font-size: 2.6rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.intro-stat span {
  font-size: 0.82rem;
  color: var(--muted);
}
.intro-stat .stat-line {
  margin-top: 0.7rem;
  border-top: 1px solid var(--line);
  padding-top: 0.6rem;
}
.discover,
.premium-templates,
.workbench,
.projects,
.admin {
  border-top: 1px solid var(--line);
  padding: 3rem 0;
}
.premium-templates {
  padding: 2.25rem 0 3rem;
}
.premium-heading {
  align-items: end;
}
.premium-heading .muted {
  max-width: 34rem;
  text-align: end;
}
.premium-game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}
.premium-game-card {
  display: grid;
  grid-template-columns: minmax(5.5rem, 50%) minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  border: 1px solid #bfcbc1;
  border-radius: 10px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  text-align: start;
  cursor: pointer;
  box-shadow: 0 3px 8px rgb(23 37 43 / 5%);
  transition:
    border-color 0.18s,
    box-shadow 0.18s,
    transform 0.18s;
}
.premium-game-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.premium-game-card.selected {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.premium-game-card:focus-visible {
  outline: 3px solid #17637f;
  outline-offset: 3px;
}
.premium-game-cover {
  width: 100%;
  height: auto;
  align-self: center;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: cover;
  background: #16242e url("./card-default.webp") center/cover;
}
.premium-game-body {
  display: grid;
  align-content: center;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.7rem 0.8rem;
}
.premium-game-body > span:not(.premium-game-actions) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.premium-game-body strong {
  font-size: 0.95rem;
}
.premium-game-body > span:not(.premium-game-actions) {
  color: var(--muted);
  font-size: 0.73rem;
}
.premium-game-actions {
  margin-top: 0.35rem;
  color: #a13812;
  font-size: 0.69rem;
  font-weight: 800;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.section-heading h2 {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  letter-spacing: -0.045em;
  line-height: 1.05;
  margin: 0;
}
.muted,
.form-note {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}
.filters {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
}
.search-field {
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 520px;
}
.search-field input {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0.75rem;
  outline: 0;
}
.search-field span {
  padding: 0 0.75rem;
  color: var(--muted);
  font-size: 1.35rem;
}
.filter-select select {
  height: 44px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0 0.7rem;
  color: var(--ink);
}
.recommended-toggle {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 650;
  white-space: nowrap;
}
.recommended-toggle input {
  accent-color: var(--accent);
}
.game-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem 1rem;
}
.game-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 3px 6px rgb(23 37 43 / 4%);
  transition:
    box-shadow 0.18s,
    border-color 0.18s;
}
.game-card:hover {
  box-shadow: var(--shadow);
  border-color: #b1bcb6;
}
.game-card.selected {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.game-card:focus-visible {
  outline: 3px solid #17637f;
  outline-offset: 3px;
}
.card-media {
  width: 100%;
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16/9;
  background: #16242e url("./card-default.webp") center/cover;
}
.card-media.exclusive {
  background-image: none;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
}
.game-cover {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.25s;
}
.game-cover.portrait {
  object-position: center 72%;
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .game-card:hover .game-cover {
    transform: scale(1.045);
  }
}
.cover-kind {
  position: absolute;
  right: 7px;
  bottom: 6px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgb(10 18 34 / 76%);
  color: white;
  font-size: 0.64rem;
  line-height: 1.35;
}
.game-card-body {
  width: 100%;
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem 0.95rem;
}
.game-card strong,
.card-meta {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}
.game-card strong {
  font-size: 1rem;
  line-height: 1.55;
}
.card-meta {
  font-size: 0.8rem;
  color: #546468;
}
.card-pick {
  display: inline-block;
  vertical-align: 2px;
  color: #a13812;
  background: #ffebdf;
  border-radius: 4px;
  font-size: 0.68rem;
  padding: 0.08rem 0.35rem;
  margin-right: 0.45rem;
}
@media (max-width: 540px) {
  .game-grid {
    gap: 0.85rem 0.6rem;
  }
  .game-card strong {
    font-size: 0.91rem;
  }
  .card-pick {
    font-size: 0.61rem;
    margin-right: 0.25rem;
    padding: 0 0.2rem;
    vertical-align: 1px;
  }
  .card-meta {
    font-size: 0.71rem;
  }
  .cover-kind {
    font-size: 0.58rem;
    right: 4px;
    bottom: 4px;
  }
}
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding-top: 1rem;
  font-size: 0.83rem;
}
.workbench {
  scroll-margin-top: 4rem;
}
.studio-mode {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin: -0.3rem 0 1rem;
  padding: 0.6rem;
  border: 1px solid var(--line);
  background: #eee9df;
}
.studio-mode-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 46px;
  padding: 0.6rem 1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #46585f;
  font: inherit;
  font-weight: 700;
  font-size: 0.94rem;
  white-space: nowrap;
  cursor: pointer;
}
.studio-mode-button.active {
  background: var(--surface);
  border-color: #c3cbc7;
  color: var(--ink);
  box-shadow: inset 0 -3px var(--ink);
}
#studio-mode {
  background: #c84018;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  padding-inline: 1.25rem;
  box-shadow: 0 2px 5px #9a300e30;
}
#studio-mode:hover {
  background: #ad3512;
}
#studio-mode.active {
  background: #a83312;
  border-color: #8e2e11;
  box-shadow: inset 0 -3px #6c230f;
}
#studio-mode.active .mode-arrow {
  display: none;
}
#studio-mode.active::after {
  content: "✓";
  width: 18px;
}
.studio-mode-button:focus-visible {
  outline: 3px solid #0c6173;
  outline-offset: 3px;
}
.studio-mode p {
  margin: 0 0 0 auto;
  max-width: 430px;
  color: #46585f;
  font-size: 0.875rem;
}
.bench-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.control-panel {
  padding: 1.25rem;
  border-right: 1px solid var(--line);
  min-width: 0;
}
.studio-controls {
  display: grid;
  gap: 0.85rem;
}
.studio-intro {
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}
.studio-intro strong {
  display: block;
  font-size: 1.06rem;
}
.studio-intro p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.studio-controls > label,
.studio-prompt {
  display: grid;
  gap: 0.35rem;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 750;
}
.studio-controls select,
.studio-controls input,
.studio-controls textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0.62rem;
}
.studio-controls textarea {
  resize: vertical;
  min-height: 7rem;
}
.quick-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.quick-actions button {
  border: 1px solid #d9a796;
  background: #fff1e9;
  color: #9d3c25;
  padding: 0.38rem 0.45rem;
  font: inherit;
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
}
.quick-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.selected-summary {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.selected-summary h3 {
  font-size: 1.25rem;
  margin: 0 0 0.2rem;
}
.selected-summary p {
  margin: 0;
  font-size: 0.83rem;
  color: var(--muted);
}
.settings {
  display: grid;
  gap: 1rem;
  padding: 1rem 0;
}
.setting label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.85rem;
}
.setting output {
  font-size: 0.78rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.setting input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  margin: 0.4rem 0 0;
}
.skin-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}
.skin-option input {
  position: absolute;
  opacity: 0;
}
.skin-option span {
  display: block;
  border: 1px solid var(--line);
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
}
.skin-option input:checked + span {
  border-color: var(--accent);
  background: #fff1e9;
}
.control-actions {
  margin-top: 0.65rem;
}
.control-actions .button {
  flex: 1;
  text-align: center;
  justify-content: center;
}
.play-stage {
  grid-template-rows: 1fr auto;
  position: relative;
  min-height: 560px;
  background: var(--dark);
  display: grid;
}
.play-stage iframe {
  width: 100%;
  height: 100%;
  min-height: 560px;
  border: 0;
  background: #000;
}
.stage-placeholder {
  color: #dbe7e0;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 2rem;
  gap: 0.5rem;
  background:
    radial-gradient(circle at 72% 20%, #3d6661 0, transparent 35%), var(--dark);
}
.stage-placeholder span {
  color: var(--gold);
  font-size: 2rem;
}
.stage-placeholder strong {
  font-size: 1.2rem;
}
.stage-placeholder p {
  color: #9cb8ad;
  max-width: 300px;
  font-size: 0.85rem;
  margin: 0;
}
.stage-bar {
  position: relative;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.45rem 0.75rem;
  background: rgba(9, 22, 25, 0.82);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: #d6e0d9;
  font-size: 0.7rem;
  pointer-events: none;
}
.notice {
  margin-bottom: 1rem;
  border-left: 3px solid var(--gold);
  background: #fff8df;
  padding: 0.7rem 0.85rem;
  font-size: 0.88rem;
}
.project-list {
  display: grid;
  gap: 0.65rem;
}
.studio-history {
  border-top: 1px solid var(--line);
  padding: 3rem 0;
}
.version-list {
  display: grid;
  gap: 0.65rem;
}
.version-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 1rem;
}
.version-item.current {
  border-left: 4px solid var(--accent);
}
.version-copy h3 {
  margin: 0.18rem 0;
  font-size: 1rem;
}
.version-copy p,
.version-copy small {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}
.version-number {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.06em;
}
.version-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.project-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1rem;
}
.project-item h3 {
  font-size: 1rem;
  margin: 0;
}
.project-item p {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.project-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.empty-state {
  border: 1px dashed #b7c2bb;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}
.empty-state strong {
  color: var(--ink);
}
.admin {
  border-top-color: var(--dark);
}
.admin-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}
.admin-stat {
  background: var(--dark);
  color: #fff;
  padding: 1rem;
  min-width: 130px;
}
.admin-stat strong {
  font-size: 1.7rem;
  display: block;
}
.admin-stat span {
  font-size: 0.74rem;
  color: #b7ccc2;
}
.admin-share {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 0;
  gap: 1rem;
}
.auth-dialog {
  width: min(480px, calc(100% - 2rem));
  border: 0;
  padding: 0;
  background: var(--surface);
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.28);
}
.source-dialog {
  width: min(900px, calc(100% - 2rem));
  max-height: min(80vh, 800px);
  border: 0;
  padding: 0;
  background: var(--surface);
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.28);
}
.source-dialog::backdrop {
  background: rgba(17, 35, 40, 0.55);
}
.source-dialog-inner {
  padding: 1.5rem;
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
}
.dialog-heading h2 {
  margin: 0;
  font-size: 1.45rem;
}
.dialog-heading .dialog-close {
  position: static;
}
.source-files {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}
.source-file {
  border: 1px solid var(--line);
  background: #f3f1eb;
}
.source-file summary {
  cursor: pointer;
  padding: 0.65rem;
  font-weight: 750;
  overflow-wrap: anywhere;
}
.source-file h3 {
  margin: 0;
  padding: 0.5rem 0.65rem 0;
  font-size: 0.75rem;
  color: var(--muted);
}
.source-file pre {
  max-height: 270px;
  overflow: auto;
  margin: 0;
  padding: 0.65rem;
  border-bottom: 1px solid var(--line);
  background: #17252b;
  color: #e5eee8;
  font:
    0.73rem/1.45 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.auth-dialog::backdrop {
  background: rgba(17, 35, 40, 0.55);
  backdrop-filter: blur(2px);
}
.auth-dialog form {
  padding: 2rem;
  display: grid;
  gap: 0.85rem;
  position: relative;
}
.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-bottom: 1px solid var(--line);
  margin: 0 -0.15rem 0.15rem;
}
.auth-tabs button {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0.58rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 750;
  cursor: pointer;
}
.auth-tabs button.active {
  border-bottom-color: var(--accent);
  color: var(--ink);
}
.auth-dialog #auth-fields {
  display: grid;
  gap: 0.85rem;
}
.auth-step,
#security-email-bind-fields {
  display: grid;
  gap: 0.85rem;
}
.auth-step > .muted {
  margin: 0;
}
.code-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
}
.code-field .button {
  white-space: nowrap;
}
.button-github {
  background: #24292f;
  border-color: #24292f;
  color: #fff;
}
.button-github:hover {
  background: #3a4149;
  border-color: #3a4149;
}
.auth-dialog h2 {
  margin: 0;
  font-size: 1.7rem;
}
.auth-dialog label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
}
.auth-dialog input {
  width: 100%;
  border: 1px solid var(--line);
  padding: 0.65rem;
  background: #fff;
}
.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}
.password-field input {
  min-width: 0;
}
.password-toggle {
  border: 1px solid var(--line);
  border-left: 0;
  background: var(--surface);
  color: var(--muted);
  min-width: 3.7rem;
  padding: 0 0.55rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 750;
  cursor: pointer;
}
.password-toggle:hover {
  color: var(--accent);
}
.password-strength {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.76rem;
}
.strength-meter {
  flex: 0 0 6rem;
  height: 0.38rem;
  overflow: hidden;
  background: #e3e7e1;
}
.strength-meter i {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.16s ease;
}
.password-strength[data-level="3"] .strength-meter i,
.password-strength[data-level="4"] .strength-meter i {
  background: #3c775f;
}
.field-note {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.4;
}
.dialog-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border: 0;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
}
.dialog-actions {
  justify-content: flex-end;
  margin-top: 0.45rem;
}
.auth-dialog .dialog-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.55rem;
}
#auth-forgot {
  grid-row: 1;
  justify-self: end;
  width: auto;
  padding: 0.2rem 0;
  border: 0;
  color: #923915;
  background: transparent;
}
#auth-form > .form-error:empty {
  display: none;
}
.mail-note {
  color: #196040;
  font-size: 0.8rem;
  font-weight: 500;
}
#security-email-summary {
  overflow-wrap: anywhere;
}
.auth-dialog .dialog-actions .button {
  width: 100%;
}
.form-error {
  min-height: 1.25rem;
  margin: 0;
  color: #a32718;
  font-size: 0.8rem;
}
.security-dialog {
  width: min(660px, calc(100% - 2rem));
  max-height: min(88vh, 860px);
  border: 0;
  padding: 0;
  background: var(--surface);
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.28);
}
.security-dialog::backdrop {
  background: rgba(17, 35, 40, 0.55);
  backdrop-filter: blur(2px);
}
.security-dialog-inner {
  display: grid;
  gap: 1.25rem;
  padding: 1.5rem;
}
.security-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  border: 1px solid var(--line);
  background: #f3f1eb;
}
.security-overview p {
  display: grid;
  gap: 0.16rem;
  margin: 0;
  padding: 0.8rem;
  border-right: 1px solid var(--line);
}
.security-overview p:last-child {
  border-right: 0;
}
#security-email-bind-fields label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
}
#security-email-bind-fields input {
  width: 100%;
  border: 1px solid var(--line);
  padding: 0.65rem;
  background: #fff;
}
.security-overview strong {
  color: var(--accent);
  font-size: 1.1rem;
}
.security-overview span {
  color: var(--muted);
  font-size: 0.74rem;
}
.security-section {
  display: grid;
  gap: 0.7rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}
.security-section h3 {
  margin: 0;
  font-size: 1rem;
}
.security-section > div > .muted,
.security-section > .muted {
  margin-top: 0.18rem;
}
.security-qr {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1rem;
  border: 1px solid #d9a796;
  background: #fff7f2;
  padding: 0.85rem;
}
.security-qr img {
  width: 132px;
  height: 132px;
  image-rendering: pixelated;
}
.security-qr p {
  margin: 0.28rem 0;
  color: var(--muted);
  font-size: 0.78rem;
}
.security-qr code {
  display: block;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.8rem;
}
.security-action-fields label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
}
.security-action-fields input {
  width: 100%;
  border: 1px solid var(--line);
  padding: 0.65rem;
  background: #fff;
}
.security-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.security-recovery {
  border: 1px solid #d9a796;
  background: #fff7f2;
  padding: 1rem;
}
.security-recovery ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.security-recovery li {
  border: 1px dashed #d9a796;
  background: #fff;
  padding: 0.5rem;
  font:
    0.78rem ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  overflow-wrap: anywhere;
}
.security-events {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.security-events li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.45rem;
  font-size: 0.8rem;
}
.security-events time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  max-width: min(400px, calc(100% - 2rem));
  background: var(--dark);
  color: #fff;
  padding: 0.75rem 1rem;
  opacity: 0;
  transform: translateY(1rem);
  pointer-events: none;
  transition: 0.2s;
  z-index: 8;
}
.toast.show {
  opacity: 1;
  transform: none;
}
.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;
}
@media (max-width: 800px) {
  .site-header {
    gap: 1rem;
  }
  .site-header nav {
    display: none;
  }
  .account {
    margin-left: auto;
  }
  .intro {
    grid-template-columns: 1fr;
    padding: 2.2rem 0;
  }
  .intro-stat {
    max-width: 270px;
  }
  .game-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .premium-game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bench-layout {
    grid-template-columns: 1fr;
  }
  .control-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .play-stage,
  .play-stage iframe {
    min-height: 430px;
  }
  .studio-mode p {
    flex-basis: 100%;
    margin-left: 0;
  }
  .version-item {
    grid-template-columns: 1fr;
  }
  .version-actions {
    justify-content: flex-start;
  }
}
@media (max-width: 540px) {
  .site-header {
    min-height: 62px;
    padding: 0 1rem;
  }
  .brand {
    gap: 0.4rem;
    font-size: 0.95rem;
  }
  .account .guest-info {
    display: none;
  }
  main {
    padding: 0 1rem;
  }
  .intro h1 {
    font-size: 2.65rem;
  }
  .filters {
    align-items: stretch;
    flex-wrap: wrap;
  }
  .search-field {
    flex-basis: 100%;
  }
  .recommended-toggle {
    padding: 0 0.25rem;
  }
  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .premium-templates {
    padding: 1.75rem 0 2.25rem;
  }
  .premium-heading .muted {
    text-align: start;
  }
  .premium-game-grid {
    grid-template-columns: 1fr;
  }
  .premium-game-card {
    grid-template-columns: 45% minmax(0, 1fr);
  }

  .game-card-body {
    padding: 0.7rem;
  }
  .section-heading {
    align-items: start;
    flex-direction: column;
  }
  .section-heading > button {
    align-self: flex-end;
    margin-top: -3.25rem;
  }
  .play-stage,
  .play-stage iframe {
    min-height: 300px;
  }
  .control-actions {
    flex-wrap: wrap;
  }
  .control-actions .button {
    min-width: calc(50% - 0.3rem);
  }
  .project-item {
    grid-template-columns: 1fr;
  }
  .project-actions {
    justify-content: flex-start;
  }
  .studio-mode {
    align-items: stretch;
  }
  .studio-mode-button,
  #studio-mode {
    padding-inline: 0.5rem;
    gap: 0.35rem;
  }
  #studio-mode {
    flex: 1;
  }
  .studio-mode p {
    font-size: 0.8rem;
  }
  .auth-dialog form {
    padding: 1.35rem;
  }
  .security-dialog-inner {
    padding: 1.1rem;
  }
  .security-overview p {
    padding: 0.65rem 0.45rem;
  }
  .security-overview strong {
    font-size: 0.96rem;
  }
  .security-overview span {
    font-size: 0.68rem;
  }
  .security-qr {
    grid-template-columns: 1fr;
  }
  .security-qr img {
    width: 120px;
    height: 120px;
  }
  .security-actions .button {
    flex: 1 1 calc(50% - 0.25rem);
  }
  .security-events li {
    align-items: start;
    flex-direction: column;
    gap: 0.18rem;
  }
  .security-events time {
    text-align: left;
  }
  .code-field {
    grid-template-columns: 1fr;
  }
  .code-field .button {
    width: 100%;
  }
}
@media (max-width: 374px) {
  .studio-mode {
    padding: 0.4rem;
  }
  #studio-mode .mode-arrow,
  #studio-mode.active::after {
    display: none;
  }
  .studio-mode-button {
    font-size: 0.875rem;
  }
  #studio-mode {
    font-size: 0.94rem;
  }
  .studio-mode p {
    font-size: 0.75rem;
  }
  .intro-stat {
    padding-left: 1rem;
  }
}

.selected-summary p {
  overflow-wrap: anywhere;
}
.selected-summary a {
  text-decoration: underline;
}
.workbench .setting {
  min-width: 0;
}
.setting label {
  overflow-wrap: anywhere;
}

.project-name {
  display: grid;
  gap: 0.4rem;
  font-size: 0.9rem;
}
.project-name input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0.6rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.form-note {
  margin-top: 0.65rem;
}
.username {
  max-width: 24vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stage-bar {
  pointer-events: none;
}
.control-panel,
.play-stage {
  min-width: 0;
}
.project-item h3 {
  overflow-wrap: anywhere;
}
.skin-option:focus-within {
  outline: 2px solid var(--accent);
}
@media (max-width: 800px) {
  .play-stage {
    grid-row: 1;
  }
  .play-stage iframe,
  .play-stage {
    min-height: clamp(380px, 60vh, 560px);
  }
  .site-header nav {
    display: flex;
    gap: 0.6rem;
  }
  .site-header nav a:not(:last-child) {
    display: none;
  }
  .site-header {
    gap: 0.6rem;
  }
  .site-header nav a {
    white-space: nowrap;
    font-size: 0.8rem;
  }
  .account {
    gap: 0.45rem;
  }
}
@media (max-width: 380px) {
  .site-header nav {
    display: none;
  }
  .account .username {
    max-width: 5rem;
  }
}
#studio-allowance {
  padding: 12px;
  background: #edf4ec;
  border: 1px solid #cedfd1;
  border-radius: 8px;
  color: #23513f;
}
#studio-allowance span {
  display: block;
  font-size: 12px;
  color: #4e695f;
}
#studio-allowance progress {
  display: block;
  width: 100%;
  height: 7px;
  accent-color: #31795b;
  margin: 8px 0;
}
#studio-examples button {
  text-align: left;
  white-space: normal;
  line-height: 1.4;
  height: auto;
}

#studio-generate:disabled {
  background: #d7ddd8;
  color: #475850;
  cursor: not-allowed;
}

/* Languages and bidirectional layouts */
.localizing body {
  visibility: hidden;
}
.site-header {
  gap: 1.1rem;
  flex-wrap: wrap;
  padding-block: 0.75rem;
}
.site-header nav {
  margin: 0;
  margin-inline-end: auto;
  flex-wrap: wrap;
}
.language-picker {
  display: inline-flex;
  align-items: center;
  position: relative;
  color: var(--dark);
}
.language-picker svg {
  position: absolute;
  inset-inline-start: 10px;
  pointer-events: none;
}
.language-picker select {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: inherit;
  font-size: 0.88rem;
  min-height: 40px;
  max-width: 100%;
  padding-inline: 34px 6px;
  cursor: pointer;
}
.language-picker select:focus-visible {
  outline: 3px solid #0c6173;
  outline-offset: 2px;
}
.intro {
  grid-template-columns: minmax(0, 1fr) minmax(175px, 24%);
}
.intro-stat {
  border: 0;
  border-inline-start: 2px solid var(--accent);
  padding-inline: 1.2rem 0;
}
.intro h1 {
  line-height: 1.08;
  font-size: clamp(2.25rem, 5.3vw, 4.8rem);
  letter-spacing: -0.045em;
  text-wrap: balance;
}
.intro h1,
.section-heading h2,
.button,
.studio-mode-button,
dialog,
.account,
.control-panel {
  overflow-wrap: anywhere;
}
.game-card,
.project-item,
.setting {
  text-align: start;
}
.card-pick {
  margin-inline: 0 0.4rem;
}
.filters,
.control-actions,
.dialog-actions,
.account,
.pagination {
  flex-wrap: wrap;
}
.search-field {
  min-width: min(100%, 15rem);
}
.filter-select,
.filter-select select,
.recommended-toggle,
.control-panel select,
.account {
  max-width: 100%;
}
.search-field input,
.studio-controls,
.control-panel input,
.studio-mode-button,
.control-panel label {
  min-width: 0;
}
.recommended-toggle,
.button,
.studio-mode-button {
  white-space: normal;
  height: auto;
}
.recommended-toggle {
  min-height: 40px;
}
.studio-mode p {
  margin-inline: auto 0;
}
:dir(rtl) .mode-arrow {
  transform: scaleX(-1);
}
:dir(rtl) .brand,
:dir(rtl) .game-card strong,
:dir(rtl) .intro-stat strong {
  unicode-bidi: isolate;
}
:dir(rtl) .brand {
  direction: ltr;
}
html:is(:lang(ar), :lang(fa), :lang(th), :lang(hi))
  :is(.intro h1, .section-heading h2, .eyebrow, .intro h1 em) {
  letter-spacing: normal;
  line-height: 1.35;
  font-style: normal;
}
input[type="email"],
input[type="password"],
pre,
code {
  direction: ltr;
  text-align: left;
}
@media (max-width: 1060px) {
  .site-header {
    gap: 0.5rem 1rem;
  }
  .site-header nav {
    order: 3;
    flex-basis: 100%;
    gap: 1rem;
  }
  .language-picker {
    margin-inline-start: auto;
  }
}
@media (max-width: 800px) {
  .intro {
    grid-template-columns: minmax(0, 1fr);
  }
  .site-header nav,
  .site-header nav a:not(:last-child) {
    display: flex;
    white-space: normal;
  }
  .site-header nav {
    gap: 0.4rem 1rem;
    align-items: center;
  }
  .site-header .account {
    margin: 0;
  }
  .site-header .guest-info {
    display: none;
  }
  .intro h1 {
    font-size: clamp(2rem, 7vw, 3.5rem);
  }
  .workbench,
  .discover,
  .projects {
    scroll-margin-top: 9rem;
  }
}
@media (max-width: 600px) {
  .site-header {
    position: static;
    gap: 0.75rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .site-header nav {
    grid-column: 1/-1;
    order: 2;
  }
  .site-header .account {
    grid-column: 1/-1;
    order: 3;
  }
  .language-picker select {
    max-width: 42vw;
    font-size: 0.8rem;
  }
  .site-header .account .button-primary {
    width: 100%;
  }
  .studio-mode-button,
  #studio-mode {
    flex: 1 1 10rem;
    max-width: 100%;
  }
  .studio-mode-button svg {
    flex-shrink: 0;
  }
  .pagination {
    gap: 0.45rem;
  }
  .pagination .button {
    padding-inline: 0.48rem;
  }
  .workbench,
  .discover,
  .projects {
    scroll-margin-top: 1rem;
  }
}
