/* ============================================================
   Password Studio — 页面专属样式（复用 ../styles.css）
   ============================================================ */

/* ---------- 品牌色：青绿 ---------- */

html[data-theme="light"] {
  --accent: #0f766e;
  --accent-ink: #0f766e;
  --accent-solid: #0f766e;
  --accent-hover: #115e59;
  --accent-soft: #ecfdf5;
  --accent-border: #99f6e4;
  --on-accent: #ffffff;
}

html[data-theme="dark"] {
  --accent: #5eead4;
  --accent-ink: #99f6e4;
  --accent-solid: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-soft: rgba(45, 212, 191, .13);
  --accent-border: rgba(45, 212, 191, .4);
  --on-accent: #042f2e;
}

body::before {
  background:
    radial-gradient(48% 60% at 18% 10%, rgba(13, 148, 136, .17), transparent 70%),
    radial-gradient(42% 55% at 82% 0%, rgba(14, 165, 233, .12), transparent 72%);
}

html[data-theme="dark"] body::before {
  background:
    radial-gradient(48% 60% at 18% 10%, rgba(45, 212, 191, .18), transparent 70%),
    radial-gradient(42% 55% at 82% 0%, rgba(14, 165, 233, .14), transparent 72%);
}

.brand-mark {
  background: linear-gradient(140deg, #14b8a6, #0f766e 70%);
  box-shadow: 0 6px 16px -6px rgba(13, 148, 136, .85);
}

html[data-theme="dark"] .brand-mark {
  background: linear-gradient(140deg, #5eead4, #0d9488 75%);
  color: #042f2e;
  box-shadow: 0 6px 18px -6px rgba(45, 212, 191, .6);
}

.btn-primary {
  box-shadow: 0 6px 16px -8px rgba(13, 148, 136, .9);
}

/* ---------- 面板与密码框 ---------- */

.pw-panel {
  padding: 0;
  overflow: hidden;
}

.pw-box {
  position: relative;
  padding: 20px 22px 18px;
  color: #e2e8f0;
  background:
    radial-gradient(120% 140% at 12% 0%, #123243 0%, #0b1220 52%, #070b14 100%);
  border-bottom: 1px solid rgba(148, 163, 184, .16);
}

.pw-box::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(148, 163, 184, .14) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: .45;
  pointer-events: none;
}

.pw-box > * { position: relative; z-index: 1; }

.pw-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pw-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  color: #94a3b8;
}

.pw-count {
  padding: 2px 8px;
  border: 1px solid rgba(45, 212, 191, .24);
  border-radius: 999px;
  background: rgba(45, 212, 191, .1);
  color: #99f6e4;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0;
}

.pw-tools { display: flex; gap: 6px; }

.pw-tool {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(148, 163, 184, .2);
  border-radius: 8px;
  background: rgba(148, 163, 184, .08);
  color: #cbd5e1;
}
.pw-tool:hover { background: rgba(148, 163, 184, .18); color: #ffffff; }

.pw-tool .eye-off { display: none; }
.pw-box.is-masked .pw-tool .eye-on { display: none; }
.pw-box.is-masked .pw-tool .eye-off { display: block; }

.pw-value {
  display: block;
  margin: 14px 0 16px;
  font-family: var(--mono);
  font-size: clamp(1.3rem, 3.2vw, 1.9rem);
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: .045em;
  word-break: break-all;
  min-height: 1.45em;
  user-select: all;
}

.pw-value .ch-letter { color: #f8fafc; }
.pw-value .ch-upper { color: #a5b4fc; }
.pw-value .ch-digit { color: #67e8f9; }
.pw-value .ch-symbol { color: #fbbf24; }
.pw-value .ch-mask { color: #64748b; letter-spacing: .14em; }

.pw-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.pw-source {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: #8ba0b8;
}

.pw-source .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .16);
}

.pw-box .btn-primary { flex: none; }

/* ---------- 强度 ---------- */

.strength {
  margin: 18px 22px 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.strength-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.strength-head b { color: var(--text); }
.strength-word { font-weight: 700; }

.strength-bits {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted-2);
  white-space: nowrap;
}
.strength-bits b { font-size: 13px; }

.strength-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-top: 10px;
}

.strength-bar span {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-3);
  transition: background .2s ease;
}

.strength[data-level="1"] .strength-word { color: #b91c1c; }
.strength[data-level="2"] .strength-word { color: #b45309; }
.strength[data-level="3"] .strength-word { color: #0369a1; }
.strength[data-level="4"] .strength-word { color: #047857; }

.strength[data-level="1"] .strength-bar span:nth-child(-n+1) { background: #dc2626; }
.strength[data-level="2"] .strength-bar span:nth-child(-n+2) { background: #d97706; }
.strength[data-level="3"] .strength-bar span:nth-child(-n+3) { background: #0284c7; }
.strength[data-level="4"] .strength-bar span:nth-child(-n+4) { background: #059669; }

.strength-meta {
  margin: 9px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted-2);
}
.strength-meta b { color: var(--text); font-weight: 600; }
.strength-meta sup { font-size: 9px; }

html[data-theme="dark"] .strength[data-level="1"] .strength-word { color: #fca5a5; }
html[data-theme="dark"] .strength[data-level="2"] .strength-word { color: #fcd34d; }
html[data-theme="dark"] .strength[data-level="3"] .strength-word { color: #7dd3fc; }
html[data-theme="dark"] .strength[data-level="4"] .strength-word { color: #6ee7b7; }

html[data-theme="dark"] .strength[data-level="1"] .strength-bar span:nth-child(-n+1) { background: #f87171; }
html[data-theme="dark"] .strength[data-level="2"] .strength-bar span:nth-child(-n+2) { background: #fbbf24; }
html[data-theme="dark"] .strength[data-level="3"] .strength-bar span:nth-child(-n+3) { background: #38bdf8; }
html[data-theme="dark"] .strength[data-level="4"] .strength-bar span:nth-child(-n+4) { background: #34d399; }

/* ---------- 设置 ---------- */

.pw-settings { padding: 18px 22px 0; }

.setting-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.setting-head label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.length-value {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}
.length-value span {
  margin-left: 2px;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted-2);
}

.range {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 6px;
  margin: 14px 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-solid) var(--fill, 20%), var(--surface-3) var(--fill, 20%));
  outline: none;
  cursor: pointer;
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--accent-solid);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .25);
  cursor: grab;
  transition: transform .12s ease;
}
.range::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.08); }

.range::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2px solid var(--accent-solid);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .25);
  cursor: grab;
}

.range:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
  border-radius: 999px;
}

.range-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted-2);
}

.charsets { margin: 20px 0 0; padding: 0; border: 0; }

.charsets legend {
  padding: 0;
  margin-bottom: 9px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.charset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.charset { position: relative; display: block; cursor: pointer; }

.charset input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.charset-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  transition: border-color .15s ease, background .15s ease;
}

.charset-card::after {
  content: "";
  flex: none;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.charset:hover .charset-card { border-color: var(--accent-border); }

.charset input:checked + .charset-card {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.charset input:checked + .charset-card::after {
  border-color: var(--accent-solid);
  background: var(--accent-solid);
  box-shadow: inset 0 0 0 3px var(--surface);
}

.charset input:focus-visible + .charset-card {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.charset-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.charset-card code {
  font-size: 11px;
  color: var(--muted-2);
}

.charset input:checked + .charset-card .charset-title,
.charset input:checked + .charset-card code { color: var(--accent-ink); }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  cursor: pointer;
}

.switch-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch-copy b { font-size: 12.5px; color: var(--text); }
.switch-copy small { font-size: 10.5px; line-height: 1.45; color: var(--muted-2); }

.switch-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--surface-3);
  transition: background .16s ease;
}

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

.switch-row input:checked + .switch { background: var(--accent-solid); }
.switch-row input:checked + .switch::after {
  transform: translateX(16px);
  background: var(--on-accent);
}

.switch-row input:focus-visible + .switch {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.pw-note {
  margin: 10px 0 0;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--muted-2);
}

/* ---------- 快捷设置 ---------- */

.pw-presets {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 18px 22px 0;
}

.presets-label {
  margin-right: 2px;
  font-size: 11.5px;
  color: var(--muted-2);
}

.preset-chip {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  transition: border-color .13s ease, background .13s ease, color .13s ease;
}
.preset-chip:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

/* ---------- 历史 ---------- */

.history {
  margin-top: 18px;
  padding: 18px 22px 22px;
  border-top: 1px solid var(--border);
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.history-head h2 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.history-head h2 span {
  margin-left: 4px;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--muted-2);
}

.link-btn[disabled] { opacity: .45; cursor: not-allowed; text-decoration: none; }
.link-btn[disabled]:hover { color: var(--muted); text-decoration-color: transparent; }

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 5px;
}

.history-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto 28px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
}

.history-time {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

.history-pw {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  word-break: break-all;
  line-height: 1.45;
}

.history-badge {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.history-badge.s-1 { color: #b91c1c; background: #fef2f2; }
.history-badge.s-2 { color: #b45309; background: #fffbeb; }
.history-badge.s-3 { color: #0369a1; background: #f0f9ff; }
.history-badge.s-4 { color: #047857; background: #ecfdf5; }

html[data-theme="dark"] .history-badge.s-1 { color: #fca5a5; background: rgba(248, 113, 113, .12); }
html[data-theme="dark"] .history-badge.s-2 { color: #fcd34d; background: rgba(251, 191, 36, .12); }
html[data-theme="dark"] .history-badge.s-3 { color: #7dd3fc; background: rgba(56, 189, 248, .12); }
html[data-theme="dark"] .history-badge.s-4 { color: #6ee7b7; background: rgba(52, 211, 153, .12); }

.history-item .history-copy {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted-2);
}
.history-item .history-copy:hover { background: var(--surface-2); color: var(--accent-ink); }
.history-copy svg { width: 14px; height: 14px; }

.history-empty {
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--surface-2);
  text-align: center;
  font-size: 12px;
  color: var(--muted-2);
}

/* ---------- 侧栏 ---------- */

.strength-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
}

.strength-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.strength-legend .dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-1 { background: #dc2626; }
.dot-2 { background: #d97706; }
.dot-3 { background: #0284c7; }
.dot-4 { background: #059669; }

html[data-theme="dark"] .dot-1 { background: #f87171; }
html[data-theme="dark"] .dot-2 { background: #fbbf24; }
html[data-theme="dark"] .dot-3 { background: #38bdf8; }
html[data-theme="dark"] .dot-4 { background: #34d399; }

.strength-legend b {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted-2);
  white-space: nowrap;
}

.legend-note {
  margin: 12px 0 0;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--muted-2);
}

.tips-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
}

.tips-list li {
  position: relative;
  padding-left: 15px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
}

.tips-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- 文章 ---------- */

.callout {
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--accent-soft);
  color: var(--text) !important;
  font-size: 13px !important;
}

/* ---------- 响应式 ---------- */

@media (max-width: 720px) {
  .pw-box { padding: 16px 16px 15px; }
  .pw-value { font-size: clamp(1.15rem, 5.2vw, 1.5rem); margin: 12px 0 14px; }
  .strength { margin: 14px 16px 0; padding: 13px 14px; }
  .pw-settings { padding: 16px 16px 0; }
  .pw-presets { padding: 16px 16px 0; }
  .history { padding: 16px; }
  .history-head h2 span { display: none; }
  .legend-note { display: none; }
  .pw-box .btn { padding: 0 13px; }
}

@media (max-width: 520px) {
  .history-item { grid-template-columns: minmax(0, 1fr) auto 28px; }
  .history-time { display: none; }
  .pw-bottom { align-items: flex-start; }
  .pw-source { font-size: 10.5px; }
  .charset-card { padding: 10px; }
  .charset-card code { display: none; }
}

@media (max-width: 380px) {
  .pw-count { display: none; }
  .pw-tools { gap: 4px; }
  .pw-tool { width: 30px; height: 30px; }
}
