@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("fonts/inter-variable.woff2") format("woff2");
}

:root {
  --primary-color: #3b82f6;
  --primary-dark: #2563eb;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --border-color: #e5e7eb;
  --danger: #dc2626;
  --success: #16a34a;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-primary);
  background: var(--bg-secondary);
  line-height: 1.6;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 28px 0;
}

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

.brand {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
}

.tagline {
  color: var(--text-secondary);
  margin: 4px 0 0;
  font-size: 0.92rem;
  max-width: 40ch;
}

.tab-nav {
  display: flex;
  gap: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 4px;
  height: fit-content;
}

.tab-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab-btn.active {
  background: var(--bg-primary);
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

main.wrap {
  padding-top: 32px;
  padding-bottom: 60px;
}

.panel {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 28px;
  margin-bottom: 24px;
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.step-badge {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
}

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

label {
  display: block;
  margin: 16px 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

input[type="text"],
textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  resize: vertical;
  margin-top: 6px;
}

textarea:focus,
input:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 1px;
}

.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 16px;
  margin: 16px 0;
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--primary-color);
  background: #eff6ff;
}

.dropzone.has-file {
  border-style: solid;
  border-color: var(--success);
  color: var(--text-primary);
}

button {
  font-family: inherit;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: var(--gradient-primary);
  color: white;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: 10px;
  padding: 13px 20px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 0.08s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.primary:hover:not(:disabled) {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.primary:active:not(:disabled) {
  transform: translateY(0);
}

.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.output-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.output-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.output-card:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.output-card:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.output-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--gradient-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.output-label {
  font-weight: 600;
  font-size: 0.92rem;
}

.status-banner {
  padding: 12px 16px;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid var(--primary-color);
  color: var(--text-primary);
  margin-bottom: 20px;
}

.status-banner.error {
  background: #fef2f2;
  border-color: var(--danger);
  color: #991b1b;
}

.status-banner.success {
  background: #f0fdf4;
  border-color: var(--success);
  color: #166534;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.history-item {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  background: var(--bg-secondary);
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.history-item-title {
  font-weight: 700;
  color: var(--text-primary);
}

.history-item-meta {
  font-size: 0.82rem;
  color: var(--text-light);
  white-space: nowrap;
}

.history-item-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0 0 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-item-text.expanded {
  -webkit-line-clamp: unset;
}

.history-item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.ghost-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.empty-state {
  text-align: center;
  color: var(--text-light);
  padding: 32px 0;
}

.site-footer {
  text-align: center;
  color: var(--text-light);
  padding: 30px 0 50px;
  font-size: 0.85rem;
}

@media (max-width: 520px) {
  .header-row {
    flex-direction: column;
  }
  .tab-nav {
    align-self: stretch;
  }
  .tab-btn {
    flex: 1;
  }
}
