:root {
  --ink: #102b4b;
  --muted: #65809a;
  --primary: #1f74d4;
  --primary-dark: #1459a8;
  --blue: #45a5ff;
  --aqua: #42d4e2;
  --cream: #eef8ff;
  --paper: #ffffff;
  --soft-paper: #f8fdff;
  --line: #d9eaf7;
  --video-matte: #d3ddd6;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  min-height: -webkit-fill-available;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: -webkit-fill-available;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  appearance: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  opacity: .7;
  cursor: wait;
  transform: none !important;
  box-shadow: none !important;
}

.app {
  --page-pad-x: 18px;
  --page-pad-top: 22px;
  --page-pad-bottom: 32px;
  position: relative;
  width: min(100%, 480px);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100svh;
  min-height: 100dvh;
  margin: auto;
  padding: var(--page-pad-top) var(--page-pad-x) max(var(--page-pad-bottom), env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: visible;
}

.version-chip {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 3;
  max-width: calc(100% - 112px);
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.version-chip span:last-child,
.version-text-button {
  min-width: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.changelog-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 22px rgba(16, 43, 75, .12);
}

.version-text-button:focus-visible,
.changelog-icon:focus-visible,
.home-team-link:focus-visible {
  outline: 2px solid rgba(31, 116, 212, .35);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.home-team-link {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 3;
  display: flex;
  align-items: center;
  height: 28px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}

.home-page {
  min-height: calc(100dvh - var(--page-pad-top) - var(--page-pad-bottom));
  display: grid;
  grid-template-rows: minmax(52px, 10svh) minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  text-align: center;
}

.home-center {
  position: relative;
  grid-row: 2;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-areas:
    "hero"
    "media"
    "tip";
  grid-template-rows: minmax(82px, .78fr) auto minmax(72px, 1.12fr);
  justify-content: center;
  justify-items: center;
  align-content: stretch;
  padding: 0 0 clamp(8px, 2svh, 18px);
}

.hero {
  grid-area: hero;
  align-self: end;
  width: min(100%, 360px);
  padding: 0 0 clamp(8px, 1.6svh, 16px);
}

.brand-title {
  display: block;
  width: min(100%, 360px);
  margin: 0 auto 4px;
  line-height: 0;
}

.brand-title img {
  display: block;
  width: 100%;
  height: auto;
}

.hero p {
  max-width: 330px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.headphone-tip {
  grid-area: tip;
  align-self: start;
  margin: clamp(12px, 2svh, 18px) auto 0;
  padding: 7px 14px;
  border: 1px solid rgba(31, 116, 212, .14);
  border-radius: 999px;
  background: rgba(255, 255, 255, .62);
  color: #1f74d4;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
  box-shadow: 0 8px 18px rgba(16, 43, 75, .05);
}

.howto-image {
  grid-area: media;
  display: block;
  width: min(calc(100% - 40px), 320px);
  height: auto;
  aspect-ratio: 768 / 414;
  margin: 0 auto;
  border-radius: 18px;
  object-fit: cover;
  object-position: center;
  background: #25b7d0;
  box-shadow: 0 12px 26px rgba(16, 43, 75, .08);
}

.card {
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 12px 30px rgba(16, 43, 75, .08);
}

.home-card {
  grid-row: 3;
  width: min(100%, 340px);
  align-self: end;
  margin-top: 0;
  padding: 0 0 2px;
}

.home-card .primary {
  margin-top: 0;
}

.primary,
.primary-button {
  width: 100%;
  margin-top: 10px;
  padding: 13px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 7px 0 var(--primary-dark);
}

.primary:active,
.primary-button:active {
  transform: translateY(4px);
  box-shadow: 0 3px 0 var(--primary-dark);
}

.share,
.secondary-button {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: #304d68;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(16, 43, 75, .06);
}

.share:active,
.secondary-button:active {
  transform: translateY(2px);
  box-shadow: 0 3px 10px rgba(16, 43, 75, .06);
}

.back-link {
  display: block;
  width: fit-content;
  margin: 0 0 24px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.play-page {
  --page-pad-x: 0;
  --page-pad-top: 0;
  --page-pad-bottom: 0;
  display: grid;
  grid-template-rows: minmax(52px, 10svh) minmax(0, 1fr) auto;
  align-content: stretch;
  gap: clamp(10px, 1.8svh, 18px);
  padding: max(18px, env(safe-area-inset-top)) 0 max(18px, env(safe-area-inset-bottom));
  background: #eef8ff;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.play-page:focus {
  outline: none;
}

.instruction-panel {
  position: absolute;
  top: max(56px, calc(env(safe-area-inset-top) + 48px));
  left: 50%;
  z-index: 3;
  width: min(100% - 36px, 430px);
  min-height: 0;
  height: clamp(74px, 16svh, 136px);
  margin: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: 0 14px;
  transform: translateX(-50%);
  pointer-events: none;
}

.instruction-text {
  --caption-size: clamp(20px, min(6.8vw, 4.8svh), 38px);
  width: 100%;
  min-height: 2.2em;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  color: var(--ink);
  font-size: var(--caption-size);
  font-weight: 900;
  line-height: 1.24;
  text-align: center;
  text-shadow: 0 2px 0 rgba(255, 255, 255, .72);
  overflow-wrap: anywhere;
}

.progress-track {
  width: min(100%, 330px);
  height: 7px;
  overflow: hidden;
  border-radius: 9px;
  background: #d8eaf8;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.video-window .progress-track {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 1px;
  z-index: 4;
  width: auto;
  height: 6px;
  border-radius: 999px;
  background: rgba(232, 247, 255, .9);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .42),
    0 3px 10px rgba(16, 43, 75, .1);
  backdrop-filter: blur(4px);
}

.video-panel {
  position: relative;
  grid-row: 2;
  width: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  align-self: stretch;
  padding: clamp(22px, 5svh, 44px) 0 clamp(56px, 10svh, 96px);
}

.video-panel::before {
  content: "";
  position: absolute;
  inset: 20px 20px -14px;
  z-index: 0;
  background: linear-gradient(90deg, rgba(69, 165, 255, 0) 0%, rgba(69, 165, 255, .2) 18%, rgba(66, 212, 226, .24) 50%, rgba(69, 165, 255, .2) 82%, rgba(69, 165, 255, 0) 100%);
  filter: blur(20px);
  opacity: .82;
  pointer-events: none;
}

.video-window {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 20px), calc(100dvh * 20 / 11), 460px);
  aspect-ratio: 20 / 11;
  display: grid;
  place-items: center;
  overflow: visible;
  background: transparent;
  isolation: isolate;
}

.video-window::before {
  content: "";
  position: absolute;
  inset: -20px -18px;
  z-index: 0;
  border-radius: 30px;
  background:
    radial-gradient(circle at 18% 50%, rgba(69, 165, 255, .28), rgba(69, 165, 255, 0) 42%),
    radial-gradient(circle at 82% 50%, rgba(66, 212, 226, .26), rgba(66, 212, 226, 0) 42%),
    linear-gradient(135deg, rgba(255, 255, 255, .84), rgba(176, 223, 255, .3) 45%, rgba(255, 255, 255, .56));
  filter: blur(18px);
  opacity: .94;
  pointer-events: none;
}

.video-window::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(31, 116, 212, .18), rgba(31, 116, 212, 0) 12%, rgba(31, 116, 212, 0) 88%, rgba(31, 116, 212, .18)),
    linear-gradient(180deg, rgba(255, 255, 255, .34), rgba(255, 255, 255, 0) 15%, rgba(255, 255, 255, 0) 84%, rgba(66, 212, 226, .2));
  box-shadow:
    inset 0 0 22px rgba(255, 255, 255, .4),
    inset 0 0 42px rgba(31, 116, 212, .18);
  pointer-events: none;
}

