:root {
  --bg: #f4f0e8;
  --surface: #ffffff;
  --border: #e0d8cc;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --green: #2c5f2e;
  --green-light: #e8f0e8;
  --amber: #d97706;
  --red: #dc2626;
  --blue: #1d4ed8;
  --gold: #f59e0b;
  --silver: #94a3b8;
  --bronze: #b45309;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* Layout */
.container { max-width: 860px; margin: 0 auto; padding: 0 20px; }

header {
  background: var(--green);
  color: white;
  padding: 16px 0;
}
header .container { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
header h1 { font-size: 1.25rem; font-weight: 600; }
header nav a { color: rgba(255,255,255,0.85); text-decoration: none; margin-left: 20px; font-size: 0.875rem; }
header nav a:hover { color: white; }
header nav a.active { color: white; font-weight: 700; border-bottom: 2px solid rgba(255,255,255,0.8); padding-bottom: 2px; }
.lang-toggle { background: rgba(255,255,255,0.15); color: white; border: 1px solid rgba(255,255,255,0.4); border-radius: 4px; padding: 3px 10px; font-size: 0.8rem; font-weight: 600; cursor: pointer; margin-left: 12px; line-height: 1.4; }
.lang-toggle:hover { background: rgba(255,255,255,0.28); }

main { padding: 32px 0 64px; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 16px; color: var(--green); }
.card h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 10px; }

/* Forms */
.form-group { margin-bottom: 18px; }
label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 6px; color: var(--text); }
label span.hint { font-weight: 400; color: var(--text-muted); margin-left: 6px; }

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s;
}
input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(44,95,46,0.12);
}
textarea { resize: vertical; min-height: 120px; }
textarea.memo { min-height: 280px; font-family: monospace; font-size: 0.875rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  -webkit-appearance: none;
  appearance: none;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--green); color: white; }
.btn-primary:hover:not(:disabled) { opacity: 0.9; }
.btn-secondary { background: var(--green-light); color: var(--green); border: 1px solid var(--green); }
.btn-danger { background: var(--red); color: white; }
.btn-sm { padding: 6px 14px; font-size: 0.8125rem; }

/* Score bar */
.score-section { margin-bottom: 24px; }
.score-total { font-size: 3rem; font-weight: 700; color: var(--green); line-height: 1; }
.score-label { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 12px; }

.bar-wrap { background: #e5e7eb; border-radius: 999px; height: 12px; overflow: hidden; margin-bottom: 4px; }
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--amber), var(--green));
  width: 0%;
  transition: width 1s ease-out;
}
.bar-label { display: flex; justify-content: space-between; font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 12px; }
.bar-label strong { color: var(--text); }

/* Feedback cards */
.feedback-grid { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .feedback-grid { grid-template-columns: 1fr; } }

.feedback-card {
  border-radius: var(--radius);
  padding: 16px;
  border-left: 4px solid;
}
.feedback-card.strengths { border-color: var(--green); background: var(--green-light); }
.feedback-card.missing { border-color: var(--amber); background: #fef3c7; }
.feedback-card.risks { border-color: var(--red); background: #fee2e2; }
.feedback-card.next { border-color: var(--blue); background: #eff6ff; grid-column: 1 / -1; }

.feedback-card h3 { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.feedback-card.strengths h3 { color: var(--green); }
.feedback-card.missing h3 { color: var(--amber); }
.feedback-card.risks h3 { color: var(--red); }
.feedback-card.next h3 { color: var(--blue); }

.feedback-card ul { padding-left: 18px; }
.feedback-card li { margin-bottom: 4px; font-size: 0.9rem; }
.feedback-card p { font-size: 0.9rem; }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-pending { background: #f3f4f6; color: #6b7280; }
.badge-processing { background: #dbeafe; color: var(--blue); }
.badge-complete { background: #dcfce7; color: #15803d; }
.badge-error { background: #fee2e2; color: var(--red); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { background: var(--green); color: white; padding: 10px 14px; text-align: left; font-weight: 600; font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* Leaderboard special rows */
tr.rank-1 td { background: #fef9ee; }
tr.rank-2 td { background: #f8fafc; }
tr.rank-3 td { background: #fdf6ee; }
.medal { font-size: 1.1rem; margin-right: 4px; }
.award-tag { font-size: 0.75rem; background: #fef3c7; color: #92400e; padding: 2px 6px; border-radius: 4px; margin-left: 6px; font-weight: 600; }

/* Spinner */
.spinner-wrap { text-align: center; padding: 40px; color: var(--text-muted); }
.spinner {
  display: inline-block;
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  box-shadow: var(--shadow-md);
  animation: slide-in 0.2s ease;
  max-width: 320px;
}
@keyframes slide-in { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.toast-error { background: #fee2e2; color: var(--red); border: 1px solid #fca5a5; }
.toast-info { background: #dbeafe; color: var(--blue); border: 1px solid #93c5fd; }

/* Round 1 banner */
.round-banner {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  padding: 20px 24px;
  text-align: center;
  margin-bottom: 24px;
}
.round-banner h2 { color: var(--amber); font-size: 1.1rem; margin-bottom: 6px; }
.round-banner p { color: #92400e; font-size: 0.9rem; }

/* History timeline */
.timeline { position: relative; padding-left: 32px; }
.timeline::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 24px; }
.timeline-dot {
  position: absolute;
  left: -26px;
  top: 4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--green);
}
.timeline-dot.pending { background: #9ca3af; box-shadow: 0 0 0 2px #9ca3af; }
.timeline-dot.error { background: var(--red); box-shadow: 0 0 0 2px var(--red); }

/* Refresh bar */
.refresh-bar { display: flex; align-items: center; gap: 12px; font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 16px; }
.refresh-bar button { padding: 4px 10px; font-size: 0.8125rem; }

/* Util */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.hidden { display: none; }
.links { margin-top: 16px; display: flex; gap: 16px; flex-wrap: wrap; }
.links a { color: var(--green); text-decoration: none; font-size: 0.875rem; }
.links a:hover { text-decoration: underline; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-header h1 { font-size: 1.5rem; font-weight: 700; }
