.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0;
    right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 22px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: #28a745;
}
input:checked + .slider:before {
    transform: translateX(18px);
}
body {
  font-size: 1rem; /* or 16px */
}

/* ---- Playground layout ----
   Three panels of the same height: code | output on the top row, waveform
   below (or one per row when stacked). Any panel can be maximized to the
   whole viewport; Esc or the Restore button brings it back. */
#monaco-wrapper { padding: 0 8px; margin-bottom: 2rem; width: 95%; }   /* gutter on the right for comfortable scrolling */
.pg-panel {
  --pg-h: 42vh;
  height: var(--pg-h); min-height: 260px;
  display: flex; flex-direction: column;
  border: 1px solid #ccc; border-radius: .4rem; overflow: hidden; background: #fff;
}
.pg-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .25rem .6rem; font-size: .9rem; font-weight: 600;
  background: #f1f3f5; border-bottom: 1px solid #dee2e6; flex: none;
}
/* VS Code style explorer beside the editor */
.pg-panel-body.pg-editor-body { flex-direction: row; }
.pg-explorer { width: 190px; flex: none; display: flex; flex-direction: column; background: #252526; color: #cccccc;
               border-right: 1px solid #3c3c3c; font-size: .82rem; min-height: 0; }
.pg-explorer-head { display: flex; justify-content: space-between; align-items: center; padding: .35rem .6rem;
                    font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #bbbbbb; }
.pg-explorer-btn { border: 0; background: none; color: #cccccc; cursor: pointer; font-size: .95rem; line-height: 1; padding: 0 .2rem; }
.pg-explorer-btn:hover { color: #fff; }
.pg-explorer-new { border: 1px solid #5a5a5a; border-radius: .25rem; background: none; color: #cccccc; cursor: pointer;
                   font-size: .72rem; font-weight: 600; letter-spacing: 0; text-transform: none; padding: .05rem .4rem; line-height: 1.4; }
.pg-explorer-new:hover { background: #37373d; color: #fff; border-color: #888; }
.pg-explorer-list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.pg-explorer-item { display: flex; align-items: center; gap: .4rem; padding: .22rem .6rem; cursor: pointer; white-space: nowrap; }
.pg-explorer-item:hover { background: #2a2d2e; }
.pg-explorer-item.active { background: #37373d; color: #fff; }
.pg-file-icon { font-size: .6rem; font-weight: 700; padding: .05rem .25rem; border-radius: .2rem; background: #4b6ea9; color: #fff; flex: none; }
.pg-file-icon.v { background: #3b8a5a; }
.pg-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; font-family: ui-monospace, Menlo, Consolas, monospace; }
.pg-file-actions { display: none; gap: .1rem; }
.pg-explorer-item:hover .pg-file-actions, .pg-explorer-item.active .pg-file-actions { display: inline-flex; }
.pg-file-actions button { border: 0; background: none; color: #cccccc; cursor: pointer; font-size: .8rem; padding: 0 .15rem; line-height: 1; }
.pg-file-actions button:hover { color: #fff; }
.pg-explorer-foot { padding: .3rem .6rem; font-size: .68rem; color: #8a8a8a; border-top: 1px solid #3c3c3c; }
.pg-explorer-toggle { display: none; border: 1px solid #c9ced4; border-radius: .3rem; background: #fff; font-size: .8rem; padding: .05rem .45rem; margin-right: auto; cursor: pointer;
                      font-family: ui-monospace, Menlo, Consolas, monospace; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 991.98px) {
  .pg-explorer-toggle { display: inline-block; }
  .pg-editor-body { position: relative; }
  .pg-explorer { display: none; position: absolute; inset: 0 auto 0 0; z-index: 5; box-shadow: 4px 0 12px rgba(0,0,0,.35); }
  .pg-explorer.open { display: flex; }
}
.pg-max { border: 1px solid #c9ced4; border-radius: .3rem; background: #fff; font-size: .8rem; padding: .05rem .45rem; cursor: pointer; }
.pg-max:hover { background: #e9ecef; }
.pg-panel-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#editor { flex: 1; min-height: 0; width: 100%; border: 0; }
#output { flex: 1; min-height: 0; width: 100%; resize: none; border: 0; border-radius: 0;
          font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
#waveform { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#waveform .iw { flex: 1; min-height: 0; border: 0; border-radius: 0; }
#waveform .iw-scroll { max-height: none; }
#waveform .iw-pane-list { max-height: none; }
#pg-layout.stacked .pg-panel { --pg-h: 48vh; }
.pg-panel.maximized {
  position: fixed; inset: 0; z-index: 1050; height: 100vh; min-height: 0;
  border: 0; border-radius: 0;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
body.pg-has-max { overflow: hidden; }
.pg-only-max { display: none; }
.pg-panel.maximized .pg-only-max { display: inline-flex; }

/* Prevent overflow beyond the screen */
body, html {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Buttons and headings shouldn't break the layout */
#runButton {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

@media (max-width: 576px) {
  .monaco-editor {
    font-size: 16px !important;
  }

  #output, #waveform, textarea, pre, code {
    font-size: 16px;
  }
}

/* ---- site navigation (templates/base.html) ---- */
.site-nav .navbar-brand { font-weight: 600; letter-spacing: .01em; }
.site-logo { border-radius: 6px; box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.site-avatar { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%;
               background: #0d6efd; color: #fff; font-weight: 600; font-size: .9rem; }
.site-account .dropdown-toggle::after { display: none; }
.site-login { padding: .2rem .7rem; }
.site-toggler { border: 0; padding: .3rem .35rem; color: rgba(255,255,255,.85); line-height: 0; }
.site-toggler:focus { box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
@media (max-width: 991.98px) {
  /* the menu drops down over the page instead of pushing it down */
  .site-nav { position: relative; z-index: 1030; }
  .site-nav .navbar-collapse { position: absolute; top: 100%; left: 0; right: 0; background: #212529;
                               box-shadow: 0 10px 24px rgba(0,0,0,.35); border-top: 1px solid rgba(255,255,255,.08); }
  .site-nav .navbar-collapse .navbar-nav { padding: .35rem 0 .6rem; }
  .site-nav .navbar-collapse .nav-link { display: flex; align-items: center; gap: .75rem; padding: .65rem 1.1rem;
                                         color: rgba(255,255,255,.78); border-left: 3px solid transparent; }
  .site-nav .navbar-collapse .nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
  .site-nav .navbar-collapse .nav-link.active { color: #fff; background: rgba(13,110,253,.18); border-left-color: #0d6efd; font-weight: 600; }
  .site-nav .nav-ico { opacity: .85; flex: none; }
  .site-account .dropdown-menu { right: 0; left: auto; }
}
@media (min-width: 992px) {
  .site-nav .navbar-collapse .nav-link.active { color: #fff; }
  .site-account { margin-left: .5rem; }
}
/* the round initial must not make the bar taller than when logged out (56 px): pages are laid out against it */
.site-account .nav-link { padding-top: 0; padding-bottom: 0; }
.site-account .dropdown-toggle:focus-visible { outline: 2px solid rgba(255,255,255,.5); outline-offset: 2px; border-radius: 999px; }
.site-account .dropdown-toggle:focus:not(:focus-visible) { outline: 0; }

/* ---- Challenges page (challenges/select_category.html) ---- */
/* ---- the header band of the browsing pages (templates/includes/band_top.html) ---- */
.site-band { position: relative; overflow: hidden; padding: 2.5rem 1rem 2.75rem; color: #fff; text-align: center;
             background:
               radial-gradient(circle at 1px 1px, rgba(255,255,255,.07) 1px, transparent 0) 0 0 / 22px 22px,
               radial-gradient(ellipse at 50% -20%, rgba(13,110,253,.45), transparent 60%),
               linear-gradient(180deg, #212529 0%, #161a1e 100%); }
.band-art { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .2; pointer-events: none; }
.site-band-inner { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; }
.band-eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: .78rem; font-weight: 700; color: #6ea8fe; margin-bottom: .5rem; }
.band-eyebrow a { color: inherit; text-decoration: none; }
.band-eyebrow a:hover { color: #fff; }
.band-title { font-weight: 300; font-size: clamp(1.8rem, 4.5vw, 2.8rem); letter-spacing: -.01em; margin-bottom: .6rem; }
.band-lede { color: rgba(255,255,255,.72); font-size: 1.05rem; max-width: 640px; margin: 0 auto; }
.band-meta { color: rgba(255,255,255,.6); font-size: .95rem; margin: .35rem 0 0; }
.site-band a:not(.btn) { color: #9ec5fe; }
.site-band .band-eyebrow a { color: #6ea8fe; }
.band-actions { margin-top: 1.25rem; display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.band-search { display: flex; gap: .5rem; justify-content: center; margin: 1.25rem auto 0; max-width: 32rem; }
.band-search .form-control { background: rgba(255,255,255,.95); border: 0; }
.site-band .badge { vertical-align: middle; font-size: .75rem; }
.chal-stats { list-style: none; padding: 0; margin: 1.4rem 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.chal-stats li { padding: .35rem .9rem; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; background: rgba(255,255,255,.05);
                 font-size: .9rem; color: rgba(255,255,255,.8); }
.chal-stats strong { color: #fff; margin-right: .2rem; }
.band-overlap { padding-bottom: 3.75rem; }
.band-hero { padding-top: 4rem; padding-bottom: 4.25rem; }
.band-hero .band-title { font-size: clamp(2.1rem, 5.5vw, 3.4rem); }                       /* cards below rise into it */
.chal-add { margin-top: 1.2rem; }
.chal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; max-width: 1040px;
             margin: -2.25rem auto 2.5rem; position: relative; }
.chal-grid:has(> .chal-card:only-child) { max-width: 520px; }
.chal-card { position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid #e3e6ea; border-radius: 1rem;
             padding: 1.5rem 1.5rem 1.35rem; box-shadow: 0 10px 30px rgba(16,24,40,.08); transition: transform .18s, box-shadow .18s; overflow: hidden; }
.chal-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--chal-accent); }
.chal-card:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(16,24,40,.13); }
.chal-comb { --chal-accent: #0d6efd; --chal-tint: #e7f0ff; }
.chal-seq  { --chal-accent: #7c3aed; --chal-tint: #f1eafe; }
.chal-card-top { display: flex; align-items: center; gap: .9rem; margin-bottom: .75rem; }
.chal-icon { flex: none; width: 52px; height: 52px; border-radius: .8rem; display: inline-flex; align-items: center; justify-content: center;
             background: var(--chal-tint); color: var(--chal-accent); }
.chal-card-title { font-size: 1.3rem; font-weight: 600; margin: 0; }
.chal-card-title a { color: #212529; text-decoration: none; }
.chal-count { margin: 0; color: #6c757d; font-size: .92rem; }
.chal-blurb { color: #495057; margin-bottom: 1rem; }
.chal-topics { list-style: none; padding: 0; margin: 0 0 1.25rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.chal-topics li { font-size: .8rem; padding: .2rem .6rem; border-radius: 999px; background: #f1f3f5; color: #495057; }
.chal-topics li span { color: #868e96; margin-left: .15rem; }
.chal-topics .chal-more { background: none; color: #868e96; }
.chal-foot { margin-top: auto; }
.chal-progress { margin-bottom: 1rem; }
.chal-bar { height: 6px; border-radius: 999px; background: #edf0f3; overflow: hidden; margin-bottom: .3rem; }
.chal-bar span { display: block; height: 100%; background: var(--chal-accent); border-radius: inherit; }
.chal-progress small { color: #6c757d; }
.chal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.chal-seq .chal-browse { background: #7c3aed; border-color: #7c3aed; }
.chal-next { position: relative; z-index: 2; font-size: .9rem; color: var(--chal-accent); text-decoration: none; font-weight: 500; }
.chal-next:hover { text-decoration: underline; }
.chal-done { color: #198754; }
@media (max-width: 575.98px) {
  .site-band { padding: 2rem 1rem 2.25rem; }
  .band-overlap { padding-bottom: 3.25rem; }
  .band-art { opacity: .12; }
  .chal-grid { grid-template-columns: 1fr; gap: 1rem; }
  .chal-card { padding: 1.25rem; }
}
