:root {
  --bg: #0b1220;
  --bg-soft: #111b31;
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --card: #ffffff;
  --surface: #f8fbff;
  --surface-2: #eef4fb;
  --success: #16a34a;
  --danger: #dc2626;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: Arial, sans-serif;
  background: linear-gradient(180deg, #f7fbff 0%, #eef4fb 100%);
  color: var(--text);
  line-height: 1.7;
}

.container {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 18, 32, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.topbar-inner {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  color: white;
  text-decoration: none;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.back-link {
  color: white;
  text-decoration: none;
  opacity: 0.92;
  font-size: 15px;
}

.lang-switcher {
  display: flex;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}

.lang-btn {
  border: none;
  background: transparent;
  color: white;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
}

.lang-btn.active {
  background: white;
  color: #0f172a;
}

.hero {
  background:
    radial-gradient(circle at top left, rgba(59,130,246,0.28), transparent 30%),
    radial-gradient(circle at right center, rgba(37,99,235,0.24), transparent 30%),
    linear-gradient(135deg, #0b1220 0%, #13264d 100%);
  color: white;
  padding: 78px 0 56px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.8fr;
  gap: 28px;
  align-items: start;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  margin-bottom: 18px;
  font-size: 14px;
  font-weight: 700;
}

.hero h1 {
  font-size: 52px;
  line-height: 1.1;
  max-width: 900px;
  margin-bottom: 18px;
  letter-spacing: -0.02em;
}

.hero-text {
  max-width: 860px;
  font-size: 19px;
  color: #dbeafe;
  margin-bottom: 26px;
}

.search-panel {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-xl);
  padding: 22px;
}

.field-label {
  display: block;
  font-size: 14px;
  color: #dbeafe;
  margin-bottom: 10px;
  font-weight: 700;
}

.search-box {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 14px;
  margin-bottom: 10px;
}

.search-box input {
  width: 100%;
  min-height: 60px;
  border-radius: 16px;
  border: none;
  outline: none;
  padding: 0 18px;
  font-size: 17px;
  color: var(--text);
}

.search-box button {
  min-height: 60px;
  border-radius: 16px;
  border: none;
  background: white;
  color: #0f172a;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.search-box button:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.search-helper {
  font-size: 14px;
  color: #dbeafe;
  opacity: 0.95;
}

.hero-mini-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.18);
}

.mini-overline,
.mini-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 700;
}

.hero .mini-overline {
  color: #bfdbfe;
}

.hero-mini-card h3 {
  font-size: 26px;
  margin-bottom: 14px;
}

.feature-list {
  list-style: none;
  display: grid;
  gap: 12px;
}

.feature-list li {
  position: relative;
  padding-left: 24px;
  color: #dbeafe;
}

.feature-list li::before {
  content: "•";
  position: absolute;
  left: 8px;
  top: 0;
  color: #93c5fd;
  font-weight: 800;
}

.message {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 15px;
}

.message.info {
  background: rgba(255,255,255,0.12);
  color: white;
  border: 1px solid rgba(255,255,255,0.14);
}

.message.error {
  background: rgba(239,68,68,0.18);
  color: #fee2e2;
  border: 1px solid rgba(254,202,202,0.22);
}

.hidden {
  display: none !important;
}

.section {
  padding: 58px 0;
}

.result-section {
  padding-top: 18px;
  padding-bottom: 18px;
}

.result-section.compact-empty {
  padding-top: 8px;
  padding-bottom: 4px;
}

