/* Namefy.ai - Brutalist Editorial */
/* 粗犷、直接、高对比度的设计 */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --black: #0a0a0a;
  --white: #fafafa;
  --gray: #666;
  --light-gray: #e0e0e0;
  --accent: #ff3c00;
  --success: #00aa55;
  --warning: #ddaa00;
  --error: #dd0000;
}

body {
  font-family: 'JetBrains Mono', monospace;
  background: var(--white);
  color: var(--black);
  line-height: 1.5;
  font-size: 14px;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 60px 24px;
}

/* Header - Bold editorial style */
header {
  margin-bottom: 60px;
  border-bottom: 3px solid var(--black);
  padding-bottom: 24px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

header h1 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(48px, 12vw, 80px);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 0.9;
  margin-bottom: 12px;
}

header h1 span {
  font-style: italic;
}

.logo-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.logo-link:hover h1 {
  color: var(--accent);
}

/* Auth Area */
.auth-area {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
}

.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--white);
  border: 2px solid var(--black);
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.login-btn:hover {
  background: var(--black);
  color: var(--white);
}

/* Language Switcher */
.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  background: var(--white);
  border: 2px solid var(--gray);
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--gray);
}

.lang-btn:hover {
  border-color: var(--black);
  color: var(--black);
}

.login-btn:hover svg path {
  fill: var(--white);
}

.login-btn svg {
  flex-shrink: 0;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--black);
  object-fit: cover;
}

.user-name {
  font-size: 12px;
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  padding: 10px 16px;
  background: var(--white);
  border: 2px solid var(--gray);
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  color: var(--gray);
  cursor: pointer;
  transition: all 0.15s;
}

.logout-btn:hover {
  border-color: var(--error);
  color: var(--error);
}

.subtitle {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gray);
}

/* Form */
.form-group {
  margin-bottom: 32px;
}

label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
  color: var(--gray);
}

textarea {
  width: 100%;
  padding: 16px;
  background: var(--white);
  border: 2px solid var(--black);
  font-size: 14px;
  font-family: inherit;
  color: var(--black);
  resize: vertical;
  min-height: 100px;
}

textarea::placeholder {
  color: #999;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.char-count {
  display: block;
  text-align: right;
  font-size: 11px;
  color: var(--gray);
  margin-top: 6px;
}

/* Suffix selector - checkbox grid */
.suffix-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border: 2px solid var(--black);
  border-bottom: none;
}

.suffix-item {
  flex: 1 0 25%;
  min-width: 80px;
  cursor: pointer;
  border-bottom: 2px solid var(--black);
  border-right: 2px solid var(--black);
}

.suffix-item:nth-child(4n) {
  border-right: none;
}

.suffix-item input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.suffix-item span {
  display: block;
  padding: 12px 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray);
  transition: all 0.1s;
  background: var(--white);
}

.suffix-item:hover span {
  background: var(--light-gray);
}

.suffix-item input:checked + span {
  background: var(--black);
  color: var(--white);
}

/* Toggle more suffixes button */
.toggle-more-btn {
  width: 100%;
  padding: 10px 16px;
  background: var(--light-gray);
  border: 2px solid var(--black);
  border-top: none;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  color: var(--gray);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}

.toggle-more-btn:hover {
  background: var(--white);
  color: var(--black);
}

.toggle-more-btn.expanded {
  border-bottom: none;
}

.toggle-more-btn .toggle-icon {
  font-size: 10px;
  transition: transform 0.2s;
}

.toggle-more-btn.expanded .toggle-icon {
  transform: rotate(180deg);
}

/* More suffixes section */
.suffix-group-more {
  border-top: none;
}

/* Selected more suffixes section (shown when collapsed) */
.suffix-group-selected {
  border-top: none;
}

.suffix-group-selected .suffix-item span {
  background: var(--black);
  color: var(--white);
}

.suffix-group-selected .suffix-item:hover span {
  background: #333;
}

/* When selected section is visible, remove bottom border from popular suffixes */
.suffix-group-selected:not([hidden]) {
  border-bottom: none;
}

/* Submit button */
button[type="submit"] {
  width: 100%;
  padding: 18px 24px;
  background: var(--black);
  color: var(--white);
  border: none;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 8px;
}

button[type="submit"]:hover {
  background: var(--accent);
}

