* {
  box-sizing: border-box;
}

:root {
  --bg: #0b1120;
  --card: rgba(13, 39, 77, 0.72);
  --text: #ffffff;
  --muted: #a0b4cc;
  --accent: #049fd9;
  --accent-strong: #0277a6;
  --outline: rgba(4, 159, 217, 0.35);
  --danger: #ff4d6a;
  --success: #6cc04a;
  --radius: 14px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  background-image:
    radial-gradient(ellipse at 18% 20%, rgba(4, 159, 217, 0.12), transparent 42%),
    radial-gradient(ellipse at 86% 80%, rgba(108, 192, 74, 0.08), transparent 45%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(11, 17, 32, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.home-icon {
  min-width: 66px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--outline);
  color: var(--text);
  background: rgba(4, 159, 217, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
}

.topbar h1 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
}

.upload-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px 36px;
  display: grid;
  gap: 14px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--outline);
  border-radius: var(--radius);
  padding: 18px;
}

.panel h2 {
  margin: 0;
  font-size: 1.2rem;
}

.panel-subtext {
  margin: 6px 0 14px;
  color: var(--muted);
}

.file-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--outline);
  background: rgba(4, 159, 217, 0.2);
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

#doc-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-name {
  margin: 10px 0 6px;
  font-size: 0.88rem;
  color: var(--muted);
  word-break: break-word;
}

.panel-help {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

.btn-primary,
.btn-secondary {
  border-radius: 10px;
  border: none;
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  padding: 10px 14px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #00bceb);
  color: #fff;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.mode-actions,
.session-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.generation-settings {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  max-width: 440px;
}

.setting-label {
  font-size: 0.86rem;
  color: var(--muted);
}

.setting-input,
.setting-select {
  width: 100%;
  border: 1px solid var(--outline);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 9px 10px;
}

/* Keep native dropdown lists readable on browsers that open light option menus. */
.setting-select option,
.setting-select optgroup {
  color: #0b1120;
  background: #f2f7ff;
}

.setting-input:focus,
.setting-select:focus {
  outline: 2px solid rgba(4, 159, 217, 0.45);
  outline-offset: 1px;
}

.session-actions.wrap {
  margin-top: 16px;
}

.status-msg {
  margin: 12px 0 0;
  min-height: 20px;
  font-size: 0.88rem;
  color: var(--muted);
}

.status-msg.error {
  color: var(--danger);
}

.status-msg.success {
  color: var(--success);
}

.progress-wrap {
  margin-top: 10px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.progress-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #15d38a);
  transition: width 220ms ease;
}

.session-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.session-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.session-progress {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.question-box {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  line-height: 1.45;
  font-weight: 600;
}

.options-grid {
  display: grid;
  gap: 8px;
}

.option-btn {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 9px;
  padding: 10px;
  font-size: 0.9rem;
  font-family: var(--font);
  cursor: pointer;
}

.option-btn.correct {
  border-color: rgba(108, 192, 74, 0.8);
  background: rgba(108, 192, 74, 0.22);
}

.option-btn.wrong {
  border-color: rgba(255, 77, 106, 0.8);
  background: rgba(255, 77, 106, 0.2);
}

.option-btn:disabled {
  cursor: default;
  opacity: 0.95;
}

.feedback {
  min-height: 22px;
  margin: 10px 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.flash-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}

.flash-label {
  margin: 0 0 6px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

#flash-term {
  margin: 0;
  font-size: 1.05rem;
}

#flash-definition {
  margin: 6px 0 0;
  color: var(--text);
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

@media (max-width: 720px) {
  .topbar h1 {
    font-size: 0.95rem;
  }

  .session-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
