/* ============================================================
   BitGenius demo portal (login / profile / demo)
   Builds on the tokens in style.css.
   ============================================================ */

.portal { min-height: 100vh; padding: clamp(6.5rem, 12vh, 8rem) 0 4rem; position: relative; }
.portal::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 420px; pointer-events: none;
  background: radial-gradient(60% 80% at 20% 0%, rgba(68,83,199,0.18), transparent 70%),
              radial-gradient(50% 70% at 85% 10%, rgba(52,229,196,0.10), transparent 70%);
}
.portal .wrap { position: relative; }
.portal h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); }
.portal .lede { margin-bottom: 0; }
[hidden] { display: none !important; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.3rem, 3vw, 2rem);
}
.panel h2 { font-size: 1.35rem; margin-bottom: 0.4rem; }
.panel h3 { font-size: 1.05rem; margin-bottom: 0.3rem; }
.panel .hint { color: var(--faint); font-size: 0.86rem; margin: 0.2rem 0 0; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 1rem; }
.field label { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.field input, .field textarea, .field select {
  font: inherit; color: var(--text); background: var(--ink-2);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem; transition: border-color .2s, box-shadow .2s; width: 100%;
}
.field textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(52,229,196,0.15); }
.field .count { font-family: var(--mono); font-size: 0.75rem; color: var(--faint); align-self: flex-end; }
.field .count.over { color: var(--coral); }
.check { display: flex; gap: 0.7rem; align-items: flex-start; margin-top: 1.2rem; color: var(--muted); font-size: 0.9rem; }
.check input { margin-top: 0.3rem; accent-color: var(--teal); width: 18px; height: 18px; flex-shrink: 0; }

.btn { cursor: pointer; font: inherit; }
.btn-ghost { background: transparent; color: var(--text); }   /* <button> otherwise gets the browser's white default */
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none !important; }
.btn-danger { border-color: rgba(255,107,74,0.45) !important; color: var(--coral); background: transparent; }
.btn-danger:hover { background: rgba(255,107,74,0.08); }
.btn-row { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 1.4rem; align-items: center; }

