:root {
  --page: #ffffff;
  --sub: #f4f5f7;
  --line: #e4e6ea;
  --text: #14181d;
  --muted: #8b929c;
  --ink: #111315;
  --accent: #1b7ac4;
  --danger: #d2453c;
  --radius: 7px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--page);
  color: var(--text);
  font: 14px/1.5 "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 24px 60px;
}

.title {
  margin: 0 0 26px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ── 링크 입력 ────────────────────────────────────────── */

.label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 13px;
}

.row { display: flex; gap: 8px; }
.row.tight { gap: 6px; margin: 12px 0; }

input[type="text"], select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--page);
  color: var(--text);
  font: inherit;
}

input[type="text"]::placeholder { color: #b6bcc5; }

input[type="text"]:focus, select:focus {
  outline: 2px solid var(--ink);
  outline-offset: -1px;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%238b929c' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 32px;
}

input[type="range"] { width: 100%; accent-color: var(--ink); }

.hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.hint.center { text-align: center; }
.muted { color: var(--muted); font-weight: 400; }

.status {
  margin: 10px 0 0;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 12.5px;
  background: var(--sub);
  color: #3d4650;
}

.status.error { background: #fdeceb; color: var(--danger); }

/* ── 버튼 ────────────────────────────────────────────── */

button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--page);
  color: var(--text);
  font: inherit;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
}

button:hover { border-color: var(--ink); }

button.solid {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  font-weight: 700;
}

button.solid:hover { filter: brightness(1.35); }
button.solid:disabled { opacity: 0.45; cursor: progress; filter: none; }

button.ghost { padding: 6px 11px; font-size: 12.5px; }

/* 사진 속 큼직한 검은 다운로드 버튼 */
.download {
  width: 100%;
  margin-top: 26px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border-radius: 6px;
}

.download:hover { filter: brightness(1.35); border-color: var(--ink); }
.download:disabled { opacity: 0.5; cursor: progress; filter: none; }

/* ── 설정 ────────────────────────────────────────────── */

#options {
  margin-top: 28px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.selects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px 26px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12.5px;
}

.field label b { color: var(--text); }

/* ── 토글 ────────────────────────────────────────────── */

.toggles {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 40px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 13px;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  appearance: none;
  flex: none;
  width: 44px;
  height: 24px;
  margin: 0;
  border-radius: 12px;
  background: #d6d9dd;
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease;
}

.toggle input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

.toggle input:checked { background: var(--ink); }
.toggle input:checked::after { transform: translateX(20px); }

.toggle input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.toggle span { font-size: 13.5px; color: #6b4a44; }
.toggle input:not(:checked) ~ span { color: var(--muted); }

.toggle input:disabled { opacity: 0.4; cursor: default; }
.toggle:has(input:disabled) { cursor: default; }
.toggle:has(input:disabled) span { opacity: 0.5; }

/* ── 게임 선택 목록 ───────────────────────────────────── */

.picker-block {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.picker-block summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.picker {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.picker li { border-bottom: 1px solid var(--line); }

.picker label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  cursor: pointer;
}

.picker label:hover { background: var(--sub); }

.picker input { accent-color: var(--ink); flex: none; }

.picker img {
  width: 56px;
  height: 26px;
  object-fit: cover;
  border-radius: 4px;
  flex: none;
  background: var(--sub);
}

.picker span {
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker li.off label { opacity: 0.4; }

/* ── 미리보기 ─────────────────────────────────────────── */

.preview {
  margin-top: 30px;
  display: flex;
  justify-content: center;
}

.empty {
  margin: 8vh 0;
  text-align: center;
}

.empty p { margin: 6px 0; }

#board {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 34px rgba(24, 39, 63, 0.10);
}

@media (max-width: 780px) {
  .selects { grid-template-columns: 1fr 1fr; }
  .toggles { grid-template-columns: 1fr; gap: 14px; }
}
