:root {
  --bg: #09070f;
  --surface-solid: #1a1a24;
  --surface: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.06);
  --glass: rgba(153, 153, 153, 0.17);
  --brand: #7b61ff;
  --brand-text: #9c91ff;
  --brand-strong: #c2c0ff;
  --danger: #f56177;
  --good: #7be3a5;
  --text: #fff;
  --text-2: rgba(255, 255, 255, 0.67);
  --text-3: rgba(255, 255, 255, 0.4);
  --placeholder: linear-gradient(160deg, #3b2f7a, #15121f);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #050409;
  color: var(--text);
  font-family: Inter, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
  padding: 0;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.stage {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 32px;
  padding: 24px;
}

/* ---------- phone ---------- */

.phone {
  position: relative;
  flex: none;
  width: 390px;
  height: min(844px, calc(100vh - 48px));
  border-radius: 48px;
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 30px 80px rgba(0, 0, 0, 0.6);
}

#screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  scrollbar-width: none;
}

#screen::-webkit-scrollbar,
.hero-row::-webkit-scrollbar,
.card-row::-webkit-scrollbar {
  display: none;
}

.screen-center {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px;
  text-align: center;
}

.muted {
  color: var(--text-2);
  font-size: 15px;
  line-height: 22px;
}

.center {
  text-align: center;
  margin-top: 48px;
}

.spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.appbar {
  position: relative;
  z-index: 2;
  height: 56px;
  margin-top: 16px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.appbar h1 {
  flex: 1;
  text-align: center;
  font-size: 16px;
  line-height: 22px;
  font-weight: 700;
  letter-spacing: -0.16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appbar .title {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.appbar .title span {
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--text-3);
}

.glass-btn {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass);
  box-shadow: 0 0 0 0.5px rgba(166, 166, 166, 0.6), 0 8px 15px rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(12px);
  font-size: 18px;
}

.glass-btn.ghost {
  visibility: hidden;
}

.btn-primary {
  width: 100%;
  height: 48px;
  border-radius: 16px;
  background: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.16px;
}

.btn-text {
  width: 100%;
  height: 52px;
  font-size: 16px;
  font-weight: 600;
}

.btn-secondary {
  height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  font-size: 15px;
  font-weight: 600;
}

.meta {
  color: var(--text-2);
  font-size: 18px;
  line-height: 28px;
  font-weight: 500;
  letter-spacing: -0.18px;
}

.meta i {
  display: inline-block;
  width: 4px;
  height: 4px;
  margin: 0 8px;
  border-radius: 50%;
  background: var(--text-2);
  vertical-align: middle;
}

.avatar {
  border-radius: 50%;
  background: var(--placeholder) center / cover;
}

/* ---------- picker ---------- */

.picker {
  padding-bottom: 32px;
  background: linear-gradient(180deg, #17122b 0%, var(--bg) 320px);
  min-height: 100%;
}

.picker .appbar h1 {
  font-size: 18px;
}

.notice {
  margin: 0 20px 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  line-height: 18px;
}

.hero-row {
  display: flex;
  gap: 12px;
  padding: 8px 20px 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.hero {
  position: relative;
  flex: 0 0 100%;
  height: 420px;
  border-radius: 28px;
  overflow: hidden;
  scroll-snap-align: center;
  background: var(--placeholder) center / cover;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(9, 7, 15, 0) 30%, rgba(9, 7, 15, 0.94) 82%);
}

.hero-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px;
  text-align: center;
}

.badge {
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(26, 26, 36, 0.85);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.hero h2 {
  font-size: 30px;
  line-height: 36px;
  font-weight: 700;
  letter-spacing: -0.45px;
}

.hero .meta {
  margin: 8px 0 20px;
  font-size: 17px;
}

.play-icon {
  border-style: solid;
  border-width: 7px 0 7px 12px;
  border-color: transparent transparent transparent #fff;
}

.dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 8px;
}

.dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
}

.dots i.active {
  background: #fff;
}

.category {
  margin-top: 28px;
}

.category h3 {
  padding: 0 16px;
  font-size: 20px;
  line-height: 26px;
  font-weight: 700;
}

.category p {
  padding: 4px 16px 0;
  color: var(--text-2);
  font-size: 15px;
  line-height: 22px;
}

