/* ============================================================
   qrgolos — Discord-inspired design system
   ============================================================ */
:root {
  --darkest: #1e1f22;
  --darker:  #232428;
  --dark:    #2b2d31;
  --mid:     #313338;
  --light:   #383a40;
  --input:   #1e1f22;
  --blurple: #5865f2;
  --blurple-h: #4752c4;
  --green:   #23a55a;
  --red:     #f23f43;
  --yellow:  #f0b232;
  --text:    #f2f3f5;
  --muted:   #b5bac1;
  --faint:   #949ba4;
  --linkc:   #00a8fc;
  --border:  #1f2023;
  --font: "Rubik", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
/* hide leftover decorative elements from the previous theme */
.corner, .scan-progress, .qr-frame .b, .qr-laser, .scope-frame { display: none !important; }

body.page {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -10%, #404252 0%, var(--darkest) 55%);
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 2vh, 32px);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

/* ---------- app card ---------- */
.app {
  width: 100%;
  max-width: min(460px, calc(100vw - 24px));
  background: var(--mid);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.24), 0 0 0 1px rgba(0,0,0,0.2);
  overflow: hidden;
}
.app-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: var(--dark);
  border-bottom: 1px solid var(--border);
}
.app-id { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.app-icon {
  width: 40px; height: 40px; border-radius: 16px;
  background: var(--blurple); color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 0.95rem; letter-spacing: -0.02em;
  transition: border-radius .2s ease;
}
.app-id:hover .app-icon { border-radius: 12px; }
.app-meta { display: flex; flex-direction: column; line-height: 1.2; }
.app-name { color: var(--text); font-weight: 700; font-size: 1rem; }
.app-status { display: flex; align-items: center; gap: 6px; color: var(--faint); font-size: 0.76rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.dot-online { background: var(--green); }
.dot-rec { background: var(--red); animation: dotpulse 1s infinite; }
.dot-idle { background: var(--faint); }
@keyframes dotpulse { 50% { opacity: .4; } }

.body { padding: 22px 20px 6px; }
.app-foot {
  padding: 12px 16px; font-size: 0.72rem; color: var(--faint);
  border-top: 1px solid var(--border); background: var(--dark);
}

/* ---------- typography ---------- */
.kicker {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--faint); margin: 0 0 10px;
}
.headline {
  font-weight: 800; font-size: clamp(1.6rem, 6vw, 2.05rem);
  line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 10px; color: var(--text);
}
.headline em { font-style: normal; color: var(--blurple); }
.sub { color: var(--muted); font-size: 0.95rem; margin: 0 0 20px; }

/* ---------- buttons ---------- */
.btn {
  -webkit-appearance: none; appearance: none;
  font-family: var(--font); font-weight: 600; font-size: 0.92rem;
  color: #fff; background: var(--blurple); border: none; border-radius: 8px;
  padding: 11px 18px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s ease, opacity .15s, transform .04s, box-shadow .15s;
}
.btn:hover { background: var(--blurple-h); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-arrow { transition: transform .15s; }
.btn:hover .btn-arrow { transform: translateX(3px); }
.btn-primary { width: 100%; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid #4e5058; }
.btn-ghost:hover { background: var(--light); border-color: #4e5058; }
.btn-danger { background: transparent; color: #f5a3aa; border: 1px solid rgba(242,63,67,.5); }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn-rec { background: var(--green); }
.btn-rec:hover { background: #1e9150; }
.btn-stop { background: var(--red); }
.btn-stop:hover { background: #d93539; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.stop-sq { width: 10px; height: 10px; background: #fff; border-radius: 2px; }
.controls { display: flex; gap: 10px; margin: 0 0 14px; }
.controls .btn { flex: 1; }

/* ---------- forms ---------- */
.form { margin: 4px 0 12px; }
.form .btn-primary { margin-top: 8px; }
.field { display: block; margin-bottom: 16px; }
.lbl {
  display: block; font-size: 0.74rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 8px;
}
.lbl i { font-style: normal; color: #6d7178; text-transform: none; font-weight: 500; }
.field input, .field textarea {
  width: 100%; font-family: var(--font); font-size: 0.98rem; color: var(--text);
  background: var(--input); border: 1px solid #111214; border-radius: 8px;
  padding: 11px 12px; resize: vertical; outline: none;
  transition: border-color .15s;
}
.field input::placeholder, .field textarea::placeholder { color: #6d7178; }
.field input:focus, .field textarea:focus { border-color: var(--blurple); }
.field input[type="file"] { padding: 9px; color: var(--muted); font-size: .86rem; }
.check { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .95rem; margin: 2px 0 16px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.hint { color: var(--faint); font-size: 0.88rem; margin: 14px 0 2px; }
.link { color: var(--linkc); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- status line ---------- */
.status { font-size: 0.92rem; color: var(--muted); min-height: 1.3em; margin: 0 0 14px; text-align: center; }
.status.busy { color: var(--muted); }
.status.rec  { color: var(--green); font-weight: 600; }
.status.err  { color: #f5a3aa; }
.status.ok   { color: var(--green); }

/* ---------- landing steps ---------- */
.steps { list-style: none; padding: 0; margin: 6px 0 22px; }
.steps li {
  display: flex; align-items: center; gap: 13px; color: var(--text);
  font-size: 0.96rem; font-weight: 500; padding: 12px; margin-bottom: 8px;
  background: var(--dark); border-radius: 8px;
  overflow-wrap: anywhere;
}
.sub, .headline, .lbl { overflow-wrap: anywhere; }
.steps li > span:not(.num) { min-width: 0; }
.steps .num {
  flex: none; width: 28px; height: 28px; border-radius: 8px;
  background: var(--blurple); color: #fff; display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 700;
}

/* ---------- QR card ---------- */
.qr-frame {
  width: 256px; max-width: 88%; aspect-ratio: 1; margin: 6px auto 14px;
  background: #fff; border-radius: 16px; padding: 16px;
  display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
.qr-frame-sm { width: 188px; margin: 4px auto 12px; padding: 12px; border-radius: 12px; }
.qr-img { width: 100%; height: 100%; image-rendering: pixelated; border-radius: 4px; }
.qr-url { text-align: center; font-family: var(--mono); font-size: 0.8rem; color: var(--faint); margin: 0 0 20px; word-break: break-all; }
.qr-url .caret { color: var(--blurple); }

/* ---------- recorder: Discord voice panel ---------- */
.voice-panel {
  background: var(--dark); border-radius: 12px; padding: 22px 16px 18px;
  margin: 4px 0 16px; text-align: center;
}
.voice-ring { position: relative; width: 150px; height: 150px; margin: 4px auto 14px; display: grid; place-items: center; }
.voice-pulse {
  position: absolute; inset: 12px; border-radius: 50%; border: 3px solid var(--green);
  opacity: 0; transform: scale(1);
  transition: opacity .15s ease, transform .08s ease-out;
}
.voice-ring.speaking .voice-pulse {
  opacity: calc(.2 + var(--lvl, 0) * .8);
  transform: scale(calc(1 + var(--lvl, 0) * .4));
}
.voice-core {
  position: relative; z-index: 2; width: 104px; height: 104px; border-radius: 50%;
  background: var(--light); color: var(--muted); display: grid; place-items: center;
  transition: background .2s, color .2s, box-shadow .2s;
}
.voice-core svg { width: 42px; height: 42px; }
.voice-ring.speaking .voice-core {
  background: var(--green); color: #fff;
  box-shadow: 0 0 0 6px rgba(35,165,90,.22);
}
.timer {
  font-family: var(--mono); font-size: 1.5rem; font-weight: 500; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.voice-ring.speaking ~ .timer, .recording .timer { color: var(--green); }
.timer-max { font-size: 0.85rem; color: var(--faint); }
.player { width: 100%; margin: 6px 0 12px; }

/* ---------- success state ---------- */
.done { padding: 26px 20px; text-align: center; }
.done-mark {
  width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 50%;
  background: var(--green); display: grid; place-items: center;
  box-shadow: 0 0 0 8px rgba(35,165,90,.18);
}
.done-mark svg { width: 38px; height: 38px; fill: none; stroke: #fff; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.done-mark svg path { stroke-dasharray: 50; stroke-dashoffset: 50; animation: draw .45s .1s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.done .headline { color: var(--green); }

/* ---------- entrance ---------- */
.reveal .s1,.reveal .s2,.reveal .s3,.reveal .s4,.reveal .s5,.reveal .s6 {
  opacity: 0; transform: translateY(8px); animation: rise .45s cubic-bezier(.2,.7,.2,1) forwards;
}
.reveal .s1{animation-delay:.04s}.reveal .s2{animation-delay:.09s}.reveal .s3{animation-delay:.14s}
.reveal .s4{animation-delay:.19s}.reveal .s5{animation-delay:.24s}.reveal .s6{animation-delay:.29s}
@keyframes rise { to { opacity: 1; transform: none; } }
.app.reveal { animation: pop .28s ease both; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

/* ---------- landing: button row + creator ---------- */
.btn-row { display: flex; gap: 10px; margin-bottom: 6px; }
.btn-row .btn { flex: 1; width: auto; }
.creator {
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.creator-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--faint);
}
.creator-qr {
  background: #fff; padding: 10px; border-radius: 12px; line-height: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,.28); transition: transform .15s ease;
}
.creator-qr:hover { transform: translateY(-2px); }
.creator-qr img { display: block; border-radius: 4px; image-rendering: pixelated; }
.creator-nick { font-family: var(--mono); font-size: 0.85rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal .s1,.reveal .s2,.reveal .s3,.reveal .s4,.reveal .s5,.reveal .s6 { opacity: 1; transform: none; }
}

/* ============================================================
   Adaptive / fit-to-screen
   ============================================================ */
img, svg, canvas { max-width: 100%; }
.field input, .field textarea { max-width: 100%; }

/* landing tries to fit the viewport without scrolling */
.page.landing .body { padding-top: 18px; padding-bottom: 4px; }

@media (max-height: 820px) {
  .page.landing .headline { font-size: clamp(1.35rem, 5.2vh, 1.9rem); margin-bottom: 8px; }
  .page.landing .sub { font-size: 0.9rem; margin-bottom: 14px; }
  .page.landing .steps { margin: 4px 0 14px; }
  .page.landing .steps li { padding: 9px 12px; margin-bottom: 6px; font-size: 0.9rem; }
  .page.landing .creator { margin-top: 14px; padding-top: 14px; gap: 8px; }
  .page.landing .creator-qr { padding: 8px; }
  .page.landing .creator-qr img { width: clamp(100px, 17vh, 150px); height: auto; }
}
@media (max-height: 700px) {
  .page.landing .app-bar { padding: 9px 16px; }
  .page.landing .headline { font-size: 1.4rem; line-height: 1.12; }
  .page.landing .sub { font-size: 0.85rem; margin-bottom: 10px; }
  .page.landing .steps { margin: 2px 0 12px; }
  .page.landing .steps li { padding: 7px 11px; margin-bottom: 5px; font-size: 0.85rem; }
  .page.landing .steps .num { width: 24px; height: 24px; font-size: 0.74rem; }
  .page.landing .creator { margin-top: 10px; padding-top: 12px; gap: 6px; }
  .page.landing .creator-qr img { width: clamp(86px, 13vh, 120px); }
  .page.landing .creator-label { font-size: 0.66rem; }
  .page.landing .app-foot { padding: 8px 16px; }
}

/* recorder voice panel scales down on short screens */
@media (max-height: 720px) {
  .voice-panel { padding: 16px 14px 12px; margin-bottom: 12px; }
  .voice-ring { width: 120px; height: 120px; margin: 2px auto 10px; }
  .voice-core { width: 84px; height: 84px; }
  .voice-core svg { width: 34px; height: 34px; }
  .timer { font-size: 1.3rem; }
  .field { margin-bottom: 12px; }
}

/* narrow phones */
@media (max-width: 380px) {
  .body { padding-left: 16px; padding-right: 16px; }
  .btn-row { gap: 8px; }
  .btn { padding: 11px 12px; font-size: 0.88rem; gap: 6px; }
  .qr-frame { padding: 12px; }
}
