/* ==========================================================================
   Soal & Kunci Paket A — XI Akuntansi (Ultra-Simple, Anti-AI-Slop, Mobile-First)
   ========================================================================== */

:root {
  --bg-canvas: #f6f4ef;
  --bg-sheet: #ffffff;
  --bg-subtle: #ede9df;
  --bg-hover: #faf8f4;
  --ink: #181816;
  --ink-2: #59554d;
  --ink-muted: #7d786e;
  --line: #e2ddd3;
  --line-strong: #c9c2b4;

  --accent: #14453d;
  --accent-hover: #0e332d;

  --key-bg: #ecf7f0;
  --key-border: #1e7e50;
  --key-ink: #125c39;

  --warn-bg: #fdf5e6;
  --warn-border: #d9a75a;
  --warn-ink: #7a490a;

  --mark-bg: #fff0a8;

  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg-canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(246, 244, 239, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.brand-title {
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg-subtle);
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b58328;
}

.status-dot.is-live {
  background: #1e7e50;
}

/* Session Drawer */
.session-drawer {
  border-top: 1px solid var(--line);
  background: var(--bg-sheet);
}

.session-drawer-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 12px 14px 14px;
}

.session-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.session-form .input {
  flex: 1 1 240px;
  min-height: 38px;
  font-size: 13px;
}

.session-subrow {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.upload-har-link {
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.session-feedback {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  background: #fdf0ee;
  color: #8f2318;
}

.session-feedback.is-ok {
  background: var(--key-bg);
  color: var(--key-ink);
}

/* Buttons & Inputs */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-sm {
  min-height: 36px;
  padding: 0 11px;
  font-size: 12.5px;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-outline {
  background: var(--bg-sheet);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-outline:hover {
  background: var(--bg-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
}

.input,
.select-input {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg-sheet);
  font-size: 14px;
}

.input:focus,
.select-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

/* Main Container */
.main-wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 16px 14px 72px;
}

/* Simple Controls Bar */
.controls-bar {
  background: var(--bg-sheet);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.field-label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-2);
}

.search-row {
  display: flex;
  gap: 8px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-input-wrap .input {
  padding-right: 34px;
}

.search-input-wrap .input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.clear-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

/* Progress & Meta */
.progress-box {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--bg-sheet);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.progress-top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 7px;
}

.progress-track {
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.sheet-meta-bar {
  margin: 14px 2px 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.meta-line {
  font-size: 13px;
  color: var(--ink-2);
}

/* Missing / Offline Notice Box */
.missing-box {
  margin-bottom: 14px;
  padding: 18px 16px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 10px;
  color: var(--warn-ink);
}

.missing-box h2 {
  margin: 0 0 6px;
  font-size: 16px;
}

.missing-box p {
  margin: 0 0 12px;
  font-size: 13.5px;
}

.inline-connect-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-connect-form .input {
  flex: 1 1 240px;
}

/* Questions List (Ruled Editorial Sheet) */
.question-sheet {
  background: var(--bg-sheet);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.question-item {
  padding: 18px 16px;
  border-bottom: 1px solid var(--line);
}

.question-item:last-child {
  border-bottom: 0;
}

.question-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.question-head-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.soal-no {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-subtle);
}

.kunci-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 4px;
  background: var(--key-bg);
  color: var(--key-ink);
  border: 1px solid rgba(30, 126, 80, 0.28);
}

.mapel-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.copy-btn {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}

.copy-btn:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.question-stem {
  max-width: 72ch;
  font-size: 15.5px;
  line-height: 1.62;
  overflow-wrap: anywhere;
}

.question-stem p:first-child {
  margin-top: 0;
}

.question-stem p:last-child {
  margin-bottom: 0;
}

.question-stem img,
.option-images img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--line);
  margin-top: 8px;
}

.question-audio {
  margin-top: 10px;
}

.question-audio audio {
  width: 100%;
  max-width: 400px;
}

.options-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 72ch;
}

.option-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-hover);
}

.option-row.is-correct {
  background: var(--key-bg);
  border: 1.5px solid var(--key-border);
}

.option-letter {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--bg-sheet);
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 1px;
}

.option-row.is-correct .option-letter {
  background: var(--key-ink);
  border-color: var(--key-ink);
  color: #ffffff;
}

.option-content {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.option-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.option-correct-label {
  align-self: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--key-ink);
  white-space: nowrap;
}

.kunci-only-note {
  margin: 2px 0 0;
  font-size: 13.5px;
  color: var(--ink-2);
}

.empty-msg {
  padding: 32px 18px;
  text-align: center;
  color: var(--ink-2);
  font-size: 14px;
}

mark {
  background: var(--mark-bg);
  color: var(--ink);
  padding: 0 2px;
  border-radius: 2px;
}

.top-float-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 45;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(24, 24, 22, 0.16);
  cursor: pointer;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 80;
  padding: 9px 15px;
  border-radius: 999px;
  background: var(--ink);
  color: #ffffff;
  font-size: 13px;
}

@media (min-width: 760px) {
  .topbar-inner,
  .session-drawer-inner,
  .main-wrap {
    padding-left: 22px;
    padding-right: 22px;
  }

  .controls-bar {
    grid-template-columns: 1fr 1.2fr;
    align-items: end;
    gap: 14px;
    padding: 16px 18px;
  }

  .question-item {
    padding: 22px 24px;
  }
}

@media (max-width: 560px) {
  .search-row {
    flex-direction: column;
  }

  .search-row .btn {
    width: 100%;
  }

  .option-row {
    flex-wrap: wrap;
  }

  .option-correct-label {
    width: 100%;
    padding-left: 35px;
  }
}