.alt-section {
  background: linear-gradient(180deg, #eef4fb 0%, #e9f1fa 100%);
  padding-top: 18px;
}

.result-card,
.citation-card,
.empty-history-card,
.history-item,
.footer-info-card {
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.result-card {
  padding: 30px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 26px;
}

.result-header h2 {
  font-size: 34px;
  line-height: 1.22;
  letter-spacing: -0.01em;
}

.result-actions,
.download-actions,
.history-actions-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.link-btn,
.small-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 12px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-weight: 800;
  font-size: 14px;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.link-btn:hover,
.small-btn:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.link-btn.primary {
  background: #0f172a;
  color: white;
}

.link-btn.secondary,
.small-btn {
  background: #e2e8f0;
  color: #0f172a;
}

.export-btn {
  background: #dbeafe;
  color: #1d4ed8;
}

.danger-btn {
  background: #fee2e2;
  color: #991b1b;
}

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

.meta-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.meta-item h4 {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 6px;
}

.meta-item p,
.meta-item a {
  font-size: 16px;
  color: var(--text);
  word-break: break-word;
}

.meta-item a {
  text-decoration: none;
  color: var(--primary);
  font-weight: 700;
}

.abstract-box {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 22px;
}

.abstract-box h3 {
  font-size: 24px;
  margin-bottom: 10px;
}

.external-tools {
  margin-top: 24px;
}

.external-tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.external-tool-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.external-tool-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.external-tool-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
}

.external-tool-card span {
  display: block;
  font-size: 14px;
  color: var(--muted);
}

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

.section-title-row h2 {
  font-size: 34px;
  line-height: 1.2;
}

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

.history-selection-info {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.citation-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.citation-card {
  padding: 24px;
}

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

.citation-head h3 {
  font-size: 24px;
}

.copy-btn {
  border: none;
  background: #0f172a;
  color: white;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
}

.citation-text {
  font-size: 16px;
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-word;
}

.empty-text {
  color: var(--muted);
}

.history-list {
  display: grid;
  gap: 16px;
}

.empty-history-card {
  padding: 24px;
  color: var(--muted);
  font-size: 16px;
}

.history-item {
  padding: 22px;
  display: grid;
  gap: 14px;
  border: 2px solid transparent;
}

.history-item.selected {
  border-color: #93c5fd;
  background: #f8fbff;
}

.history-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.history-left {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  width: 100%;
}

.history-checkbox {
  width: 22px;
  height: 22px;
  margin-top: 4px;
  accent-color: #2563eb;
  cursor: pointer;
  flex-shrink: 0;
}

.history-main {
  flex: 1;
}

.history-title {
  font-size: 20px;
  line-height: 1.4;
  font-weight: 800;
}

.history-sub {
  color: var(--muted);
  font-size: 14px;
}

.history-doi {
  font-size: 14px;
  color: var(--primary);
  word-break: break-all;
}

.history-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.history-btn {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  background: #0f172a;
  color: white;
}

.history-btn.secondary {
  background: #e2e8f0;
  color: #0f172a;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.footer-info-section {
  padding-top: 28px;
}

.footer-info-card {
  padding: 30px;
}

.footer-info-card h2 {
  font-size: 34px;
  margin-bottom: 16px;
}

.footer-info-card p {
  font-size: 17px;
  color: var(--text);
  margin-bottom: 14px;
}

.footer-link-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.footer-link-card {
  display: block;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.footer-link-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.footer-link-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

.footer-link-card span {
  display: block;
  font-size: 14px;
  color: var(--muted);
}

.export-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
}

.export-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
}

.export-modal-dialog {
  position: relative;
  z-index: 2;
  width: min(680px, calc(100% - 32px));
  margin: 80px auto;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  padding: 24px;
}

.export-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.export-modal-header h3 {
  font-size: 26px;
  line-height: 1.3;
}

.export-modal-close {
  border: none;
  background: #eef4fb;
  color: #0f172a;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.export-modal-text {
  color: var(--muted);
  margin-bottom: 18px;
}

.export-style-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.export-style-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.export-style-option {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fbff;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 700;
  cursor: pointer;
}

.export-style-option input {
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
}

.export-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 1100px) {
  .external-tools-grid,
  .footer-link-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 980px) {
  .hero-grid,
  .search-box,
  .meta-grid,
  .citation-grid,
  .external-tools-grid,
  .footer-link-grid,
  .export-style-grid {
    grid-template-columns: 1fr;
  }

  .result-header,
  .section-title-row,
  .history-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero h1 {
    font-size: 38px;
  }

  .result-header h2,
  .section-title-row h2,
  .footer-info-card h2,
  .export-modal-header h3 {
    font-size: 28px;
  }
}

@media (max-width: 640px) {
  .topbar-inner {
    min-height: 70px;
    flex-direction: column;
    justify-content: center;
    padding: 10px 0;
  }

  .topbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .hero {
    padding: 56px 0 48px;
  }

  .hero h1 {
    font-size: 30px;
  }

  .hero-text {
    font-size: 17px;
  }

  .result-card,
  .citation-card,
  .hero-mini-card,
  .empty-history-card,
  .history-item,
  .footer-info-card,
  .export-modal-dialog {
    padding: 20px;
  }

  .history-left {
    gap: 10px;
  }
}