:root {
  --bg: #070910; --bg2: #0c0f18; --card: #141824; --line: #232a3d; --text: #eef1fa; --dim: #8c96af;
  --c1: #00e5ff; --c2: #2979ff; --c3: #aa00ff; --ok: #3cd282; --bad: #e6505a; --warn: #ffc83c;
  --grad: linear-gradient(135deg, var(--c1), var(--c2) 50%, var(--c3));
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  min-height: 100dvh; padding-bottom: calc(76px + var(--safe-b));
  background: radial-gradient(900px 500px at 50% -15%, #142046 0%, var(--bg) 65%) fixed;
}
button, input, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

header { display: flex; align-items: center; gap: 10px; padding: 18px 18px 6px; max-width: 560px; margin: 0 auto; }
header svg { flex: none; }
header b { font-size: 20px; letter-spacing: 3px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
header .status { margin-left: auto; font-size: 12px; color: var(--dim); display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); }

main { max-width: 560px; margin: 0 auto; padding: 8px 16px 24px; }
h1 { font-size: 24px; margin: 6px 0 4px; }
.sub { color: var(--dim); margin: 0 0 16px; font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px; margin-bottom: 14px; }
.card h2 { font-size: 15px; margin: 0 0 10px; color: var(--dim); font-weight: 600; }

.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick label, .tile {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start; justify-content: center;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 14px; min-height: 84px; cursor: pointer;
}
.pick label:active, .tile:active { transform: scale(.98); }
.pick input[type=file] { display: none; }
.ico { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--grad); font-size: 15px; }
.pick span { font-weight: 600; font-size: 15px; }
.pick small { color: var(--dim); font-size: 12px; margin-top: -4px; }

textarea, input.field {
  width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; outline: none; resize: vertical;
}
textarea:focus, input.field:focus { border-color: var(--c2); }
input.code {
  width: 100%; text-align: center; letter-spacing: 12px; font: 700 34px/1 "Segoe UI", system-ui, sans-serif;
  padding: 16px 8px 16px 20px; background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; outline: none;
}
input.code:focus { border-color: var(--c2); }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 0; border-radius: 16px;
  padding: 15px; font-weight: 700; font-size: 16px; color: #fff; background: linear-gradient(90deg, var(--c2), var(--c3)); cursor: pointer; text-decoration: none;
}
.btn:disabled { opacity: .45; }
.btn.ghost { background: var(--bg2); border: 1px solid var(--line); color: var(--text); font-weight: 600; }
.btn.small { padding: 10px 12px; font-size: 14px; border-radius: 12px; width: auto; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.mt { margin-top: 12px; }

.queue { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.qitem { display: flex; align-items: center; gap: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; }
.qitem img, .qitem .ext { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; flex: none; }
.ext { display: grid; place-items: center; font: 700 10px sans-serif; background: var(--grad); }
.qitem .meta { flex: 1; min-width: 0; }
.qitem .name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qitem .size { color: var(--dim); font-size: 12px; }
.x { background: none; border: 0; color: var(--dim); font-size: 20px; padding: 4px 8px; cursor: pointer; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: 14px; }
.switch small { display: block; color: var(--dim); font-size: 12px; }
.toggle { position: relative; width: 50px; height: 30px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle i { position: absolute; inset: 0; background: var(--line); border-radius: 30px; transition: .2s; }
.toggle i::after { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.toggle input:checked + i { background: var(--c2); }
.toggle input:checked + i::after { transform: translateX(20px); }

.bar { height: 8px; background: #ffffff14; border-radius: 4px; overflow: hidden; margin-top: 14px; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--c1), var(--c2)); transition: width .15s; }
.msg { margin-top: 10px; font-size: 14px; color: var(--dim); min-height: 20px; }
.msg.bad { color: var(--bad); } .msg.ok { color: var(--ok); }

.result { text-align: center; }
.bigcode { font: 800 46px/1.1 "Segoe UI", system-ui, sans-serif; letter-spacing: 8px; margin: 6px 0 2px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.qr { background: #fff; border-radius: 16px; padding: 10px; display: inline-block; margin: 12px auto 6px; }
.qr svg { display: block; width: 200px; height: 200px; }
.link { font-size: 12px; color: var(--dim); word-break: break-all; background: var(--bg2); border-radius: 12px; padding: 10px; margin-top: 8px; text-align: left; }

.preview { margin-top: 12px; border-radius: 16px; overflow: hidden; background: var(--bg2); border: 1px solid var(--line); }
.preview img, .preview video { display: block; width: 100%; max-height: 60vh; object-fit: contain; background: #000; }
.preview pre { margin: 0; padding: 14px; white-space: pre-wrap; word-break: break-word; font: 15px/1.5 "Segoe UI", system-ui, sans-serif; max-height: 50vh; overflow: auto; }
.filecard { display: flex; gap: 12px; align-items: center; padding: 12px; }

.hist { display: flex; flex-direction: column; gap: 8px; }
.hitem { display: flex; align-items: center; gap: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.hitem .meta { flex: 1; min-width: 0; }
.hitem .name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hitem .size { color: var(--dim); font-size: 12px; }
.hitem .c { font-weight: 800; letter-spacing: 2px; font-size: 15px; }
.empty { color: var(--dim); text-align: center; padding: 20px 0; font-size: 14px; }

nav {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 4px;
  background: rgba(10, 13, 22, .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 8px 8px calc(8px + var(--safe-b));
}
nav button {
  flex: 1; max-width: 140px; background: none; border: 0; color: var(--dim); display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 12px; padding: 6px 0; border-radius: 12px; cursor: pointer;
}
nav button svg { width: 24px; height: 24px; }
nav button.on { color: var(--text); background: #ffffff0d; }
nav button.on svg { stroke: var(--c1); }

.toast {
  position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%) translateY(20px); opacity: 0;
  background: #1d2334; border: 1px solid var(--line); padding: 10px 16px; border-radius: 30px; font-size: 14px; transition: .25s; pointer-events: none; z-index: 10;
  max-width: calc(100% - 32px);
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.install { display: flex; align-items: center; gap: 12px; }
.install .meta { flex: 1; }
.install small { color: var(--dim); display: block; font-size: 12px; }
footer { text-align: center; color: var(--dim); font-size: 12px; padding: 4px 0 12px; }
footer a { color: var(--dim); }
