/* ===== MEB library (js/mebindex.js) ===== */
.meb-panel { max-width: 680px; }
.meb-tip { margin: 0; font-size: 0.84rem; color: var(--text); background: var(--primary-tint); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; }
.meb-note { margin: 0; font-size: 0.78rem; color: var(--text-muted); }
.meb-count { font-size: 0.8rem; color: var(--text-muted); }
.meb-lib-btn { align-self: flex-start; }

.meb-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.meb-q { grid-column: 1 / -1; }
.meb-filters input, .meb-filters select {
  width: 100%; min-width: 0; min-height: 40px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; font: inherit; font-size: 0.86rem;
}
.meb-filters input:focus, .meb-filters select:focus { outline: none; border-color: var(--primary); }

.meb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.meb-row { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: var(--card-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.meb-row-title { font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }
.meb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.meb-chip { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; background: var(--primary-tint); color: var(--text); border: 1px solid var(--border); }
.meb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* White on the brand gradient is under 4.5:1 at its cyan end; a solid primary keeps these labels readable. */
.meb-panel .btn-primary { background: var(--primary-hover); }
.meb-open { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; padding: 6px 14px; min-height: 36px; }
.meb-actions .btn-ghost { padding: 6px 12px; min-height: 36px; text-align: left; }
.meb-src { color: var(--primary-text); font-size: 0.8rem; font-weight: 600; text-decoration: none; }
.meb-src:hover, .meb-src:focus-visible { text-decoration: underline; }
.meb-yearbar { display: flex; flex-wrap: wrap; gap: 6px; }
.meb-fchip {
  min-height: 36px; padding: 6px 12px; font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 999px;
}
.meb-fchip:hover { border-color: var(--primary); }
.meb-fchip[aria-pressed="true"] { background: var(--primary-tint); border-color: var(--primary); color: var(--text); box-shadow: inset 0 0 0 1px var(--primary); }
.meb-fchip:focus-visible, .meb-set-btn:focus-visible, .meb-srclink:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.meb-fchip-sets { margin-left: auto; }
.meb-year { font-weight: 700; border-color: var(--primary); }
.meb-year.none, .meb-grade.none { font-weight: 500; border-color: var(--border); color: var(--text-muted); }
.meb-set { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.meb-set .meb-error { flex: 1 1 100%; font-size: 0.82rem; }
.meb-set-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; min-height: 36px; }
.meb-set-btn .spinner { width: 16px; height: 16px; }
.meb-stats { font-size: 0.8rem; color: var(--text-muted); }
.meb-soon { margin: 0; font-size: 0.78rem; color: var(--text-muted); font-style: italic; }
.meb-srclink { display: inline-block; margin: 2px 0 6px; color: var(--primary-text); font-size: 0.82rem; font-weight: 600; text-decoration: none; }
.meb-srclink:hover { text-decoration: underline; }
.meb-home-btn::before { content: '📚'; }
.meb-more { align-self: center; margin-top: 8px; }
.meb-empty { text-align: center; color: var(--text-muted); font-size: 0.88rem; margin: 18px 0; }
.meb-foot { margin: 4px 0 0; font-size: 0.78rem; color: var(--text-muted); }

.meb-topics > summary { cursor: pointer; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.meb-topics ul { list-style: none; margin: 6px 0 4px; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; }
.meb-topics li { display: flex; justify-content: space-between; gap: 10px; }
.meb-topics li span { overflow-wrap: anywhere; min-width: 0; }
.meb-topics li b { flex-shrink: 0; }

.meb-state { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 28px 8px; text-align: center; font-size: 0.9rem; }
.meb-state .spinner { width: 20px; height: 20px; color: var(--primary); }
.meb-error { margin: 0; color: var(--wrong); }

@media (max-width: 480px) {
  .meb-panel { width: 100%; max-height: 92vh; padding: 16px 14px; }
  .meb-filters { grid-template-columns: 1fr 1fr; }
  .meb-filters select:last-of-type { grid-column: 1 / -1; }
  .meb-fchip-sets { margin-left: 0; }
  .meb-set-btn { flex: 1 1 100%; justify-content: center; }
  .meb-actions .btn-ghost { flex: 1 1 100%; }
}

/* ===== Senaryolar tab (js/mebscen.js) ===== */
.meb-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.meb-tab {
  min-height: 40px; padding: 8px 14px; font: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer;
  background: none; color: var(--text-muted); border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.meb-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--primary); }
.meb-tab:hover { color: var(--text); }
.meb-tab:focus-visible, .scen-open-btn:focus-visible, .scen-pick select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.scen-pick { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--text-muted); }
.scen-pick select {
  width: 100%; min-width: 0; min-height: 40px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; font-size: 0.86rem;
}
.scen-row, .scen-course { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: var(--card-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.scen-row-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; }
.scen-row-title { font-weight: 700; font-size: 0.92rem; }
.scen-stats { font-size: 0.8rem; color: var(--text-muted); }
.scen-bar { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; }
.scen-bar i { display: block; min-width: 3px; background: var(--primary); }
.scen-bar i:nth-child(even) { background: var(--secondary); }
.scen-national { margin: 6px 0 0; padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); font-weight: 600; font-size: 0.88rem; }
.scen-text { white-space: pre-line; }

/* Tap targets of at least 40 px on a phone. */
@media (max-width: 600px) {
  .meb-fchip, .meb-actions .btn-ghost, .meb-open, .meb-set-btn, .meb-panel .btn-icon, .meb-tab { min-height: 40px; }
  .meb-panel .btn-icon { min-width: 40px; }
  .meb-src, .meb-topics summary { display: inline-flex; align-items: center; min-height: 40px; }
}
.storage-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10000; padding: 10px 14px; background: #b3261e; color: #fff; font-weight: 600; font-size: 0.88rem; text-align: center; }

/* On a phone the grade and subject chips scroll sideways instead of pushing the scenarios off screen. */
@media (max-width: 480px) {
  .scen-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .scen-chips .meb-fchip { flex: 0 0 auto; }
  .scen-open-btn { flex: 1 1 100%; justify-content: center; }
}
