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

:root {
  --bg-primary: #08080f;
  --bg-secondary: #0e0e1a;
  --bg-elevated: #141425;
  --bg-surface: #1a1a2e;
  --border: #2a2a45;
  --border-focus: #7b5ea7;
  --text-primary: #e8e6f0;
  --text-secondary: #9896a8;
  --text-muted: #6b6980;
  --accent: #7b5ea7;
  --accent-bright: #9b7ec8;
  --accent-glow: rgba(123, 94, 167, 0.3);
  --gold: #c4a240;
  --gold-bright: #e0c060;
  --gold-glow: rgba(196, 162, 64, 0.25);
  --red: #c44040;
  --green: #40c470;
  --font: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
}

html {
  font-size: 15px;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
}

.header {
  padding: 24px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 28px;
  color: var(--accent-bright);
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo h1 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 0.73rem;
  color: var(--text-muted);
  font-weight: 400;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 48px;
}

h2 {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.actions {
  display: flex;
  gap: 8px;
}

.btn {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 8px 20px;
  transition: all 0.15s ease;
  outline: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 16px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-bright);
  box-shadow: 0 0 24px var(--accent-glow);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

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

.btn-sm {
  padding: 4px 12px;
  font-size: 0.78rem;
}

textarea {
  width: 100%;
  min-height: 280px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea::placeholder {
  color: var(--text-muted);
}

.options-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.option-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.select {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-family: var(--font);
  font-size: 0.78rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.select:focus {
  border-color: var(--border-focus);
}

.select option {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.progress-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.progress-bar-container {
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-radius: 3px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px var(--accent-glow);
}

.progress-details {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.progress-details span:empty {
  display: none;
}

.result-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

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

.result-header {
  margin-bottom: 16px;
}

.result-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.character-card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.character-info h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--gold-bright);
  text-shadow: 0 0 12px var(--gold-glow);
}

.character-details {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.separator {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.dps-display {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.dps-main {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.dps-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dps-value {
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: -0.02em;
  text-shadow: 0 0 20px var(--gold-glow);
  font-variant-numeric: tabular-nums;
}

.dps-details {
  display: flex;
  gap: 24px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.dps-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.sim-meta {
  display: flex;
  gap: 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.error-section {
  animation: fadeIn 0.3s ease;
}

.error-content {
  background: rgba(196, 64, 64, 0.08);
  border: 1px solid rgba(196, 64, 64, 0.3);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.error-content h3 {
  font-size: 0.9rem;
  color: var(--red);
  margin-bottom: 8px;
}

.error-content pre {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
}

.log-section {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.log-output {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.hidden {
  display: none !important;
}

@media (max-width: 600px) {
  .dps-value {
    font-size: 2rem;
  }

  .dps-details {
    gap: 16px;
  }

  .character-details {
    flex-wrap: wrap;
  }

  textarea {
    min-height: 200px;
  }
}