button[type="submit"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button[type="submit"]:disabled:hover {
  background: var(--black);
}

[hidden] {
  display: none !important;
}

.btn-loading:not([hidden]) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Error */
.error {
  margin-top: 16px;
  padding: 16px;
  background: var(--white);
  border: 2px solid var(--error);
  color: var(--error);
  font-size: 13px;
}

/* Results */
.results {
  margin-top: 60px;
  border-top: 3px solid var(--black);
  padding-top: 32px;
}

.result-description {
  position: relative;
  padding: 20px 24px 20px 48px;
  margin-bottom: 32px;
  border: 2px solid var(--black);
  background: var(--white);
}

.result-description::before {
  content: '"';
  position: absolute;
  left: 12px;
  top: 8px;
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 48px;
  line-height: 1;
  color: var(--accent);
}

.result-description .desc-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gray);
  margin-bottom: 6px;
}

.result-description .desc-text {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 18px;
  font-style: italic;
  line-height: 1.5;
  color: var(--black);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.results-header h2 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 32px;
  font-weight: 400;
}

.results-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sort-options {
  display: flex;
  gap: 0;
  border: 2px solid var(--black);
}

.sort-btn {
  padding: 8px 16px;
  background: var(--white);
  border: none;
  border-right: 2px solid var(--black);
  font-size: 11px;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
  cursor: pointer;
  transition: all 0.1s;
}

.sort-btn:last-child {
  border-right: none;
}

.sort-btn:hover {
  background: var(--light-gray);
}

.sort-btn.active {
  background: var(--black);
  color: var(--white);
}

/* Top 3 */
.top3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-bottom: 48px;
  border: 2px solid var(--black);
}

.top3-item {
  padding: 20px;
  border-right: 2px solid var(--black);
  position: relative;
}

.top3-item:last-child {
  border-right: none;
}

.top3-item::before {
  content: attr(data-rank);
  position: absolute;
  top: 12px;
  right: 12px;
  font-family: 'Instrument Serif', serif;
  font-size: 48px;
  font-style: italic;
  color: var(--light-gray);
  line-height: 1;
}

.top3-item .domain {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 20px;
  font-weight: 400;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.top3-item .advice {
  font-size: 12px;
  color: var(--gray);
  line-height: 1.5;
  margin-bottom: 8px;
}

.top3-item .meta {
  font-size: 10px;
  color: #999;
  word-break: break-all;
}

/* Domain cards */
.cards-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.refresh-btn {
  padding: 8px 16px;
  background: var(--white);
  border: 2px solid var(--black);
  font-size: 11px;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.1s;
}

.refresh-btn:hover:not(:disabled) {
  background: var(--black);
  color: var(--white);
}

.refresh-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.share-btn {
  padding: 8px 16px;
  background: var(--white);
  border: 2px solid var(--black);
  font-size: 11px;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.1s;
}

.share-btn:hover {
  background: var(--black);
  color: var(--white);
}

.domain-cards {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 2px solid var(--black);
  border-bottom: none;
}

.domain-card {
  padding: 20px 24px;
  border-bottom: 2px solid var(--black);
}

.domain-card:hover {
  background: #f8f8f8;
}

.domain-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.domain-card-rank {
  font-family: 'Instrument Serif', serif;
  font-size: 14px;
  font-style: italic;
  color: var(--gray);
  min-width: 24px;
}

.domain-card-name {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 20px;
  font-weight: 400;
}

.domain-card-score {
  font-size: 11px;
  font-weight: 600;
  background: var(--black);
  color: var(--white);
  padding: 3px 8px;
  margin-left: auto;
}

.domain-card-strategy {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 2px 6px;
}

.domain-card-suffixes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

/* Suffix tags */
.suffix-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid;
}

.suffix-tag-available {
  background: var(--white);
  border-color: var(--success);
  color: var(--success);
  cursor: pointer;
}

.suffix-tag-available:hover {
  background: var(--success);
  color: var(--white);
}

.suffix-tag-available::before {
  content: '●';
  font-size: 8px;
}

.suffix-tag-taken {
  background: var(--white);
  border-color: var(--light-gray);
  color: #999;
  text-decoration: line-through;
}

.suffix-tag-premium {
  background: var(--white);
  border-color: var(--warning);
  color: #aa8800;
}

.suffix-tag-premium::before {
  content: '$';
  font-size: 10px;
}

.suffix-tag-loading {
  background: var(--white);
  border-color: var(--light-gray);
  color: var(--gray);
}

.suffix-tag-loading::after {
  content: '';
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--light-gray);
  border-top-color: var(--gray);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.suffix-tag-unknown {
  background: var(--white);
  border-color: var(--light-gray);
  color: #999;
}

.domain-card-reason {
  font-size: 12px;
  color: var(--gray);
  line-height: 1.5;
}