.notice { margin-top: 1rem; padding: 0.8rem 1rem; border-radius: var(--radius-sm); font-size: 0.92rem; border: 1px solid var(--line); background: var(--ink-2); color: var(--muted); }
.notice.ok { border-color: rgba(52,229,196,0.4); color: #bff6ea; }
.notice.err { border-color: rgba(255,107,74,0.45); color: #ffc9bc; }
.notice:empty { display: none; }

/* ---------- Login ---------- */
.login-grid { display: grid; grid-template-columns: 1fr 440px; gap: clamp(2rem, 5vw, 5rem); align-items: center; }
@media (max-width: 900px) { .login-grid { grid-template-columns: 1fr; } }
.login-points { list-style: none; padding: 0; margin: 1.8rem 0 0; }
.login-points li { display: flex; gap: 0.75rem; padding: 0.6rem 0; border-top: 1px solid var(--line); color: var(--muted); }
.login-points li:first-child { border-top: 0; }
.login-points .ck { color: var(--teal); }
.login-points b { color: var(--text); font-weight: 600; }

.provider {
  display: flex; align-items: center; justify-content: center; gap: 0.7rem; width: 100%;
  padding: 0.8rem 1rem; margin-top: 0.7rem; border-radius: 999px; cursor: pointer;
  font: 500 0.98rem var(--body); color: var(--text); background: var(--ink-2);
  border: 1px solid var(--line-strong); transition: border-color .2s, background .2s;
}
.provider:hover { border-color: var(--teal); background: rgba(52,229,196,0.06); }
.provider svg { width: 18px; height: 18px; flex-shrink: 0; }
.divider { display: flex; align-items: center; gap: 0.8rem; color: var(--faint); font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.2em; margin: 1.4rem 0 0.2rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.code-input { font-family: var(--mono) !important; font-size: 1.4rem !important; letter-spacing: 0.4em; max-width: 12rem; }
.fineprint { color: var(--faint); font-size: 0.8rem; margin-top: 1.2rem; }
.fineprint a { color: var(--muted); text-decoration: underline; }

/* ---------- Quota meters ---------- */
.quota { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 1.8rem; }
.quota > div { background: var(--surface); padding: 1rem 1.2rem; }
.quota .k { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.quota .v { font-family: var(--mono); font-size: 1.15rem; margin-top: 0.25rem; }
.quota .v small { color: var(--muted); font-size: 0.8rem; }
.meter { --pct: 0%; height: 4px; border-radius: 4px; background: var(--ink-2); margin-top: 0.6rem; overflow: hidden; }
.meter::after { content: ""; display: block; height: 100%; width: var(--pct); background: var(--grad-teal); border-radius: 4px; transition: width .6s ease; }
.meter.high::after { background: linear-gradient(90deg, var(--amber), var(--coral)); }

/* ---------- Demo ---------- */
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); margin-top: 1.4rem; }
@media (max-width: 960px) { .demo-grid { grid-template-columns: 1fr; } }
.demo-card { display: flex; flex-direction: column; }
.demo-card .tag { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--teal); }
.demo-card h2 { margin-top: 0.4rem; }

.rec { display: flex; align-items: center; gap: 1rem; margin-top: 1.2rem; flex-wrap: wrap; }
.rec-btn {
  width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--line-strong); cursor: pointer;
  background: var(--ink-2); color: var(--text); display: grid; place-items: center; transition: all .2s;
}
.rec-btn:hover { border-color: var(--coral); }
.rec-btn svg { width: 26px; height: 26px; }
.rec-btn.on { background: var(--coral); border-color: var(--coral); color: #fff; box-shadow: 0 0 0 0 rgba(255,107,74,0.6); animation: pulse 1.8s infinite; }
.rec-time { font-family: var(--mono); font-size: 1.4rem; min-width: 5ch; }
.rec-time small { color: var(--faint); font-size: 0.8rem; }
.or { color: var(--faint); font-size: 0.85rem; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.wave { display: block; width: 100%; height: 56px; margin-top: 1rem; border-radius: var(--radius-sm); background: #060911; border: 1px solid var(--line); }
.clip-info { font-family: var(--mono); font-size: 0.78rem; color: var(--faint); margin-top: 0.5rem; min-height: 1.2em; }

.output {
  margin-top: 1.2rem; background: #060911; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 1rem 1.1rem; font-family: var(--mono); font-size: 0.9rem; line-height: 1.65; min-height: 120px; white-space: pre-wrap;
}
/* Karaoke transcript: upcoming words muted, spoken words bright, current word highlighted */
.output.karaoke .kw { color: var(--faint); cursor: pointer; border-radius: 4px; padding: 0 1px; transition: color .15s, background .15s; }
.output.karaoke .kw.done { color: var(--text); }
.output.karaoke .kw.on { color: #04140F; background: var(--teal); box-shadow: 0 0 0 2px var(--teal); }
.output.karaoke .kw:hover { text-decoration: underline; text-decoration-color: var(--teal); }
#sttAudio { margin-top: 0.8rem; }
.output.placeholder { color: var(--faint); }
.output-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 0.6rem; font-family: var(--mono); font-size: 0.75rem; color: var(--faint); flex-wrap: wrap; }
.linkish { background: none; border: 0; color: var(--teal); cursor: pointer; font: inherit; padding: 0; }
.linkish:hover { text-decoration: underline; }

.samples { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.9rem; }
.sample { font: 0.8rem var(--body); color: var(--muted); background: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 0.35rem 0.8rem; cursor: pointer; text-align: left; }
.sample:hover { border-color: var(--teal); color: var(--text); }
.seg { align-self: flex-start; display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px; margin-top: 0.2rem; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 0.4rem 1rem; border-radius: 999px; font-size: 0.9rem; color: var(--muted); transition: all .2s; }
.seg input:checked + span { background: var(--teal); color: #04140F; font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }
.row2 { display: flex; gap: 1.4rem; flex-wrap: wrap; align-items: flex-end; }
.row2 .field { flex: 1; min-width: 160px; }
input[type=range] { accent-color: var(--teal); padding: 0 !important; border: 0 !important; background: none !important; }
audio { width: 100%; margin-top: 1rem; }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(4,20,15,0.3); border-top-color: #04140F; animation: spin .8s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Profile ---------- */
.profile-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: var(--gap); margin-top: 1.4rem; align-items: start; }
@media (max-width: 900px) { .profile-grid { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 9rem 1fr; gap: 0.55rem 1rem; margin-top: 1rem; font-size: 0.95rem; }
.kv dt { color: var(--faint); font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; padding-top: 0.2rem; }
.kv dd { margin: 0; }
.history { width: 100%; border-collapse: collapse; margin-top: 0.8rem; font-size: 0.88rem; }
.history th { text-align: left; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); font-weight: 500; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); }
.history td { padding: 0.5rem; border-bottom: 1px solid var(--line); color: var(--muted); }
.history .st-done, .history .st-cached { color: var(--teal); }
.history .st-failed { color: var(--coral); }
.empty { color: var(--faint); font-size: 0.9rem; margin-top: 0.8rem; }
.danger-zone { border-color: rgba(255,107,74,0.25); }
