:root {
  color-scheme: dark;
  --page-bg: #090909;
  --panel-bg: #111;
  --field-bg: #020202;
  --line-soft: #343434;
  --line-hard: #e8e8e8;
  --text-main: #f2f2f2;
  --text-muted: #a8a8a8;
  --red: #e41215;
  --red-soft: rgba(228, 18, 21, 0.18);
  --yellow: #ffdc00;
  --green: #8dd47e;
  --shadow-red: 0 0 18px rgba(228, 18, 21, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: radial-gradient(circle at 15% 0, rgba(228, 18, 21, 0.12), transparent 28%), var(--page-bg);
  color: var(--text-main);
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
}

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

button {
  min-height: 42px;
  border: 2px solid var(--line-hard);
  background: #050505;
  color: var(--text-main);
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0;
}

button:hover,
button:focus-visible {
  border-color: var(--red);
  color: var(--yellow);
  box-shadow: var(--shadow-red);
  outline: none;
}

.sandbox-shell {
  min-height: 100vh;
  border: 3px solid var(--line-soft);
  background: rgba(10, 10, 10, 0.96);
}

.wp-site-header {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 58px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line-soft);
  background: #050505;
}

.wp-site-brand {
  flex: 0 0 auto;
  color: var(--yellow);
  font-size: 20px;
  font-weight: 900;
  text-decoration: none;
}

.wp-site-menu {
  min-width: 0;
  overflow-x: auto;
}

.wp-site-menu-list,
.wp-site-menu-list ul {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.wp-site-menu-list ul {
  display: none;
}

.wp-site-menu-list a {
  display: block;
  padding: 10px 12px;
  color: var(--text-main);
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.wp-site-menu-list a:hover,
.wp-site-menu-list a:focus-visible {
  color: var(--yellow);
  background: var(--red-soft);
  outline: 1px solid var(--red);
}

.wp-site-menu-note {
  color: #ff9c9e;
  font-size: 14px;
  line-height: 1.4;
}

.sandbox-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 560px);
  gap: 24px;
  align-items: center;
  padding: 14px 18px 16px;
  border-bottom: 3px solid var(--red);
}

h1 {
  margin: 0;
  color: var(--red);
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1;
  font-weight: 900;
}

.sandbox-topbar p {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 15px;
}

.code-display label,
.paste-label,
.search-box span {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
}

.code-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 10px;
}

input,
textarea,
select {
  width: 100%;
  border: 2px solid var(--line-soft);
  background: var(--field-bg);
  color: var(--text-main);
  font-weight: 800;
}

input {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 96px;
  padding: 10px 12px;
  line-height: 1.45;
}

.sandbox-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: calc(100vh - 90px);
}

.side-panel {
  padding: 18px;
  border-right: 3px solid var(--line-soft);
  background: #0d0d0d;
}

.preset-poster {
  width: 180px;
  height: 210px;
  margin: 0 auto 18px;
  border: 4px solid #151515;
  background: linear-gradient(#f7c617 0 20%, #e42c16 20% 54%, #1b1510 54%);
  color: #111;
  position: relative;
  overflow: hidden;
}

.poster-title {
  position: relative;
  z-index: 2;
  padding: 6px 4px;
  color: #111;
  font-size: 25px;
  font-weight: 1000;
  text-align: center;
  transform: skew(-4deg);
}

.poster-scene {
  position: absolute;
  inset: 52px 0 0;
}

.poster-sun {
  position: absolute;
  right: 22px;
  bottom: 24px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #ffd31a;
  box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.12);
}

.poster-rider {
  position: absolute;
  left: 38px;
  bottom: 18px;
  width: 64px;
  height: 92px;
  background: linear-gradient(90deg, #202020 0 42%, #5b4a35 42%);
  clip-path: polygon(38% 0, 58% 7%, 70% 28%, 62% 100%, 18% 100%, 27% 28%);
  box-shadow: 38px 34px 0 -22px #222;
}

.status-box {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 2px solid var(--line-soft);
  background: #050505;
  text-align: center;
}

.status-box span {
  font-size: 24px;
  font-weight: 900;
}

.status-box small {
  color: var(--yellow);
  font-size: 14px;
}

.difficulty-panel {
  margin-top: 14px;
  padding: 12px;
  border: 2px solid var(--line-soft);
  background: #050505;
}

.difficulty-panel h2 {
  margin: 0 0 10px;
  color: var(--text-main);
  font-size: 18px;
}

.difficulty-preset-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.difficulty-preset-button {
  display: grid;
  gap: 2px;
  min-height: 52px;
  padding: 6px 8px;
  line-height: 1.2;
}

.difficulty-preset-button strong {
  font-size: 15px;
}

.difficulty-preset-button span {
  color: var(--text-muted);
  font-size: 12px;
}

.difficulty-preset-button.is-active {
  border-color: var(--red);
  color: var(--yellow);
  box-shadow: var(--shadow-red);
}

.difficulty-preset-button.is-active span {
  color: var(--yellow);
}

.side-actions {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

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

.parse-message {
  min-height: 22px;
  margin: 10px 0 16px;
  color: var(--text-muted);
  line-height: 1.4;
}

.parse-message.is-error {
  color: #ff6b6d;
}

.parse-message.is-ok {
  color: var(--green);
}

.changed-panel {
  border-top: 2px solid var(--line-soft);
  padding-top: 14px;
}

.changed-panel h2 {
  margin: 0 0 10px;
  color: var(--text-main);
  font-size: 20px;
}

.changed-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.changed-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line-soft);
  padding: 8px 10px;
  background: #050505;
  color: var(--text-muted);
}

.changed-item strong {
  color: var(--text-main);
}

.changed-item span {
  color: var(--red);
  font-weight: 900;
  white-space: nowrap;
}

.empty-changes {
  color: var(--text-muted);
}

.options-panel {
  min-width: 0;
  padding: 18px;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
  gap: 16px;
  align-items: end;
  padding-bottom: 16px;
  background: linear-gradient(#0d0d0d 0 82%, transparent);
}

.category-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px 12px;
}

.category-tab {
  position: relative;
  border-color: var(--line-hard);
  color: var(--text-main);
}

.category-tab.is-active {
  border-color: var(--red);
  color: var(--yellow);
  background: linear-gradient(180deg, #1a0505, #090909);
  box-shadow: inset 0 -10px 18px rgba(228, 18, 21, 0.55), var(--shadow-red);
}

.search-box input {
  font-weight: 700;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(360px, 1fr));
  gap: 12px 28px;
}

.option-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 230px);
  gap: 12px;
  align-items: center;
  min-height: 66px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.option-row.is-section-start {
  margin-top: 24px;
}

.option-meta {
  min-width: 0;
}

.option-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  font-size: 20px;
  font-weight: 900;
}

.option-title small {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

.option-description {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.35;
}

.option-select {
  min-height: 44px;
  padding: 0 10px;
  text-align: center;
  text-align-last: center;
  font-size: 20px;
}

.option-row.is-changed .option-title,
.option-row.is-changed .option-select {
  color: var(--red);
}

.option-row.is-hidden {
  display: none;
}

@media (max-width: 1180px) {
  .sandbox-topbar,
  .sandbox-layout,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .side-panel {
    border-right: 0;
    border-bottom: 3px solid var(--line-soft);
  }

  .option-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .sandbox-topbar,
  .side-panel,
  .options-panel {
    padding: 14px;
  }

  .category-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .option-row {
    grid-template-columns: 1fr;
  }

  .code-copy-row,
  .side-actions.compact {
    grid-template-columns: 1fr;
  }

  .wp-site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
  }

}
