body[data-ui="embed-compact"] {
  --embed-bg: #071019;
  --embed-panel: rgba(12, 24, 36, 0.92);
  --embed-panel-soft: rgba(15, 28, 42, 0.82);
  --embed-line: rgba(151, 174, 196, 0.14);
  --embed-text: #f4f8ff;
  --embed-muted: #95a6bc;
  background:
    radial-gradient(circle at top, rgba(39, 103, 189, 0.14), transparent 34%),
    linear-gradient(180deg, #06111a 0%, var(--embed-bg) 100%);
}

body.menu-open {
  overflow: hidden;
}

body.menu-open .app {
  display: none;
}

.main-menu {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: #071019;
  overflow: hidden;
}

.main-menu[hidden] {
  display: none;
}

.main-menu picture,
.main-menu img {
  width: 100%;
  height: 100%;
  display: block;
}

.main-menu img {
  object-fit: cover;
}

.menu-hotspot {
  position: absolute;
  z-index: 2;
  border: 0;
  border-radius: 12px;
  padding: 0;
  background: rgba(255, 255, 255, 0);
  box-shadow: none;
  transform: none;
  cursor: pointer;
}

.menu-hotspot:hover {
  background: rgba(255, 255, 255, 0.08);
  filter: none;
}

.menu-hotspot:active {
  transform: none;
}

.menu-hotspot:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.92);
  outline-offset: 3px;
}

.menu-hotspot-inner {
  display: none;
}

.menu-message {
  position: absolute;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  min-width: 180px;
  max-width: min(440px, calc(100vw - 48px));
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(9, 22, 34, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff7df;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.menu-message.show {
  opacity: 1;
}

body[data-ui="embed-compact"] .app {
  width: min(1220px, calc(100vw - 24px));
  margin: 12px auto;
  gap: 10px;
}

body[data-ui="embed-compact"] .topbar,
body[data-ui="embed-compact"] .card {
  background: var(--embed-panel);
  border-color: var(--embed-line);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.2);
}

.play-layout {
  display: grid;
  grid-template-columns: 220px minmax(420px, 1fr);
  gap: 10px;
  align-items: start;
}

body[data-ui="embed-compact"] .topbar {
  display: block;
  padding: 14px 16px;
}

.play-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.play-hero-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.play-hero h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.08;
}

.play-hero-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.play-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 420px;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: right;
}

