/* The game's dev panel look (Geist): black, hairline borders, white and grey text; color only
   for state: a changed value blue, the unsaved dot amber, errors red. */
:root {
  --bg: #000;
  --card: #0a0a0a;
  --field: #111;
  --line: #262626;
  --line-strong: #2e2e2e;
  --text: #ededed;
  --muted: #a1a1a1;
  --blue: #52a8ff;
  --amber: #f5a623;
  --red: #ff6166;
  --sans: "Geist", "Noto Sans TC", system-ui, sans-serif;
  --mono: "Geist Mono", "Noto Sans TC", ui-monospace, monospace;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
}

[hidden] {
  display: none !important;
}

.mono {
  font-family: var(--mono);
}

.secondary {
  color: var(--muted);
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: calc(12px + env(safe-area-inset-top)) 16px 10px;
  background: rgb(0 0 0 / 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.top > *,
main > * {
  max-width: 760px;
  margin-inline: auto;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.title {
  flex: 1 1 auto;
  min-width: 0;
}

/* The slot name is the title and edits in place, as the phone panel shows it at the top. */
.name {
  width: 100%;
  margin: 0 0 0 -6px;
  padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: 600 20px/1.3 var(--sans);
  letter-spacing: -0.01em;
}

.name:hover {
  border-color: var(--line-strong);
}

.name:focus {
  outline: none;
  border-color: var(--muted);
  background: var(--field);
}

.name::placeholder {
  color: #737373;
}

#changed {
  margin: 0;
  font-size: 13px;
}

.primary {
  position: relative;
  min-height: 40px;
  padding: 8px 20px;
  border: 0;
  border-radius: 8px;
  background: var(--text);
  color: #0a0a0a;
  font-weight: 500;
}

.primary:active {
  background: #ccc;
}

.primary .dot {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--amber);
}

.search {
  display: block;
  margin-top: 10px;
}

.field {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--field);
  color: var(--text);
  /* 16px keeps iOS Safari from zooming in on focus. */
  font: 16px/1.4 var(--sans);
}

.field:focus {
  outline: none;
  border-color: var(--muted);
  box-shadow: 0 0 0 3px rgb(237 237 237 / 0.12);
}

.field::placeholder {
  color: #737373;
}

.sections {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.sections::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.chip:hover,
.chip:active {
  border-color: var(--muted);
  color: var(--text);
}

main {
  padding: 4px 16px calc(64px + env(safe-area-inset-bottom));
}

.notice {
  margin: 16px 0 0;
  padding: 10px 12px;
  border: 1px solid rgb(255 97 102 / 0.4);
  border-radius: 8px;
  background: rgb(255 97 102 / 0.08);
  color: var(--red);
  font-size: 14px;
}

.section {
  scroll-margin-top: var(--header-height, 180px);
}

.section-title {
  margin: 28px 4px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}

/* Each row draws the line above it; the card clips the first one, so hidden rows leave no
   double lines. */
.row {
  margin-top: -1px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}

.label {
  flex: 1 1 auto;
  font-weight: 500;
}

.value {
  white-space: nowrap;
}

.value.changed {
  color: var(--blue);
}

.icon {
  flex: none;
  width: 32px;
  height: 32px;
  padding: 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
}

.icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.icon:hover,
.icon:active {
  background: #1a1a1a;
}

.note {
  margin: 2px 0 0;
  font-size: 13px;
}

.control {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.control input[type="number"] {
  flex: none;
  width: 96px;
  padding: 6px 10px;
  font-family: var(--mono);
  text-align: right;
}

.warning {
  margin: 8px 0 0;
  font-size: 13px;
}

.empty {
  margin-top: 48px;
  text-align: center;
}

/* Slider: a 2px track filled up to the value, a rounded square knob. */
input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 32px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]:focus {
  outline: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(to right, var(--text) var(--fill, 0%), var(--line-strong) var(--fill, 0%));
}

input[type="range"]::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -9px;
  border: 0;
  border-radius: 6px;
  background: var(--text);
  -webkit-appearance: none;
}

input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgb(237 237 237 / 0.2);
}

input[type="range"]::-moz-range-track {
  height: 2px;
  background: var(--line-strong);
}

input[type="range"]::-moz-range-progress {
  height: 2px;
  background: var(--text);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 6px;
  background: var(--text);
}

@media (pointer: coarse) {
  input[type="range"]::-webkit-slider-thumb {
    width: 26px;
    height: 26px;
    margin-top: -12px;
    border-radius: 8px;
  }
}

select.field {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M13 19l11 11 11-11' fill='none' stroke='%23A1A1A1' stroke-width='5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center / 18px;
}

.sheet {
  width: min(560px, calc(100vw - 32px));
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
}

.sheet::backdrop {
  background: rgb(0 0 0 / 0.6);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.sheet .icon {
  padding: 0;
}

.sheet textarea {
  margin-top: 12px;
  resize: none;
  font: 13px/1.45 var(--mono);
  word-break: break-all;
}

.sheet p {
  margin: 10px 0 0;
  font-size: 13px;
}

.wide {
  width: 100%;
  margin-top: 14px;
}
