/* Free tools (/tools/*): the in-page tool panel. Loaded only by the tool pages, after
   styles.css, whose colour tokens it uses (so light and dark follow the system). */
.tool {
  margin-block: clamp(28px, 4vw, 48px) 0;
  padding: clamp(20px, 3vw, 36px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.tool > h2 {
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  margin-bottom: var(--space-3);
}
.t-private {
  position: relative;
  max-width: var(--reading);
  margin-top: var(--space-3);
  padding-left: 30px;
  color: var(--ink-2);
  font-size: var(--fs-small);
}
.t-private::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 5px var(--accent);
}
.t-drop {
  margin-top: var(--space-5);
  padding: clamp(18px, 3vw, 28px);
  border: 2px dashed var(--accent-line);
  border-radius: var(--radius-sm);
  background: var(--sunk);
  transition: background-color 0.2s, border-color 0.2s;
}
.t-drop.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.t-drop > p {
  margin-top: var(--space-2);
  color: var(--dim);
  font-size: var(--fs-small);
}
.t-file-label {
  display: block;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--space-3);
}
.t-file {
  max-width: 100%;
  font: inherit;
  font-size: var(--fs-small);
  color: var(--ink-2);
}
.t-file::file-selector-button {
  margin-right: 14px;
  min-height: 48px;
  padding: 10px 22px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.t-status {
  min-height: 1.5em;
  margin-top: var(--space-4);
  font-size: var(--fs-small);
  color: var(--ink);
  max-width: 820px;
}
.t-status.is-error {
  color: var(--coral-strong);
  font-weight: 600;
}
.t-nojs {
  margin-top: var(--space-4);
  color: var(--coral-strong);
  font-weight: 600;
}
/* Filters and options */
.t-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-5);
  align-items: flex-end;
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line-soft);
}
.t-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--fs-small);
  color: var(--ink-2);
  font-weight: 600;
  min-width: 0;
}
.t-field[hidden] {
  display: none;
}
.t-field.is-check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 500;
}
.t-field input[type="search"],
.t-field input[type="text"],
.t-field select {
  min-height: 44px;
  min-width: 0;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}
.t-field select {
  max-width: min(320px, 100%);
}
.tool input[type="checkbox"] {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
}
.t-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  margin-top: var(--space-4);
}
.t-row .button {
  min-height: 44px;
  padding: 10px 18px;
  font-size: var(--fs-small);
  cursor: pointer;
  font-family: inherit;
}
.t-row .button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
.t-count {
  font-size: var(--fs-small);
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
/* The word list (Kindle) */
.t-list {
  list-style: none;
  margin: var(--space-4) 0 0;
  padding: 0;
  max-height: min(70vh, 640px);
  overflow-y: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--paper);
}
.t-list li + li {
  border-top: 1px solid var(--line-soft);
}
.t-list label {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  cursor: pointer;
}
.t-list label:hover {
  background: var(--accent-soft);
}
.t-list input[type="checkbox"] {
  margin-top: 2px;
}
.t-item {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  min-width: 0;
}
.t-word {
  color: var(--ink);
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}
.t-form,
.t-meta {
  color: var(--dim);
  font-size: var(--fs-micro);
}
.t-tag {
  font-size: 0.75rem;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--ink);
}
.t-sentence {
  flex-basis: 100%;
  color: var(--ink-2);
  font-size: var(--fs-small);
  overflow-wrap: anywhere;
}
.t-meta {
  flex-basis: 100%;
}
.t-empty {
  padding: 16px;
  color: var(--dim);
}
/* The text box and preview (export fixer) */
.t-input {
  display: block;
  width: 100%;
  min-height: 180px;
  margin-top: var(--space-2);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1.5;
  resize: vertical;
  tab-size: 4;
}
.t-preview-wrap {
  margin-top: var(--space-4);
  max-height: min(70vh, 560px);
  overflow: auto;
}
.t-preview-wrap .data-table th,
.t-preview-wrap .data-table td {
  padding: 10px 16px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.t-preview-wrap .data-table tbody th {
  white-space: normal;
  min-width: 8em;
}
.t-preview-wrap .data-table td {
  color: var(--ink-2);
}
.t-preview-wrap .data-table td.is-empty::after {
  content: "(no meaning)";
  color: var(--dim);
  font-style: italic;
}
.t-preview-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.t-more {
  margin-top: var(--space-2);
  font-size: var(--fs-micro);
  color: var(--dim);
}
.t-next {
  margin-top: var(--space-6);
  padding: clamp(18px, 3vw, 26px);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}
.t-next h3 {
  font-size: var(--fs-h3);
  color: var(--ink);
}
.t-next p {
  margin-top: var(--space-2);
  max-width: var(--reading);
  color: var(--ink-2);
}
.t-next .button-row {
  margin-top: var(--space-4);
}
/* The panel is shown before the script runs; the controls that only work with it wait. */
.tool:not(.is-ready) .t-needs-js {
  display: none;
}
@media (max-width: 640px) {
  .t-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .t-field select,
  .t-field input[type="search"],
  .t-field input[type="text"] {
    max-width: none;
    width: 100%;
  }
  .t-row .button {
    flex: 1 1 auto;
  }
  /* styles.css stacks tables on phones: the word above its meaning, tight. */
  .t-preview-wrap .data-table th,
  .t-preview-wrap .data-table td {
    padding: 2px 0;
  }
  .t-file::file-selector-button {
    display: block;
    margin: 0 0 10px;
  }
}
