:root {
  --bg: #f4f4f5;
  --card: #ffffff;
  --text: #18181b;
  --muted: #71717a;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --primary: #18181b;
  --primary-hover: #000000;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #16a34a;
  --primary-strong: #16a34a;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(24, 24, 27, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  width: min(720px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
}

.header,
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.9rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  color: #fff;
  background: var(--primary);
  font-size: 0.9rem;
}

.status {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

.generator {
  align-self: center;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

h1 {
  margin: 0 0 6px;
  font-size: clamp(1.55rem, 5vw, 2.1rem);
  line-height: 1.05;
  letter-spacing: -0.06em;
}

p {
  margin: 0;
}

.title-row p,
.note {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.ghost-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  color: var(--text);
  background: #fff;
  font-weight: 800;
}

.password-box {
  display: flex;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fafafa;
}

.password-output {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0 4px;
  color: var(--text);
  background: transparent;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.copy-button,
.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 13px;
  font-weight: 800;
}

.copy-button,
.primary-button {
  border: 0;
  color: #fff;
  background: var(--primary);
}

.copy-button:hover,
.primary-button:hover {
  background: var(--primary-hover);
}

.copy-button {
  padding: 0 14px;
}

.secondary-button {
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: #fff;
}

.secondary-button:hover,
.ghost-button:hover {
  background: #f4f4f5;
}

.strength-wrap {
  margin: 14px 0 20px;
}

.strength-meta,
.range-row,
.count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.strength-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e4e7;
}

.strength-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--danger);
  transition: width 0.2s ease, background 0.2s ease;
}

.length-range {
  width: 100%;
  margin-bottom: 18px;
  accent-color: var(--primary);
}

.count-row {
  margin-bottom: 18px;
}

.count-row input {
  width: 82px;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  background: #fff;
  font-weight: 700;
  text-align: center;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.options-grid label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  font-size: 0.9rem;
  font-weight: 650;
  user-select: none;
}

.options-grid label:hover {
  background: #fafafa;
}

.options-grid input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.password-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  max-height: 190px;
  overflow: auto;
}

.password-list:empty {
  display: none;
}

.password-list button {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.86rem;
  font-weight: 700;
  text-align: left;
  overflow-wrap: anywhere;
}

.password-list button:hover {
  background: #fafafa;
}

.note {
  margin-top: 16px;
}

code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafafa;
  color: var(--text);
  font-size: 0.9em;
}

.footer {
  justify-content: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  transform: translate(-50%, 14px);
  padding: 11px 14px;
  border-radius: 999px;
  color: #fff;
  background: var(--primary);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

button {
  transition: background 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
  opacity: 0.85;
}

@media (max-width: 560px) {
  .app {
    width: min(100% - 20px, 720px);
    padding: 14px 0;
  }

  .header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .generator {
    align-self: start;
    padding: 18px;
    border-radius: 20px;
  }

  .title-row {
    align-items: flex-start;
  }

  .password-box,
  .actions-row,
  .options-grid {
    grid-template-columns: 1fr;
  }

  .password-box {
    flex-direction: column;
  }

  .copy-button {
    width: 100%;
  }
}