.card-row {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.scenario-card {
  position: relative;
  flex: 0 0 134px;
  height: 230px;
  border-radius: 20px;
  overflow: hidden;
  background: var(--placeholder) center / cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.scenario-card span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 48px 10px 12px;
  background: linear-gradient(180deg, rgba(9, 7, 15, 0), rgba(9, 7, 15, 0.92));
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  text-align: left;
}

/* ---------- briefing ---------- */

.briefing {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: #0d0a17;
}

.backdrop {
  position: absolute;
  inset: -100px;
  background: center / cover;
  filter: blur(30px);
  opacity: 0.75;
}

.photo {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  aspect-ratio: 3 / 4;
  background: var(--placeholder) top center / cover;
  -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 60%, transparent 100%);
}

.nav-scrim {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(
    180deg,
    rgba(9, 7, 15, 0.92) 0%,
    rgba(9, 7, 15, 0.88) 45%,
    rgba(9, 7, 15, 0.75) 58%,
    rgba(9, 7, 15, 0.55) 68%,
    rgba(9, 7, 15, 0.32) 78%,
    rgba(9, 7, 15, 0.12) 88%,
    rgba(9, 7, 15, 0) 100%
  );
}

.briefing-card {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  padding: 28px 20px 24px;
  border-radius: 32px 32px 44px 44px;
  background: rgba(26, 26, 36, 0.4);
  border: 1px solid var(--border);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  text-align: center;
}

.briefing-card h2 {
  padding: 0 20px;
  font-size: 32px;
  line-height: 40px;
  font-weight: 700;
  letter-spacing: -0.48px;
}

.briefing-card .meta {
  margin-top: 12px;
}

.tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 16px 0 24px;
  padding: 12px 20px;
  text-align: left;
}

.tips-list li {
  display: flex;
  gap: 12px;
}

.tips-list b {
  flex: none;
  width: 32px;
  height: 32px;
  margin-top: 2px;
  border-radius: 12px;
  background: rgba(123, 97, 255, 0.15);
  border: 0.5px solid rgba(123, 97, 255, 0.2);
  color: var(--brand-strong);
  font: 600 16px/32px 'Source Serif 4', Georgia, serif;
  text-align: center;
}

.tips-list strong {
  display: block;
  font-size: 18px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.18px;
}

.tips-list span {
  display: block;
  margin-top: 6px;
  color: var(--text-2);
  font-size: 16px;
  line-height: 22px;
}

.briefing-card .btn-text {
  margin-top: 20px;
}

/* ---------- live call ---------- */

.call {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 16px 12px 24px;
  background: var(--surface-solid);
}

.call-head {
  height: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  text-align: center;
}

.call-head h1 {
  font-size: 16px;
  line-height: 22px;
  font-weight: 700;
  letter-spacing: -0.16px;
}

.call-head span {
  color: var(--text-3);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.12px;
}

.call-note {
  width: 100%;
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 14px;
  line-height: 20px;
  letter-spacing: -0.14px;
}

.call-note img {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.call-note button {
  color: var(--brand-text);
  font-weight: 600;
}

.tile {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
  border-radius: 22px;
  overflow: hidden;
  background: #23232f;
}

.tile-bg {
  position: absolute;
  inset: -8px;
  background: center / cover;
  filter: blur(2px);
}

.tile-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.35));
}

.partner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -56%);
}

.partner .avatar {
  width: 146px;
  height: 146px;
  outline: 3px solid rgba(255, 255, 255, 0.16);
  outline-offset: 12px;
  transition: outline-color 0.2s;
}

.partner.speaking .avatar {
  outline-color: var(--brand);
}