.video-crop {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  border-radius: 16px;
  background: var(--video-matte);
  box-shadow:
    0 16px 42px rgba(16, 43, 75, .12),
    0 0 0 1px rgba(255, 255, 255, .64),
    0 0 0 10px rgba(255, 255, 255, .16);
}

.training-video {
  display: block;
  width: 102%;
  height: 102%;
  transform: translate(-.45%, -1%);
  transform-origin: center;
  object-fit: cover;
}

.play-glyph {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  width: 70px;
  height: 70px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(232, 247, 255, .92);
  box-shadow: 0 16px 38px rgba(16, 43, 75, .16);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.play-glyph::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 6px;
  border-top: 15px solid transparent;
  border-bottom: 15px solid transparent;
  border-left: 23px solid var(--ink);
}

.play-page[data-playing="true"] .play-glyph {
  opacity: 0;
  transform: translate(-50%, -50%) scale(.92);
}

.control-row {
  grid-row: 3;
  width: min(100% - 52px, 340px);
  margin: 0 auto;
  align-self: end;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.control-row .secondary-button {
  margin-top: 0;
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 9px 10px;
  border-color: #cfe0ff;
  background: #f4f8ff;
  color: #1c55bc;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 6px 14px rgba(16, 43, 75, .06);
}

.control-row .play-control {
  border-color: #1f74d4;
  background: #1f74d4;
  color: #fff;
  box-shadow: 0 5px 0 #1459a8;
}

.control-row .home-control {
  border-color: #9edce7;
  background: #e8fbff;
  color: #0b7891;
  box-shadow: 0 5px 0 #b7e6f0;
}

.control-row .replay-control {
  border-color: #ffd48a;
  background: #fff6df;
  color: #8b5b00;
  box-shadow: 0 5px 0 #efc469;
}

.control-row .play-control:active,
.control-row .home-control:active,
.control-row .replay-control:active {
  transform: translateY(3px);
}

.control-row .play-control:active {
  box-shadow: 0 2px 0 #1459a8;
}

.control-row .home-control:active {
  box-shadow: 0 2px 0 #b7e6f0;
}

.control-row .replay-control:active {
  box-shadow: 0 2px 0 #efc469;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 43, 75, .46);
}

.modal-card {
  position: relative;
  width: min(100%, 430px);
  max-height: min(78vh, 620px);
  overflow: hidden;
  border: 1px solid #dbeaf6;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(16, 43, 75, .2);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 18px 12px;
  border-bottom: 1px solid #e8f2fb;
}

.modal-head span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.modal-head b {
  display: block;
  color: var(--ink);
  font-size: 18px;
}

.modal-head button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  padding: 0;
  background: var(--ink);
  color: #fff;
  font-size: 21px;
  line-height: 1;
}

