/* ============ Relay demo styles ============ */
:root {
  --ink: #111111;
  --muted: #6b6b6b;
  --soft: #595959;
  --line: #ececec;
  --tile: #f3f3f3;
  --green: #1ec10e;
  --red: #e5484d;
  --top: 68px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: #fff;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button, input { font-family: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }

/* ---------- Desktop landing and phone preview ---------- */
.hero { position: relative; height: 100vh; background: linear-gradient(to bottom, #fff 0%, #fff 35%, #f2f2f4 100%); display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 24px; }
.hero h1 { font-size: clamp(48px, 8vw, 96px); line-height: 1; font-weight: 800; letter-spacing: -0.04em; }
.hero p { margin-top: 20px; font-size: 20px; line-height: 1.45; font-weight: 500; color: var(--soft); max-width: 460px; margin-left: auto; margin-right: auto; }
.hero-btn { margin-top: 36px; height: 58px; padding: 0 36px; border: 0; border-radius: 29px; background: var(--ink); color: #fff; font-size: 17px; font-weight: 700; cursor: pointer; transition: transform .15s ease; }
.hero-btn:hover { transform: scale(1.03); }
.hero-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.hero-hint { position: absolute; bottom: 28px; left: 50%; margin-left: -11px; animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 0%,100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
.stage { height: 100vh; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 24px; background: #f2f2f4; }
.phone {
  position: relative; width: 390px; height: 844px; border-radius: 56px; overflow: hidden;
  background: #fff; box-shadow: 0 0 0 10px #111, 0 30px 80px rgba(0, 0, 0, 0.3);
}
.island {
  position: absolute; top: 11px; left: 50%; width: 124px; height: 36px; margin-left: -62px;
  border-radius: 18px; background: #000; z-index: 100; pointer-events: none;
}
.home-indicator {
  position: absolute; bottom: 9px; left: 50%; width: 134px; height: 5px; margin-left: -67px;
  border-radius: 3px; background: var(--ink); z-index: 100; pointer-events: none;
}
.phone[data-indicator="light"] .home-indicator { background: #fff; }

/* Real phones: fill the screen, no fake frame */
@media (max-width: 500px) {
  :root { --top: calc(env(safe-area-inset-top, 0px) + 16px); }
  .hero { display: none; }
  .stage { display: block; padding: 0; height: 100dvh; overflow: visible; background: #fff; }
  .phone { width: 100%; height: 100dvh; transform: none !important; border-radius: 0; box-shadow: none; }
  .island, .home-indicator { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-hint { animation: none; }
}

/* ---------- Screens ---------- */
#app { position: absolute; inset: 0; }
.screen {
  position: absolute; inset: 0; padding: var(--top) 24px 40px; display: flex; flex-direction: column;
  overflow: hidden; background: #fff;
}

/* ---------- Shared bits ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 58px; border: 0;
  border-radius: 29px; background: var(--ink); color: #fff; font-size: 17px; font-weight: 700; cursor: pointer;
}
.btn:disabled { cursor: default; }
.icon-btn {
  width: 44px; height: 44px; border: 0; background: transparent; display: flex; align-items: center;
  justify-content: center; cursor: pointer; color: inherit; padding: 0;
}
.scrim {
  position: absolute; inset: 0; z-index: 20; width: 100%; border: 0; padding: 0; cursor: pointer;
  background: rgba(0, 0, 0, 0.5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.sheet {
  position: absolute; left: 12px; right: 12px; bottom: 26px; z-index: 30; padding: 20px; border-radius: 36px;
  background: #fff; color: var(--ink); display: flex; flex-direction: column; gap: 16px;
  animation: sheet-up 0.28s ease-out;
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-title { font-size: 18px; font-weight: 800; }
.close-btn {
  width: 34px; height: 34px; border: 0; border-radius: 17px; background: #f1f1f1; display: flex;
  align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.spacer { flex: 1; }
@media (max-width: 500px) { .sheet { bottom: max(26px, env(safe-area-inset-bottom)); } }

/* ---------- Welcome ---------- */
.welcome { padding-left: 28px; padding-right: 28px; }
.welcome h1 { font-size: clamp(24px, 7vw, 30px); line-height: 1.1; font-weight: 800; letter-spacing: -1.2px; text-align: center; white-space: nowrap; }
.welcome .stack { position: absolute; top: 50%; left: 16px; right: 16px; transform: translateY(-50%); display: flex; justify-content: center; }
.welcome .cta { margin-top: auto; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.welcome .login { text-align: center; font-size: 15px; line-height: 1.5; font-weight: 400; color: var(--soft); }
.welcome .login a { color: var(--ink); font-weight: 700; }
.welcome .terms { text-align: center; font-size: 12px; line-height: 1.5; font-weight: 400; color: var(--soft); }
.welcome .terms a { color: var(--ink); text-decoration: underline; }

/* ---------- Home ---------- */
.home-head { display: flex; justify-content: space-between; align-items: center; }
.home-head .icon-btn:first-child { margin-left: -10px; }
.home-head .icon-btn:last-child { margin-right: -10px; }
.home h1 { font-size: 40px; line-height: 1.05; font-weight: 800; letter-spacing: -1.2px; margin-top: 10px; }
.home .sub { font-size: 15px; font-weight: 500; color: var(--muted); margin-top: 4px; }
.tabs { display: flex; gap: 2px; margin-top: 20px; padding: 4px; border-radius: 18px; background: #f4f4f4; }
.tab { flex: 1; height: 38px; border: 0; border-radius: 14px; background: transparent; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab[aria-pressed="true"] { background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); }
.list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; overflow-y: auto; padding-bottom: 120px; scrollbar-width: none; }
.list::-webkit-scrollbar, .search-results::-webkit-scrollbar { display: none; }
.card {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border: 1.5px solid var(--line);
  border-radius: 20px; background: #fff; flex: none;
}
.radio { width: 26px; height: 26px; border-radius: 13px; border: 2px solid #c4c4c4; flex: none; }
.radio.done { border: 0; background: var(--green); display: flex; align-items: center; justify-content: center; }
.card .text { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.card .name { font-size: 16px; font-weight: 700; }
.card.is-done .name { color: var(--muted); }
.card .meta { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 500; color: var(--muted); }
.play-chip { width: 36px; height: 36px; border-radius: 18px; border: 1.5px solid #d6d6d6; display: flex; align-items: center; justify-content: center; flex: none; }
.play-chip.live { background: var(--ink); border: 0; }
.fade { position: absolute; left: 0; right: 0; bottom: 0; height: 100px; background: linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.94) 70%); pointer-events: none; z-index: 5; }
.searchbar {
  position: absolute; left: 16px; right: 16px; bottom: 30px; z-index: 6; height: 54px; padding: 0 18px; border-radius: 27px;
  background: rgba(240, 240, 244, 0.78); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 0, 0, 0.06); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12); display: flex; align-items: center; gap: 10px;
}
.searchbar input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 17px; font-weight: 500; color: var(--ink); }

/* search mode */
.search-overlay { position: absolute; inset: 0; z-index: 10; background: #fff; }
.search-top { position: absolute; left: 16px; right: 16px; top: calc(var(--top) - 6px); display: flex; align-items: center; gap: 12px; }
.search-field { flex: 1; min-width: 0; height: 50px; padding: 0 6px 0 16px; border-radius: 25px; background: #f1f1f4; display: flex; align-items: center; gap: 10px; }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 17px; font-weight: 500; color: var(--ink); }
.search-go { display: flex; align-items: center; height: 38px; padding: 0 16px; border: 0; border-radius: 19px; background: var(--ink); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; }
.search-cancel { border: 0; background: transparent; padding: 8px 0; font-size: 16px; font-weight: 700; color: var(--ink); cursor: pointer; }
.search-results { position: absolute; top: calc(var(--top) + 62px); left: 24px; right: 24px; bottom: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; scrollbar-width: none; }
.results-title { font-size: 14px; font-weight: 800; color: var(--muted); margin-top: 16px; }
.empty-results { color: var(--muted); font-size: 14px; }

/* menu */
.menu {
  position: absolute; z-index: 30; top: calc(var(--top) + 48px); left: 16px; width: 256px; padding: 8px; border-radius: 26px;
  background: #fff; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22); display: flex; flex-direction: column; gap: 2px;
}
.scrim.light { background: rgba(0, 0, 0, 0.28); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; height: 48px; padding: 0 12px; border: 0; border-radius: 18px;
  background: transparent; color: var(--ink); font-size: 16px; font-weight: 600; text-align: left; cursor: pointer;
}
.menu-item.active { background: #f4f4f4; font-weight: 700; }
.menu-rule { height: 1.5px; margin: 6px 12px; background: var(--line); }

/* account sheet */
.avatar-block { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0 8px; }
.avatar { width: 76px; height: 76px; border-radius: 38px; background: var(--ink); color: #fff; font-size: 28px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.avatar-block .name { margin-top: 10px; font-size: 24px; font-weight: 800; letter-spacing: -0.6px; }
.avatar-block .role { font-size: 15px; font-weight: 500; color: var(--muted); }
.info { display: flex; flex-direction: column; border: 1.5px solid var(--line); border-radius: 20px; }
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 15px 16px; border-bottom: 1.5px solid var(--line); }
.info-row:last-child { border-bottom: 0; }
.info-row span:first-child { font-size: 14px; font-weight: 500; color: var(--muted); }
.info-row span:last-child { font-size: 15px; font-weight: 700; }

/* contacts sheet */
.contacts { display: flex; flex-direction: column; gap: 10px; }
.contact { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 20px; }
.contact .initials { width: 48px; height: 48px; border-radius: 24px; background: var(--tile); font-size: 16px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
.contact .text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.contact .text .n { font-size: 16px; font-weight: 700; }
.contact .text .r { font-size: 13px; font-weight: 600; color: var(--muted); }
.contact .text .d { font-size: 12px; font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call { width: 40px; height: 40px; border: 0; border-radius: 20px; background: var(--ink); display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }

/* ---------- Training (vertical video) ---------- */
.training { padding: 0; background: #1a1a1a; color: #fff; }
.training video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #1a1a1a; }
.t-top { position: absolute; left: 0; right: 0; top: 0; height: 190px; background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0)); pointer-events: none; }
.t-bottom { position: absolute; left: 0; right: 0; bottom: 0; height: 420px; background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.85)); pointer-events: none; }
.t-progress { position: absolute; top: calc(var(--top) - 4px); left: 16px; right: 16px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.3); }
.t-progress div { width: 0%; height: 4px; border-radius: 2px; background: #fff; }
.t-row { position: absolute; top: calc(var(--top) + 12px); left: 8px; right: 16px; display: flex; align-items: center; justify-content: space-between; }
.t-row .count { font-size: 14px; font-weight: 700; color: rgba(255, 255, 255, 0.85); }
.t-play {
  position: absolute; left: 50%; top: 50%; margin: -40px 0 0 -40px; width: 80px; height: 80px; border: 0; border-radius: 40px;
  background: rgba(255, 255, 255, 0.25); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.t-rail { position: absolute; right: 16px; bottom: 190px; display: flex; flex-direction: column; gap: 22px; align-items: center; }
.rail-btn { width: 48px; height: 48px; border: 0; border-radius: 24px; background: rgba(255, 255, 255, 0.18); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.sound-group { position: relative; }
.volume-control { position: absolute; bottom: 48px; left: 50%; transform: translate(-50%, 8px); width: 52px; height: 166px; padding: 12px 0; border-radius: 26px; background: rgba(0, 0, 0, 0.6); display: flex; flex-direction: column; align-items: center; gap: 8px; visibility: hidden; opacity: 0; pointer-events: none; transition: opacity .15s ease, transform .15s ease; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.sound-group:hover .volume-control, .sound-group:focus-within .volume-control, .sound-group.is-open .volume-control { visibility: visible; opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.volume-control input { width: 24px; height: 112px; margin: 0; cursor: pointer; accent-color: #fff; writing-mode: vertical-lr; direction: rtl; }
.volume-control output { color: #fff; font-size: 12px; font-weight: 700; text-align: center; }
.t-caption { position: absolute; left: 24px; right: 88px; bottom: 134px; display: flex; flex-direction: column; gap: 8px; }
.t-caption .title { font-size: 30px; line-height: 1.06; font-weight: 800; letter-spacing: -0.9px; }
.t-caption .desc { font-size: 15px; line-height: 1.4; font-weight: 500; color: rgba(255, 255, 255, 0.85); }
.t-cta { position: absolute; left: 24px; right: 24px; bottom: 40px; }
.btn-locked { background: rgba(255, 255, 255, 0.2); color: rgba(255, 255, 255, 0.8); font-size: 16px; gap: 8px; }
.btn-white { background: #fff; color: var(--ink); }
.hidden { display: none !important; }

/* quiz */
.quiz-sheet { height: 560px; }
.segs { display: flex; gap: 6px; }
.segs i { flex: 1; height: 4px; border-radius: 2px; background: rgba(17, 17, 17, 0.15); }
.segs i.on { background: var(--ink); }
.q-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.q-text { font-size: 24px; line-height: 1.15; font-weight: 800; letter-spacing: -0.5px; margin-top: 6px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border: 2px solid var(--line); border-radius: 18px;
  background: #fff; text-align: left; cursor: pointer; color: var(--ink); font-size: 15px; font-weight: 600; line-height: 1.3;
}
.option span { flex: 1; }
.option.selected { border-color: var(--ink); }
.option.correct { border-color: var(--green); }
.option.wrong { border-color: var(--red); }
.mark { width: 22px; height: 22px; border-radius: 11px; border: 2px solid #d0d0d0; flex: none; display: flex; align-items: center; justify-content: center; }
.mark.black { background: var(--ink); border: 0; }
.mark.green { background: var(--green); border: 0; }
.mark.red { background: var(--red); border: 0; }
.btn-56 { height: 56px; border-radius: 28px; }
.btn-off { background: #e4e4e4; color: #8a8a8a; }
.done-sheet { height: 370px; align-items: center; text-align: center; padding-top: 28px; }
.done-sheet h2 { margin-top: 4px; font-size: 28px; font-weight: 800; letter-spacing: -0.8px; }
.done-sheet p { font-size: 15px; line-height: 1.45; font-weight: 500; color: var(--soft); margin-top: -8px; }
.retry-icon { width: 96px; height: 96px; border-radius: 48px; display: flex; align-items: center; justify-content: center; background: var(--tile); }

/* ---------- Coming soon / Error ---------- */
.notice { padding-top: var(--top); }
.notice .back { width: 44px; height: 44px; margin-left: -10px; display: flex; align-items: center; justify-content: center; }
.notice .mid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; text-align: center; padding-bottom: 40px; }
.notice .tile { width: 74px; height: 75px; border-radius: 24px; background: var(--tile); display: flex; align-items: center; justify-content: center; }
.notice h1 { font-size: 30px; line-height: 1.05; font-weight: 800; letter-spacing: -1.2px; }
.notice p { font-size: 13px; line-height: 1.5; font-weight: 500; color: var(--soft); margin-top: 10px; }
