/* Up next (js/upnext.js), design canvas page P3, take A. Phone first (390 px). Tokens from site.css and
   home.css; rows, labels, chips and buttons follow the design system's patterns.md. */

body[data-view="upnext"] .wrap { max-width: 430px; padding: 8px 20px 28px; }

.un { display: flex; flex-direction: column; gap: 14px; font: 400 15px/1.5 var(--ui); color: var(--text); }
.un-h1 { font: 400 32px/1.15 var(--read); letter-spacing: -.005em; margin: 0; }
.un-sub { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.un-empty { font-size: 15px; color: var(--muted); margin: 8px 0 0; }
.un-note { font-size: 13px; color: var(--muted); margin: 0; }
.un-note:empty { display: none; }

.un-label { font: 600 11px/1.4 var(--ui); letter-spacing: .09em; text-transform: uppercase; color: var(--gold); }
.un-label-muted { color: var(--muted); margin-top: 8px; }
/* Section header (patterns.md): label left, count right. */
.un-sec { display: flex; align-items: baseline; justify-content: space-between; margin-top: 8px; }
.un-sec .un-label-muted { margin-top: 0; }
.un-count { font-size: 12px; color: var(--muted); }

.un-list { display: flex; flex-direction: column; gap: 0; }

/* The next study: a card (patterns.md "Card") */
.un-next {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  /* 18 x 20 px; the right side is 12 px because the 44 px icon buttons carry their own space. */
  padding: 18px 12px 18px 20px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px;
}
.un-row-in { display: flex; align-items: flex-start; gap: 8px; }

/* After that: list rows (patterns.md "Row") */
.un-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.un-n { width: 20px; flex: none; padding-top: 3px; font-size: 12px; color: var(--muted); }
.un-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.un-title { font: 400 17px/1.3 var(--read); overflow-wrap: anywhere; }
.un-title-next { font-size: 22px; line-height: 1.2; }
.un-meta { font-size: 12px; color: var(--muted); }
.un-btns { display: flex; flex: none; margin-top: -10px; }
.un-move { color: var(--muted); }
.un-move:disabled { opacity: .35; cursor: default; background: none; }

/* Add a topic */
.un-add { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.un-input {
  min-height: 48px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--panel); color: var(--text); font: 400 16px/1.4 var(--read);
}
.un-input:focus { outline: none; border-color: var(--gold); }
.un-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.un-chip {
  min-height: 36px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: transparent; color: var(--muted); font: 500 13px/1 var(--ui); cursor: pointer;
}
.un-chip[aria-pressed="true"] { background: var(--keywash); border-color: var(--gold); color: var(--text); }
.un-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line-strong); background: var(--raised); color: var(--text); font: 500 15px/1 var(--ui); cursor: pointer;
}
.un-btn-primary { background: var(--gold); border-color: var(--gold); color: var(--ground); }
.un-btn-ghost { background: transparent; }
.un-grow { flex: 1; }
.un-btn-row { display: flex; gap: 8px; }

/* Change a topic in place, and the remove question (inside the card or a row) */
.un-card-in { display: flex; flex-direction: column; gap: 10px; }
.un-swap, .un-ask { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 2px; }
.un-ask-q { font: 400 17px/1.3 var(--read); overflow-wrap: anywhere; }
.un-row-open { padding-right: 0; }
.un-row-open .un-text { padding-right: 0; }

/* A later topic: the words are the button that opens its change form */
.un-text-btn {
  background: none; border: 0; padding: 0; margin: 0; text-align: left; color: inherit; font: inherit; cursor: pointer;
  min-height: 44px;
}
.un-text-btn:disabled { cursor: default; }
.un-text-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.un-btn:disabled { opacity: .6; cursor: default; }
.un-chip:focus-visible, .un-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* A change in flight: the other buttons do nothing until it lands, so they look paused. */
.un[aria-busy="true"] button { opacity: .55; cursor: progress; }