.play-controls-label {
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

.level-selector {
  display: grid;
  gap: 10px;
  position: sticky;
  top: 10px;
}

.level-selector h2 {
  margin: 0;
  font-size: 15px;
  color: var(--embed-muted, #95a6bc);
  letter-spacing: 0.08em;
}

.level-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.level-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(17, 31, 46, 0.78);
  border: 1px solid rgba(151, 174, 196, 0.14);
  cursor: pointer;
  font-weight: 600;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.level-list li:hover {
  border-color: rgba(120, 170, 226, 0.28);
  transform: translateY(-1px);
}

.level-list li.active {
  border-color: #6db2ff;
  background: rgba(20, 48, 78, 0.96);
  box-shadow: inset 0 0 0 1px rgba(109, 178, 255, 0.12);
}

.lv-num {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  font-size: 12px;
  flex-shrink: 0;
}

.lv-name {
  font-size: 13px;
  line-height: 1.3;
}

.game-area { position: static; }

.game-shell {
  display: grid;
  gap: 10px;
}

.level-name {
  margin: 0;
  color: var(--embed-muted);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.objective {
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(109, 178, 255, 0.16);
  background: rgba(15, 35, 55, 0.9);
  color: #d8e8fb;
  font-size: 13px;
  line-height: 1.45;
}

.objective-label {
  color: var(--embed-muted);
  margin-right: 6px;
}

body[data-ui="embed-compact"] .status {
  padding: 8px 12px;
  border-radius: 12px;
  min-height: 40px;
  background: rgba(10, 27, 44, 0.88);
  border-color: rgba(67, 116, 171, 0.32);
  color: #dbeafe;
  font-size: 13px;
  font-weight: 600;
}

body[data-ui="embed-compact"] .board-wrap {
  padding: 10px;
  border-radius: 16px;
  background: rgba(3, 8, 14, 0.92);
  border: 1px solid rgba(151, 174, 196, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.hud-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  min-height: 52px;
  border-radius: 14px;
  background: var(--embed-panel-soft);
  border: 1px solid var(--embed-line);
}

.hud-inline-items {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.hud-sep { color: rgba(149, 166, 188, 0.45); }

.hud-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-height: 20px;
  font-size: 13px;
}

.hud-item .label { color: var(--embed-muted); }

.hud-item b {
  color: var(--embed-text);
  font-size: 13px;
  font-weight: 700;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

body[data-ui="embed-compact"] .hud-actions button,
body[data-ui="embed-compact"] .dpad button {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
}

body[data-ui="embed-compact"] button.primary {
  background: linear-gradient(180deg, #76bcff 0%, #4d9ef5 100%);
  color: #031120;
}

@media (max-width: 720px) {
  .menu-message {
    bottom: 2.5%;
    font-size: 13px;
  }

  body[data-ui="embed-compact"] .app {
    width: min(100vw - 16px, 560px);
    margin: 8px auto;
  }

  body[data-ui="embed-compact"] .topbar,
  body[data-ui="embed-compact"] .card {
    border-radius: 14px;
  }

  .play-hero {
    display: grid;
    gap: 8px;
  }

  .play-controls {
    justify-content: flex-start;
    text-align: left;
  }

  .play-layout { grid-template-columns: 1fr; }
  .level-selector { position: static; }
  .level-list {
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 6px;
  }
  .level-list li {
    justify-content: center;
    padding: 8px;
  }
  .lv-name { font-size: 12px; }
  .game-shell { gap: 8px; }
  .objective { padding: 8px 10px; }
  body[data-ui="embed-compact"] .status {
    min-height: 0;
    padding: 8px 10px;
  }
  body[data-ui="embed-compact"] .board-wrap {
    padding: 8px;
    overflow: hidden;
  }
  .hud-inline {
    display: grid;
    gap: 8px;
  }
  .hud-inline-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }
  .hud-sep { display: none; }
  .hud-item {
    display: grid;
    gap: 2px;
    padding: 7px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
  }
  .hud-actions {
    width: 100%;
    margin-left: 0;
  }
  .hud-actions a,
  .hud-actions button {
    flex: 1 1 0;
  }
  .dpad {
    display: grid;
    grid-template-columns: repeat(3, 52px);
    gap: 8px;
  }
  body[data-ui="embed-compact"] .dpad button {
    min-height: 46px;
  }
}

@media (max-width: 420px) {
  .play-hero-subtitle { display: none; }
  .play-controls {
    font-size: 11px;
    gap: 6px;
  }
  .hud-inline-items {
    grid-template-columns: 1fr;
  }
}

@media (orientation: portrait) {
  .play-controls {
    display: none;
  }

  .menu-start {
    left: 24.2%;
    top: 69.0%;
    width: 52.1%;
    height: 8.0%;
  }

  .menu-select {
    left: 24.2%;
    top: 79.3%;
    width: 25.1%;
    height: 6.0%;
  }

  .menu-settings {
    left: 51.2%;
    top: 79.3%;
    width: 25.1%;
    height: 6.0%;
  }

  .menu-hotspot {
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    border-radius: 0;
    overflow: visible;
  }

  .menu-hotspot:hover,
  .menu-hotspot:active {
    background: transparent;
  }

  .menu-hotspot-inner {
    width: 100%;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 2.2vw, 18px);
    border-radius: clamp(18px, 3vw, 24px);
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 0 rgba(44, 27, 5, 0.18);
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.25),
      0 8px 0 rgba(164, 94, 8, 0.95),
      0 12px 22px rgba(0, 0, 0, 0.18);
    transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
  }

  .menu-hotspot:hover .menu-hotspot-inner {
    filter: brightness(1.03);
  }

  .menu-hotspot:active .menu-hotspot-inner {
    transform: translateY(2px);
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.22),
      0 6px 0 rgba(164, 94, 8, 0.95),
      0 8px 14px rgba(0, 0, 0, 0.16);
  }

  .menu-hotspot:focus-visible {
    outline-color: rgba(255, 234, 160, 0.98);
    outline-offset: 4px;
  }

  .menu-hotspot-label {
    white-space: nowrap;
  }

  .menu-start .menu-hotspot-inner {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 24%),
      linear-gradient(180deg, #ffd25f 0%, #ffbc3b 58%, #f3a81f 100%);
    color: #5a3107;
    font-size: clamp(24px, 5vw, 34px);
  }

  .menu-select .menu-hotspot-inner,
  .menu-settings .menu-hotspot-inner {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 26%),
      linear-gradient(180deg, #587391 0%, #3f5873 50%, #2f455c 100%);
    color: #f4f7fb;
    text-shadow: 0 2px 0 rgba(18, 28, 38, 0.28);
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.12),
      0 7px 0 rgba(35, 53, 72, 0.96),
      0 10px 18px rgba(0, 0, 0, 0.16);
    font-size: clamp(18px, 4vw, 25px);
  }

  .menu-select:active .menu-hotspot-inner,
  .menu-settings:active .menu-hotspot-inner {
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.1),
      0 5px 0 rgba(35, 53, 72, 0.96),
      0 7px 12px rgba(0, 0, 0, 0.14);
  }

  .menu-hotspot-icon {
    position: relative;
    flex: 0 0 auto;
    display: inline-block;
  }

  .menu-hotspot-icon-play {
    width: clamp(26px, 5vw, 38px);
    height: clamp(26px, 5vw, 38px);
    filter: drop-shadow(0 2px 2px rgba(74, 47, 9, 0.22));
  }

  .menu-hotspot-icon-play::before {
    content: "";
    position: absolute;
    left: 18%;
    top: 11%;
    width: 0;
    height: 0;
    border-top: clamp(11px, 2.1vw, 16px) solid transparent;
    border-bottom: clamp(11px, 2.1vw, 16px) solid transparent;
    border-left: clamp(18px, 3.2vw, 24px) solid #fff7eb;
  }

  .menu-hotspot-icon-grid {
    width: clamp(24px, 4.6vw, 34px);
    height: clamp(24px, 4.6vw, 34px);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(3px, 0.8vw, 5px);
  }

  .menu-hotspot-icon-grid i {
    display: block;
    border-radius: 4px;
    background: #f8fbff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  }

  .menu-hotspot-icon-gear {
    width: clamp(26px, 5vw, 38px);
    height: clamp(26px, 5vw, 38px);
    border-radius: 50%;
    background:
      radial-gradient(circle at center, #f8fbff 0 24%, transparent 26%),
      conic-gradient(from 0deg, #f8fbff 0 12.5%, transparent 12.5% 25%, #f8fbff 25% 37.5%, transparent 37.5% 50%, #f8fbff 50% 62.5%, transparent 62.5% 75%, #f8fbff 75% 87.5%, transparent 87.5% 100%);
    filter: drop-shadow(0 2px 2px rgba(18, 28, 38, 0.24));
  }

  .menu-hotspot-icon-gear::before {
    content: "";
    position: absolute;
    inset: 18%;
    border-radius: 50%;
    background: #f8fbff;
  }

  .menu-hotspot-icon-gear::after {
    content: "";
    position: absolute;
    inset: 34%;
    border-radius: 50%;
    background: #4a627b;
  }
}

@media (orientation: landscape) {
  body[data-ui="embed-compact"] .topbar {
    padding: 8px 12px;
  }

  .play-hero {
    gap: 10px;
  }

  .play-hero h1 {
    font-size: clamp(18px, 2.3vw, 24px);
    line-height: 1.06;
  }

  .play-controls {
    font-size: 10px;
    line-height: 1.15;
  }

  .level-selector {
    gap: 6px;
  }

  .level-list {
    gap: 4px;
  }

  .level-list li {
    padding: 6px 7px;
  }

  .lv-num {
    width: 22px;
    height: 22px;
  }

  .objective {
    padding: 6px 9px;
    min-height: 0;
  }

  body[data-ui="embed-compact"] .status {
    min-height: 0;
    padding: 6px 9px;
  }

  .hud-inline {
    min-height: 40px;
    padding: 5px 7px;
  }

  .hud-item {
    min-height: 16px;
  }

  body[data-ui="embed-compact"] .hud-actions button,
  body[data-ui="embed-compact"] .dpad button {
    min-height: 32px;
    padding: 6px 9px;
  }

  .play-controls {
    display: flex;
  }
}

body[data-mode="select"] .select-app {
  display: grid;
  gap: 14px;
  width: min(1240px, calc(100vw - 24px));
  margin: 10px auto 16px;
}

body[data-mode="select"] .select-header {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 12px;
}

body[data-mode="select"] .back-button {
  width: 72px;
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  position: relative;
}

body[data-mode="select"] .back-button:hover {
  filter: brightness(1.05);
}

body[data-mode="select"] .back-button:focus-visible {
  outline: 3px solid rgba(255, 225, 143, 0.9);
  outline-offset: 3px;
}

body[data-mode="select"] .back-button::before {
  content: "\2190";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff1d2;
  font-size: 54px;
  font-weight: 900;
  text-shadow:
    0 2px 0 rgba(22, 35, 48, 0.3),
    0 0 10px rgba(0, 0, 0, 0.16);
}

body[data-mode="select"] .select-title-pill {
  justify-self: center;
  min-width: min(420px, 100%);
  padding: 14px 22px;
  border-radius: 0;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.04), transparent 30%),
    linear-gradient(180deg, rgba(32, 53, 76, 0.94), rgba(21, 38, 59, 0.96));
  border: 1px solid rgba(120, 155, 189, 0.26);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 12px 28px rgba(0, 0, 0, 0.22);
  text-align: center;
}

body[data-mode="select"] .select-title-pill span {
  display: inline-block;
  color: #f7e7c0;
  font-size: clamp(28px, 3.4vw, 52px);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(31, 31, 31, 0.28);
}

body[data-mode="select"] .select-header-spacer {
  width: 72px;
}

body[data-mode="select"] .select-stage {
  display: grid;
  gap: 12px;
}

body[data-mode="select"] .select-grid-shell {
  display: grid;
  gap: 10px;
}

body[data-mode="select"] .level-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 1.8vw, 22px);
}

