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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
    "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif;
  background: #f8fafc;
  min-height: 100vh;
  color: #1e293b;
  line-height: 1.6;
}

/* ========== Header ========== */
header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  transition: opacity 0.2s;
}

.logo:hover {
  opacity: 0.8;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: #2563eb;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  font-weight: 600;
}

.logo-text {
  font-size: 1.375rem;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.02em;
}

.header-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #475569;
}

.back-btn {
  padding: 0.625rem 1.25rem;
  background: #f1f5f9;
  color: #475569;
  border: none;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.back-btn:hover {
  background: #e2e8f0;
}

/* ========== Main Container ========== */
.main-container {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
}

.content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ========== Input Section ========== */
.input-section {
  background: white;
  border-radius: 10px;
  padding: 2.5rem;
  border: 1px solid #e2e8f0;
}

.page-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.page-description {
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 2rem;
  font-size: 0.9375rem;
}

/* ========== Tabs ========== */
.tab-container {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid #e2e8f0;
}

.tab-btn {
  padding: 0.875rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #64748b;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: #2563eb;
}

.tab-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ========== Input Groups ========== */
.input-group {
  margin-bottom: 1.5rem;
}

.input-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.5rem;
}

.input-field {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9375rem;
  outline: none;
  transition: all 0.2s;
  background: white;
}

.input-field:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.textarea-field {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
  resize: vertical;
  background: white;
}

.textarea-field:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.char-count {
  text-align: right;
  font-size: 0.8125rem;
  color: #94a3b8;
  margin-top: 0.5rem;
}

/* ========== Summary Type Selection ========== */
.summary-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.875rem;
}

.type-btn {
  padding: 1.125rem;
  background: white;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.375rem;
  text-align: left;
}

.type-btn:hover {
  border-color: #2563eb;
  background: #f8fafc;
}

.type-btn.active {
  border-color: #2563eb;
  background: #eff6ff;
}

.type-icon {
  font-size: 1.25rem;
  opacity: 0.8;
}

.type-name {
  font-weight: 600;
  color: #1e293b;
  font-size: 0.9375rem;
}

.type-desc {
  font-size: 0.8125rem;
  color: #64748b;
}

/* ========== Buttons ========== */
.summarize-btn {
  width: 100%;
  padding: 1rem;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.summarize-btn:hover {
  background: #1d4ed8;
}

.summarize-btn:active {
  transform: scale(0.98);
}

.summarize-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-icon {
  font-size: 1.125rem;
}

/* ========== Result Section ========== */
.result-section {
  background: white;
  border-radius: 10px;
  padding: 2.5rem;
  border: 1px solid #e2e8f0;
  animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f1f5f9;
}

.result-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.01em;
}

.copy-btn {
  padding: 0.625rem 1rem;
  background: #f1f5f9;
  color: #475569;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: #e2e8f0;
}

.summary-result {
  background: #f8fafc;
  border-left: 3px solid #2563eb;
  padding: 1.5rem;
  border-radius: 6px;
  line-height: 1.8;
  color: #334155;
  font-size: 0.9375rem;
  word-break: break-word;
}

/* ========== Markdown Styles ========== */
.summary-result h1,
.summary-result h2,
.summary-result h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.summary-result h1 {
  font-size: 1.625rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.5rem;
}

.summary-result h2 {
  font-size: 1.375rem;
}

.summary-result h3 {
  font-size: 1.125rem;
}

.summary-result h1:first-child,
.summary-result h2:first-child,
.summary-result h3:first-child {
  margin-top: 0;
}

.summary-result p {
  margin-bottom: 1rem;
  line-height: 1.8;
}

.summary-result p:last-child {
  margin-bottom: 0;
}

.summary-result strong {
  font-weight: 600;
  color: #1e293b;
}

.summary-result em {
  font-style: italic;
  color: #475569;
}

.summary-result code {
  background: #e2e8f0;
  color: #dc2626;
  padding: 0.2rem 0.375rem;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875em;
}

.summary-result pre {
  background: #1e293b;
  color: #f1f5f9;
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1rem 0;
}

.summary-result pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

.summary-result ul,
.summary-result ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.summary-result li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
}

.summary-result ul li {
  list-style-type: disc;
}

