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

:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --border: #d1d5db;
  --border-focus: #6366f1;
  --text: #111827;
  --text-secondary: #6b7280;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-active: #4338ca;
  --accent-disabled: #a5b4fc;
  --error: #dc2626;
  --error-bg: #fef2f2;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
}

.container {
  width: 100%;
  max-width: 1100px;
}

header {
  text-align: center;
  margin-bottom: 32px;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.subtitle {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.workspace {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}

.columns {
  display: flex;
  gap: 24px;
}

.column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

textarea {
  width: 100%;
  height: 360px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
  background: #fafafa;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  outline: none;
}

textarea:focus {
  border-color: var(--border-focus);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

textarea[readonly] {
  background: #f9fafb;
  color: var(--text-secondary);
  cursor: default;
}

textarea[readonly]:focus {
  border-color: var(--border);
  box-shadow: none;
}

.actions {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

button {
  padding: 12px 40px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  letter-spacing: 0.01em;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  background: var(--accent-active);
  transform: translateY(0);
}

button:disabled {
  background: var(--accent-disabled);
  cursor: not-allowed;
  transform: none;
}

button.loading {
  position: relative;
  color: transparent;
}

button.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  animation: pulse-label 1.2s ease-in-out infinite;
}

@keyframes pulse-label {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

button.loading::before {
  content: "Summarizing…";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  animation: pulse-label 1.2s ease-in-out infinite;
}

.error {
  font-size: 0.875rem;
  color: var(--error);
  background: var(--error-bg);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: 6px;
  padding: 8px 14px;
  max-width: 480px;
  text-align: center;
}

@media (max-width: 700px) {
  .columns {
    flex-direction: column;
  }

  textarea {
    height: 220px;
  }

  .workspace {
    padding: 20px;
  }

  h1 {
    font-size: 1.5rem;
  }
}
