:root {
  color-scheme: light;
  --ink: #19202a;
  --paper: #f7fbff;
  --line: rgba(62, 111, 168, 0.12);
  --aqua: #38c0bd;
  --leaf: #70c45b;
  --sun: #ffd567;
  --coral: #ff6f61;
  --violet: #7b68ee;
  --shadow: rgba(25, 32, 42, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family:
    ui-rounded,
    "SF Pro Rounded",
    "PingFang SC",
    "Microsoft YaHei",
    system-ui,
    sans-serif;
  letter-spacing: 0;
  touch-action: none;
}

button {
  border: 0;
  font: inherit;
}

.game-shell {
  position: fixed;
  inset: 0;
  min-width: 320px;
  min-height: 480px;
  overflow: hidden;
  background:
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(0deg, var(--line) 1px, transparent 1px) 0 0 / 34px 34px,
    radial-gradient(circle at 16% 15%, rgba(255, 213, 103, 0.35), transparent 20%),
    linear-gradient(180deg, #f8fcff 0%, #e8f8ff 46%, #fff8ed 100%);
}

#gameCanvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.game-shell.is-home .hud,
.game-shell.is-home .touch-pad,
.game-shell:not(.is-playing) .touch-pad,
.game-shell:not(.is-playing) .pause-button {
  display: none;
}

.hud {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(88px, 1fr));
  gap: 8px;
  pointer-events: none;
}

.hud.is-timed {
  grid-template-columns: repeat(3, minmax(72px, 1fr));
}

.metric.is-hidden {
  display: none;
}

.time-metric {
  background: rgba(255, 213, 103, 0.9);
}

.metric {
  min-width: 0;
  height: 54px;
  padding: 8px 10px;
  border: 2px solid rgba(25, 32, 42, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 4px 5px 0 rgba(25, 32, 42, 0.09);
  backdrop-filter: blur(8px);
}

.metric span {
  display: block;
  color: rgba(25, 32, 42, 0.62);
  font-size: 12px;
  line-height: 1.1;
  white-space: nowrap;
}

.metric strong {
  display: block;
  min-width: 0;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(16px, 4.6vw, 24px);
  font-weight: 900;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(112px + env(safe-area-inset-bottom));
  z-index: 4;
  max-width: min(84vw, 360px);
  margin: 0;
  padding: 10px 14px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  box-shadow: 4px 5px 0 rgba(25, 32, 42, 0.14);
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.pause-button {
  position: absolute;
  right: max(20px, env(safe-area-inset-right));
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 4;
  width: 58px;
  height: 58px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: rgba(255, 213, 103, 0.9);
  box-shadow: 4px 5px 0 rgba(25, 32, 42, 0.16);
  color: var(--ink);
  cursor: pointer;
  font-size: 24px;
  font-weight: 950;
  line-height: 1;
  touch-action: manipulation;
}

.pause-button:active {
  box-shadow: 1px 2px 0 rgba(25, 32, 42, 0.88);
  transform: translate(2px, 2px);
}

.pause-panel {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: rgba(25, 32, 42, 0.2);
  backdrop-filter: blur(5px);
}

.pause-panel.is-hidden {
  display: none;
}

.pause-card {
  width: min(92vw, 400px);
  max-height: min(92vh, 660px);
  overflow: auto;
  padding: 14px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(232, 248, 255, 0.96)),
    linear-gradient(90deg, rgba(25, 32, 42, 0.06) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(0deg, rgba(25, 32, 42, 0.06) 1px, transparent 1px) 0 0 / 24px 24px;
  box-shadow: 8px 10px 0 rgba(25, 32, 42, 0.2);
}

.pause-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.pause-head span {
  color: var(--ink);
  font-size: clamp(28px, 8vw, 40px);
  font-weight: 950;
  line-height: 1;
}

.pause-head strong {
  max-width: 44%;
  overflow: hidden;
  color: var(--coral);
  font-size: clamp(24px, 7.6vw, 36px);
  font-weight: 950;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resume-button {
  width: 100%;
  min-height: 48px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--sun);
  box-shadow: 4px 5px 0 rgba(25, 32, 42, 0.16);
  color: var(--ink);
  cursor: pointer;
  font-size: 20px;
  font-weight: 950;
}

.save-slots {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.save-slot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 72px;
  padding: 10px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 4px 5px 0 rgba(25, 32, 42, 0.12);
}

.save-slot:nth-child(2) {
  background: rgba(56, 192, 189, 0.18);
}

.save-slot:nth-child(3) {
  background: rgba(255, 111, 97, 0.16);
}

.save-slot span,
.save-slot em {
  display: block;
  color: rgba(25, 32, 42, 0.6);
  font-style: normal;
  font-weight: 850;
  line-height: 1.15;
}

.save-slot span {
  font-size: 13px;
}

.save-slot strong {
  display: block;
  max-width: 100%;
  margin: 4px 0;
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(19px, 5.6vw, 27px);
  font-weight: 950;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-slot em {
  font-size: 12px;
}

.slot-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.slot-actions button {
  min-width: 72px;
  min-height: 30px;
  padding: 0 10px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 950;
  line-height: 1;
}

.slot-actions button[data-action="load"] {
  background: rgba(112, 196, 91, 0.92);
}

.slot-actions button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.6);
  opacity: 0.52;
}

.resume-button:active,
.slot-actions button:active:not(:disabled) {
  box-shadow: 1px 2px 0 rgba(25, 32, 42, 0.88);
  transform: translate(2px, 2px);
}

.home-panel {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(32px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    max(32px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.78), rgba(232, 248, 255, 0.9)),
    radial-gradient(circle at 50% 28%, rgba(255, 213, 103, 0.32), transparent 22%);
  text-align: center;
}

.home-panel.is-hidden {
  display: none;
}

.dev-entry {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  min-height: 38px;
  padding: 0 11px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 3px 4px 0 rgba(25, 32, 42, 0.12);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.dev-entry span {
  margin-right: 4px;
  color: var(--violet);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.logo-mark {
  position: relative;
  width: 82px;
  height: 70px;
  margin: 0 auto 8px;
}

.logo-mark span {
  position: absolute;
  left: 16px;
  bottom: 6px;
  width: 52px;
  height: 48px;
  border: 3px solid var(--ink);
  border-radius: 22px 22px 16px 16px;
  background: var(--aqua);
  box-shadow: 5px 5px 0 rgba(25, 32, 42, 0.12);
}

.logo-mark span::before,
.logo-mark span::after {
  position: absolute;
  top: 16px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  content: "";
}

.logo-mark span::before {
  left: 11px;
}

.logo-mark span::after {
  right: 11px;
}

.logo-mark i {
  position: absolute;
  left: 2px;
  bottom: 0;
  width: 78px;
  height: 14px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--leaf);
  transform: rotate(-4deg);
}

.home-panel h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(34px, 10vw, 48px);
  font-weight: 950;
  line-height: 1;
}

.home-panel p {
  min-height: 24px;
  margin: 12px 0 18px;
  color: rgba(25, 32, 42, 0.72);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.home-menu {
  display: grid;
  width: min(86vw, 360px);
  gap: 12px;
}

.home-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 18px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 5px 6px 0 rgba(25, 32, 42, 0.16);
  color: var(--ink);
  text-align: left;
}

.home-button {
  cursor: pointer;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease;
}

.home-button:first-child {
  background: var(--sun);
}

.home-button:nth-child(2) {
  background: rgba(56, 192, 189, 0.86);
}

.home-score {
  background: rgba(255, 255, 255, 0.82);
}

.home-score-label small {
  display: block;
  margin-top: 7px;
  color: var(--violet);
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
}

.home-item span {
  color: rgba(25, 32, 42, 0.68);
  font-size: 15px;
  font-weight: 850;
  line-height: 1;
}

.home-item strong {
  color: var(--ink);
  font-size: clamp(22px, 7vw, 34px);
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.home-button:nth-child(2) strong {
  font-size: clamp(17px, 5.4vw, 24px);
}

.home-button:active {
  box-shadow: 1px 2px 0 rgba(25, 32, 42, 0.9);
  transform: translate(3px, 3px);
}

.mode-panel {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  padding: max(28px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    max(28px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background:
    linear-gradient(180deg, #f7fbff, #e8f8ff),
    linear-gradient(90deg, rgba(25, 32, 42, 0.06) 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(0deg, rgba(25, 32, 42, 0.06) 1px, transparent 1px) 0 0 / 26px 26px;
}

.mode-panel.is-hidden {
  display: none;
}

.mode-panel h2 {
  margin: 52px 0 8px;
  color: var(--ink);
  font-size: clamp(32px, 9vw, 46px);
  font-weight: 950;
  line-height: 1;
}

.mode-relation-group {
  width: min(86vw, 380px);
  padding: 11px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 4px 5px 0 rgba(25, 32, 42, 0.12);
}

.mode-relation-group {
  margin-bottom: 11px;
}

.mode-group-kicker {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
  text-align: center;
}

.following-read-status {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.4;
}

.mode-relation-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(86vw, 380px);
  padding: 12px 14px;
  border: 2.5px solid var(--ink, #19202a);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 3px 4px 0 rgba(25, 32, 42, 0.1);
  margin-bottom: 12px;
}

.mode-benefit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-top: 8px;
  padding: 6px 14px;
  border: 2px solid var(--ink, #19202a);
  border-radius: 999px;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  color: #15803d;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 3px 0 rgba(25, 32, 42, 0.14);
}

.mode-benefit-btn.is-hidden {
  display: none;
}

.mode-benefit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 0 rgba(25, 32, 42, 0.2);
}

.mode-benefit-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(25, 32, 42, 0.2);
}

.mode-options {
  display: grid;
  width: min(86vw, 380px);
  gap: 12px;
}

.mode-option {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 10px 16px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--sun);
  box-shadow: 5px 6px 0 rgba(25, 32, 42, 0.16);
  color: var(--ink);
  cursor: pointer;
}

.mode-option.is-timed {
  background: rgba(56, 192, 189, 0.88);
}

.mode-option:disabled {
  box-shadow: 3px 4px 0 rgba(25, 32, 42, 0.1);
  cursor: not-allowed;
  filter: grayscale(0.35);
  opacity: 0.68;
}

.mode-option span {
  display: grid;
  min-width: 0;
  gap: 4px;
  font-size: 18px;
  font-weight: 900;
  text-align: left;
}

.mode-option span b {
  font-size: 18px;
}

.mode-option span small {
  color: rgba(25, 32, 42, 0.66);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
}

.mode-option strong {
  font-size: clamp(25px, 7vw, 34px);
  font-weight: 950;
}

.mode-option:active {
  box-shadow: 1px 2px 0 rgba(25, 32, 42, 0.88);
  transform: translate(3px, 3px);
}

.title-wall {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(28px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    max(28px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background:
    linear-gradient(180deg, rgba(255, 248, 237, 0.9), rgba(232, 248, 255, 0.92)),
    linear-gradient(90deg, rgba(25, 32, 42, 0.06) 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(0deg, rgba(25, 32, 42, 0.06) 1px, transparent 1px) 0 0 / 26px 26px;
}

.title-wall.is-hidden {
  display: none;
}

.rank-panel {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: flex;
  flex-direction: column;
  padding: max(22px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background:
    linear-gradient(180deg, #f7fbff, #e8f8ff),
    linear-gradient(90deg, rgba(25, 32, 42, 0.06) 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(0deg, rgba(25, 32, 42, 0.06) 1px, transparent 1px) 0 0 / 26px 26px;
}

.rank-panel.is-hidden {
  display: none;
}

.dev-panel {
  position: absolute;
  inset: 0;
  z-index: 8;
  overflow-y: auto;
  padding: max(20px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: linear-gradient(180deg, #f7fbff, #e8f8ff);
  color: var(--ink);
  text-align: left;
  touch-action: pan-y;
}

.dev-panel.is-hidden,
.dev-content article.is-hidden {
  display: none;
}

.dev-head {
  position: relative;
  min-height: 78px;
  padding: 3px 12px 0 82px;
}

.dev-head .wall-back {
  top: 0;
  left: 0;
}

.dev-head h2 {
  margin: 0;
  font-size: clamp(28px, 7.4vw, 38px);
  font-weight: 950;
  line-height: 1;
}

.dev-head p {
  margin: 8px 0 0;
  color: rgba(25, 32, 42, 0.64);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
}

.dev-tabs {
  position: sticky;
  top: max(-1px, env(safe-area-inset-top));
  z-index: 2;
  display: grid;
  grid-template-columns: 88px 72px 72px 150px 88px;
  gap: 5px;
  overflow-x: auto;
  padding: 4px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
}

.dev-tabs button {
  min-width: 0;
  min-height: 38px;
  border-radius: 5px;
  background: transparent;
  color: rgba(25, 32, 42, 0.62);
  cursor: pointer;
  font-size: 14px;
  font-weight: 950;
}

.dev-tabs button.is-active {
  background: var(--sun);
  color: var(--ink);
}

.dev-content {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: 18px 4px 24px;
}

.dev-content h3 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 950;
  line-height: 1.25;
}

.dev-content h3:not(:first-child) {
  margin-top: 24px;
}

.dev-content p,
.dev-content li,
.dev-compare dd {
  color: rgba(25, 32, 42, 0.76);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.65;
}

.dev-content code:not(.code-sample code) {
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(123, 104, 238, 0.12);
  color: #4335a8;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
  overflow-wrap: anywhere;
}

.dev-content .dev-lead {
  padding: 12px 14px;
  border-left: 5px solid var(--aqua);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.tutorial-title {
  margin: 30px 0 18px;
  padding: 13px 14px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--sun);
  box-shadow: 4px 5px 0 rgba(25, 32, 42, 0.14);
}

.tutorial-title span {
  display: block;
  margin-bottom: 4px;
  color: rgba(25, 32, 42, 0.62);
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
}

.dev-content .tutorial-title h3 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
}

.step-number {
  display: inline-grid;
  width: 27px;
  height: 27px;
  margin-right: 7px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--aqua);
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
  vertical-align: 2px;
}

.step-result {
  margin-top: 16px !important;
  padding: 13px 14px;
  border: 2px solid rgba(25, 32, 42, 0.28);
  border-radius: 8px;
  background: rgba(112, 196, 91, 0.16);
  color: var(--ink) !important;
}

.dev-content p {
  margin: 0 0 12px;
}

.dev-content ul {
  margin: 0;
  padding-left: 20px;
}

.dev-steps {
  margin: 0;
  padding-left: 24px;
}

.dev-steps li + li {
  margin-top: 7px;
}

.dev-steps strong {
  color: var(--ink);
}

.dev-compare {
  margin: 0;
  border-top: 2px solid rgba(25, 32, 42, 0.18);
}

.dev-compare div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 0;
  border-bottom: 2px solid rgba(25, 32, 42, 0.18);
}

.dev-compare dt {
  color: var(--violet);
  font-size: 15px;
  font-weight: 950;
  line-height: 1.5;
}

.dev-compare dd {
  margin: 0;
}

.code-sample {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #19202a;
  box-shadow: 4px 5px 0 rgba(25, 32, 42, 0.12);
}

.code-sample button {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  min-width: 54px;
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.code-sample pre {
  max-width: 100%;
  margin: 0;
  padding: 48px 14px 16px;
  overflow-x: auto;
  color: #e8f8ff;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.65;
  text-align: left;
  touch-action: pan-x pan-y;
}

.code-sample.compact pre {
  padding-top: 44px;
}

.dev-content .dev-note {
  margin-top: 12px;
  color: rgba(25, 32, 42, 0.58);
  font-size: 12px;
}

.dev-details {
  margin-top: 14px;
  border: 2px solid rgba(25, 32, 42, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.dev-details summary {
  padding: 12px 38px 12px 13px;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 950;
  line-height: 1.35;
}

.dev-details p,
.dev-details ul {
  margin: 0;
  padding: 0 13px 13px;
}

.dev-details ul {
  padding-left: 32px;
}

.dev-board-map div {
  grid-template-columns: 82px minmax(0, 1fr);
}

.sdk-feature-list {
  display: grid;
  gap: 10px;
  margin-bottom: 28px;
}

.sdk-feature-card {
  min-width: 0;
  padding: 14px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 3px 4px 0 rgba(25, 32, 42, 0.12);
}

.sdk-feature-card header {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.sdk-feature-card header > div {
  min-width: 0;
}

.sdk-feature-card header > span {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--sun);
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
}

.dev-content .sdk-feature-card h3 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.25;
}

.sdk-feature-card header code {
  color: var(--violet);
  font-size: 10.5px;
  font-weight: 850;
  white-space: nowrap;
}

.dev-content .sdk-feature-card p {
  margin: 5px 0 0;
  color: rgba(25, 32, 42, 0.72);
  font-size: 13px;
  line-height: 1.55;
}

.sdk-feature-card p strong {
  color: var(--ink);
}

.source-files {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.source-files button {
  min-width: 0;
  min-height: 40px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 900;
}

.source-files button.is-active {
  background: var(--sun);
  box-shadow: 2px 3px 0 rgba(25, 32, 42, 0.2);
}

.dev-content .source-status {
  min-height: 20px;
  margin-bottom: 7px;
  color: rgba(25, 32, 42, 0.58);
  font-size: 12px;
}

.source-sample pre {
  max-height: 62vh;
  min-height: 240px;
}

.rank-head {
  position: relative;
  flex: 0 0 auto;
  padding: 4px 84px 0;
  text-align: center;
}

.rank-head .wall-back {
  top: 0;
  left: 0;
}

.rank-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(30px, 8vw, 44px);
  font-weight: 950;
  line-height: 1;
}

.rank-head p {
  min-height: 18px;
  margin: 8px -72px 0;
  color: rgba(25, 32, 42, 0.7);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.2;
}

.rank-boards,
.rank-periods {
  display: grid;
  gap: 5px;
  flex: 0 0 auto;
  padding: 4px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.rank-boards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 16px 0 7px;
}

.rank-periods {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 10px;
}

.rank-boards button,
.rank-periods button {
  min-width: 0;
  min-height: 38px;
  border-radius: 5px;
  background: transparent;
  color: rgba(25, 32, 42, 0.62);
  cursor: pointer;
  font-size: 14px;
  font-weight: 950;
}

.rank-boards button.is-active,
.rank-periods button.is-active {
  background: var(--sun);
  box-shadow: 2px 3px 0 rgba(25, 32, 42, 0.16);
  color: var(--ink);
}

.rank-status {
  flex: 0 0 auto;
  min-height: 22px;
  color: rgba(25, 32, 42, 0.62);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.4;
  text-align: center;
}

.rank-list {
  display: grid;
  gap: 7px;
  min-height: 0;
  margin: 0;
  padding: 0 3px 8px;
  overflow-y: auto;
  list-style: none;
}

.rank-row {
  display: grid;
  grid-template-columns: 36px 42px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 58px;
  padding: 7px 11px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 3px 4px 0 rgba(25, 32, 42, 0.1);
}

.rank-row.is-top-1 {
  background: rgba(255, 213, 103, 0.9);
}

.rank-row.is-top-2 {
  background: rgba(232, 240, 247, 0.96);
}

.rank-row.is-top-3 {
  background: rgba(255, 180, 132, 0.72);
}

.rank-place {
  color: var(--ink);
  font-size: 21px;
  font-weight: 950;
  text-align: center;
}

.rank-avatar {
  width: 42px;
  height: 42px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--aqua);
}

.rank-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rank-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-score {
  max-width: 104px;
  overflow: hidden;
  color: var(--violet);
  font-size: clamp(19px, 5.6vw, 28px);
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wall-back {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
  min-width: 72px;
  min-height: 40px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  box-shadow: 3px 4px 0 rgba(25, 32, 42, 0.14);
  color: var(--ink);
  cursor: pointer;
  font-size: 16px;
  font-weight: 950;
}

.title-wall h2 {
  margin: 0 0 16px;
  color: var(--ink);
  font-size: clamp(30px, 8vw, 46px);
  font-weight: 950;
  line-height: 1;
}

.title-list {
  display: grid;
  width: min(86vw, 390px);
  gap: 10px;
}

.title-card {
  position: relative;
  display: grid;
  min-height: 126px;
  place-items: center;
  padding: 18px 16px 16px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 25%, rgba(255, 213, 103, 0.38), transparent 20%),
    radial-gradient(circle at 78% 78%, rgba(56, 192, 189, 0.28), transparent 22%),
    #fff;
  box-shadow: 5px 6px 0 rgba(25, 32, 42, 0.14);
  overflow: hidden;
  transform: rotate(-1deg);
}

.title-card:nth-child(2) {
  transform: rotate(1deg);
}

.title-card:nth-child(3) {
  transform: rotate(-0.5deg);
}

.title-card::before,
.title-card::after {
  position: absolute;
  width: 58px;
  height: 58px;
  border: 8px solid rgba(255, 111, 97, 0.18);
  border-radius: 50%;
  content: "";
}

.title-card::before {
  top: -26px;
  left: -26px;
}

.title-card::after {
  right: -30px;
  bottom: -30px;
  border-color: rgba(56, 192, 189, 0.18);
}

.title-card.is-locked {
  filter: grayscale(0.48);
}

.title-index {
  justify-self: start;
  align-self: start;
  color: rgba(25, 32, 42, 0.54);
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.art-title {
  position: relative;
  z-index: 1;
  display: block;
  color: transparent;
  background: linear-gradient(90deg, #ff6f61 0%, #ffd567 44%, #38c0bd 72%, #7b68ee 100%);
  background-clip: text;
  font-family:
    "Hannotate SC",
    "Yuanti SC",
    "PingFang SC",
    "Microsoft YaHei",
    cursive,
    sans-serif;
  font-size: clamp(34px, 9.8vw, 54px);
  font-weight: 950;
  line-height: 1.02;
  text-align: center;
  text-shadow:
    2px 2px 0 rgba(25, 32, 42, 0.88),
    5px 6px 0 rgba(25, 32, 42, 0.1);
  transform: rotate(-3deg);
  -webkit-background-clip: text;
}

.title-card.is-locked .art-title {
  background: linear-gradient(90deg, #98a2ad, #c4cbd3);
  background-clip: text;
  text-shadow:
    2px 2px 0 rgba(25, 32, 42, 0.55),
    5px 6px 0 rgba(25, 32, 42, 0.08);
  -webkit-background-clip: text;
}

.title-status {
  justify-self: end;
  align-self: end;
  min-width: 82px;
  padding: 6px 9px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--sun);
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
}

.title-card.is-locked .title-status {
  background: #eef2f6;
  color: rgba(25, 32, 42, 0.68);
}

.wall-action {
  min-width: 146px;
  min-height: 48px;
  margin-top: 16px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: rgba(56, 192, 189, 0.9);
  box-shadow: 4px 5px 0 rgba(25, 32, 42, 0.88);
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
  font-weight: 950;
}

.wall-back:active,
.wall-action:active {
  box-shadow: 1px 2px 0 rgba(25, 32, 42, 0.88);
  transform: translate(2px, 2px);
}

.touch-pad {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  left: max(18px, env(safe-area-inset-left));
  z-index: 3;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.pad-button {
  width: 78px;
  height: 64px;
  border: 3px solid rgba(25, 32, 42, 0.88);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 4px 5px 0 rgba(25, 32, 42, 0.12);
  color: var(--ink);
  cursor: pointer;
  font-size: 44px;
  font-weight: 950;
  line-height: 1;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}

.pad-button:active,
.pad-button.is-pressed {
  background: rgba(56, 192, 189, 0.78);
  transform: translate(2px, 2px);
}

@media (min-width: 720px) {
  .game-shell {
    width: min(100vw, 560px);
    height: min(100vh, 900px);
    margin: auto;
    border-right: 3px solid rgba(25, 32, 42, 0.9);
    border-left: 3px solid rgba(25, 32, 42, 0.9);
    box-shadow: 0 0 0 999px #dff3ff;
  }

  .touch-pad {
    display: none;
  }

  .pause-button {
    right: 24px;
    bottom: 24px;
  }
}

@media (min-width: 520px) {
  .sdk-feature-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 370px) {
  .dev-tabs button {
    padding: 0 2px;
    font-size: 12px;
  }

  .dev-entry {
    width: 42px;
    min-width: 42px;
    padding: 0;
    font-size: 0;
  }

  .dev-entry span {
    margin: 0;
    font-size: 14px;
  }

  .save-slot {
    grid-template-columns: 1fr;
  }

  .slot-actions {
    grid-template-columns: 1fr 1fr;
  }
}

/* Toy Modal Popup Component */
.toy-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: toyFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toy-modal-overlay.is-hidden {
  display: none !important;
}

.toy-modal-card {
  position: relative;
  width: min(90vw, 360px);
  padding: 28px 24px 22px;
  border: 3px solid var(--ink, #19202a);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22), 6px 8px 0 rgba(25, 32, 42, 0.88);
  text-align: center;
  transform: scale(1);
  animation: toyPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toy-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--ink, #19202a);
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--ink, #19202a);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.toy-modal-close:hover {
  background: #e2e8f0;
  transform: scale(1.1);
}

.toy-modal-icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 12px;
  animation: toyBounce 1.2s ease infinite alternate;
}

.toy-modal-title {
  margin: 0 0 8px;
  color: var(--ink, #19202a);
  font-size: 20px;
  font-weight: 900;
}

.toy-modal-desc {
  margin: 0 0 14px;
  color: #475569;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 600;
}

.toy-modal-badge {
  display: inline-block;
  margin-bottom: 20px;
  padding: 6px 14px;
  border: 2px solid var(--ink, #19202a);
  border-radius: 999px;
  background: rgba(56, 192, 189, 0.15);
  color: #0d9488;
  font-size: 12px;
  font-weight: 850;
}

.toy-modal-badge.is-hidden {
  display: none !important;
}

.toy-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toy-modal-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 10px 18px;
  border: 2.5px solid var(--ink, #19202a);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.toy-modal-btn.is-primary {
  background: #38c0bd;
  color: #ffffff;
  box-shadow: 0 4px 0 var(--ink, #19202a);
}

.toy-modal-btn.is-primary:hover {
  background: #2cb0ad;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--ink, #19202a);
}

.toy-modal-btn.is-primary:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--ink, #19202a);
}

.toy-modal-btn.is-secondary {
  background: #f8fafc;
  color: #64748b;
  box-shadow: 0 3px 0 rgba(25, 32, 42, 0.15);
}

.toy-modal-btn.is-secondary:hover {
  background: #f1f5f9;
  color: var(--ink, #19202a);
}

.toy-modal-btn.is-secondary.is-hidden {
  display: none !important;
}

@keyframes toyFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes toyPopIn {
  from { opacity: 0; transform: scale(0.88) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes toyBounce {
  from { transform: translateY(0); }
  to { transform: translateY(-6px); }
}

button:focus-visible,
[role="button"]:focus-visible {
  outline: 4px solid #7b68ee;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .toy-modal-overlay,
  .toy-modal-card,
  .toy-modal-icon {
    animation: none;
  }

  .toy-modal-close,
  .toy-modal-btn {
    transition: none;
  }
}
