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

:root {
  --bg:       #0d1117;
  --surface:  #161b22;
  --surface2: #21262d;
  --accent:   #1a7f5a;
  --accent2:  #3fb882;
  --gold:     #d4a017;
  --text:     #e6edf3;
  --muted:    #8b949e;
  --border:   #30363d;
  --green:    #3fb882;
  --red:      #f85149;
  --radius:   12px;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

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

/* ── Header ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
}

header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent2), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

header p { color: var(--muted); font-size: 0.9rem; margin-top: 6px; }

main { padding: 32px 0 80px; }

/* ── Sections ── */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent2);
  margin-bottom: 18px;
}

/* ── Profile grid ── */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 12px;
}

@media (max-width: 560px) { .profile-grid { grid-template-columns: 1fr; } }

.profile-note { color: var(--muted); font-size: 0.82rem; }

/* ── Fields ── */
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group label { font-size: 0.85rem; color: var(--muted); }

.input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  padding: 10px 13px;
  width: 100%;
  transition: border-color 0.2s;
  font-family: inherit;
}

.input:focus { outline: none; border-color: var(--accent2); }
textarea.input { resize: vertical; }
.required { color: var(--red); }

/* ── Tabs ── */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.tab-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.83rem;
  padding: 6px 15px;
  transition: all 0.2s;
}

.tab-btn:hover { border-color: var(--accent2); color: var(--text); }
.tab-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ── Dynamic fields ── */
#dynamic-fields { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }

/* ── Buttons ── */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  padding: 13px 28px;
  transition: opacity 0.2s, transform 0.1s;
  width: 100%;
}

.btn-primary:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.88rem;
  padding: 8px 16px;
  transition: border-color 0.2s;
  white-space: nowrap;
}

.btn-secondary:hover { border-color: var(--accent2); }

/* ── Error ── */
#error-msg {
  background: rgba(248, 81, 73, 0.08);
  border: 1px solid rgba(248, 81, 73, 0.3);
  border-radius: 8px;
  color: #ffa198;
  font-size: 0.9rem;
  margin-top: 12px;
  padding: 10px 14px;
}
#error-msg.hidden { display: none; }

/* ── Result box ── */
#result-box { margin-top: 24px; }
#result-box.hidden { display: none; }

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.result-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent2);
}

.word-count {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 8px;
}

.result-actions { display: flex; gap: 8px; }

.result-text {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  font-size: 1rem;
  line-height: 1.85;
  white-space: pre-wrap;
  max-height: 500px;
  overflow-y: auto;
}

.tanya-marker {
  display: inline-block;
  background: rgba(212, 160, 23, 0.15);
  border: 1px solid rgba(212, 160, 23, 0.4);
  border-radius: 6px;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 10px;
  margin: 4px 0;
}

/* ── Pertanyaan cards ── */
.pertanyaan-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-top: 24px;
  margin-bottom: 14px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.pertanyaan-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.pertanyaan-no {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin-bottom: 6px;
}

.pertanyaan-text {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.5;
}

.kisi-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.kisi-text {
  font-size: 0.9rem;
  color: #a8d5b5;
  line-height: 1.65;
}

/* ── History ── */
.history-item {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item:last-child { border-bottom: none; }

.history-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.badge {
  background: rgba(63, 184, 130, 0.1);
  border: 1px solid rgba(63, 184, 130, 0.3);
  border-radius: 4px;
  color: var(--accent2);
  font-size: 0.7rem;
  padding: 2px 8px;
  font-weight: 600;
}

.ts { color: var(--muted); font-size: 0.75rem; }

.history-text {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.history-actions { display: flex; gap: 8px; }

.btn-copy-small, .btn-load-small {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 4px 10px;
  transition: all 0.2s;
}

.btn-copy-small:hover, .btn-load-small:hover { border-color: var(--accent2); color: var(--text); }

.empty-state { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 24px 0; }

#pertanyaan-section.hidden { display: none; }
