/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0f0e0c;
  --bg-surface: #1a1815;
  --bg-elevated: #242019;
  --bg-card: #1e1b16;
  --border: #3a3428;
  --border-light: #2e2920;
  --text: #e8e0d0;
  --text-muted: #9a8f7a;
  --text-dim: #6b6150;
  --accent: #c8a96e;
  --accent-hover: #d4b97e;
  --accent-dim: #8a7040;
  --success: #7ab87a;
  --warning: #d4a855;
  --danger: #c96a5e;
  --mint: #5ecf7a;
  --nearmint: #7ab87a;
  --good: #d4b855;
  --fair: #c98a4a;
  --poor: #c96a5e;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
img, svg { max-width: 100%; height: auto; }

/* ===== Header ===== */
.site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
}
.logo:hover { text-decoration: none; color: var(--text); }
.logo-icon { color: var(--accent); }
.logo-accent { color: var(--accent); }
.site-nav ul {
  list-style: none;
  display: flex;
  gap: 20px;
}
.site-nav a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}
.site-nav a:hover { color: var(--accent); }

/* ===== Hero ===== */
.hero-section {
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg) 100%);
  padding: 60px 20px 40px;
  text-align: center;
}
.hero-content { max-width: 640px; margin: 0 auto; }
.hero-section h1 {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
  color: var(--text);
}
.hero-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
}
.stat { display: flex; flex-direction: column; align-items: center; }
.stat-num { font-size: 1.6rem; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--text-dim); margin-top: 2px; }

/* ===== Section Titles ===== */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.section-desc {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 0.95rem;
}

/* ===== Grader Section ===== */
.grader-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}
.grader-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: start;
}

/* ===== Category Grid ===== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}
.category-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
  font-family: var(--font);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.category-card:hover { border-color: var(--accent-dim); background: var(--bg-elevated); }
.category-card.active { border-color: var(--accent); background: var(--bg-elevated); box-shadow: 0 0 0 2px rgba(200,169,110,0.2); }
.category-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cat-icon { font-size: 1.8rem; }
.cat-name { font-weight: 600; font-size: 0.95rem; }
.cat-desc { font-size: 0.8rem; color: var(--text-dim); }

/* ===== Grade Tiers ===== */
.grading-area { display: none; }
.grading-area.visible { display: block; }
.grade-reference { margin-bottom: 28px; }
.grade-reference h3 { font-size: 1.1rem; margin-bottom: 16px; color: var(--text-muted); }
.grade-tiers { display: flex; flex-direction: column; gap: 8px; }
.grade-tier {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.grade-badge {
  min-width: 60px;
  text-align: center;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.grade-badge.mint { background: rgba(94,207,122,0.15); color: var(--mint); }
.grade-badge.nearmint { background: rgba(122,184,122,0.15); color: var(--nearmint); }
.grade-badge.good { background: rgba(212,184,85,0.15); color: var(--good); }
.grade-badge.fair { background: rgba(201,138,74,0.15); color: var(--fair); }
.grade-badge.poor { background: rgba(201,106,94,0.15); color: var(--poor); }
.grade-info { flex: 1; }
.grade-info dt { font-weight: 600; font-size: 0.95rem; }
.grade-info dd { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

/* ===== Checklist ===== */
.checklist-area { margin-bottom: 28px; }
.checklist-area h3 { font-size: 1.1rem; margin-bottom: 16px; }
.checklist-group {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.checklist-group-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 12px;
  color: var(--accent);
}
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.checklist-item label {
  font-size: 0.9rem;
  cursor: pointer;
  flex: 1;
}
.checklist-item label .detail {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary {
  background: var(--accent);
  color: var(--bg);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); color: var(--text); }
.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ===== Result ===== */
.result-area { margin-top: 24px; }
.result-area.hidden { display: none; }
.result-card {
  background: var(--bg-card);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.result-grade {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.result-grade.mint { color: var(--mint); }
.result-grade.nearmint { color: var(--nearmint); }
.result-grade.good { color: var(--good); }
.result-grade.fair { color: var(--fair); }
.result-grade.poor { color: var(--poor); }
.result-details {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.result-notes {
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  margin-bottom: 16px;
  line-height: 1.5;
}
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Sidebar ===== */
.grader-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 72px;
}
.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.sidebar-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--accent);
}
.saved-list { display: flex; flex-direction: column; gap: 8px; }
.saved-entry {
  padding: 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.saved-entry .se-grade {
  font-weight: 700;
  font-size: 1rem;
}
.saved-entry .se-cat { color: var(--text-dim); font-size: 0.8rem; }
.saved-entry .se-date { color: var(--text-dim); font-size: 0.75rem; }
.tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tips-list li {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-left: 16px;
  position: relative;
}
.tips-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent-dim);
}
.empty-state {
  color: var(--text-dim);
  font-size: 0.85rem;
  font-style: italic;
}

/* ===== Guide Section ===== */
.guide-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}
.guide-content p {
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.7;
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 24px;
}
.guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.guide-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--accent);
}
.guide-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.guide-card li {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.guide-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.grade-definitions dt {
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 12px;
}
.grade-definitions dd {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
  margin-left: 0;
}

/* ===== FAQ Section ===== */
.faq-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 60px;
}
.faq-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 24px;
}
.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.faq-item summary {
  padding: 16px 20px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  color: var(--accent);
  transition: transform 0.2s;
}
.faq-item[open] summary::after { content: "−"; }
.faq-item summary:hover { background: var(--bg-elevated); }
.faq-item p {
  padding: 0 20px 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 40px 20px;
  margin-top: 40px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.footer-brand .logo-text { font-size: 1.1rem; font-weight: 700; }
.footer-tagline { font-size: 0.85rem; color: var(--text-dim); }
.footer-links {
  display: flex;
  gap: 20px;
}
.footer-links a { font-size: 0.85rem; color: var(--text-muted); }
.footer-links a:hover { color: var(--accent); }
.footer-note { font-size: 0.8rem; color: var(--text-dim); }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .grader-layout { grid-template-columns: 1fr; }
  .grader-sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
  .sidebar-card { flex: 1; min-width: 250px; }
  .guide-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .hero-section h1 { font-size: 1.6rem; }
  .hero-stats { gap: 24px; }
  .category-grid { grid-template-columns: 1fr 1fr; }
  .guide-grid { grid-template-columns: 1fr; }
  .faq-grid { grid-template-columns: 1fr; }
  .grade-tier { flex-direction: column; gap: 8px; }
  .site-nav ul { gap: 12px; }
  .site-nav a { font-size: 0.8rem; }
}
@media (max-width: 480px) {
  .category-grid { grid-template-columns: 1fr; }
  .header-inner { padding: 0 12px; }
  .hero-section { padding: 40px 12px 28px; }
  .grader-section { padding: 24px 12px; }
}

/* ===== Print ===== */
@media print {
  .site-header, .site-footer, .grader-sidebar, .hero-section, .form-actions, .result-actions { display: none; }
  body { background: #fff; color: #000; }
  .result-card { border: 2px solid #000; background: #fff; }
  .grade-tier { border: 1px solid #ccc; }
}

/* ===== Focus Visible ===== */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }


/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