body[data-mode="select"] .level-card {
  position: relative;
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  min-width: 0;
  text-align: left;
}

body[data-mode="select"] .level-card:hover:not(:disabled) .level-card-art {
  transform: translateY(-2px);
  filter: drop-shadow(0 16px 32px rgba(0, 0, 0, 0.28));
}

body[data-mode="select"] .level-card:focus-visible {
  outline: 3px solid rgba(255, 197, 61, 0.9);
  outline-offset: 4px;
  border-radius: 0;
}

body[data-mode="select"] .level-card[disabled] {
  cursor: default;
}

body[data-mode="select"] .level-card-art {
  position: absolute;
  inset: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  border-radius: 0;
  filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.24));
}

body[data-mode="select"] .level-card.selected .level-card-art {
  transform: scale(1.015);
  filter:
    drop-shadow(0 0 0 rgba(0, 0, 0, 0))
    drop-shadow(0 18px 34px rgba(0, 0, 0, 0.24))
    drop-shadow(0 0 18px rgba(255, 197, 61, 0.28));
}

body[data-mode="select"] .level-card.unlocked .level-card-art {
  background-image: url("assets/ui/level-select/level-card-unlocked.png");
}

body[data-mode="select"] .level-card.selected .level-card-art {
  background-image: url("assets/ui/level-select/level-card-selected.png");
}

