:root {
  --huflit-blue: #17479d;
  --huflit-blue-dark: #0b2f73;
  --huflit-orange: #ee6823;
  --huflit-orange-dark: #c94d13;
  --ink: #0f172a;
  --muted: #64748b;
  --soft: #f8fafc;
  --line: rgba(23, 71, 157, 0.16);
  --glass: rgba(255, 255, 255, 0.92);
  --glass-strong: rgba(255, 255, 255, 0.98);
  --shadow: 0 28px 80px rgba(15, 23, 42, 0.25);
  --radius: 28px;
  --radius-sm: 18px;
}

* { box-sizing: border-box; }

html { min-height: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #eaf2ff;
  overflow-x: hidden;
}

button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(120deg, rgba(5, 20, 52, 0.76), rgba(23, 71, 157, 0.38) 42%, rgba(255,255,255,0.3)),
    url("background.png") center / cover no-repeat;
}

.page-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 18% 15%, rgba(238, 104, 35, 0.28), transparent 28%),
    radial-gradient(circle at 78% 10%, rgba(42, 127, 255, 0.24), transparent 30%),
    linear-gradient(to bottom, rgba(255,255,255,0.08), rgba(255,255,255,0.5));
  backdrop-filter: blur(1px);
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.hero-panel,
.workbench,
.card,
.score-card {
  border: 1px solid rgba(255,255,255,0.65);
  box-shadow: var(--shadow);
}

.hero-panel {
  position: sticky;
  top: 16px;
  min-height: calc(100vh - 32px);
  border-radius: var(--radius);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(23, 71, 157, 0.92), rgba(7, 28, 70, 0.94)),
    url("background.png") center / cover no-repeat;
  color: #fff;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(238, 104, 35, 0.45), transparent 34%),
    linear-gradient(180deg, transparent 0%, rgba(4, 12, 31, 0.48) 100%);
}

.hero-content {
  position: relative;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 30px;
}

.brand-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-logo {
  width: 100px;
  height: auto;
  filter: drop-shadow(0 10px 28px rgba(0,0,0,0.25));
}

.eyebrow {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.78);
  text-transform: uppercase;
  letter-spacing: .13em;
  font-size: .76rem;
  font-weight: 800;
}

.eyebrow.blue { color: var(--huflit-blue); }

h1, h2, h3, h4, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: .98;
  letter-spacing: -0.06em;
  max-width: 10ch;
}

.hero-lead {
  margin-top: auto;
  font-size: 1.05rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.86);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0;
}

.hero-stats div {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.13);
  border: 1px solid rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
}

.hero-stats strong {
  display: block;
  font-size: 1.2rem;
  color: #fff;
}

.hero-stats span {
  font-size: .78rem;
  color: rgba(255,255,255,0.78);
}

.privacy-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.8);
  font-size: .88rem;
  line-height: 1.5;
}

.privacy-note i { color: #ffd1b9; padding-top: 3px; }

.workbench {
  background: rgba(255,255,255,0.82);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(18px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 8px 20px;
}

.topbar h2 {
  margin-bottom: 0;
  font-size: clamp(1.3rem, 2.2vw, 2.1rem);
  letter-spacing: -0.04em;
  color: var(--ink);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: fit-content;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(23, 71, 157, 0.14);
  background: rgba(255,255,255,0.9);
  color: var(--muted);
  font-weight: 750;
  font-size: .85rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 0 4px rgba(148, 163, 184, .16);
}

.status-pill[data-state="recording"] .status-dot {
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, .16), 0 0 20px rgba(239, 68, 68, .56);
}

.status-pill[data-state="processing"] .status-dot {
  background: var(--huflit-orange);
  box-shadow: 0 0 0 4px rgba(238, 104, 35, .18), 0 0 22px rgba(238, 104, 35, .52);
}

.status-pill[data-state="done"] .status-dot {
  background: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, .16);
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 16px;
}

