:root {
  --primary-600: #0f766e;
  --primary-700: #115e59;
  --accent: #7c3aed;
  --warn: #f97316;
  --danger: #dc2626;
  --success: #15803d;
  --gray-50: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-500: #6c757d;
  --gray-700: #495057;
  --gray-900: #212529;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--white);
  color: var(--gray-900);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  margin: 0;
}

a {
  color: var(--primary-600);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

h1,
h2 {
  font-size: 1.15rem;
  line-height: 1.35;
}

.page-shell {
  margin: 0 auto;
  max-width: 1200px;
  padding: 0 15px;
}

.navbar {
  align-items: center;
  background: #e3f2fd;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-top: 8px;
  min-height: 58px;
  padding: 8px 0;
  position: relative;
}

.navbar-brand {
  align-items: center;
  color: var(--gray-900);
  display: inline-flex;
  font-size: 1.05rem;
  font-weight: 600;
  gap: 10px;
}

.navbar-brand:hover {
  text-decoration: none;
}

.brand-icon {
  align-items: center;
  background: var(--primary-600);
  border-radius: 8px;
  color: var(--white);
  display: inline-flex;
  font-weight: 700;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.nav-actions,
.nav-links {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.nav-actions a,
.nav-dropdown summary,
.nav-links a {
  background: transparent;
  border: 0;
  color: var(--gray-700);
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  margin: 0;
  padding: 0.55rem 0.65rem;
  width: auto;
}

.nav-actions a:hover,
.nav-dropdown summary:hover,
.nav-links a:hover {
  background: var(--gray-100);
  text-decoration: none;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown summary {
  cursor: pointer;
  list-style: none;
}

.nav-dropdown summary::-webkit-details-marker {
  display: none;
}

.nav-dropdown summary::after {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  content: "";
  display: inline-block;
  height: 0;
  margin-left: 0.35rem;
  vertical-align: middle;
  width: 0;
}

.nav-dropdown[open] summary {
  background: var(--gray-100);
}

.dropdown-panel {
  background: var(--white);
  border: 1px solid var(--gray-200);
  box-shadow: 0 14px 30px rgba(33, 37, 41, 0.1);
  display: grid;
  gap: 0.2rem;
  min-width: 180px;
  padding: 0.35rem;
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 10;
}

.dropdown-panel a {
  display: block;
  padding: 0.65rem 0.75rem;
}

.intro-card,
.card {
  background: var(--gray-50);
  border: 1px solid #d8ecfb;
}

.intro-card {
  margin-top: 0.75rem;
  padding: 0.9rem 1rem;
}

.intro-card p,
.sub-title {
  color: var(--gray-500);
  margin-bottom: 0;
}

.card,
.seo-copy {
  margin-top: 0.85rem;
}

.card-body {
  padding: 1rem;
}

.section-head {
  align-items: baseline;
  display: flex;
  gap: 0.8rem;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.card h2,
.seo-copy h2 {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 0.45rem;
  margin-bottom: 0;
}

.badge {
  background: var(--accent);
  border-radius: 0.25rem;
  color: var(--white);
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.25em 0.45em;
}

.settings-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(140px, 0.6fr) minmax(140px, 0.6fr) minmax(260px, 1.2fr);
}

label {
  display: grid;
  min-width: 0;
}

label > span {
  color: var(--gray-700);
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

input,
output {
  background: var(--white);
  border: 1px solid var(--gray-300);
  color: var(--gray-900);
  display: block;
  font: inherit;
  min-height: 38px;
  min-width: 0;
  padding: 0.4rem 0.65rem;
  width: 100%;
}

input:focus {
  border-color: #5eead4;
  box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.16);
  outline: 0;
}

.option-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 0.85rem;
}

.check-field {
  align-items: center;
  background: var(--white);
  border: 1px solid var(--gray-300);
  display: flex;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.45rem 0.65rem;
}

.check-field input {
  min-height: auto;
  width: auto;
}

.check-field span {
  color: var(--gray-700);
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

button {
  background: var(--primary-600);
  border: 1px solid var(--primary-600);
  border-radius: 0.25rem;
  color: var(--white);
  cursor: pointer;
  font: inherit;
  min-height: 38px;
  padding: 0.375rem 0.95rem;
  white-space: nowrap;
}

button:hover {
  background: var(--primary-700);
  border-color: var(--primary-700);
}

.button-light {
  background: #ecfdf5;
  border-color: #b7e4d8;
  color: var(--primary-700);
}

.button-light:hover {
  background: #ccfbf1;
  border-color: #99f6e4;
  color: var(--primary-700);
}

.button-secondary {
  background: var(--warn);
  border-color: var(--warn);
}

.button-secondary:hover {
  background: #ea580c;
  border-color: #ea580c;
}

.result-list {
  display: grid;
  gap: 0.5rem;
}

.password-row {
  align-items: center;
  background: var(--white);
  border: 1px solid var(--gray-300);
  display: grid;
  gap: 0.55rem;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 0.55rem;
}

.password-value {
  color: var(--gray-900);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  overflow-wrap: anywhere;
}

.password-row button {
  min-height: 34px;
  padding: 0.25rem 0.7rem;
}

.empty-state {
  background: var(--white);
  border: 1px solid var(--gray-300);
  color: var(--gray-500);
  font-weight: 600;
  padding: 1rem;
  text-align: center;
}

.result-toolbar {
  align-items: center;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  margin-top: 0.85rem;
}

.summary-strip {
  align-items: center;
  background: var(--white);
  border: 1px solid var(--gray-300);
  display: flex;
  flex-wrap: wrap;
  min-height: 38px;
}

.summary-strip span {
  color: var(--gray-500);
  font-size: 0.92rem;
  padding: 0.35rem 0.7rem;
  white-space: nowrap;
}

.summary-strip span + span {
  border-left: 1px solid var(--gray-300);
}

.summary-strip strong,
#strengthText {
  color: var(--primary-700);
  font-size: 1.02rem;
  margin-left: 0.25rem;
}

.message-box {
  color: var(--gray-700);
  font-weight: 600;
  text-align: left;
}

.message-box.is-error {
  color: var(--danger);
}

.message-box.is-success {
  color: var(--success);
}

.feature-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 0.8rem;
}

.feature-grid span {
  background: var(--white);
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
  padding: 0.5rem 0.65rem;
}

.faq-card details {
  border-top: 1px solid var(--gray-300);
  padding: 0.8rem 0;
}

.faq-card details:first-of-type {
  border-top: 0;
}

summary {
  cursor: pointer;
  font-weight: 600;
}

details p,
.seo-copy {
  color: var(--gray-700);
  font-size: 0.95rem;
}

details p,
.seo-copy p {
  margin-bottom: 0;
}

.footer {
  color: darkgray;
  font-size: 0.95rem;
  line-height: 1.6;
  padding-bottom: 2rem;
  padding-top: 2rem;
  text-align: center;
}

.footer a {
  color: darkgray;
}

.toast {
  background: var(--gray-900);
  border-radius: 0.25rem;
  bottom: 18px;
  color: var(--white);
  left: 50%;
  opacity: 0;
  padding: 0.65rem 0.9rem;
  pointer-events: none;
  position: fixed;
  transform: translateX(-50%);
  transition: opacity 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
}

@media (max-width: 900px) {
  .settings-grid,
  .option-grid,
  .result-toolbar,
  .feature-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 700px) {
  .navbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .button-row {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .password-row {
    grid-template-columns: 1fr;
  }

  .summary-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-strip span + span {
    border-left: 0;
  }
}

/* Mobile Safari navigation guard */
.navbar .nav-actions button,
.navbar .nav-actions a,
.navbar .nav-dropdown summary {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--gray-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  margin: 0;
  min-height: 0;
  padding: 0.55rem 0.65rem;
  text-align: center;
  white-space: nowrap;
  width: auto;
}

.navbar .nav-actions button:hover,
.navbar .nav-actions a:hover,
.navbar .nav-dropdown summary:hover,
.navbar .nav-actions button.is-active {
  background: var(--gray-100);
  color: var(--primary-700);
  text-decoration: none;
}

.navbar .nav-actions {
  min-width: 0;
}

.navbar .nav-dropdown {
  position: relative;
}

.navbar .dropdown-panel {
  left: 0;
  right: auto;
  top: 100%;
  width: max-content;
  min-width: 180px;
  max-width: calc(100vw - 30px);
}

@media (max-width: 700px) {
  .navbar {
    align-items: stretch;
  }

  .navbar .nav-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  .navbar .nav-actions button,
  .navbar .nav-actions a,
  .navbar .nav-dropdown summary {
    width: auto !important;
  }

  .navbar .dropdown-panel {
    position: absolute;
    width: max-content !important;
  }
}

.navbar .nav-actions.has-dropdown {
  overflow: visible;
}

.navbar .nav-actions.has-dropdown .dropdown-panel {
  left: 0;
  right: auto;
  max-width: min(260px, calc(100vw - 30px));
  z-index: 1000;
}

@media (max-width: 700px) {
  .navbar .nav-actions.has-dropdown {
    overflow: visible;
  }

  .navbar .nav-actions.has-dropdown .nav-dropdown {
    position: relative;
  }

  .navbar .nav-actions.has-dropdown .dropdown-panel {
    left: 0;
    right: auto;
    top: 100%;
    max-width: min(260px, calc(100vw - 30px));
  }
}
