:root {
  --frame: #111113;
  --panel: #070707;
  --panel-line: #161616;
  --card: #141318;
  --card-line: #1e1d22;
  --input: #16151a;
  --input-line: #2f2e33;
  --row: #1f1f23;
  --text: #e3e3e3;
  --text-2: #a2a1a6;
  --dim: #706f72;
  --blue: #3777e8;
  --blue-h: #4a86ee;
  --green: #93bd83;
  --red: #d97e7b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--frame);
  color: var(--text);
  font: 15px/1.55 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
html { scrollbar-color: #2f2e33 transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a292e; border-radius: 10px; border: 2px solid var(--frame); min-height: 40px; }
::-webkit-scrollbar-thumb:hover { background: #3a393f; }
::-webkit-scrollbar-button { display: none; }

.top {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 20px 12px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 14px; }
.brand img { height: 22px; width: auto; display: block; }
.brand span { padding-left: 10px; border-left: 1px solid var(--input-line); line-height: 18px; }

.panel {
  max-width: 760px;
  margin: 0 auto 24px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  padding: 28px 28px 24px;
}

.intro h1 { margin: 0 0 6px; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.intro p { margin: 0 0 22px; color: var(--text-2); }

.pick {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  padding: 30px 16px;
  border: 1px dashed var(--input-line);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.pick:hover, .pick.over { border-color: var(--blue); background: #16151c; }
.pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.pick svg { width: 28px; height: 28px; color: var(--blue); margin-bottom: 6px; }
.pick b { font-weight: 600; font-size: 16px; }
.pick-sub { color: var(--dim); font-size: 13px; }
.pick:focus-within { border-color: var(--blue); }

.opt {
  display: flex; align-items: flex-start; gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--card-line);
  border-radius: 10px;
  cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.sw {
  flex: none; position: relative;
  width: 34px; height: 20px; margin-top: 2px;
  background: var(--input-line); border-radius: 10px;
  transition: background .15s;
}
.sw::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text); transition: transform .15s;
}
.opt input:checked + .sw { background: var(--blue); }
.opt input:checked + .sw::after { transform: translateX(14px); }
.opt input:focus-visible + .sw { outline: 2px solid var(--blue); outline-offset: 2px; }
.opt-tx { display: flex; flex-direction: column; }
.opt-tx b { font-weight: 500; }
.opt-tx span { color: var(--dim); font-size: 13px; }

.modes { margin-top: 14px; }
.modes-t { margin: 0 0 8px; font-size: 13px; font-weight: 500; color: #7f7f81; }
.mode-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.mode {
  font: inherit; font-size: 14px;
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px 0 10px;
  border-radius: 18px;
  border: 1px solid var(--input-line);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.mode:hover { background: var(--row); color: var(--text); }
.mode.on { border-color: var(--blue); background: rgba(55, 119, 232, .12); color: var(--text); }
.mode:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.mode i { width: 14px; height: 14px; border-radius: 50%; flex: none; border: 1px solid rgba(255,255,255,.12); }
.sw-none { background: transparent; border-style: dashed !important; border-color: #5a595e !important; }
.sw-light { background: #8c8b90; }
.sw-pixel { background: radial-gradient(circle, #cfd6e4 1px, transparent 1.4px) 0 0 / 4px 4px, #4b5f80; }
.sw-filter { background: #d8a066; }
.sw-grain { background: radial-gradient(circle, #d9d2c6 0.8px, transparent 1.1px) 1px 1px / 3px 3px, #7a7166; }
.sw-strong { background: #3777e8; }
.mode-desc { margin: 8px 0 0; color: var(--dim); font-size: 13px; min-height: 20px; }

.results { margin-top: 26px; }
.res-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.save-hint { margin: 0; color: var(--text-2); font-size: 14px; }
.res-act { display: flex; gap: 8px; }

.btn {
  font: inherit; font-size: 14px; font-weight: 500;
  height: 36px; padding: 0 16px;
  border: 0; border-radius: 18px;
  background: var(--blue); color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover { background: var(--blue-h); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--text-2); border: 1px solid var(--input-line); }
.btn.ghost:hover { background: var(--row); color: var(--text); }
.btn.sm { height: 32px; padding: 0 14px; font-size: 13px; }

.list { display: grid; gap: 14px; }
.item {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 10px;
  overflow: hidden;
}
.item .ph {
  display: flex; align-items: center; justify-content: center;
  min-height: 180px;
  background: #0c0c0e;
  color: var(--dim); font-size: 14px;
}
.item img {
  display: block;
  width: 100%; height: auto;
  max-height: 78vh;
  object-fit: contain;
  background: #0c0c0e;
  -webkit-touch-callout: default;
}
.meta {
  display: flex; align-items: center; gap: 10px 14px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-top: 1px solid var(--card-line);
  font-size: 13px;
}
.ok { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-weight: 500; }
.ok svg { width: 14px; height: 14px; }
.err { color: var(--red); }
.info { color: var(--dim); }
.removed { flex-basis: 100%; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.removed > span:first-child { color: var(--dim); margin-right: 2px; }
.tag {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--row);
  border: 1px solid #27262b;
  color: var(--text-2);
  font-size: 12px;
}
.meta .btn { margin-left: auto; }

.about { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--panel-line); }
.about h2 { margin: 0 0 8px; font-size: 13px; font-weight: 500; color: #7f7f81; }
.about ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 14px; }
.about li + li { margin-top: 6px; }

@media (max-width: 600px) {
  body { font-size: 15px; }
  .top { padding: 12px 16px 10px; }
  .panel { margin: 0 8px 16px; padding: 20px 16px 18px; }
  .intro h1 { font-size: 20px; }
  .pick { padding: 26px 12px; }
  .res-head { flex-direction: column; align-items: stretch; }
  .res-act { justify-content: stretch; }
  .res-act .btn { flex: 1; height: 40px; }
  .item img { max-height: none; }
}
