/* Root Variables - Clean, Modern Palette */
:root {
  --color-bg: #fafafa;
  --color-surface: #ffffff;
  --color-border: #e5e5e5;
  --color-text-primary: #171717;
  --color-text-secondary: #737373;
  --color-text-muted: #a3a3a3;
  --color-accent: #000;
  --color-ai: #dc2626;
  --color-ai-bg: #fef2f2;
  --color-ai-border: #fecaca;
  --color-human: #059669;
  --color-human-bg: #f0fdf4;
  --color-human-border: #bbf7d0;
  --radius: 8px;
}

/* Base Styles */
* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* Typography */
h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

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

/* Header */
.hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

/* Hero Section */
.hero {
  margin: 0 0 16px;
  text-align: center;
}

.hero h1 {
  font-size: 1.75rem;
  margin: 0 0 4px;
}

.hero p {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  margin: 0;
}

/* Layout Grid */
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

/* Sections */
section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
}

section h2 {
  margin: 0 0 6px;
}

section .muted {
  display: block;
  margin-bottom: 10px;
}

/* Buttons */
.btn, button {
  padding: 8px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s;
  font-family: inherit;
}

.btn:hover, button:hover {
  opacity: 0.85;
}

.btn-secondary {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-primary);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8125rem;
  transition: background 0.15s;
  font-family: inherit;
}

.btn-secondary:hover {
  background: var(--color-bg);
}

/* Form Elements */
input[type=file] {
  flex: 1;
  padding: 8px;
  font-size: 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  font-family: inherit;
}

/* Code Blocks */
code, pre {
  background: var(--color-bg);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.8125rem;
}

.code {
  font-family: ui-monospace, "SF Mono", Monaco, monospace;
  background: var(--color-bg);
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  max-height: 120px;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--color-text-secondary);
}

/* Try Section */
.try-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}

#file { flex: 1; }

.preview-wrap {
  width: 100%;
  height: 260px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Results */
.result {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}

#summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.badge.ai {
  background: var(--color-ai-bg);
  color: var(--color-ai);
  border-color: var(--color-ai-border);
}

.badge.human {
  background: var(--color-human-bg);
  color: var(--color-human);
  border-color: var(--color-human-border);
}

.kv {
  color: var(--color-text-secondary);
  font-size: 0.75rem;
}

.scorebar {
  height: 4px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}

.scorebar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--color-ai), #f59e0b);
  width: 0%;
  transition: width 300ms ease;
}

/* API Section Header */
.api .hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 10px;
  padding: 0;
  border: none;
}

/* Footer */
footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  text-align: center;
  font-size: 0.8125rem;
}

footer a {
  color: var(--color-text-secondary);
  text-decoration: none;
}

footer a:hover {
  color: var(--color-text-primary);
}

/* Responsive Design */
@media (max-width: 768px) {
  .row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .preview-wrap {
    height: 200px;
  }
}