.bars {
  height: 22px;
  margin-top: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.partner.speaking .bars {
  opacity: 1;
}

.bars i {
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: var(--brand);
  animation: bar 0.9s ease-in-out infinite;
}

.bars i:nth-child(1),
.bars i:nth-child(5) {
  animation-delay: -0.6s;
}

.bars i:nth-child(2),
.bars i:nth-child(4) {
  animation-delay: -0.3s;
}

@keyframes bar {
  0%,
  100% {
    transform: scaleY(0.33);
  }
  50% {
    transform: scaleY(1);
  }
}

.self-view {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 115px;
  height: 158px;
  border-radius: 22px;
  background: var(--surface-solid);
  outline: 2px solid transparent;
  transition: outline-color 0.2s;
}

.self-view.speaking {
  outline-color: var(--brand);
}

.you-avatar {
  width: 62px;
  height: 62px;
  margin: 43px auto 0;
  border-radius: 50%;
  background: var(--brand);
  font-size: 16px;
  line-height: 62px;
  font-weight: 700;
  text-align: center;
}

.self-view.muted .you-avatar {
  opacity: 0.4;
}

.self-view span {
  position: absolute;
  left: 14px;
  bottom: 10px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}

.caption {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 12px 16px 16px;
  border-radius: 14px;
  background: rgba(9, 7, 15, 0.8);
}

.caption[hidden],
.caption.captions-off {
  display: none;
}

.caption span {
  color: var(--text-2);
  opacity: 0.7;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}

.caption p {
  min-height: 66px;
  margin-top: 4px;
  font-size: 16px;
  line-height: 22px;
  letter-spacing: -0.16px;
}

.controls {
  display: flex;
  gap: 12px;
  padding: 12px 20px 10px;
  border-radius: 1000px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
}

.control {
  min-width: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.12px;
}

.control span {
  position: relative;
  width: 68px;
  height: 52px;
  border-radius: 1000px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass);
}

.control.end span {
  background: var(--danger);
}

.control.off span {
  background: rgba(245, 97, 119, 0.3);
}

.control.off span::after {
  content: '';
  position: absolute;
  width: 28px;
  height: 2px;
  border-radius: 1px;
  background: #fff;
  transform: rotate(-45deg);
}

/* ---------- loader ---------- */

.loader {
  height: 100%;
  padding: 16px 32px;
  background: linear-gradient(180deg, #2c2450 0%, #332a5c 12%, var(--surface-solid) 42%);
}

.loader h2 {
  margin-top: 88px;
  font-size: 24px;
  line-height: 32px;
  font-weight: 700;
  text-align: center;
}

.steps {
  list-style: none;
  margin-top: 8px;
}

.steps li {
  margin-top: 28px;
  color: var(--text-3);
}

.steps li > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
}

.steps li.active,
.steps li.done {
  color: var(--text);
}

.check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand);
  visibility: hidden;
  font-style: normal;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
}

.check::before {
  content: '✓';
}

.steps li.done .check {
  visibility: visible;
}

.bar {
  height: 5px;
  margin-top: 12px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.bar b {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 3px;
  background: var(--brand-strong);
}

.steps li.done .bar b {
  width: 100%;
}

.steps li.active .bar b {
  animation: fill 20s cubic-bezier(0.1, 0.7, 0.2, 1) forwards;
}

@keyframes fill {
  to {
    width: 92%;
  }
}

.hint {
  margin-top: 36px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 19px;
}

/* ---------- result ---------- */

.result {
  position: relative;
  padding: 0 20px 28px;
}

.result .photo {
  opacity: 0.55;
}

.result .appbar {
  margin: 16px -20px 0;
}

.score {
  position: relative;
  margin-top: 124px;
  text-align: center;
}

.big-gauge {
  position: relative;
  width: 240px;
  margin: 0 auto;
}

svg .track,
svg .value {
  fill: none;
  stroke-width: 14;
  stroke-linecap: round;
}

svg .track {
  stroke: rgba(255, 255, 255, 0.14);
}

svg .knob {
  fill: #fff;
  stroke-width: 5;
}

.big-gauge strong {
  position: absolute;
  top: 58px;
  left: 0;
  right: 0;
  font-size: 56px;
  line-height: 64px;
  font-weight: 700;
}

.big-gauge button {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 20px;
}

.big-gauge button i {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  border-radius: 50%;
  border: 1.5px solid var(--text-2);
  font-style: normal;
  font-size: 11px;
  line-height: 15px;
}

.score h2 {
  margin: 6px 0 16px;
  font-size: 28px;
  line-height: 34px;
  font-weight: 700;
}

.result h3 {
  margin: 32px 0 14px;
  font-size: 22px;
  line-height: 28px;
  font-weight: 700;
}

.card {
  padding: 16px;
  border-radius: 24px;
  background: #14121c;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

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

.play {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand);
}

.play::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 17px;
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent #fff;
}

.play.playing::before {
  left: 15px;
  width: 4px;
  height: 16px;
  border-width: 0 5px;
  border-color: #fff;
}