/* History */
.history {
  margin-top: 60px;
  padding-top: 32px;
  border-top: 1px solid var(--light-gray);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}

.history-header h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gray);
  font-weight: 500;
}

.text-btn {
  background: none;
  border: none;
  font-size: 11px;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
  cursor: pointer;
}

.text-btn:hover {
  color: var(--error);
}

#historyList {
  list-style: none;
}

.history-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--light-gray);
  cursor: pointer;
  transition: padding-left 0.15s;
}

.history-item:hover {
  padding-left: 8px;
}

.history-item .desc {
  font-size: 13px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item .meta {
  font-size: 11px;
  color: var(--gray);
}

.empty {
  padding: 24px 0;
  color: var(--gray);
  font-size: 12px;
}

/* Footer */
footer {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--light-gray);
}

footer p {
  font-size: 11px;
  color: var(--gray);
}

.footer-links {
  margin-top: 8px;
}

.footer-links a {
  color: var(--gray);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-divider {
  margin: 0 12px;
  color: var(--light-gray);
}

/* Responsive */
@media (max-width: 640px) {
  .container {
    padding: 40px 16px;
  }

  header h1 {
    font-size: 48px;
  }

  .suffix-item {
    flex: 1 0 50%;
  }

  .suffix-item:nth-child(2n) {
    border-right: none;
  }

  .suffix-item:nth-child(4n) {
    border-right: 2px solid var(--black);
  }

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

  .top3-item {
    border-right: none;
    border-bottom: 2px solid var(--black);
  }

  .top3-item:last-child {
    border-bottom: none;
  }

  .domain-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .domain-card-score {
    margin-left: 0;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Selection */
::selection {
  background: var(--black);
  color: var(--white);
}

/* Focus */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print */
@media print {
  body {
    font-size: 12px;
  }
  .container {
    max-width: 100%;
    padding: 0;
  }
}

/* Quota Display */
.quota-display {
  font-size: 12px;
  color: var(--gray);
  padding: 10px 16px;
  border: 2px solid var(--light-gray);
  background: var(--white);
}

.quota-display strong {
  color: var(--accent);
}

/* Login Overlay */
.login-overlay {
  position: relative;
  margin-bottom: 32px;
  padding: 32px;
  background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
  border: 2px solid var(--black);
  text-align: center;
}

.login-overlay-content p {
  font-size: 14px;
  color: var(--gray);
  margin-bottom: 16px;
}

.login-overlay-btn {
  padding: 14px 32px;
  background: var(--black);
  color: var(--white);
  border: none;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background 0.15s;
}

.login-overlay-btn:hover {
  background: var(--accent);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal-content {
  position: relative;
  background: var(--white);
  padding: 40px;
  max-width: 400px;
  width: 90%;
  border: 2px solid var(--black);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--gray);
  line-height: 1;
}

.modal-close:hover {
  color: var(--black);
}

.modal-content h2 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 28px;
  font-weight: 400;
  margin-bottom: 8px;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 24px;
}

/* Auth Tabs */
.auth-tabs {
  display: flex;
  border: 2px solid var(--black);
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 12px;
  background: var(--white);
  border: none;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.15s;
}

.auth-tab:first-child {
  border-right: 2px solid var(--black);
}

.auth-tab:hover {
  background: var(--light-gray);
}

.auth-tab.active {
  background: var(--black);
  color: var(--white);
}

/* Auth Error */
.auth-error {
  padding: 12px;
  background: #fff0f0;
  border: 1px solid var(--error);
  color: var(--error);
  font-size: 13px;
  margin-bottom: 16px;
}

/* Auth Forms */
.modal-content .form-group {
  margin-bottom: 16px;
}

.modal-content input[type="email"],
.modal-content input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--black);
  font-size: 14px;
  font-family: inherit;
  background: var(--white);
}

.modal-content input:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-submit-btn {
  width: 100%;
  padding: 14px;
  background: var(--black);
  color: var(--white);
  border: none;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background 0.15s;
}

.auth-submit-btn:hover {
  background: var(--accent);
}

/* Auth Divider */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--light-gray);
}

.auth-divider span {
  padding: 0 16px;
  font-size: 12px;
  color: var(--gray);
  text-transform: uppercase;
}

/* Google Login Button */
.google-login-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  background: var(--white);
  border: 2px solid var(--black);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.google-login-btn:hover {
  background: var(--light-gray);
}

/* Responsive Modal */
@media (max-width: 640px) {
  .modal-content {
    padding: 24px;
  }

  .auth-area {
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
  }

  .quota-display {
    order: 2;
  }
}