.card,
.score-card {
  background: var(--glass-strong);
  border-radius: var(--radius-sm);
  padding: 18px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--huflit-blue);
  font-weight: 900;
  letter-spacing: -0.02em;
}

.card-head i { color: var(--huflit-orange); margin-right: 8px; }

.icon-btn,
.text-btn,
.secondary-btn {
  border: 0;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border .18s ease, opacity .18s ease;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  color: var(--huflit-blue);
  background: rgba(23, 71, 157, .08);
}

.icon-btn:hover,
.text-btn:hover,
.secondary-btn:hover { transform: translateY(-1px); }

.cue-card {
  background:
    linear-gradient(135deg, rgba(255,255,255,.98), rgba(255,250,246,.98));
}

.cue-text {
  min-height: 155px;
  color: #172554;
  line-height: 1.65;
  font-size: 1.05rem;
  font-weight: 650;
}

.cue-advice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.cue-advice div {
  border-radius: 16px;
  background: rgba(23, 71, 157, 0.06);
  padding: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.cue-advice i { color: var(--huflit-orange); margin-right: 8px; }
.cue-advice strong { color: var(--huflit-blue); margin-right: 4px; }

.recorder-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background:
    radial-gradient(circle at 96% 0%, rgba(238,104,35,.16), transparent 34%),
    #fff;
}

.record-main {
  display: flex;
  gap: 18px;
  align-items: center;
}

.record-btn {
  position: relative;
  width: 92px;
  height: 92px;
  flex: 0 0 92px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(145deg, var(--huflit-orange), var(--huflit-orange-dark));
  box-shadow: 0 18px 40px rgba(238, 104, 35, .36);
  display: grid;
  place-items: center;
  font-size: 2rem;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.record-btn:hover { transform: translateY(-2px); }
.record-btn:active { transform: translateY(1px) scale(.98); }

.record-btn[data-recording="true"] {
  background: linear-gradient(145deg, #ef4444, #b91c1c);
  box-shadow: 0 18px 40px rgba(239, 68, 68, .36);
}

.pulse-ring {
  position: absolute;
  inset: -10px;
  border-radius: inherit;
  border: 2px solid rgba(238, 104, 35, .3);
  opacity: 0;
}

.record-btn[data-recording="true"] .pulse-ring {
  opacity: 1;
  animation: pulse 1.2s ease-out infinite;
}

@keyframes pulse {
  from { transform: scale(.84); opacity: .72; }
  to { transform: scale(1.18); opacity: 0; }
}

.record-copy h3 {
  margin: 0 0 6px;
  color: var(--huflit-blue);
  font-size: 1.24rem;
  letter-spacing: -0.04em;
}

.record-copy p {
  margin-bottom: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.timer-line {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-weight: 750;
}

#timer { color: var(--huflit-orange); font-variant-numeric: tabular-nums; }
.dot-separator { color: #cbd5e1; }

.meter-wrap { margin-top: auto; }
.meter-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 750;
}
.meter {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
}
.meter span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--huflit-blue), var(--huflit-orange));
  transition: width .08s linear;
}

.action-row { display: flex; gap: 10px; flex-wrap: wrap; }
.secondary-btn,
.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--huflit-blue);
  background: rgba(23, 71, 157, .06);
  border: 1px solid rgba(23, 71, 157, .12);
  font-weight: 850;
  font-size: .9rem;
}
.secondary-btn:disabled { opacity: .42; cursor: not-allowed; transform: none; }

