:root {
  --bg: #f4f5f8;
  --card: #ffffff;
  --text: #16181d;
  --muted: #6b7280;
  --line: #e4e6eb;
  --primary: #2f6bf0;
  --primary-ink: #ffffff;
  --danger: #d93a3a;
  --ok: #17a36b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 8px rgba(16, 24, 40, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #181b21;
    --text: #eceef2;
    --muted: #9aa1ad;
    --line: #2a2e36;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 480px; margin: 0 auto; padding: 8px 16px 48px; }
h2 { font-size: 20px; margin: 0 0 4px; }
h3 { font-size: 15px; color: var(--muted); font-weight: 600; margin: 22px 2px 10px; }
.top {
  max-width: 480px; margin: 0 auto; padding: 14px 16px 6px;
  display: flex; align-items: center; justify-content: space-between;
  padding-top: max(14px, env(safe-area-inset-top));
}
.brand { font-weight: 800; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(160deg, #2f6bf0, #1b3a8c); display: inline-block; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-top: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
input[type=email], input[type=password], input[type=text], input:not([type]) {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text);
}
input:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }
button {
  font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 10px; padding: 10px 14px; cursor: pointer;
}
button.primary { background: var(--primary); color: var(--primary-ink); border: 0; width: 100%; padding: 13px; font-weight: 700; }
button.ghost { background: transparent; }
button.small { padding: 6px 10px; font-size: 13px; }
button.danger { color: var(--danger); width: 100%; margin-top: 8px; }
button:disabled { opacity: .5; }
.hint { font-size: 13px; color: var(--muted); margin: -4px 2px 12px; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab { flex: 1; border: 0; background: var(--bg); color: var(--muted); font-weight: 600; }
.tab.active { background: var(--primary); color: var(--primary-ink); }

input.code { text-align: center; letter-spacing: 6px; font-size: 26px; font-weight: 700; margin-bottom: 12px; }

.device-head { display: flex; justify-content: space-between; align-items: flex-start; margin-top: 8px; }
.online { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.online::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #9aa1ad; }
.online.on::before { background: var(--ok); }

.preview-wrap { display: flex; justify-content: center; margin-top: 14px; }
.preview {
  width: 220px; height: 220px; border-radius: 18px; overflow: hidden; background: #000;
  border: 10px solid #1c1f26; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  display: flex; align-items: center; justify-content: center; text-align: center; color: #fff;
}
.preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview .custom { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px; }
.preview .custom b { font-size: 30px; line-height: 1.15; }
.preview .custom span { font-size: 13px; opacity: .9; margin-top: 6px; }

.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.preset { padding: 0; border: 2px solid transparent; border-radius: 12px; overflow: hidden; background: none; aspect-ratio: 1; }
.preset img { width: 100%; height: 100%; display: block; }
.preset.active { border-color: var(--primary); }

.fold > summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.fold > summary::after { content: "＋"; color: var(--muted); }
.fold[open] > summary::after { content: "－"; }
.fold[open] > summary { margin-bottom: 14px; }
.field-label { font-size: 14px; color: var(--muted); margin: 4px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { padding: 8px 12px; border-radius: 20px; font-size: 14px; }
.chip.active { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.swatches { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.swatch { width: 36px; height: 36px; border-radius: 50%; padding: 0; border: 3px solid transparent; }
.swatch.active { border-color: var(--text); }

.upload { display: block; text-align: center; border: 1.5px dashed var(--line); border-radius: 12px; padding: 18px; color: var(--primary); font-weight: 600; cursor: pointer; margin: 0; }
.photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.photos button { padding: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 1; border: 2px solid transparent; }
.photos button.active { border-color: var(--primary); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }

.slider { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; margin: 0; color: var(--text); font-weight: 600; }
.slider input { width: 100%; margin-top: 10px; accent-color: var(--primary); }
.row { display: flex; gap: 8px; }
.row input { margin: 0; }
.row button { white-space: nowrap; flex: none; }

.list { margin-top: 8px; }
.list button { width: 100%; text-align: left; margin-top: 8px; display: flex; justify-content: space-between; align-items: center; padding: 14px; background: var(--card); box-shadow: var(--shadow); border: 0; border-radius: var(--radius); }

.preview-note { text-align: center; font-size: 13px; color: var(--muted); min-height: 18px; margin-top: 8px; }
.steps { padding-left: 20px; margin: 0 0 8px; }
.steps li { margin-bottom: 8px; font-size: 15px; }
select { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.row.center { align-items: center; margin-top: 12px; }
.row.center .primary { flex: 1; white-space: nowrap; }
.row.between { justify-content: space-between; align-items: center; margin-top: 8px; }
.pick button { position: relative; }
.pick button.active::after {
  content: attr(data-n); position: absolute; top: 4px; right: 4px; min-width: 22px; height: 22px; border-radius: 11px;
  background: #16181d; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.storage-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.bar { height: 10px; background: var(--bg); border-radius: 6px; overflow: hidden; margin-top: 8px; }
.bar > div { height: 100%; background: var(--primary); width: 0; transition: width .3s; }
.bar > div.warn { background: var(--danger); }
.files { margin-top: 12px; }
.group { font-size: 13px; color: var(--muted); font-weight: 600; margin: 14px 0 6px; }
.file { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.file .thumb { width: 44px; height: 44px; border-radius: 8px; overflow: hidden; background: var(--bg); flex: none; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); text-align: center; }
.file .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file .meta { flex: 1; min-width: 0; font-size: 14px; }
.file .meta > div:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-size: 12px; color: var(--ok); border: 1px solid var(--ok); border-radius: 10px; padding: 2px 8px; }
button.wide { width: 100%; margin-top: 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.help { margin: 8px 0 4px; }
.help summary { color: var(--primary); font-size: 14px; cursor: pointer; }

.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--card); padding: 4px; border-radius: 12px; margin-top: 16px; box-shadow: var(--shadow); position: sticky; top: 4px; z-index: 5; }
.mode { border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 14px; padding: 10px 2px; border-radius: 9px; white-space: nowrap; }
.mode.active { background: var(--primary); color: #fff; }
.panel { margin-top: 4px; }
.card-title { font-weight: 700; margin-bottom: 12px; }
button.gap { margin-top: 14px; }
.themes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px; }
.theme { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px; font-size: 13px; font-weight: 600; border-radius: 12px; background: var(--card); box-shadow: var(--shadow); border: 2px solid transparent; }
.theme .emoji { font-size: 22px; line-height: 1; }
.theme.active { border-color: var(--primary); }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; margin-bottom: 10px; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
label select { display: block; width: 100%; margin-top: 6px; }
.theme-card { background: linear-gradient(180deg, #3A4659, #121826); }
.theme-card b { font-size: 48px !important; }
#slide-sec-custom { margin: 0; flex: 1; min-width: 0; }
.photos > p { grid-column: 1 / -1; margin: 4px 0; }

.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #16181d; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100% - 32px);
}
.toast.err { background: var(--danger); }
