/* The tool page (/app and /ko/app). Builds on site.css: its colours, type, buttons and tables. */

[hidden] { display: none !important; }

.page.tool { max-width: 820px; }
.tool h1 { margin-bottom: 8px; }
.tool .lead { font-size: 18px; color: var(--muted); margin-bottom: 8px; }

/* Sections: a thin rule above each, no boxes around them */
.tool-step { border-top: 1px solid var(--rule); margin-top: 28px; padding-top: 22px; }
.tool-step h2, .tool-info h2 { border: 0; padding: 0; margin: 0 0 14px; font-size: 21px; }
.tool-info { border-top: 1px solid var(--rule); margin-top: 44px; padding-top: 22px; color: var(--muted); font-size: 15.5px; }
.tool-info strong { color: var(--text); }
.tool-info ul { padding-left: 20px; }

.field-label { display: block; font-weight: 600; font-size: 15px; margin: 0 0 6px; color: var(--text); }
.field-row { margin: 16px 0; }
.panel { margin-top: 16px; }
.panel-help { color: var(--muted); font-size: 15px; margin: 0 0 12px; }

.tool input[type="radio"],
.tool input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; flex: none; }

/* Paste or upload */
.mode { display: flex; flex-wrap: wrap; gap: 8px; }
.mode-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
}
.mode-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mode-option:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }

textarea#text {
  display: block;
  width: 100%;
  min-height: 240px;
  padding: 12px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.55;
  resize: vertical;
}
textarea#text:focus,
.tool select:focus { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--accent); }
.tool input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.tool select {
  max-width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}
.tool input[type="file"] { max-width: 100%; font: inherit; font-size: 15px; }
.tool input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--accent);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.field-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; margin-top: 8px; }
.count { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.count.over { color: var(--text); font-weight: 700; }

/* Purposes: one row each, the chosen row in the accent colour */
.purposes { border: 0; margin: 0; padding: 0; min-width: 0; }
.purpose {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 8px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
}
.purpose input { margin-top: 4px; }
.purpose:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.purpose-name { display: block; font-weight: 600; }
.purpose-desc { display: block; color: var(--muted); font-size: 15px; line-height: 1.5; }

.tone { border: 0; margin: 14px 0 0; padding: 0; min-width: 0; }
.inline-choice { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; margin-right: 22px; cursor: pointer; }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 20px 0 12px; line-height: 1.5; cursor: pointer; }
.check input { margin-top: 3px; }

.turnstile { margin: 12px 0; }

.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 16px 0 0; }
.run-row .small { flex: 1 1 220px; }
.tool .button:disabled { opacity: 0.5; cursor: not-allowed; }
.tool .button:not(.button-quiet):disabled:hover { background: var(--accent); border-color: var(--accent); }
.tool .button-quiet:disabled:hover { background: var(--bg); color: var(--accent); }

#audio-progress { display: block; width: 100%; height: 8px; margin: 14px 0 0; accent-color: var(--accent); }

/* Messages: green tint for news, grey with a rule for problems */
.msg { margin: 12px 0 0; padding: 10px 14px; border-radius: var(--radius); background: var(--accent-soft); color: var(--text); font-size: 15.5px; line-height: 1.55; }
.msg-error { background: var(--panel); border: 1px solid var(--rule-strong); font-weight: 600; }
#notice { margin-top: 16px; }

/* The pass key box: on the page only once the pass is on sale */
.pass-box { margin: 16px 0 0; padding: 10px 14px; border: 1px solid var(--rule); border-radius: var(--radius); }
.pass-box summary { font-weight: 600; cursor: pointer; }
.pass-box[open] summary { margin-bottom: 10px; }
.pass-help { color: var(--muted); font-size: 15px; margin: 0 0 12px; }
.pass-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pass-row .field-label { flex: 0 0 100%; margin: 0; }
.pass-input {
  flex: 1 1 260px;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
}
.pass-input:focus { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--accent); }

/* Result */
.result h2 { margin-bottom: 10px; }
.ai-note { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius); background: var(--accent-soft); font-size: 15px; }
.result-body {
  min-height: 120px;
  padding: 18px 20px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg);
  /* break-word, not anywhere: long links still wrap, but table columns can no longer be
     squeezed until a word like "Wednesday" splits in two. A wide table scrolls in its wrapper. */
  overflow-wrap: break-word;
}
.result-body > :first-child { margin-top: 0; }
.result-body > :last-child { margin-bottom: 0; }
.result-body h2 { margin: 0 0 12px; padding: 0; border: 0; font-size: 22px; }
.result-body h3 { margin: 22px 0 8px; font-size: 18px; }
.result-body h4 { margin: 16px 0 6px; font-size: 16.5px; }
.result-body p,
.result-body ul,
.result-body ol { margin: 0 0 12px; }
.result-body li { margin-bottom: 4px; }
.result-body .table-scroll { margin: 8px 0 16px; }
.result-body table { font-size: 15px; }
.result-body hr { border: 0; border-top: 1px solid var(--rule); margin: 16px 0; }
.result-body code { font-family: var(--mono); font-size: 0.92em; background: var(--panel); padding: 1px 4px; border-radius: 4px; }
.result-status { margin: 12px 0 0; color: var(--muted); font-size: 15px; }
.result-status.msg-error { color: var(--text); font-weight: 600; }
.result-actions { margin-top: 12px; }

@media (max-width: 640px) {
  .tool h1 { font-size: 26px; }
  .tool .lead { font-size: 17px; }
  .mode { display: grid; grid-template-columns: 1fr 1fr; }
  .mode-option { justify-content: center; padding: 8px 10px; font-size: 15px; }
  .tool select { width: 100%; }
  .tool .button-small { width: auto; }
  .purpose { padding: 10px 12px; }
  .result-body { padding: 14px; }
  .result-body h2 { font-size: 20px; }
}

@media print {
  .tool h1, .tool .lead, .tool-form, .tool-info, .result-actions, .result-status, .pair-link, #notice, .pass-box { display: none !important; }
  .tool-step.result { border: 0; margin: 0; padding: 0; }
  .result-body { border: 0; padding: 0; }
}