.overall-card {
  display: grid;
  grid-template-columns: 126px 1fr;
  gap: 16px;
  align-items: center;
  background: linear-gradient(135deg, rgba(23,71,157,.98), rgba(12,48,112,.98));
  color: #fff;
}
.overall-card .card-head { grid-column: 1 / -1; color: #fff; margin-bottom: 0; }
.overall-band {
  width: 126px;
  height: 126px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
}
.overall-band span { font-size: 2.8rem; line-height: 1; font-weight: 950; color: #fff; }
.overall-band small { display: block; margin-top: -22px; color: rgba(255,255,255,.72); font-weight: 800; }
.summary-text { margin: 0; color: rgba(255,255,255,.82); line-height: 1.6; }

.score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.score-card {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.07);
}
.score-card span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .72rem;
  font-weight: 900;
}
.score-card strong {
  color: var(--huflit-blue);
  font-size: 2.1rem;
  line-height: 1;
  margin: 12px 0;
}
.score-card small { color: var(--muted); line-height: 1.45; }

.transcript-card,
.feedback-card,
.sample-card { grid-column: 1 / -1; }

.transcript-box,
.sample-box {
  min-height: 150px;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid rgba(148,163,184,.25);
  padding: 16px;
  line-height: 1.7;
  color: #1e293b;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.metrics-grid div {
  padding: 12px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid rgba(148,163,184,.22);
}
.metrics-grid span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 850;
  margin-bottom: 7px;
}
.metrics-grid strong { color: var(--huflit-blue); font-size: 1.1rem; }

.feedback-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.feedback-columns h4 {
  margin-bottom: 8px;
  color: var(--huflit-blue);
}
ul { margin: 0; padding-left: 1.2rem; }
li { margin: 7px 0; color: #334155; line-height: 1.55; }

.focus-boxes {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.focus-boxes div {
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(23,71,157,.06), rgba(238,104,35,.06));
  border: 1px solid rgba(23,71,157,.1);
}
.focus-boxes strong { color: var(--huflit-blue); display: block; margin-bottom: 8px; }
.focus-boxes p { margin: 0; color: var(--muted); line-height: 1.55; }

.error-banner {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 13px 15px;
  border-radius: 18px;
  color: #7f1d1d;
  background: #fee2e2;
  border: 1px solid #fecaca;
  font-weight: 750;
}
.error-banner.visible { display: flex; }

.processing {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(10px);
}
.processing.visible { display: grid; }
.processing-card {
  width: min(440px, 100%);
  text-align: center;
  border-radius: 28px;
  padding: 28px;
  background: rgba(255,255,255,.98);
  box-shadow: var(--shadow);
}
.spinner {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 5px solid rgba(23,71,157,.14);
  border-top-color: var(--huflit-orange);
  margin: 0 auto 16px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.processing-card h3 { margin-bottom: 8px; color: var(--huflit-blue); }
.processing-card p { margin: 0; color: var(--muted); line-height: 1.5; }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 1fr; }
  .hero-panel { position: relative; min-height: auto; }
  .hero-content { min-height: 380px; }
  h1 { max-width: 15ch; }
}

@media (max-width: 840px) {
  .app-shell { width: min(100% - 18px, 1480px); margin: 9px auto; }
  .workbench { padding: 14px; }
  .topbar { align-items: flex-start; flex-direction: column; padding-bottom: 14px; }
  .layout-grid { grid-template-columns: 1fr; }
  .score-grid { grid-template-columns: 1fr 1fr; }
  .overall-card { grid-template-columns: 106px 1fr; }
  .overall-band { width: 106px; height: 106px; }
  .overall-band span { font-size: 2.2rem; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .focus-boxes { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .hero-content { padding: 22px; min-height: 430px; }
  .brand-row { align-items: flex-start; }
  .brand-logo { width: 82px; }
  h1 { font-size: 2.25rem; }
  .hero-stats { grid-template-columns: 1fr; }
  .card, .score-card { padding: 15px; border-radius: 20px; }
  .record-main { flex-direction: column; align-items: flex-start; }
  .record-btn { width: 86px; height: 86px; flex-basis: 86px; }
  .cue-advice { grid-template-columns: 1fr; }
  .score-grid { grid-template-columns: 1fr; }
  .overall-card { grid-template-columns: 1fr; text-align: left; }
  .feedback-columns { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .action-row .secondary-btn { flex: 1; justify-content: center; }
}
