:root { color-scheme: light dark; }

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
  padding: 24px;
  display: grid;
  place-items: center;
}

.card {
  width: min(760px, 100%);
  border: 1px solid color-mix(in oklab, CanvasText 20%, transparent);
  border-radius: 14px;
  padding: 18px 18px 14px;
  transition: filter 120ms ease, opacity 120ms ease;
}

h1 { margin: 4px 0 14px; font-size: 20px; }

label { display: grid; gap: 6px; margin: 10px 0; }

input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid color-mix(in oklab, CanvasText 18%, transparent);
  background: color-mix(in oklab, Canvas 92%, black);
}

.secure-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.secure-field input[type="password"] {
  -webkit-text-security: disc;
}

.row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
  align-items: center;
}

button {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid color-mix(in oklab, CanvasText 18%, transparent);
  background: color-mix(in oklab, Canvas 92%, black);
  cursor: pointer;
}

button:disabled { opacity: 0.6; cursor: not-allowed; }

button.hold {
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* KDF toggle: styled like other controls, without changing overall layout structure */
.kdf-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid color-mix(in oklab, CanvasText 18%, transparent);
  background: color-mix(in oklab, Canvas 92%, black);
  margin: 0;
}

.kdf-toggle input {
  margin: 0;
  padding: 0;
  border-radius: 4px;
  width: 16px;
  height: 16px;
}

.out { margin-top: 14px; }
.out-row { display: grid; gap: 8px; }

.msg { margin: 10px 0 0; min-height: 18px; opacity: 0.85; }
.note { margin-top: 14px; font-size: 12px; opacity: 0.75; }

body.panic main.card {
  filter: blur(10px);
  opacity: 0.15;
}
/* --- Row alignment (keep layout, fix wrap/stacking) --- */
.row{
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap; /* 小屏时允许换行，但默认同一行 */
}

/* 把 KDF 推到按钮行右侧（如果你不想推右侧，删掉这一行即可） */
.kdf-toggle{
  margin-left:auto;
}

/* --- Toggle switch (KDF) --- */
.toggle{
  display:inline-flex;
  align-items:center;
  gap:10px;
  user-select:none;
  white-space:nowrap;
}

.toggle input{
  position:absolute;
  opacity:0;
  width:1px;
  height:1px;
}

.toggle .track{
  width:46px;
  height:26px;
  border-radius:999px;
  background:#d7d7d7;
  position:relative;
  box-shadow: inset 0 0 0 1px #bdbdbd;
  flex:0 0 auto;
}

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

/* Checked */
.toggle input:checked + .track{
  background:#3b82f6;
  box-shadow: inset 0 0 0 1px #2563eb;
}

.toggle input:checked + .track::after{
  transform: translateX(20px);
}

/* Focus */
.toggle input:focus-visible + .track{
  outline:2px solid #2563eb;
  outline-offset:2px;
}

/* Label text */
.toggle .toggle-text{
  font-weight:600;
}
