:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #f2f4f7;
  --border: #e2e5ea;
  --text: #1a1d23;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --panel: #171a21;
    --panel-2: #1e222b;
    --border: #2a2f3a;
    --text: #e6e8ec;
    --muted: #9aa2b1;
    --accent: #4f8cff;
    --accent-hover: #6ea0ff;
    --danger: #f87171;
    --ok: #4ade80;
    --warn: #fbbf24;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 32px 20px 64px; }

/* header */
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo { font-size: 30px; line-height: 1; }
h1 { font-size: 22px; margin: 0; letter-spacing: .01em; }
.tag { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.badge {
  flex: none; font-size: 11px; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 32%, transparent);
}

/* dropzone */
.dropzone {
  border: 2px dashed var(--border); border-radius: 16px; background: var(--panel);
  padding: 40px 20px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); outline: none; }
.dropzone.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); transform: scale(1.005); }
.dz-icon { font-size: 40px; }
.dz-title { margin: 10px 0 2px; font-weight: 600; }
.dz-sub { margin: 0; font-size: 13px; color: var(--muted); }
.dz-actions { margin-top: 16px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* panels */
.panel {
  margin-top: 20px; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head-right { display: flex; align-items: center; gap: 10px; }
.panel h2 { font-size: 14px; margin: 0; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.chip {
  display: inline-block; min-width: 22px; text-align: center; font-size: 12px; font-weight: 600;
  padding: 1px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted);
  border: 1px solid var(--border);
}

/* file list */
.filelist { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; }
.filelist li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  font-size: 13px;
}
.filelist li + li { border-top: 1px solid var(--border); border-radius: 0; }
.filelist .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; }
.filelist .fsize { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.filelist .fdel {
  flex: none; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 6px;
}
.filelist .fdel:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* fields */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
input[type="text"], input[type="password"], select {
  width: 100%; padding: 9px 11px; font-size: 14px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px;
  font-family: inherit;
}
input[type="text"]:focus, input[type="password"]:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.inline { display: flex; align-items: center; gap: 8px; }
.suffix { color: var(--muted); font-size: 14px; }

/* switch */
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; font-weight: 600; margin: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.track {
  width: 40px; height: 23px; border-radius: 999px; background: var(--border);
  position: relative; transition: background .15s; flex: none;
}
.track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px;
  border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

#password { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .03em; }
#genPw { font-size: 14px; padding: 7px 10px; }

.pw-area { padding: 14px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); }

/* meter */
.meter { height: 4px; border-radius: 999px; background: var(--border); margin-top: 8px; overflow: hidden; }
.meter-bar { height: 100%; width: 0; background: var(--danger); transition: width .2s, background .2s; }

/* range */
input[type="range"] { width: 100%; accent-color: var(--accent); }
.range-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* buttons */
.btn {
  font: inherit; font-weight: 600; border-radius: 9px; cursor: pointer;
  padding: 10px 18px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 5px 10px; font-size: 12px; }
.btn.danger { color: var(--danger); }
.btn.danger:hover:not(:disabled) { border-color: var(--danger); }
.actions { margin-top: 22px; display: flex; gap: 10px; }
.actions .btn { flex: 1; }

/* progress */
.progress { height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; border: 1px solid var(--border); }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .12s linear; }
#progressText { margin: 10px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* status */
.status { margin-top: 18px; padding: 12px 14px; border-radius: 10px; font-size: 13px; border: 1px solid; }
.status.err { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.status.ok  { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.status.warn{ color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }

.muted { color: var(--muted); }
.small { font-size: 12px; }
p.small { margin: 6px 0 0; }
.foot { margin-top: 36px; text-align: center; color: var(--muted); font-size: 12px; }
.foot p { margin: 4px 0; }
.foot a { color: var(--accent); }
