/* The code list: one row per display style. Each row is name, code, preview
   and a Copy button; on a phone the name and button share a line and the
   code and preview sit under them, so nothing scrolls sideways at 320px. */
.ts-codes { list-style: none; margin: .6rem 0 .2rem; padding: 0; border-top: 1px solid var(--line); }
.ts-codes[hidden] { display: none; }
.ts-codes li {
  display: grid; grid-template-columns: 10.5rem minmax(0, 13rem) minmax(0, 1fr) auto; gap: .2rem .8rem; align-items: center;
  padding: .3rem 0; border-bottom: 1px solid var(--line);
}
.ts-name { font-size: .82rem; font-weight: 600; color: var(--ink); }
.ts-code { font-family: var(--mono); font-size: .86rem; color: var(--ink); overflow-wrap: anywhere; }
.ts-prev { font-size: .86rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.ts-copy { min-height: var(--tap); min-width: 4.6rem; padding: .3rem .7rem; font-size: .8rem; }
.ts-note { margin-top: .2rem; }
#ts-answer .dc-big { font-size: clamp(1.15rem, 4.2vw, 1.9rem); }

/* Read a code */
.ts-reader { margin-top: 1rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.ts-reader .ts-h { font-size: 1rem; margin: 0 0 .4rem; }
.ts-reader .dc-field { max-width: 26rem; }
.ts-reader input { font-family: var(--mono); }
.ts-read-out { margin: .45rem 0; font-size: .9rem; color: var(--ink); overflow-wrap: anywhere; }
.ts-read-out.ts-bad { color: var(--warn); font-weight: 600; }
.ts-reader .btn[hidden] { display: none; }

/* The worked-example table keeps its three columns at phone width. */
.ts-table code { overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .ts-codes li { grid-template-columns: minmax(0, 1fr) auto; }
  .ts-name { grid-column: 1; grid-row: 1; }
  .ts-copy { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
  .ts-code { grid-column: 1; grid-row: 2; }
  .ts-prev { grid-column: 1; grid-row: 3; font-size: .8rem; }
}
@media (max-width: 600px) {
  .ts-table table { width: 100%; min-width: 0; table-layout: fixed; }
  .ts-table th, .ts-table td { white-space: normal; overflow-wrap: break-word; vertical-align: top; padding-left: .35rem; padding-right: .35rem; }
  .ts-table th:nth-child(1), .ts-table td:nth-child(1) { width: 31%; }
  .ts-table th:nth-child(2), .ts-table td:nth-child(2) { width: 37%; }
}
@media (max-width: 560px) {
  #ts-answer .dc-big { font-size: clamp(1.02rem, 5.4vw, 1.35rem); }
  .ts-codes li { padding: .2rem 0; }
}

@media print {
  .ts-copy, .ts-reader, .ts-note { display: none !important; }
  .ts-codes { margin-top: .4rem; }
  .ts-codes li { grid-template-columns: 9.5rem 12rem minmax(0, 1fr); padding: 1px 0; font-size: 8.5pt; }
  .ts-name, .ts-code, .ts-prev { grid-column: auto; grid-row: auto; font-size: 8.5pt; }
}

/* The Time field's hint, and the field while its text is not a time. The
   date and time row aligns to the top, so the hint hangs under the time
   field instead of lifting its label above the date's. */
#dc-stamps > .controls:first-child { align-items: flex-start; }
.ts-hint { font-size: .78rem; color: var(--ink-soft); }
#ts-time[aria-invalid="true"] { border-color: var(--warn); border-bottom-color: var(--warn); }
@media print { .ts-hint { display: none; } }
