*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f0f0f;
  --bg-surface: #1a1a1a;
  --bg-card: #1f1f1f;
  --bg-input: #161616;
  --border: #2e2e2e;
  --border-light: #3a3a3a;
  --text-primary: #f0ede8;
  --text-secondary: #b3cde0;
  --text-muted: #d6b575;
  --accent: #e8d5a3;
  --accent-dim: rgba(232, 213, 163, 0.12);
  --accent-border: rgba(232, 213, 163, 0.3);
  --green: #6fcf97;
  --green-dim: rgba(111, 207, 151, 0.1);
  --red: #eb5757;
  --font-body: "IBM Plex Sans Vietnamese", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --radius: 6px;
  --radius-lg: 10px;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
}

.screen {
  display: none;
  height: 100vh;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

/* ── UPLOAD SCREEN ── */
.upload-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}

.upload-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--accent);
  border: 1px solid var(--accent-border);
  padding: 4px 14px;
  border-radius: 100px;
  margin-bottom: 2rem;
  display: inline-block;
}

.upload-hero h1 {
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.upload-hero h1 .accent {
  color: var(--accent);
}

.upload-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 520px;
  border: 1.5px dashed var(--border-light);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s;
  background: var(--bg-surface);
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.upload-icon {
  color: var(--accent);
  opacity: 0.8;
}

.upload-label {
  font-size: 15px;
  color: var(--text-primary);
}

.upload-label strong {
  color: var(--accent);
}

.upload-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  line-height: 1.8;
}

.upload-error {
  margin-top: 1rem;
  font-size: 13px;
  color: var(--red);
  background: rgba(235, 87, 87, 0.08);
  border: 1px solid rgba(235, 87, 87, 0.25);
  padding: 10px 16px;
  border-radius: var(--radius);
  max-width: 520px;
}

.storage-banner {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  padding: 10px 16px;
  border-radius: var(--radius);
  max-width: 520px;
  flex-wrap: wrap;
}

.btn-inline {
  background: var(--accent);
  color: #0f0f0f;
  border: none;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  transition: opacity 0.15s;
}

.btn-inline:hover {
  opacity: 0.85;
}

.btn-inline.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

/* ── TOPBAR ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 52px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--accent);
  border: 1px solid var(--accent-border);
  padding: 3px 10px;
  border-radius: 100px;
}

.topbar-filename {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s;
}

.btn-icon:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
}

.btn-icon.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0f0f0f;
  font-weight: 600;
}

.btn-icon.btn-primary:hover {
  opacity: 0.9;
  color: #0f0f0f;
}

/* ── PROGRESS ── */
.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.progress-bar-track {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── CONTENT ── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.field-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.65;
  padding: 10px 14px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}

.field-textarea:focus {
  border-color: var(--border-light);
}

/* ── QA GRID ── */
.qa-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 900px) {
  .qa-grid {
    grid-template-columns: 1fr;
  }
}

/* ── RATING GRID ── */
.rating-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 900px) {
  .rating-grid {
    grid-template-columns: 1fr;
  }
}

.rating-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rating-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rating-tag {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}

.tag-consistency {
  background: rgba(111, 207, 151, 0.12);
  color: #6fcf97;
  border: 1px solid rgba(111, 207, 151, 0.25);
}

.tag-fluency {
  background: rgba(86, 204, 242, 0.1);
  color: #56ccf2;
  border: 1px solid rgba(86, 204, 242, 0.2);
}

.tag-correctness {
  background: rgba(232, 213, 163, 0.12);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.rating-title {
  font-weight: 600;
  font-size: 15px;
}

.rating-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.score-row {
  display: flex;
  gap: 6px;
}

.score-btn {
  flex: 1;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.score-btn:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
}

.score-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0f0f0f;
}

.score-btn[data-val="0"].active {
  background: var(--text-muted);
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.score-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  min-height: 16px;
  line-height: 1.5;
}

/* ── NAV BAR ── */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0 0.5rem;
  gap: 12px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.nav-btn:hover:not(:disabled) {
  border-color: var(--border-light);
  color: var(--text-primary);
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.nav-btn-next {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
}

.nav-btn-next:hover:not(:disabled) {
  background: rgba(232, 213, 163, 0.2);
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}

.nav-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.nav-sample-info {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.goto-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 5px 10px;
  outline: none;
  cursor: pointer;
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 999;
  animation: toast-in 0.25s ease;
  font-family: var(--font-mono);
}

.toast.success {
  border-color: rgba(111, 207, 151, 0.4);
  color: var(--green);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hidden {
  display: none !important;
}
