*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}
body {
  font-family: "Inter", system-ui, sans-serif;
  background: #f6fafc;
  color: #0b1c26;
  min-height: 100vh;
  -webkit-tap-highlight-color: rgba(14, 116, 144, 0.15);
}
body.center {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0e7490;
}

/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0b1c26;
  color: #eaf2f8;
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-title {
  font-weight: 600;
  font-size: 14px;
}
.topbar a {
  color: #eaf2f8;
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.topbar a:hover {
  opacity: 1;
}

/* Container */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 32px;
}
.container-wide {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 32px;
}

/* Card */
.card {
  background: #fff;
  border: 1px solid rgba(11, 28, 38, 0.1);
  border-radius: 8px;
  padding: 24px;
  margin: 16px 0;
}

/* Section 2-column: kiri soal | kanan jawaban */
.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.section-grid .card {
  margin-top: 0;
}

/* Typography */
h1 {
  font-size: 36px;
  font-weight: 600;
  color: #0b1c26;
  letter-spacing: -1px;
  line-height: 1.1;
  text-wrap: balance;
}
h2 {
  font-size: 22px;
  font-weight: 600;
  color: #0b1c26;
  letter-spacing: -0.5px;
}
p {
  line-height: 1.6;
  color: rgba(11, 28, 38, 0.72);
}

/* Focus Visible */
*:focus-visible {
  outline: 2px solid #0e7490;
  outline-offset: 2px;
  border-radius: 4px;
}
input:focus-visible,
textarea:focus-visible {
  border-color: #0e7490;
}

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* List Items */
.list {
  border-top: 1px solid rgba(11, 28, 38, 0.06);
}
.list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid rgba(11, 28, 38, 0.06);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
  touch-action: manipulation;
}
.list-item:hover {
  background: rgba(14, 116, 144, 0.04);
  margin: 0 -12px;
  padding: 20px 12px;
  border-radius: 8px;
}
.list-icon {
  width: 44px;
  height: 44px;
  background: #0e7490;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
}
.list-icon.done {
  background: #065666;
}
.list-content {
  flex: 1;
  min-width: 0;
}
.list-title {
  font-size: 18px;
  font-weight: 600;
  color: #0b1c26;
}
.list-title.done {
  color: #065666;
}
.list-desc {
  font-size: 13px;
  color: #5b7a90;
}
.list-desc.done {
  color: #065666;
}
.list-arrow {
  color: #5b7a90;
  font-size: 18px;
}
.list-check {
  color: #065666;
  font-size: 20px;
}

/* Progress */
.progress {
  margin-top: 8px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.progress-bar {
  flex: 1;
  height: 6px;
  background: #e8eff4;
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: #0e7490;
  border-radius: 3px;
  transition: width 0.4s;
}
.progress-text {
  font-size: 13px;
  color: #5b7a90;
  font-variant-numeric: tabular-nums;
}

/* Forms */
label {
  display: block;
  margin-top: 14px;
  font-size: 12px;
  font-weight: 600;
  color: #5b7a90;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
input,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid rgba(11, 28, 38, 0.1);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  margin-top: 6px;
  transition: border-color 0.2s;
  background: #fff;
}
input:focus,
textarea:focus {
  border-color: #0e7490;
}
textarea {
  resize: vertical;
  line-height: 1.7;
}

/* Buttons */
button {
  background: #0e7490;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  transition: background 0.15s;
  touch-action: manipulation;
}
button:hover {
  background: #155e75;
}
button:active {
  background: #164e63;
}
button:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}
.btn-rec {
  background: #c62828;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-rec:hover {
  background: #a51f1f;
}
.btn-rec.recording {
  animation: pulse 1s ease-in-out infinite;
}
.btn-stop {
  background: #334155;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-stop:hover {
  background: #1e293b;
}
.btn-danger {
  background: rgba(234, 242, 248, 0.1);
  color: #eaf2f8;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(234, 242, 248, 0.15);
  transition: background 0.2s;
  touch-action: manipulation;
}
.btn-danger:hover {
  background: rgba(234, 242, 248, 0.2);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* Status */
.ok {
  color: #065666;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ok::before {
  content: "\2713";
  background: #065666;
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}
.err {
  color: #c62828;
  background: #fef2f2;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  border: 1px solid #fecaca;
}
.hint {
  font-size: 12px;
  color: #5b7a90;
}

/* Timer */
#timer {
  font-size: 16px;
  font-weight: 700;
  color: #0b1c26;
  background: #e8eff4;
  padding: 12px 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  min-width: 68px;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
#timer.recording {
  background: #fef2f2;
  color: #c62828;
  animation: pulse 1s ease-in-out infinite;
}
#timer.over {
  background: #c62828;
  color: #fff;
  animation: none;
}

