/* Human Type Simulator — the typing animation tool, on top of the site stylesheet. */

/* .btn sets display, which would otherwise override the hidden attribute */
[hidden] { display: none !important; }

.tool-hero { padding-block: 3.5rem 1.75rem; }
.tool-hero h1 { margin-bottom: .3em; }
.tool-hero .lead { max-width: 60ch; margin: 0; }

.tool { padding-bottom: 4.5rem; }
.tool-grid {
  display: grid;
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

/* ---------- settings panel ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.panel fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 1.15rem; }
.panel fieldset:disabled { opacity: .55; }
.field { display: grid; gap: .45rem; min-width: 0; }
.field-label {
  display: flex; justify-content: space-between; align-items: baseline; gap: .5rem;
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3);
}
.field-label output {
  font-size: .78rem; letter-spacing: 0; text-transform: none; color: var(--ink);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.panel textarea,
.panel input[type="text"] {
  width: 100%;
  font: inherit; font-size: .95rem; line-height: 1.5; color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .65rem .75rem;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.panel textarea { min-height: 10rem; resize: vertical; }
.panel textarea:focus,
.panel input[type="text"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.panel input[type="range"] { width: 100%; margin: .15rem 0; accent-color: var(--accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px;
  padding: 3px; border-radius: 11px; background: var(--surface-2);
}
.seg button {
  border: 0; background: transparent; cursor: pointer;
  padding: .5rem .35rem; border-radius: 8px;
  font-weight: 600; font-size: .86rem; color: var(--ink-2);
  transition: background-color .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease);
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] {
  background: var(--surface); color: var(--ink);
  box-shadow: 0 1px 2px rgba(22, 26, 27, .08), inset 0 0 0 1px var(--line);
}

.panel-foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.hint { font-family: var(--font-mono); font-size: .76rem; color: var(--ink-3); margin: 0; }

/* ---------- preview ---------- */
.stage { position: sticky; top: 88px; display: grid; gap: .9rem; min-width: 0; }
.screen {
  display: grid; place-items: center;
  padding: clamp(.6rem, 2vw, 1.25rem);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
/* width/height auto + both max limits keeps the canvas aspect ratio for every format */
.screen canvas {
  display: block;
  width: auto; height: auto;
  max-width: 100%; max-height: 66vh;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(22, 26, 27, .08), 0 22px 44px -26px rgba(22, 26, 27, .5);
}

.transport { display: flex; align-items: center; gap: .7rem; }
.transport input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent); }
.round-btn {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); cursor: pointer;
  transition: transform .18s var(--ease), background-color .18s var(--ease), border-color .18s var(--ease);
}
.round-btn:hover { border-color: var(--ink); }
.round-btn:active { transform: scale(.95); }
.round-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 8px 22px -12px rgba(44, 110, 91, .6); }
.round-btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.round-btn .icon { width: 20px; height: 20px; }
.round-btn .i-pause, .round-btn.is-playing .i-play { display: none; }
.round-btn.is-playing .i-pause { display: block; }
.time {
  font-family: var(--font-mono); font-size: .82rem; color: var(--ink-2);
  font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 7.2em; text-align: right;
}

.export-row { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem 1rem; }
.progress { flex: 1 1 180px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }
.status { margin: 0; font-size: .88rem; color: var(--ink-2); flex: 1 1 100%; }
.status:empty { display: none; }
.status.err { color: var(--danger); }
.privacy { margin-top: -.2rem; }

/* ---------- how it works ---------- */
.how { padding-block: 4.5rem 4rem; border-top: 1px solid var(--line); }
.how-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.how-list li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.35rem 1.4rem; }
.how-num { display: block; color: var(--accent); font-size: .85rem; margin-bottom: .9rem; }
.how-list h3 { margin-bottom: .45rem; }
.how-list p { margin: 0; color: var(--ink-2); font-size: .95rem; }

/* ---------- FAQ ---------- */
.faq-wrap { padding-block: 4.5rem 5rem; }
.faq { max-width: 46rem; display: grid; gap: .7rem; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 1.2rem; }
.faq summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 0; font-weight: 600;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-mono); color: var(--ink-3); font-size: 1.1rem; transition: transform .2s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 1.1rem; color: var(--ink-2); }

@media (max-width: 960px) {
  .tool-grid { grid-template-columns: 1fr; }
  .stage { position: static; order: -1; }
  .how-list { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .two { grid-template-columns: 1fr; }
  .time { min-width: 0; }
}