.wave {
  flex: 1;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}

.wave i {
  flex: 1;
  border-radius: 2px;
  background: #fff;
  opacity: 0.3;
}

.wave i.played {
  opacity: 0.9;
}

.wave i.bad {
  background: var(--danger);
  opacity: 0.8;
}

.wave i.good {
  background: var(--good);
  opacity: 0.8;
}

.wave i.bad.played,
.wave i.good.played {
  opacity: 1;
}

.timeline {
  position: relative;
  height: 4px;
  margin: 12px 0 6px 58px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
  cursor: pointer;
}

.timeline i,
.timeline b {
  position: absolute;
  top: 0;
  height: 100%;
}

.timeline i.bad {
  background: var(--danger);
}

.timeline i.good {
  background: var(--good);
}

.timeline b {
  left: 0;
  width: 0;
  background: rgba(255, 255, 255, 0.45);
}

.times {
  margin-left: 58px;
  display: flex;
  justify-content: space-between;
  color: var(--text-3);
  font-size: 12px;
  line-height: 16px;
}

.legend {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  color: var(--text-2);
  font-size: 15px;
}

.legend span::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--good);
}

.legend .bad::before {
  background: var(--danger);
}

.summary .who {
  display: flex;
  align-items: center;
  gap: 12px;
}

.summary .avatar {
  flex: none;
  width: 48px;
  height: 48px;
}

.summary .who span {
  display: block;
  color: var(--text-2);
  font-size: 14px;
  line-height: 20px;
}

.summary .who strong {
  font-size: 17px;
  line-height: 24px;
  font-weight: 700;
}

.quote {
  margin: 14px 0 16px;
  font-size: 18px;
  line-height: 26px;
  font-weight: 500;
}

.pattern {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(123, 97, 255, 0.14);
}

.pattern span {
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.pattern p {
  margin-top: 6px;
  font-size: 16px;
  line-height: 22px;
}

.block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 32px 0 14px;
}

.result .block-head h3 {
  margin: 0;
}

.mini-gauge {
  position: relative;
  width: 48px;
  text-align: center;
}

.mini-gauge svg {
  display: block;
}

.mini-gauge svg .track,
.mini-gauge svg .value {
  stroke-width: 22;
}

.mini-gauge svg .knob {
  r: 16px;
  stroke-width: 12;
}

.mini-gauge strong {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  font-size: 15px;
  line-height: 20px;
  font-weight: 700;
}

.mini-gauge span {
  display: block;
  margin-top: -2px;
  color: var(--text-3);
  font-size: 11px;
  line-height: 14px;
}

.moment {
  border-radius: 16px;
  overflow: hidden;
}

.said {
  padding: 14px 14px 18px;
  background: rgba(255, 255, 255, 0.07);
}

.said.good {
  background: #23372e;
}

.said + .said {
  border-top: 1px dashed rgba(123, 227, 165, 0.4);
}

.said p {
  font-size: 17px;
  line-height: 24px;
  font-weight: 500;
}

.tag {
  display: table;
  margin: 0 auto 10px;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 14px;
  font-weight: 700;
  letter-spacing: 0.8px;
}

.tag-bad {
  background: rgba(245, 97, 119, 0.22);
  border: 1px solid rgba(245, 97, 119, 0.4);
  color: #ff8a9b;
}

.tag-good {
  background: rgba(123, 227, 165, 0.14);
  border: 1px solid rgba(123, 227, 165, 0.4);
  color: var(--good);
}

.tag-neutral {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.85);
}