/* Recording Indicator */
.rec-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 12px;
}
.rec-indicator.active {
  background: #fef2f2;
  color: #c62828;
}
.rec-indicator.active::before {
  content: "";
  width: 10px;
  height: 10px;
  background: #c62828;
  border-radius: 50%;
  animation: pulse 1s ease-in-out infinite;
}
.rec-indicator.done {
  background: #ecfdf5;
  color: #065666;
}
.rec-indicator.done::before {
  content: "\2713";
  background: #065666;
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

/* Login */
.login-card {
  width: 440px;
  padding: 48px 40px;
}
.login-card h1 {
  text-align: center;
  margin-bottom: 4px;
}
.login-card .subtitle {
  text-align: center;
  color: #5b7a90;
  font-size: 14px;
  margin-bottom: 32px;
}

/* Listening */
.audio-card {
  text-align: center;
}
.audio-player {
  width: 100%;
  margin-bottom: 12px;
  border-radius: 8px;
}
.play-limit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}
.play-limit-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e8eff4;
  color: #0b1c26;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(11, 28, 38, 0.1);
}
.play-limit-badge.warning {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
.play-limit-badge.danger {
  background: #fef2f2;
  color: #c62828;
  border-color: #fecaca;
}
.play-dots {
  display: flex;
  gap: 5px;
}
.play-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #0e7490;
  transition: background 0.2s;
}
.play-dot.used {
  background: #e8eff4;
}
.teks-content {
  font-size: 16px;
  line-height: 2;
  color: #0b1c26;
  text-align: justify;
}
.teks-content p {
  margin-bottom: 20px;
  color: #0b1c26;
}
.teks-content .soal-input {
  width: 140px;
  font-size: 16px;
  border: none;
  border-bottom: 2px solid #5b7a90;
  background: transparent;
  text-align: center;
  font-weight: 600;
  color: #0e7490;
  padding: 2px 4px;
  margin: 0 4px;
  border-radius: 0;
}
.teks-content .soal-input:focus {
  border-bottom-color: #0e7490;
  background: rgba(14, 116, 144, 0.04);
}
.teks-content .soal-sentence {
  width: calc(100% - 8px);
  text-align: left;
  font-weight: 400;
  color: #0b1c26;
  margin: 4px 0;
  padding: 6px 8px;
  border-bottom-width: 2px;
}
.teks-content .soal-sentence:focus {
  background: rgba(14, 116, 144, 0.04);
}
.writing-para p {
  line-height: 1.9;
  text-align: left;
}
.teks-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.teks-title span {
  background: #0e7490;
  color: #fff;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Media */
.teks-gambar {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(11, 28, 38, 0.1);
  cursor: zoom-in;
}
.teks-baca {
  font-size: 16px;
  line-height: 1.8;
  color: #0b1c26;
}
audio,
video {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 8px;
}

/* Image Zoom Button */
.img-zoom-btn {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  cursor: zoom-in;
  border: 1px solid rgba(11, 28, 38, 0.1);
  background: none;
  padding: 0;
  margin: 0;
  display: block;
  width: 100%;
  text-align: left;
}
.img-zoom-btn img {
  width: 100%;
  display: block;
  transition: transform 0.2s;
}
.img-zoom-btn:hover img {
  transform: scale(1.01);
}
.img-zoom-btn.zoomed {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  background: rgba(11, 28, 38, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  padding: 20px;
  border: none;
}
.img-zoom-btn.zoomed img {
  max-width: 95%;
  max-height: 90vh;
  border-radius: 8px;
}

/* Record Box */
.record-box {
  text-align: center;
  padding: 20px 0;
}
.record-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.record-controls button {
  margin-top: 0;
}

/* Preview */
.preview-wrapper {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(11, 28, 38, 0.1);
}
.preview-wrapper video {
  width: 100%;
  display: block;
}
.preview-label {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #0b1c26;
  color: #eaf2f8;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Writing Hint */
.writing-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #e8eff4;
  color: #0b1c26;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  border: 1px solid rgba(11, 28, 38, 0.06);
}

/* Writing Fill-in-Paragraph */

/* Counter */
.char-counter {
  font-size: 12px;
  color: #5b7a90;
  text-align: right;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* Admin Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0;
  flex-wrap: wrap;
}
.tabs a {
  padding: 12px 20px;
  background: #e8eff4;
  border-radius: 8px 8px 0 0;
  text-decoration: none;
  color: #5b7a90;
  font-weight: 600;
  font-size: 14px;
  transition:
    background 0.15s,
    color 0.15s;
  position: relative;
}
.tabs a.active {
  background: #fff;
  color: #0b1c26;
  border-bottom: 3px solid #0e7490;
}
.tabs a:hover:not(.active) {
  background: #cbd5e1;
}

/* Admin Section Block */
.section-block {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  border: 1px solid rgba(11, 28, 38, 0.1);
  margin-bottom: 16px;
}
.section-block h2 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
  color: #0b1c26;
  padding-bottom: 12px;
  border-bottom: 2px solid #e8eff4;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-block h2::before {
  content: "";
  width: 4px;
  height: 18px;
  background: #0e7490;
  border-radius: 2px;
}

/* Nilai Grid */
.nilai-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 16px;
}
.nilai-grid label {
  font-size: 12px;
  font-weight: 700;
  color: #5b7a90;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0;
}
.nilai-grid input {
  width: 100%;
  padding: 12px;
  border: 2px solid rgba(11, 28, 38, 0.1);
  border-radius: 8px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  color: #0e7490;
  font-variant-numeric: tabular-nums;
}
.nilai-grid input:focus {
  border-color: #0e7490;
}

/* Total Score */
.total-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #e8eff4;
  border-radius: 8px;
  padding: 14px 18px;
  margin-top: 16px;
  border: 1px solid rgba(11, 28, 38, 0.06);
}
.total-score .label {
  font-size: 14px;
  font-weight: 600;
  color: #5b7a90;
}
.total-score .value {
  font-size: 24px;
  font-weight: 700;
  color: #0e7490;
  font-variant-numeric: tabular-nums;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Responsive */
@media (max-width: 640px) {
  .container,
  .container-wide {
    padding: 24px 16px;
  }
  h1 {
    font-size: 28px;
  }
  .login-card {
    width: 100%;
    margin: 16px;
    padding: 32px 24px;
  }
  .nilai-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .tabs {
    gap: 2px;
  }
  .tabs a {
    padding: 10px 12px;
    font-size: 13px;
  }
  .section-grid {
    grid-template-columns: 1fr;
  }
}
