
/* Root theme variables */
:root {
  --bg: #ffffff;
  --fg: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-contrast: #fff;
  --ok: #16a34a;
  --warn: #d97706;
  --error: #dc2626;
  --surface: #f3f4f6;
  --border: #e5e7eb;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  margin: 0;
}

.large-font { font-size: 18px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus { left: 1rem; top: 1rem; width: auto; height: auto; padding: .5rem .75rem; background: #000; color: #fff; z-index: 1000; }

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
.top-controls { display: flex; align-items: center; gap: .5rem; }
.btn {
  appearance: none; border: 1px solid var(--border); background: #fff; color: var(--fg);
  padding: .4rem .6rem; border-radius: .5rem; cursor: pointer; font-weight: 600;
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

.file-label { position: relative; overflow: hidden; }
.file-label input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.progress-bar { height: 8px; background: var(--surface); border-bottom: 1px solid var(--border); }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #22c55e); transition: width .3s ease; }

.app-main { max-width: 980px; margin: 0 auto; padding: 1rem; }

.card { background: #fff; border: 1px solid var(--border); border-radius: .75rem; padding: 1rem; }
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.section-title { font-size: 1.25rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; color: var(--muted); }

.model-card { display: grid; grid-template-columns: 56px 1fr; gap: .75rem; align-items: center; border: 1px solid var(--border); border-radius: .75rem; padding: .75rem; }
.model-card.locked { opacity: .6; }
.model-card .status { font-size: .8rem; font-weight: 600; }
.status-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }
.s-locked { background: #9ca3af; }
.s-inprogress { background: var(--warn); }
.s-mastered { background: var(--ok); }

.iconbox { width: 56px; height: 56px; border-radius: .5rem; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); }

.learn-section { display: grid; gap: .75rem; }
.learn-row { display: grid; gap: .25rem; padding: .5rem .75rem; border: 1px dashed var(--border); border-radius: .5rem; }
.learn-row h4 { margin: .25rem 0; }

.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; }

.quiz { display: grid; gap: 1rem; }
.q-card { border: 1px solid var(--border); border-radius: .75rem; padding: 1rem; background: #fff; }
.q-title { font-weight: 700; margin: 0 0 .5rem; }
.options { display: grid; gap: .5rem; }
.option { display: flex; gap: .5rem; align-items: flex-start; padding: .5rem; border: 1px solid var(--border); border-radius: .5rem; }
.option.correct { border-color: var(--ok); background: #f0fdf4; }
.option.incorrect { border-color: var(--error); background: #fef2f2; }
.feedback { margin-top: .5rem; font-weight: 600; }
.feedback.ok { color: var(--ok); }
.feedback.err { color: var(--error); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.ordered { list-style: decimal inside; padding: 0; margin: 0; }
.ordered li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; border: 1px solid var(--border); border-radius: .5rem; padding: .4rem .5rem; }
.ordered .moves { display: flex; gap: .25rem; }

.pairs { display: grid; gap: .5rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: .5rem; }
.pair select { padding: .4rem; }

.result { display: grid; gap: .5rem; }

.app-footer { padding: 1rem; border-top: 1px solid var(--border); background: var(--surface); margin-top: 2rem; }

/* Focus styles */
*:focus { outline: 3px solid #f59e0b; outline-offset: 2px; }

@media (max-width: 780px) {
  .grid.cols-3 { grid-template-columns: 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Helper classes
   ========================================================================== */

/*
 * Hide visually and from screen readers
 */

.hidden,
[hidden] {
  display: none !important;
}

/*
 * Hide only visually, but have it available for screen readers:
 * https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
 *
 * 1. For long content, line feeds are not interpreted as spaces and small width
 *    causes content to wrap 1 word per line:
 *    https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
 */

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

/*
 * Extends the .visually-hidden class to allow the element
 * to be focusable when navigated to via the keyboard:
 * https://www.drupal.org/node/897638
 */

.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  white-space: inherit;
  width: auto;
}

/*
 * Hide visually and from screen readers, but maintain layout
 */

.invisible {
  visibility: hidden;
}

/*
 * Clearfix: contain floats
 *
 * The use of `table` rather than `block` is only necessary if using
 * `::before` to contain the top-margins of child elements.
 */

.clearfix::before,
.clearfix::after {
  content: "";
  display: table;
}

.clearfix::after {
  clear: both;
}

/* ==========================================================================
   EXAMPLE Media Queries for Responsive Design.
   These examples override the primary ('mobile first') styles.
   Modify as content requires.
   ========================================================================== */

@media only screen and (min-width: 35em) {
  /* Style adjustments for viewports that meet the condition */
}

@media print,
  (-webkit-min-device-pixel-ratio: 1.25),
  (min-resolution: 1.25dppx),
  (min-resolution: 120dpi) {
  /* Style adjustments for high resolution devices */
}

/* ==========================================================================
   Print styles.
   Inlined to avoid the additional HTTP request:
   https://www.phpied.com/delay-loading-your-print-css/
   ========================================================================== */

@media print {
  *,
  *::before,
  *::after {
    background: #fff !important;
    color: #000 !important;
    /* Black prints faster */
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  abbr[title]::after {
    content: " (" attr(title) ")";
  }

  /*
   * Don't show links that are fragment identifiers,
   * or use the `javascript:` pseudo protocol
   */
  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }

  pre {
    white-space: pre-wrap !important;
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}