.why summary {
  display: flex;
  justify-content: space-between;
  padding: 14px 2px 2px;
  list-style: none;
  color: var(--brand-text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.why summary::-webkit-details-marker {
  display: none;
}

.why summary::after {
  content: '';
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border: solid var(--brand-text);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.why[open] summary::after {
  transform: translateY(5px) rotate(225deg);
}

.tip {
  margin-top: 14px;
}

.tip strong {
  color: var(--brand-strong);
  font-size: 14px;
}

.tip p {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 15px;
  line-height: 24px;
}

.tip b {
  color: var(--text);
}

.tip .step {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 0 8px;
  border-radius: 8px;
  background: rgba(123, 97, 255, 0.2);
  color: var(--text);
}

.result > .btn-primary {
  margin-top: 28px;
}

/* ---------- history ---------- */

.history {
  padding: 0 16px 24px;
}

.history .appbar {
  margin: 16px -16px 12px;
}

.history-card {
  width: 100%;
  margin-top: 10px;
  padding: 10px 16px 10px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: left;
}

.history-card .thumb {
  flex: none;
  width: 58px;
  height: 76px;
  border-radius: 12px;
  background: var(--placeholder) center / cover;
}

.history-card > div:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.history-card strong {
  display: block;
  font-size: 16px;
  line-height: 22px;
  font-weight: 700;
}

.history-card span {
  color: var(--text-2);
  font-size: 13px;
  line-height: 18px;
}

.history-card b {
  font-size: 22px;
  font-weight: 700;
}

/* ---------- sheets and toast ---------- */

#sheet-root:empty {
  display: none;
}

#sheet-root {
  position: absolute;
  inset: 0;
  z-index: 5;
}

.scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.sheet {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  max-height: 80%;
  overflow-y: auto;
  padding: 10px 16px 20px;
  border-radius: 32px 32px 44px 44px;
  background: #1c1c22;
  border: 1px solid var(--border);
}

.grabber {
  width: 56px;
  height: 5px;
  margin: 0 auto 18px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.3);
}

.sheet h2 {
  margin-bottom: 14px;
  font-size: 22px;
  line-height: 28px;
  font-weight: 700;
}

.stars {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 14px 0 18px;
}

.stars button {
  font-size: 44px;
  line-height: 48px;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.5);
}

.stars button.on {
  color: #ffb23e;
  -webkit-text-stroke: 0;
}

.sheet textarea {
  width: 100%;
  height: 120px;
  margin-bottom: 20px;
  padding: 16px;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  resize: none;
  outline: none;
}

.levels {
  list-style: none;
}

.levels li {
  display: flex;
  gap: 14px;
  padding: 12px;
  border-radius: 16px;
}

.levels li.current {
  background: var(--surface);
}

.levels b {
  flex: none;
  width: 58px;
  font-size: 15px;
  line-height: 22px;
}

.levels strong {
  display: block;
  font-size: 16px;
  line-height: 22px;
}

.levels span {
  color: var(--text-2);
  font-size: 14px;
  line-height: 20px;
}

#toast {
  position: absolute;
  z-index: 6;
  top: 16px;
  left: 16px;
  right: 16px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(44, 42, 58, 0.97);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-size: 14px;
  line-height: 20px;
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

#toast.visible {
  opacity: 1;
  transform: none;
}

/* ---------- side panel ---------- */

.panel {
  width: 440px;
  max-width: 100%;
  height: min(844px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel h1 {
  font-size: 20px;
  font-weight: 700;
}

.panel h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}

#settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

#settings label {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-2);
  font-size: 13px;
}

#settings label.half {
  grid-column: auto;
}

#settings input {
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--surface);
  color: var(--text);
  font: 13px ui-monospace, SFMono-Regular, Menlo, monospace;
  outline: none;
}

#settings input:focus {
  border-color: var(--brand);
}

#settings > button {
  grid-column: 1 / -1;
  height: 40px;
  border-radius: 10px;
  background: var(--brand);
  font-size: 14px;
  font-weight: 600;
}

#session {
  grid-column: 1 / -1;
  color: var(--text-2);
  font-size: 13px;
}

#session button {
  color: var(--brand-text);
  font-weight: 600;
}

.log-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.log-head button {
  color: var(--brand-text);
  font-size: 13px;
  font-weight: 600;
}

#log {
  flex: 1;
  min-height: 160px;
  overflow-y: auto;
  padding: 10px 12px;
  border-radius: 14px;
  background: #0d0b14;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font: 12px/18px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.log-entry {
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
}

.log-entry summary {
  cursor: pointer;
}

.log-entry pre {
  margin: 4px 0 8px 14px;
  color: var(--text-3);
  font: inherit;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-gql {
  color: var(--brand-strong);
}

.log-ws {
  color: var(--good);
}

.log-error {
  color: #ff8a9b;
}

@media (max-width: 900px) {
  .stage {
    flex-direction: column;
    padding: 0 0 24px;
  }

  .phone {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
  }

  .panel {
    height: auto;
    padding: 0 16px;
  }

  #log {
    height: 320px;
    flex: none;
  }
}
