/* DauysTap web app — builds on /home.css tokens (--bg, --ink, --muted, --line, --accent, --radius…) */
:root {
  --dt-navy: #11203a;
  --dt-navy-2: #183a60;
  --dt-blue: #1e71f4;
  --dt-blue-ink: #1559c9;
  --dt-wave: #76d2ff;
  --dt-track: #e2eaf6;
  --dt-danger: #c2364a;
}

.dt-app { padding-block: clamp(28px, 6vw, 64px) clamp(48px, 8vw, 96px); }
.dt-app .wrap { max-width: 760px; }
.dt-intro h1 { margin: 10px 0 8px; font-size: clamp(2rem, 6vw, 3.1rem); line-height: 1.05; letter-spacing: -0.035em; }
.dt-lead { margin: 0; color: var(--muted); font-size: 1.05rem; }

.dt-app [hidden] { display: none !important; }
.dt-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Tabs */
.dt-tabs {
  margin: 26px 0 16px;
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.dt-tabs::-webkit-scrollbar { display: none; }
.dt-tabs [role="tab"] {
  flex: 1 0 auto;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--muted);
  white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.dt-tabs [role="tab"]:hover { color: var(--ink); }
.dt-tabs [role="tab"][aria-selected="true"] { background: var(--ink); color: var(--bg); }

.dt-panel { display: grid; gap: 14px; }
.dt-panel[hidden] { display: none; }

.dt-card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 4vw, 26px);
}
.dt-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dt-card-head h2 { margin: 0; font-size: 1.1rem; letter-spacing: -0.01em; }
.dt-count { font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.dt-label { display: block; margin: 0 0 6px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }

/* Recorder */
.dt-recorder {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
  background: linear-gradient(135deg, var(--dt-navy), var(--dt-navy-2));
  border-color: transparent;
  color: #fff;
}
.dt-wavebox { width: 100%; height: 72px; }
.dt-wavebox canvas { width: 100%; height: 100%; display: block; }
.dt-mic {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--dt-blue);
  box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.08), 0 14px 30px -10px rgba(30, 113, 244, 0.7);
  transition: transform 0.15s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.dt-mic:hover { transform: scale(1.03); }
