@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --surface2: #f1f3f5;
  --border: #e9ecef;
  --border2: #dee2e6;
  --text: #212529;
  --muted: #868e96;
  --accent: #6366f1;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 12px;
  --radius-sm: 8px;
  --font-b: 'Inter', sans-serif;
  --font-m: 'DM Mono', monospace;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-b); background: var(--bg); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); }
h3 { font-size: clamp(1.05rem, 2vw, 1.25rem); }
.mono { font-family: var(--font-m); }
.muted { color: var(--muted); }
a { color: var(--accent); text-decoration: none; }

.container    { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 600px;  margin: 0 auto; padding: 0 24px; }

nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow);
}
.nav-logo  { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.nav-right { display: flex; align-items: center; gap: 12px; font-size: 0.85rem; color: var(--muted); }
.nav-credits { font-family: var(--font-m); font-size: 0.8rem; color: var(--accent); font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius);
  font-family: var(--font-b); font-weight: 600; font-size: 0.9rem;
  cursor: pointer; border: none; text-decoration: none; transition: all 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(99,102,241,0.3); }
.btn-primary:hover { background: #4f46e5; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border2); }
.btn-ghost:hover { background: var(--surface2); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }
.w-full { width: 100%; justify-content: center; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow);
}
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 0.78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
input, textarea, select {
  background: var(--surface); border: 1.5px solid var(--border2);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 10px 14px; font-family: var(--font-b); font-size: 0.95rem;
  width: 100%; outline: none; transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
textarea { min-height: 100px; resize: vertical; }
input[type="file"] { display: none; }

.upload-zone {
  border: 2px dashed var(--border2); border-radius: var(--radius);
  padding: 36px; text-align: center; cursor: pointer;
  transition: all 0.2s; background: var(--surface2);
}
.upload-zone:hover { border-color: var(--accent); background: rgba(99,102,241,0.04); }

.diff-group { display: flex; gap: 10px; }
.diff-btn {
  flex: 1; padding: 12px; border-radius: var(--radius);
  border: 1.5px solid var(--border2); background: var(--surface);
  color: var(--muted); cursor: pointer; text-align: center;
  transition: all 0.15s; font-family: var(--font-b); font-weight: 600; font-size: 0.85rem;
}
.diff-btn:hover { border-color: var(--accent); color: var(--text); }
.diff-btn.active[data-l="mild"] { border-color: var(--success); color: var(--success); background: rgba(34,197,94,0.06); }
.diff-btn.active[data-l="easy"] { border-color: var(--accent); color: var(--accent); background: rgba(99,102,241,0.06); }
.diff-btn.active[data-l="hard"] { border-color: var(--danger); color: var(--danger); background: rgba(239,68,68,0.06); }

.score-ring {
  width: 120px; height: 120px; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--surface2) 0);
  display: flex; align-items: center; justify-content: center;
  position: relative; margin: 0 auto 24px;
}
.score-ring::before { content: ''; position: absolute; width: 88px; height: 88px; background: var(--surface); border-radius: 50%; }
.score-value { position: relative; z-index: 1; font-weight: 800; font-size: 1.8rem; color: var(--text); }

.answer-review { border-left: 3px solid var(--border2); padding-left: 16px; margin-bottom: 20px; }
.answer-review.good { border-color: var(--success); }
.answer-review.ok   { border-color: var(--accent); }
.answer-review.poor { border-color: var(--danger); }

.loading-dots { display: flex; gap: 6px; align-items: center; }
.loading-dots span { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; animation: dot 1.4s infinite; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot { 0%,80%,100% { opacity:0.3; transform:scale(0.8); } 40% { opacity:1; transform:scale(1); } }

.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 14px 20px; font-size: 0.88rem;
  max-width: 320px; transform: translateY(80px); opacity: 0;
  transition: all 0.3s; pointer-events: none;
  box-shadow: var(--shadow-md);
}
.toast.show  { transform: translateY(0); opacity: 1; }
.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger); }
