/* ScrollGist web app. Builds on /style.css (colors, header, type). Phone first. */
/* The hidden attribute must win over the display rules below (.actions is a grid). */
[hidden] { display: none !important; }
.app { max-width: 680px; padding-top: 20px; padding-bottom: 32px; }
.app h1 { font-size: clamp(1.5rem, 6vw, 2rem); line-height: 1.2; margin: 8px 0 10px; }
.app .lead { color: var(--muted); margin: 0 0 20px; }
.app h2 { font-size: 1.1rem; margin: 0; }
.app h3 { font-size: 0.95rem; margin: 18px 0 6px; color: var(--muted); }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; margin: 0 0 16px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--fg);
  font: inherit; font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #101017; } }
.btn.small { min-height: 44px; padding: 4px 14px; font-size: 0.85rem; font-weight: 500; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.file-btn { width: 100%; position: relative; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-btn:has(input:disabled) { opacity: 0.55; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 8px 0 12px; }

.help { border-top: 1px solid var(--border); padding: 10px 0; }
.help summary { cursor: pointer; font-weight: 600; }
.help ol { margin: 8px 0 0; padding-left: 20px; }
.help li { margin: 6px 0; }
textarea {
  width: 100%; margin: 10px 0; padding: 10px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--fg); font: inherit; resize: vertical;
}
.lang-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.lang-row span { font-weight: 600; }
/* height as well as min-height: iOS Safari's native select ignores min-height (draws it 34 px). */
select { height: 44px; min-height: 44px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--fg); font: inherit; max-width: 60%; }

.status { padding: 12px 14px; border-radius: 10px; background: var(--bg-soft); margin: 0 0 16px; }
.status.error { background: color-mix(in srgb, #dc2626 12%, var(--bg)); }
.status.busy::before {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 10px; vertical-align: -2px;
  border: 2px solid var(--muted); border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .status.busy::before { animation: none; } }
.usage { color: var(--muted); font-size: 0.9rem; margin: -6px 0 16px; }

.paywall, .notice { border-color: var(--accent); }
.notice p { margin: 8px 0 0; }
.paywall p { margin: 8px 0 14px; }

.note { color: var(--muted); font-size: 0.9rem; margin: 0 0 8px; }
.card .transcript, .card .prose p { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg); font-size: 1rem; }
details summary { cursor: pointer; }
/* Touch targets: 44 px at least (Apple HIG; Material asks 48 dp). */
.app summary, .app-foot summary { padding-top: 9px; padding-bottom: 9px; min-height: 44px; box-sizing: border-box; }
/* Own marker in its own column: with the built-in inline one, a title that
   wraps on a narrow phone starts its second line under the arrow. */
.app summary, .app-foot summary { display: flex; align-items: flex-start; gap: 8px; list-style: none; }
.app summary::-webkit-details-marker, .app-foot summary::-webkit-details-marker { display: none; }
.app summary::before, .app-foot summary::before { content: "▶"; content: "▶" / ""; flex: none; font-size: 0.7em; line-height: 2.2; transition: transform 0.15s; }
.app details[open] > summary::before, .app-foot details[open] > summary::before { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .app summary::before, .app-foot summary::before { transition: none; } }
.lang-switch { min-height: 44px; display: inline-flex; align-items: center; padding: 4px 14px; }

.actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 0 0 16px; }
@media (min-width: 520px) { .actions { grid-template-columns: repeat(3, 1fr); } }

.result ul { margin: 0; padding-left: 20px; }
.result li { margin: 4px 0; overflow-wrap: anywhere; }
.card .main-idea { font-weight: 600; margin: 0; color: var(--fg); font-size: 1rem; }
.prose p { margin: 0 0 12px; }

.tree-root { font-weight: 700; margin: 0 0 8px; }
.branch { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
.branch > summary { font-weight: 600; }
.concept { margin: 10px 0 0; }
.concept b { display: block; }
.concept p { margin: 2px 0; color: var(--muted); }
.concept ul { margin: 4px 0 0; }
.links { margin-top: 14px; }
.links li { color: var(--muted); }

.app-foot { max-width: 680px; color: var(--muted); font-size: 0.85rem; padding-bottom: 32px; }
.app-foot p { margin: 6px 0; }
.device-id { border-top: 1px solid var(--border); margin-top: 12px; }
.device-id-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.device-id code { overflow-wrap: anywhere; font-size: 0.85rem; color: var(--fg); }