.dt-mic:active { transform: scale(0.97); }
.dt-mic svg { width: 38px; height: 38px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dt-mic[aria-pressed="true"] { background: #ff5f87; box-shadow: 0 0 0 10px rgba(255, 95, 135, 0.18), 0 14px 30px -10px rgba(255, 95, 135, 0.7); }
.dt-mic[aria-pressed="true"] svg rect { fill: #fff; }
.dt-mic:disabled { opacity: 0.5; cursor: progress; }
.dt-hint { margin: 0; max-width: 420px; color: #c3d0e4; font-size: 0.95rem; }
.dt-timer { margin: 0; font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.dt-recorder .dt-progress { width: 100%; }
.dt-recorder .dt-progress-head { color: #fff; }
.dt-recorder .dt-progress-head b { color: var(--dt-wave); }
.dt-recorder .dt-progress-track { background: rgba(255, 255, 255, 0.14); }
.dt-recorder .dt-progress-track i { background: var(--dt-wave); }

/* Output */
.dt-output {
  min-height: 140px;
  max-height: 46vh;
  overflow: auto;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 1.08rem;
  line-height: 1.6;
  white-space: pre-wrap;
  outline: none;
}
.dt-output:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.dt-output:empty::before { content: attr(data-placeholder); color: var(--muted); }
.dt-output .dt-partial { color: var(--muted); }

.dt-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.dt-actions .btn { min-height: 46px; }
.dt-actions[hidden] { display: none; }

/* TTS */
textarea, .dt-card input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 14px 16px;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  resize: vertical;
}
textarea:focus, .dt-card input[type="search"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.dt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.dt-presets { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.dt-presets::-webkit-scrollbar { display: none; }
.dt-chip {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.88rem;
}
.dt-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.dt-select { position: relative; }
.dt-select::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.dt-select select {
  width: 100%;
  min-height: 50px;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 0 40px 0 14px;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
}
#tts-audio { width: 100%; margin-top: 14px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

/* Progress */
.dt-progress { margin-top: 16px; }
.dt-progress[hidden] { display: none; }
.dt-progress-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; font-size: 0.92rem; }
.dt-progress-head b { color: var(--dt-blue-ink); font-variant-numeric: tabular-nums; }
.dt-progress-track { position: relative; margin-top: 8px; height: 8px; border-radius: 4px; background: var(--dt-track); overflow: hidden; }
.dt-progress-track i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 4px; background: var(--dt-blue); transition: width 0.25s linear; }
.dt-progress-track i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: translateX(-100%);
  animation: dt-shine 1.4s ease-in-out infinite;
}
@keyframes dt-shine { to { transform: translateX(100%); } }

/* Video */
.dt-drop {
  position: relative;
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 150px;
  padding: 24px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.dt-drop:hover, .dt-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dt-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dt-drop strong { font-size: 1.05rem; }
.dt-drop span { color: var(--muted); font-size: 0.88rem; }
.dt-file { margin: 12px 0 0; font-weight: 600; word-break: break-all; }

/* History */
.dt-history { list-style: none; margin: 12px 0 0; padding: 0; }
.dt-history li { border-top: 1px solid var(--line); padding: 14px 0; }
.dt-history li:first-child { border-top: 0; }
.dt-history time { display: block; font-size: 0.8rem; color: var(--muted); }
.dt-history p { margin: 6px 0 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.dt-history .dt-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.dt-link { min-height: 40px; padding: 0 10px; border-radius: 10px; font-weight: 600; font-size: 0.88rem; color: var(--accent); }
.dt-link:hover { background: var(--accent-soft); }
.dt-link.is-danger { color: var(--dt-danger); }
.dt-empty { margin: 12px 0 0; color: var(--muted); }
.dt-empty[hidden] { display: none; }

/* Toast */
.dt-toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  margin: 0;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.92rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  z-index: 60;
}
.dt-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.dt-toast.is-error { background: var(--dt-danger); color: #fff; }

/* Home-page card preview (index.html → .project-card.dauystap) */
.dt-phone {
  justify-self: center;
  width: min(240px, 80%);
  aspect-ratio: 9 / 18.5;
  padding: 9px;
  border-radius: 40px;
  background: #0d0f14;
  box-shadow: 0 30px 60px -20px rgba(17, 32, 58, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.dt-screen { height: 100%; border-radius: 32px; background: #f4f7fb; padding: 24px 14px 14px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; color: #142034; font-size: 11px; }
.dt-top { display: flex; align-items: center; justify-content: space-between; }
.dt-top b { font-size: 16px; letter-spacing: -0.02em; }
.dt-top span { font-size: 9px; font-weight: 600; color: var(--dt-blue); background: #eaf2fe; padding: 6px 10px; border-radius: 999px; }
.dt-hero-card { border-radius: 18px; padding: 12px; background: linear-gradient(135deg, var(--dt-navy), var(--dt-navy-2)); color: #fff; display: flex; flex-direction: column; gap: 8px; }
.dt-hero-card small { align-self: flex-start; font-size: 8px; font-weight: 600; color: #d6e4f7; background: rgba(255, 255, 255, 0.12); padding: 4px 8px; border-radius: 8px; }
.dt-hero-card strong { font-size: 20px; letter-spacing: -0.02em; }
.dt-wave { display: flex; align-items: center; gap: 3px; height: 30px; }
.dt-wave i { flex: 1; border-radius: 3px; background: var(--dt-wave); height: 30%; animation: dt-wave 1.2s ease-in-out infinite; }
.dt-wave i:nth-child(3n) { animation-delay: -0.3s; }
.dt-wave i:nth-child(3n+1) { animation-delay: -0.6s; }
.dt-wave i:nth-child(4n) { animation-delay: -0.9s; }
@keyframes dt-wave { 0%, 100% { height: 22%; opacity: 0.6; } 50% { height: 95%; opacity: 1; } }
.dt-btn { text-align: center; background: var(--dt-blue); border-radius: 12px; padding: 9px; font-weight: 600; }
.dt-loader { margin-top: auto; background: #fff; border: 1px solid #e4eaf3; border-radius: 14px; padding: 10px 12px; }
.dt-loader div { display: flex; justify-content: space-between; font-weight: 600; }
.dt-loader b { color: var(--dt-blue); }
.dt-loader i { display: block; margin-top: 8px; height: 6px; border-radius: 3px; background: var(--dt-track); overflow: hidden; }
.dt-loader em { display: block; height: 100%; width: 72%; border-radius: 3px; background: var(--dt-blue); animation: dt-load 3.6s var(--ease) infinite; }
@keyframes dt-load { 0% { width: 8%; } 70% { width: 86%; } 100% { width: 100%; } }
.project-card.dauystap .project-preview { display: grid; place-items: center; }

@media (max-width: 560px) {
  .dt-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
  .dt-tabs [role="tab"] { padding: 0 8px; }
  .dt-fields { grid-template-columns: 1fr; }
  .dt-row { flex-direction: column; align-items: stretch; }
  .dt-row .dt-count { align-self: flex-end; }
  .dt-actions .btn { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .dt-wave i, .dt-loader em, .dt-progress-track i::after { animation: none; }
}

/* Sign-in gate and account bar */
.dt-gate {
  margin-top: 26px;
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  padding: clamp(24px, 6vw, 40px) clamp(18px, 5vw, 32px);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--dt-navy), var(--dt-navy-2));
  color: #fff;
}
.dt-gate h2 { margin: 0; font-size: 1.4rem; letter-spacing: -0.02em; }
.dt-gate p { margin: 0; max-width: 420px; color: #c3d0e4; }
.dt-gate-button { min-height: 44px; display: flex; justify-content: center; }
.dt-gate-note { color: #fff !important; font-weight: 600; }
.dt-gate-small { font-size: 0.85rem; }
.dt-gate-small a { color: #fff; text-decoration: underline; }
.dt-account {
  margin-top: 22px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 0.88rem;
}
.dt-account-email { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.dt-account-quota { color: var(--muted); }
.dt-account .dt-link { margin-left: auto; }
.dt-account + #app-body .dt-tabs { margin-top: 10px; }
/* Guest mode: a slim invite above the tools instead of a wall */
.dt-gate.is-guest { margin-top: 18px; padding: 18px 20px; gap: 8px; }
.dt-gate.is-guest h2 { font-size: 1.1rem; }
.dt-gate.is-guest p { font-size: 0.95rem; max-width: 560px; }
.dt-gate-quota { color: #d9ff47 !important; font-weight: 700; font-size: 0.9rem; }