.summary-result ol li {
  list-style-type: decimal;
}

.summary-result a {
  color: #2563eb;
  text-decoration: none;
  border-bottom: 1px solid #93c5fd;
  transition: all 0.2s;
}

.summary-result a:hover {
  border-bottom-color: #2563eb;
  background: rgba(37, 99, 235, 0.05);
}

.summary-result blockquote {
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 3px solid #cbd5e1;
  color: #64748b;
  font-style: italic;
}

/* ========== Result Actions ========== */
.result-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.action-btn {
  flex: 1;
  padding: 0.875rem;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn.primary {
  background: #2563eb;
  color: white;
}

.action-btn.primary:hover {
  background: #1d4ed8;
}

.action-btn.secondary {
  background: #f1f5f9;
  color: #475569;
}

.action-btn.secondary:hover {
  background: #e2e8f0;
}

/* ========== Loading Section ========== */
.loading-section {
  background: white;
  border-radius: 10px;
  padding: 3rem;
  border: 1px solid #e2e8f0;
  text-align: center;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 1.25rem;
  border: 3px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  color: #64748b;
  font-size: 0.9375rem;
}

/* ========== Error Section ========== */
.error-section {
  background: white;
  border-radius: 10px;
  padding: 3rem;
  border: 1px solid #e2e8f0;
  text-align: center;
}

.error-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.error-message {
  color: #ef4444;
  font-size: 0.9375rem;
  margin-bottom: 1.5rem;
}

.retry-btn {
  padding: 0.625rem 1.5rem;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.retry-btn:hover {
  background: #1d4ed8;
}

/* ========== Sidebar ========== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.info-card {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
}

.info-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 1rem;
}

.tip-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tip-list li {
  padding-left: 1.25rem;
  position: relative;
  color: #64748b;
  line-height: 1.6;
  font-size: 0.875rem;
}

.tip-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #2563eb;
  font-weight: bold;
  font-size: 1.125rem;
}

.tech-badge {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 6px;
}

.tech-logo {
  width: 36px;
  height: 36px;
}

.tech-name {
  font-weight: 600;
  color: #1e293b;
  font-size: 0.875rem;
}

.tech-desc {
  font-size: 0.8125rem;
  color: #64748b;
  margin-top: 0.125rem;
}

/* ========== Article Detail Page ========== */
.article-info-section {
  background: white;
  border-radius: 10px;
  padding: 2.5rem;
  border: 1px solid #e2e8f0;
  margin-bottom: 1.5rem;
}

.article-header {
  margin-bottom: 2rem;
}

.article-title-detail {
  font-size: 1.875rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.3;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.article-meta-detail {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.article-date-detail {
  font-size: 0.9375rem;
  color: #64748b;
}

.original-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: #2563eb;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.original-link-btn:hover {
  background: #1d4ed8;
}

.summary-type-selector {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid #f1f5f9;
}

.summary-label {
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
  font-size: 0.875rem;
}

.summary-type-buttons {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.type-btn-small {
  padding: 0.5rem 0.875rem;
  background: white;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
}

.type-btn-small:hover {
  border-color: #2563eb;
  background: #f8fafc;
}

.type-btn-small.active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #2563eb;
}

.summary-section {
  min-height: 400px;
}

.style-guide {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.style-item {
  padding: 0.75rem;
  background: #f8fafc;
  border-radius: 6px;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: #475569;
}

.style-item strong {
  color: #1e293b;
  font-weight: 600;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  .main-container {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media (max-width: 768px) {
  .header-container {
    padding: 1rem 1.25rem;
  }

  .header-title {
    display: none;
  }

  .main-container {
    padding: 0 1.25rem;
  }

  .input-section {
    padding: 1.75rem;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .summary-type-grid {
    grid-template-columns: 1fr;
  }

  .result-section {
    padding: 1.75rem;
  }

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

  .article-title-detail {
    font-size: 1.5rem;
  }

  .article-info-section {
    padding: 1.75rem;
  }

  .summary-type-selector {
    flex-direction: column;
    align-items: flex-start;
  }

  .summary-type-buttons {
    width: 100%;
  }

  .type-btn-small {
    flex: 1;
    min-width: 70px;
  }
}