/* kindlanki — styles for e-ink Kindle (32 shades of grey, no JS).
   Palette: black, white and 7 shades of grey. No colour, no gradients,
   no border-radius (Kindle renders them poorly), no shadows. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #ffffff;
  color: #000000;
  font-family: serif;
  font-size: 20px;
  line-height: 1.4;
}

a,
a:visited {
  color: #000000;
  text-decoration: underline;
}

a:focus, button:focus, input:focus {
  outline: 2px solid #000000;
  outline-offset: 2px;
}

/* Top bar -------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 2px solid #000000;
}

.brand {
  font-weight: bold;
  font-size: 22px;
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 8px;
}

.nav-form {
  margin: 0;
  padding: 0;
  display: inline;
}

/* Content -------------------------------------------------------------- */
.content {
  padding: 16px;
  max-width: 720px;
  margin: 0 auto;
}

h1 {
  font-size: 28px;
  margin: 16px 0;
  border-bottom: 1px solid #555555;
  padding-bottom: 8px;
}

p {
  margin: 12px 0;
}

.muted { color: #555555; }
.notice { font-weight: bold; }
.error { font-weight: bold; }

/* Boxed notice used for persistent warnings on the home page
   (e.g. media collection over the per-user size limit). */
.notice-block {
  border: 2px solid #000000;
  padding: 12px 16px;
  margin: 16px 0;
}
.notice-block p {
  margin: 8px 0;
}
.notice-block code {
  font-family: monospace;
  font-size: 16px;
  background: #ffffff;
  color: #000000;
  border: 1px solid #000000;
  padding: 1px 4px;
}

/* Footer --------------------------------------------------------------- */
.footer {
  padding: 12px 16px;
  border-top: 1px solid #888888;
  text-align: right;
  font-size: 14px;
}

/* Forms ---------------------------------------------------------------- */
.form { margin: 16px 0; }

/* Inside ``.actions-split`` we zero out the form's default margins. */
.form.form-inline { margin: 0; }

.field {
  display: block;
  margin: 12px 0;
}

.field-label {
  display: block;
  font-weight: bold;
  margin-bottom: 4px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px;
  font-size: 20px;
  font-family: inherit;
  border: 2px solid #000000;
  background: #ffffff;
  color: #000000;
}

.actions {
  margin: 16px 0;
  display: flex;
  gap: 8px;
}

.actions-row { margin: 16px 0; }

/* Split actions (for example, "Back to decks" on the left and "Show answer"
   on the right on the same row on the review page). */
.actions-split {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0;
  gap: 8px;
}

/* Buttons -------------------------------------------------------------- */
.btn {
  display: inline-block;
  padding: 12px 16px;
  font-size: 20px;
  font-family: inherit;
  font-weight: bold;
  background: #ffffff;
  color: #000000;
  border: 2px solid #000000;
  text-decoration: none;
  cursor: pointer;
  min-width: 80px;
  text-align: center;
}

.btn-primary {
  background: #000000;
  color: #ffffff;
}

/* Deck list ------------------------------------------------------------ */
table.decks {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

table.decks th,
table.decks td {
  border-bottom: 1px solid #888888;
  padding: 10px 6px;
  text-align: left;
  vertical-align: top;
}

table.decks th {
  font-weight: bold;
  border-bottom: 2px solid #000000;
}

table.decks .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.deck-link {
  font-weight: bold;
}

.deck-action {
  margin: 0;
}

.btn-small {
  padding: 6px 10px;
  font-size: 16px;
  min-width: 0;
}

/* Card view ------------------------------------------------------------ */
/* Anki embeds its own ``<style>`` directly in card HTML (``notetype.css`` +
   ``cloze_styling.css``). This block covers only what Anki doesn't
   provide: a border, broken-image behaviour and the mandatory cloze
   override (Anki draws cloze in blue — ``color: blue`` — which is
   invisible on e-ink). */

.card {
  border: 2px solid #000000;
  padding: 16px;
  margin: 16px 0;
  min-height: 120px;
}

.card img {
  max-width: 100%;
  height: auto;
}

/* Broken/unavailable images should not take up space. */
img[src=""],
img:not([src]) {
  display: none;
}

/* Cloze: Anki sets ``color: blue``, invisible on e-ink. Override to
   black with ``!important`` so we win against the non-!important
   ``color: blue`` from Anki's style. Anki itself emits the cloze
   formatting (c1, c2, brackets). */
.cloze {
  color: #000000 !important;
  font-weight: bold !important;
}

/* Anki also draws inactive cloze (``cloze-inactive``) in a paler tone —
   we keep them black but at a muted weight so they are visually
   distinguishable. */
.cloze-inactive {
  color: #555555 !important;
  font-weight: normal !important;
}

/* Anki links inside a card must be high-contrast on e-ink. */
.card a {
  color: #000000;
  text-decoration: underline;
}

/* Ratings -------------------------------------------------------------- */
.ratings {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.ratings .btn {
  flex: 1 1 0;
  min-width: 90px;
}

/* Interval preview under the rating button. */
.rating-interval {
  display: block;
  font-size: 14px;
  font-weight: normal;
  margin-top: 2px;
  opacity: 0.85;
}

/* Flag controls -------------------------------------------------------- */
/* User flags (red/yellow/green/blue) can't be shown as colours on e-ink,
   so we use a native ``<select>`` with text labels. Picking an option
   auto-submits the form via inline ``onchange``. The "marked" (star)
   button sits above the flag select in the same toolbar cluster. */
.flag-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin: 0;
}

.mark-form { margin: 0; }

.mark-btn {
  font-family: inherit;
  font-size: 22px;
  line-height: 1;
  font-weight: bold;
  padding: 4px 8px;
  border: 2px solid #000000;
  background: #ffffff;
  color: #000000;
  cursor: pointer;
  min-width: 110px;
}

.mark-btn-on {
  background: #000000;
  color: #ffffff;
}

.flag-form {
  margin: 0;
  display: inline-flex;
  align-items: center;
}

.flag-select {
  font-family: inherit;
  font-size: 16px;
  font-weight: bold;
  padding: 4px 8px;
  border: 2px solid #000000;
  background: #ffffff;
  color: #000000;
  min-width: 110px;
}

/* Remaining breakdown ------------------------------------------------- */
.remaining-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 0 12px 0;
  border-bottom: 1px solid #888888;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
}

.summary-total {
  font-size: 24px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.summary-total-label {
  font-size: 16px;
  color: #555555;
  font-weight: normal;
  margin-left: 6px;
}

.breakdown {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  display: inline-block;
  padding: 4px 10px;
  border: 2px solid #000000;
  background: #ffffff;
  color: #000000;
  font-weight: bold;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

/* Zero-count chips fade into the background so the eye lands on the
   active types. */
.chip-empty {
  border-color: #888888;
  color: #888888;
}

/* The chip for the current card type is inverted — a solid black bar
   with white text — which is far more visible on e-ink than the
   previous underline. */
.chip-current {
  background: #000000;
  color: #ffffff;
}

/* Progress bar (sync_progress.html) ---------------------------------- */
.progressbar {
  width: 100%;
  height: 28px;
  border: 2px solid #000000;
  background: #ffffff;
  margin: 16px 0 8px 0;
  box-sizing: border-box;
  overflow: hidden;
}

.progressbar-fill {
  height: 100%;
  background: #000000;
  /* Smooth update transition. */
  transition: width 0.3s linear;
}

.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  margin: 0;
}