.changelog-list {
  max-height: calc(min(78vh, 620px) - 70px);
  overflow: auto;
  padding: 4px 18px 18px;
}

.changelog-item {
  padding: 14px 0;
  border-bottom: 1px solid #e8f2fb;
}

.changelog-item:last-child {
  border-bottom: 0;
}

.changelog-item b {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.changelog-item p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.team-page {
  padding-top: 24px;
}

.team-panel {
  margin-top: 12px;
}

.team-panel h1 {
  margin: 0 0 16px;
  font-size: 38px;
  line-height: 1.16;
  letter-spacing: 0;
}

.team-list {
  display: grid;
  gap: 12px;
}

.team-list div {
  display: grid;
  gap: 5px;
  padding: 15px 16px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(16, 43, 75, .08);
}

.team-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.team-list b {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.2;
}

[hidden] {
  display: none !important;
}

@media (max-width: 380px) {
  .app {
    --page-pad-x: 16px;
  }

  .version-chip {
    top: 14px;
    left: 14px;
  }

  .home-team-link {
    top: 14px;
    right: 14px;
  }

  .home-center {
    grid-template-rows: minmax(72px, .78fr) auto minmax(60px, 1.08fr);
    padding-bottom: 12px;
  }

  .hero {
    padding-bottom: 12px;
  }

  .brand-title {
    width: min(100%, 330px);
  }

  .howto-image {
    width: min(86%, 310px);
  }

  .card {
    padding: 14px;
  }

  .primary,
  .primary-button {
    padding: 12px;
  }
}

@media (max-width: 520px) and (max-height: 760px) {
  .app {
    --page-pad-top: 16px;
    --page-pad-bottom: 24px;
  }

  .version-chip {
    top: 12px;
    left: 12px;
    gap: 6px;
    font-size: 11px;
  }

  .home-team-link {
    top: 12px;
    right: 12px;
    height: 26px;
    font-size: 11px;
  }

  .changelog-icon {
    width: 26px;
    height: 26px;
    font-size: 15px;
  }

  .home-center {
    grid-template-rows: minmax(68px, .76fr) auto minmax(58px, 1.04fr);
    padding-bottom: 10px;
  }

  .hero {
    padding-bottom: 10px;
  }

  .hero p {
    font-size: 13px;
    line-height: 1.36;
  }

  .howto-image {
    width: min(84%, 300px);
  }

  .card {
    padding: 14px;
  }

  .primary,
  .primary-button {
    margin-top: 8px;
    padding: 12px;
  }

  .play-page {
    grid-template-rows: minmax(48px, 9svh) minmax(0, 1fr) auto;
    gap: 8px;
  }

  .instruction-panel {
    min-height: 0;
    top: max(50px, calc(env(safe-area-inset-top) + 42px));
    height: clamp(66px, 15svh, 112px);
    padding-top: 0;
  }

  .instruction-text {
    --caption-size: clamp(19px, min(6.3vw, 4.5svh), 34px);
    padding: 0 14px;
  }
}

@media (max-width: 520px) and (max-height: 660px) {
  .app {
    --page-pad-top: 12px;
    --page-pad-bottom: 18px;
  }

  .home-center {
    grid-template-rows: minmax(58px, .72fr) auto minmax(46px, .95fr);
    padding-bottom: 8px;
  }

  .hero {
    padding-bottom: 8px;
  }

  .hero p {
    font-size: 12px;
    line-height: 1.32;
  }

  .howto-image {
    width: min(78%, 270px);
  }

  .card {
    padding: 12px;
  }

  .primary,
  .primary-button {
    padding: 11px;
    border-radius: 10px;
  }
}