body[data-mode="select"] .level-card.locked .level-card-art {
  background-image: url("assets/ui/level-select/level-card-locked.png");
  filter: grayscale(0.18) brightness(0.82);
}

body[data-mode="select"] .level-card-number {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  color: #f6f0e0;
  font-size: clamp(24px, 2.8vw, 40px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(33, 32, 29, 0.32);
  pointer-events: none;
}

body[data-mode="select"] .level-card.locked .level-card-number {
  color: rgba(239, 241, 243, 0.72);
}

body[data-mode="select"] .level-card-stars {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

body[data-mode="select"] .level-card-stars span {
  color: #ffcb45;
  font-size: clamp(24px, 2.8vw, 36px);
  line-height: 1;
  text-shadow: 0 2px 0 rgba(117, 77, 4, 0.25);
}

body[data-mode="select"] .level-card.locked .level-card-stars {
  opacity: 0;
}

body[data-mode="select"] .legacy-preview {
  display: none !important;
}

@media (max-width: 900px) {
  body[data-mode="select"] .select-app {
    width: min(100vw - 16px, 760px);
  }

  body[data-mode="select"] .select-header {
    grid-template-columns: 58px minmax(0, 1fr) 58px;
  }

  body[data-mode="select"] .back-button,
  body[data-mode="select"] .select-header-spacer {
    width: 58px;
  }

  body[data-mode="select"] .select-title-pill {
    min-width: min(320px, 100%);
    padding: 12px 18px;
  }

  body[data-mode="select"] .select-title-pill span {
    font-size: clamp(24px, 4vw, 40px);
  }

  body[data-mode="select"] .level-grid {
    gap: 12px;
  }
}

@media (max-width: 620px) {
  body[data-mode="select"] .select-app {
    width: min(100vw - 12px, 560px);
    gap: 10px;
    margin: 8px auto 12px;
  }

  body[data-mode="select"] .select-header {
    grid-template-columns: 50px minmax(0, 1fr) 50px;
    gap: 8px;
  }

  body[data-mode="select"] .back-button,
  body[data-mode="select"] .select-header-spacer {
    width: 50px;
  }

  body[data-mode="select"] .back-button::before {
    font-size: 34px;
  }

  body[data-mode="select"] .select-title-pill {
    padding: 10px 14px;
  }

  body[data-mode="select"] .select-title-pill span {
    font-size: clamp(22px, 4.6vw, 32px);
  }

  body[data-mode="select"] .level-grid {
    gap: 10px;
  }
}

@media (max-width: 420px) {
  body[data-mode="select"] .select-header {
    grid-template-columns: 46px minmax(0, 1fr) 46px;
  }

  body[data-mode="select"] .back-button,
  body[data-mode="select"] .select-header-spacer {
    width: 46px;
  }

  body[data-mode="select"] .select-title-pill {
    min-width: 0;
    padding: 9px 12px;
  }

  body[data-mode="select"] .select-title-pill span {
    font-size: clamp(20px, 6vw, 28px);
  }

  body[data-mode="select"] .level-grid {
    gap: 8px;
  }

  body[data-mode="select"] .level-card-number {
    top: 10px;
  }

  body[data-mode="select"] .level-card-stars {
    bottom: 10px;
    gap: 6px;
  }
}

@media (orientation: portrait) and (max-width: 600px) {
  body[data-mode="select"] .level-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

@media (orientation: portrait) {
  body[data-mode="select"] .level-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

body.settings-open {
  overflow: hidden;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 10, 18, 0.68);
  backdrop-filter: blur(4px);
}

.settings-overlay.hidden {
  display: none !important;
}

.settings-dialog {
  width: min(934px, 92vw);
  max-height: 92vh;
}

.settings-panel {
  position: relative;
  aspect-ratio: 934 / 1248;
  width: 100%;
  background: url("assets/ui/settings/settings-panel.webp?v=20260531-7") center / 100% 100% no-repeat;
  filter: drop-shadow(0 24px 42px rgba(0, 0, 0, 0.34));
}

.settings-title {
  position: absolute;
  left: 50%;
  top: calc(10% - 5px);
  transform: translateX(-50%);
  color: #fdf5dc;
  font-size: clamp(26px, 4vw, 52px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 3px 0 rgba(44, 44, 44, 0.28);
  z-index: 2;
}

.settings-close {
  position: absolute;
  top: 9%;
  right: 8%;
  width: clamp(58px, 7vw, 82px);
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 20px;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #ff7860 0%, #d94631 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 10px 20px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  z-index: 3;
}

.settings-close::before,
.settings-close::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 46%;
  height: 10%;
  border-radius: 999px;
  background: #fff6ef;
  transform-origin: center;
}

.settings-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.settings-close::after { transform: translate(-50%, -50%) rotate(-45deg); }

.settings-body {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: start;
  gap: clamp(14px, 2vw, 22px);
  padding: calc(24% - 10px) 16% 10%;
}

.settings-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) minmax(70px, 120px);
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 14px 18px;
  border: 1px solid rgba(228, 208, 173, 0.6);
  border-radius: 24px;
  background: rgba(248, 239, 220, 0.36);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  color: #4b2f1a;
  font-size: clamp(22px, 3vw, 36px);
  font-weight: 900;
  cursor: pointer;
  text-align: left;
}

.settings-row-icon {
  display: grid;
  place-items: center;
  color: #8f6238;
  font-size: clamp(26px, 3.2vw, 38px);
  line-height: 1;
}

.settings-row-label {
  padding-right: 8px;
  white-space: nowrap;
}

.settings-switch {
  position: relative;
  width: min(100%, 112px);
  height: 48px;
  border-radius: 999px;
  background: linear-gradient(180deg, #aee18d 0%, #50bb54 100%);
  border: 2px solid rgba(82, 124, 53, 0.2);
  justify-self: end;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 6px 14px rgba(0, 0, 0, 0.12);
}

.settings-switch-knob {
  position: absolute;
  top: 50%;
  right: 5px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: linear-gradient(180deg, #fffdf9 0%, #f0efe6 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.settings-row.is-off .settings-switch {
  background: linear-gradient(180deg, #8bc4d7 0%, #4e7f99 100%);
}

.settings-row.is-off .settings-switch-knob {
  right: auto;
  left: 5px;
}

.settings-divider {
  height: 2px;
  margin: 4px 6px 0;
  background: linear-gradient(90deg, transparent, rgba(202, 171, 119, 0.58), transparent);
  border-radius: 999px;
}

.settings-actions {
  display: grid;
  gap: 18px;
  padding-top: 10px;
}

.settings-image-button {
  width: 84%;
  aspect-ratio: 1374 / 370;
  border: 0;
  justify-self: center;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  cursor: pointer;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.18));
}

.settings-return-button {
  background-image: url("assets/ui/settings/settings-return-button.png?v=20260531-7");
}

.settings-exit-button {
  background-image: url("assets/ui/settings/settings-exit-button.png?v=20260531-7");
  aspect-ratio: 1518 / 432;
}

@media (max-width: 620px) {
  .settings-body {
    gap: 10px;
    padding: 40% 12% 10%;
  }

  .settings-row {
    min-height: 68px;
    gap: 8px;
    padding: 10px 12px;
    font-size: 18px;
  }

  .settings-switch {
    width: 82px;
    height: 36px;
  }

  .settings-switch-knob {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 420px) {
  .settings-dialog {
    width: min(934px, 96vw);
  }

  .settings-title {
    top: calc(8% - 5px);
    font-size: clamp(20px, 5.4vw, 28px);
  }

  .settings-close {
    top: 7%;
    right: 8%;
    width: 42px;
  }

  .settings-body {
    padding: calc(28% - 10px) 10% 8%;
  }

  .settings-row {
    grid-template-columns: 28px minmax(0, 1fr) 72px;
    min-height: 60px;
    font-size: 17px;
    gap: 6px;
    padding: 9px 10px;
  }

  .settings-row-icon {
    font-size: 18px;
  }
}
