:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --ink: #17211d;
  --muted: #66736e;
  --line: #d9e1dc;
  --accent: #087f73;
  --accent-strong: #065f59;
  --accent-soft: #dff3ee;
  --warning: #b45309;
  --danger: #b42318;
  --shadow: 0 18px 45px rgb(23 33 29 / 10%);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgb(8 127 115 / 8%), transparent 280px),
    var(--bg);
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-header,
.workspace {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.app-header {
  padding: 34px 0 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 25px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.3;
}

.workspace {
  padding-bottom: 44px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 4px;
  width: min(100%, 680px);
  padding: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #e9efec;
}

.tab {
  min-height: 38px;
  padding: 8px 16px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
  white-space: nowrap;
}

.tab.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 6px 14px rgb(23 33 29 / 10%);
}

.tool-panel {
  display: none;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tool-panel.active {
  display: block;
}

.panel-head,
.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.button,
.icon-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
  font-weight: 800;
}

.button {
  padding: 9px 15px;
}

.button.primary {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
}

.button.primary:hover {
  background: var(--accent-strong);
}

.icon-button {
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 20px;
}

.password-output {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: center;
  min-height: 76px;
  padding: 14px;
  border-radius: var(--radius);
  color: #effffb;
  background: #101916;
}

.password-output output {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 24px;
  line-height: 1.35;
}

.meter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin: 16px 0 20px;
}

.meter-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebe7;
}

.meter-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--danger);
  transition: width 160ms ease, background 160ms ease;
}

.meter-track span[data-level="Medium"] {
  background: var(--warning);
}

.meter-track span[data-level="Strong"],
.meter-track span[data-level="Excellent"] {
  background: var(--accent);
}

.meter p {
  min-width: 96px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

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

.field,
.check {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfb;
}

.field span,
.check span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field output {
  color: var(--ink);
  font-size: 24px;
  font-weight: 900;
}

.field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.field input[type="number"],
.field select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
  font-weight: 800;
}

.check {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-height: 58px;
}

.check input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
}

.span-2 {
  grid-column: span 2;
}

.key-controls {
  margin-bottom: 14px;
}

.hidden {
  display: none !important;
}

.status {
  min-height: 28px;
  padding: 7px 10px;
  margin-bottom: 16px;
  border-left: 4px solid var(--accent);
  color: var(--muted);
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 800;
}

.status[data-type="success"] {
  border-left-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.status[data-type="warning"] {
  border-left-color: var(--warning);
  color: #7c2d12;
  background: #fff7ed;
}

.status[data-type="error"] {
  border-left-color: var(--danger);
  color: var(--danger);
  background: #fff1f0;
}

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

.compact-grid {
  margin-bottom: 14px;
}

.key-output {
  min-width: 0;
}

.key-output .output-head {
  margin-bottom: 10px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fbfcfb;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.key-output textarea {
  min-height: 340px;
}

.text-field {
  align-content: start;
}

.text-field textarea {
  min-height: 150px;
}

.compact-textarea {
  min-height: 96px !important;
}

.block-field {
  margin-top: 14px;
}

textarea:focus,
select:focus,
button:focus-visible,
input:focus-visible {
  outline: 3px solid rgb(8 127 115 / 22%);
  outline-offset: 2px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: min(360px, calc(100% - 40px));
  padding: 12px 14px;
  margin: 0;
  border-radius: var(--radius);
  color: #ffffff;
  background: #17211d;
  box-shadow: 0 14px 36px rgb(23 33 29 / 20%);
  font-weight: 800;
}

.clipboard-fallback {
  position: fixed;
  left: -999px;
  top: 0;
  width: 1px;
  height: 1px;
}

.not-found {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  text-align: center;
}

@media (max-width: 780px) {
  .app-header,
  .workspace {
    width: min(100% - 24px, 1180px);
  }

  .app-header {
    padding-top: 28px;
  }

  h1 {
    font-size: 28px;
  }

  .tool-panel {
    padding: 16px;
  }

  .panel-head,
  .output-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .button-row {
    justify-content: flex-start;
  }

  .control-grid,
  .key-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .tab {
    padding-inline: 10px;
    white-space: normal;
  }

  .span-2 {
    grid-column: auto;
  }

  .password-output output {
    font-size: 18px;
  }

  .meter {
    grid-template-columns: 1fr;
  }

  .meter p {
    text-align: left;
  }
}
