/*
 * Стили игры тренажёра.
 *
 * СОБРАНО СКРИПТОМ scripts/dev/sobrat-igru.mjs из styles.css старого сайта.
 * Руками не править: правку затрёт следующая сборка. Меняется оригинал —
 * запускается скрипт.
 *
 * Файл подключается ТОЛЬКО на странице тренажёра, ссылкой из самой страницы,
 * а не через nuxt.config: имена вроде .game-overlay и .arcade-key общие, и в
 * общем списке стилей они покрасили бы собой весь магазин (F4 в
 * docs/MISTAKES.md).
 */

.trenazher {
  --font-heading: Unbounded, sans-serif;
  --font-label: Onest, sans-serif;
  --font-interface: "Unbounded", "Onest", sans-serif;
  --red: #eb5b69;
  --safe-bottom: max(12px, env(safe-area-inset-bottom));
  --safe-top: max(16px, env(safe-area-inset-top));
  --blue: #4b91f1;
  --blue-soft: #e7f2ff;
  --orange: #ff955f;
  --orange-soft: #fff0e7;
  --shadow: 0 14px 38px rgba(59, 51, 101, 0.09);
  --green: #34b77a;
  --surface-soft: #f0eff6;
  --background: var(--bg);
  --shadow-soft: 0 8px 22px rgba(59, 51, 101, 0.065);
  --track: var(--surface-soft);
  --acid: #a5ff2c;
  --font-display: Unbounded, sans-serif;
}

body.game-open,
body.arcade-open {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

/*
 * Во время занятия и игры навигация скрывается по-настоящему, а не просто
 * накрывается сверху: накрытый элемент остаётся в порядке обхода, и фокус
 * с клавиатуры уходит в невидимую линейку.
 */
body.game-open .tab-bar,
body.arcade-open .tab-bar,
body.lv3-open .tab-bar {
  display: none !important;
}

h1,
h2,
.home-title p,
.daily-hero__content h2,
.game-question-head h1,
.game-result h1 {
  font-family: var(--font-heading);
  font-weight: 800;
}

p,
small,
input,
textarea,
.micro-label,
.tab-button,
.tab-button *,
.sheet-label {
  font-family: var(--font-label);
}

button,
.brand-lockup,
.brand-lockup *,
.mode-card,
.path-stage,
.path-map-card,
.achievement-card,
.setting-row,
.profile-card,
.stat-summary,
.skill-list {
  font-family: var(--font-interface);
}

.auth-intro__copy .micro-label {
  color: rgba(255, 255, 255, 0.7);
}

.setting-icon--danger {
  color: var(--red);
  background: #ffedf0;
}

.setting-row--danger strong {
  color: var(--red);
}

@media (max-width: 820px) {
  .auth-intro__copy .micro-label,
  .auth-intro__copy p {
    display: none;
  }
}

.app-content {
  width: min(100%, 520px);
  min-height: 100dvh;
  margin: 0 auto;
  padding-bottom: calc(102px + var(--safe-bottom));
}

.app-view {
  display: none;
  width: 100%;
  min-height: calc(100dvh - 100px);
  padding: var(--safe-top) 18px 28px;
  overflow-x: hidden;
  overflow-x: clip;
  animation: view-in 0.25s ease both;
}

.app-view--active {
  display: block;
}

.page-header {
  display: flex;
  min-height: 62px;
  margin-bottom: 24px;
  align-items: center;
  justify-content: space-between;
}

.page-header--home {
  margin-bottom: 28px;
}

.page-header h1 {
  margin: 4px 0 0;
  font-size: clamp(2rem, 9vw, 2.65rem);
  line-height: 1;
  letter-spacing: -0.055em;
}

.micro-label {
  color: var(--text-3);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.home-title {
  margin-bottom: 18px;
}

.home-title p {
  margin: 0 0 2px;
  color: var(--text-2);
  font-size: clamp(1.35rem, 6.5vw, 1.75rem);
  font-weight: 650;
  letter-spacing: -0.045em;
}

.home-title h1 {
  margin: 0;
  font-size: clamp(2.45rem, 12vw, 3.45rem);
  line-height: 0.98;
  letter-spacing: -0.067em;
}

.content-section {
  margin-top: 32px;
}

.section-heading {
  display: flex;
  margin-bottom: 14px;
  align-items: flex-end;
  justify-content: space-between;
}

.section-heading > div {
  min-width: 0;
}

.section-heading h2 {
  margin: 3px 0 0;
  font-size: 1.28rem;
  letter-spacing: -0.035em;
}

.arcade-launch {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  overflow: hidden;
  align-items: center;
  border: 1px solid rgba(115, 87, 239, 0.22);
  border-radius: 21px;
  color: #fff;
  background:
    radial-gradient(circle at 82% 18%, rgba(84, 213, 255, 0.35), transparent 29%),
    linear-gradient(135deg, #7656ef, #4a32bd);
  box-shadow: 0 13px 26px rgba(82, 53, 191, 0.2);
  text-align: left;
  cursor: pointer;
  isolation: isolate;
}

.arcade-launch::after {
  position: absolute;
  z-index: -1;
  right: -34px;
  bottom: -54px;
  width: 132px;
  height: 132px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  box-shadow: 0 0 0 22px rgba(255, 255, 255, 0.045);
  content: "";
}

.arcade-launch:active {
  transform: scale(0.985);
}

.arcade-launch__icon {
  display: grid;
  width: 49px;
  height: 49px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.14);
}

.arcade-launch__icon svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.arcade-launch__copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.arcade-launch__copy strong {
  font-size: 0.88rem;
}

.arcade-launch__copy small {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.65rem !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arcade-launch__badge {
  padding: 5px 7px;
  border-radius: 999px;
  color: #4a31ba;
  background: #fff;
  font-size: 0.54rem;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.arcade-launch__arrow {
  width: 19px;
  height: 19px;
}

.reminder-hero {
  position: relative;
  overflow: hidden;
  min-height: 330px;
  padding: 28px 22px;
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.98), transparent 28%),
    linear-gradient(150deg, #f1edff, #e8e2ff);
  text-align: center;
}

.reminder-hero h2 {
  margin: 8px 0 12px;
  font-size: 2.08rem;
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.reminder-hero p {
  max-width: 290px;
  margin: 0 auto;
  color: var(--text-2);
  font-size: 0.8rem;
  line-height: 1.5;
}

.reminder-illustration {
  position: relative;
  display: grid;
  width: 150px;
  height: 150px;
  margin: -2px auto 13px;
  place-items: center;
}

.reminder-illustration::before,
.reminder-illustration::after {
  position: absolute;
  border-radius: 50%;
  content: "";
}

.reminder-illustration::before {
  width: 128px;
  height: 128px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 18px 40px rgba(103, 75, 203, 0.12);
}

.reminder-illustration::after {
  width: 96px;
  height: 96px;
  border: 1px dashed rgba(115, 87, 239, 0.22);
}

.settings-group {
  overflow: hidden;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
}

.setting-row {
  display: grid;
  width: 100%;
  min-height: 72px;
  padding: 10px 14px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  border: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.setting-row + .setting-row {
  border-top: 1px solid var(--border);
}

.setting-row--button {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  cursor: pointer;
}

.setting-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
}

.setting-icon svg {
  width: 21px;
  height: 21px;
}

.setting-icon--violet {
  color: var(--violet);
  background: var(--violet-soft);
}

.setting-icon--blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.setting-icon--orange {
  color: var(--orange);
  background: var(--orange-soft);
}

.setting-row > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.setting-row strong {
  overflow: hidden;
  font-size: 0.83rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setting-row small {
  overflow: hidden;
  color: var(--text-3);
  font-size: 0.67rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setting-row b {
  color: var(--text-2);
  font-size: 0.78rem;
}

.chevron {
  width: 18px;
  height: 18px;
  color: var(--text-3);
}

.ios-switch {
  position: relative;
  display: block;
  width: 50px;
  height: 30px;
}

.ios-switch input {
  position: absolute;
  opacity: 0;
}

.ios-switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #dedde4;
  cursor: pointer;
  transition: background 0.2s ease;
}

.ios-switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(22, 20, 38, 0.2);
  content: "";
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ios-switch input:checked + span {
  background: var(--violet);
}

.ios-switch input:checked + span::after {
  transform: translateX(20px);
}

.reminder-days-section {
  margin-top: 28px;
}

.day-picker {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.day-chip {
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text-2);
  background: var(--surface);
  font-size: 0.68rem;
  font-weight: 760;
  cursor: pointer;
}

.day-chip--active {
  border-color: var(--violet);
  color: #fff;
  background: var(--violet);
  box-shadow: 0 7px 16px rgba(115, 87, 239, 0.2);
}

.ios-primary-button,
.secondary-button {
  width: 100%;
  min-height: 56px;
  padding: 14px 20px;
  border-radius: 18px;
  font-weight: 780;
  cursor: pointer;
}

.ios-primary-button {
  margin-top: 24px;
  border: 0;
  color: #fff;
  background: linear-gradient(145deg, #8064f5, #6748dd);
  box-shadow: 0 13px 28px rgba(103, 72, 221, 0.24);
}

.secondary-button {
  margin-top: 10px;
  border: 1px solid var(--border);
  color: var(--violet);
  background: var(--surface);
}

.reminder-note {
  margin: 12px auto 0;
  color: var(--text-3);
  font-size: 0.64rem;
  line-height: 1.45;
  text-align: center;
}

.tab-bar {
  position: fixed;
  z-index: 50;
  right: max(10px, calc((100vw - 520px) / 2 + 10px));
  bottom: var(--safe-bottom);
  left: max(10px, calc((100vw - 520px) / 2 + 10px));
  display: grid;
  height: 74px;
  padding: 7px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 25px;
  background: rgba(250, 250, 253, 0.88);
  box-shadow:
    0 14px 40px rgba(42, 38, 67, 0.16),
    0 0 0 1px rgba(33, 29, 57, 0.05);
  backdrop-filter: blur(22px) saturate(1.45);
}

.tab-button {
  display: flex;
  min-width: 0;
  padding: 5px 2px 3px;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 18px;
  color: var(--text-3);
  background: transparent;
  font-size: 0.59rem;
  font-weight: 680;
  cursor: pointer;
  transition: 0.18s ease;
}

.tab-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 10px;
}

.tab-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.9;
}

.tab-button--active {
  color: var(--violet);
}

.tab-button--active .tab-icon {
  background: var(--violet-soft);
}

.game-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: none;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, rgba(195, 180, 255, 0.22), transparent 34%),
    var(--bg);
  overscroll-behavior: none;
  touch-action: none;
}

.game-overlay--active {
  display: block;
  animation: game-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes game-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

.game-view,
.game-result {
  width: min(100%, 520px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: var(--safe-top) 18px calc(24px + var(--safe-bottom));
}

.game-view {
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.game-topbar {
  display: grid;
  min-height: 56px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.game-progress-wrap {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.game-context-line {
  display: flex;
  min-width: 0;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.game-context-line .micro-label {
  min-width: 0;
  overflow: hidden;
  font-size: 0.58rem;
  letter-spacing: 0.075em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-question-status {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
  align-items: center;
  color: var(--text-3);
  font-family: var(--font-label);
  font-size: 0.68rem;
  white-space: nowrap;
}

.game-close,
.sheet-close {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text-2);
  background: var(--surface);
  cursor: pointer;
}

.game-close svg,
.sheet-close svg {
  width: 20px;
  height: 20px;
}

.game-progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #e6e4ed;
}

.game-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #9f85ff, var(--violet));
  transition: width 0.35s ease;
}

.game-xp {
  display: flex;
  min-width: 57px;
  height: 36px;
  padding: 0 9px;
  gap: 5px;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  color: var(--violet);
  background: var(--violet-soft);
  font-size: 0.75rem;
}

.staff-card {
  position: relative;
  overflow: hidden;
  padding: 10px 10px 14px;
  border: 1px solid var(--border);
  border-radius: 29px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.staff-card__accent {
  position: absolute;
  top: -55px;
  left: 50%;
  width: 180px;
  height: 120px;
  border-radius: 50%;
  background: rgba(122, 93, 239, 0.08);
  filter: blur(20px);
  transform: translateX(-50%);
}

.staff-note-target {
  cursor: pointer;
  outline: none;
}

.staff-note-target .staff-note-hit-area {
  fill: #000;
  fill-opacity: 0.001;
  stroke: none;
  stroke-width: 3;
}

.staff-note-target:focus-visible .staff-note-hit-area {
  stroke: var(--violet);
}

.staff-listen-hint {
  position: relative;
  z-index: 2;
  margin: -1px 8px 2px;
  color: var(--text-3);
  font-size: 0.7rem;
  font-weight: 650;
  line-height: 1.25;
  text-align: center;
}

.game-feedback {
  min-height: 58px;
  padding: 14px 8px 9px;
  color: var(--text-2);
  font-size: 0.94rem;
  font-weight: 650;
  text-align: center;
}

.game-feedback strong,
.game-feedback b {
  font-size: 1.08rem;
  font-weight: 850;
}

.game-feedback span {
  margin-left: 5px;
  font-size: 0.75rem;
  white-space: nowrap;
}

.game-feedback--right {
  color: var(--green);
}

.game-feedback--wrong {
  color: var(--red);
}

.piano-white-key {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  height: 176px;
  padding: 93px 2px 12px;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
  border: 1px solid #dad9e1;
  border-radius: 0 0 12px 12px;
  color: var(--text);
  background: linear-gradient(180deg, #fff 0%, #fff 72%, #f5f4f8 100%);
  box-shadow:
    inset 0 -5px 0 #e9e8ee,
    0 4px 0 #d6d4de;
  cursor: pointer;
  transition:
    transform 0.09s ease,
    background 0.14s ease;
}

.piano-white-key:first-of-type {
  border-radius: 13px 0 12px 12px;
}

.piano-white-key:nth-of-type(7) {
  border-radius: 0 13px 12px 12px;
}

.piano-white-key:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow:
    inset 0 -2px 0 #e9e8ee,
    0 1px 0 #d6d4de;
}

.piano-white-key__note {
  display: grid;
  width: 24px;
  height: 32px;
  place-items: center;
  color: var(--violet);
}

.piano-white-key__note svg {
  width: 21px;
  height: 29px;
  fill: currentColor;
  stroke: none;
}

.piano-white-key strong {
  color: #1f2430;
  font-size: clamp(0.68rem, 3vw, 0.82rem);
  font-weight: 850;
  line-height: 1;
}

.piano-white-key small {
  color: #747c8b;
  font-size: 0.54rem !important;
  font-weight: 700;
}

.piano-white-key--correct {
  border-color: #59bd8b;
  color: #14774a;
  background: linear-gradient(180deg, #ecfff5, #dff7eb);
  box-shadow:
    inset 0 -5px 0 #a8dfc4,
    0 4px 0 #72c89e;
}

.piano-white-key--wrong {
  border-color: #e98591;
  color: #b62f45;
  background: linear-gradient(180deg, #fff4f5, #ffe7ea);
  box-shadow:
    inset 0 -5px 0 #efb0b7,
    0 4px 0 #db7b87;
}

.piano-black-key {
  --key-index: 1;
  position: absolute;
  z-index: 3;
  top: 0;
  left: calc((100% / 7) * var(--key-index) - min(17px, 4.35vw));
  width: min(34px, 8.7vw);
  height: 101px;
  padding: 0;
  border: 1px solid #17161d;
  border-radius: 0 0 9px 9px;
  background: linear-gradient(90deg, #23212b, #3b3945 54%, #1b1a21);
  box-shadow:
    inset 0 -7px 0 #101015,
    0 5px 7px rgba(22, 20, 30, 0.28);
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  pointer-events: auto;
  transition:
    transform 0.09s ease,
    filter 0.14s ease;
}

.piano-black-key::after {
  position: absolute;
  right: 6px;
  bottom: 12px;
  left: 6px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  content: "";
}

.piano-black-key small {
  position: absolute;
  right: 1px;
  bottom: 20px;
  left: 1px;
  color: inherit;
  font-size: 0.49rem !important;
  font-weight: 850;
  line-height: 1;
  text-align: center;
}

.piano-black-key:active:not(:disabled) {
  transform: translateY(4px);
}

.piano-black-key--correct {
  border-color: #45c782;
  background: linear-gradient(90deg, #143825, #2d8d5b 54%, #123321);
  box-shadow:
    inset 0 -5px 0 #0f4e2e,
    0 0 0 3px rgba(52, 183, 122, 0.22),
    0 6px 12px rgba(22, 95, 58, 0.3);
}

.piano-black-key--wrong {
  border-color: #f07482;
  background: linear-gradient(90deg, #42161d, #9b3342 54%, #371218);
  box-shadow:
    inset 0 -5px 0 #581923,
    0 0 0 3px rgba(235, 91, 105, 0.2);
}

.game-result {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

.game-result[hidden] {
  display: none;
}

.game-result h1 {
  margin: 8px 0 10px;
  font-size: 3rem;
  letter-spacing: -0.07em;
}

.game-result > p {
  max-width: 310px;
  margin: 0 0 30px;
  color: var(--text-2);
  font-size: 0.85rem;
  line-height: 1.5;
}

.game-result .ios-primary-button {
  margin-top: 22px;
}

.arcade-overlay {
  position: fixed;
  z-index: 150;
  inset: 0;
  display: none;
  overflow: hidden;
  color: #f7f8ff;
  background:
    radial-gradient(circle at 16% 5%, rgba(120, 83, 255, 0.3), transparent 28rem),
    radial-gradient(circle at 88% 90%, rgba(54, 202, 244, 0.18), transparent 30rem),
    #090d19;
  overscroll-behavior: none;
  touch-action: none;
}

.arcade-overlay--active {
  display: block;
  animation: game-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.arcade-shell {
  position: relative;
  display: grid;
  width: min(100%, 1040px);
  height: 100dvh;
  min-height: 0;
  margin: 0 auto;
  padding: var(--safe-top) 14px var(--safe-bottom);
  grid-template-rows: 68px minmax(0, 1fr) 118px;
  gap: 10px;
}

.arcade-topbar {
  position: relative;
  z-index: 42;
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
}

.arcade-rotate {
  position: absolute;
  z-index: 40;
  inset: 0;
  display: grid;
  padding: 72px 18px 24px;
  place-items: center;
  background:
    radial-gradient(circle at 50% 35%, rgba(117, 86, 239, .22), transparent 34%),
    #090d19;
}

.arcade-rotate[hidden] { display: none; }

.arcade-rotate__card {
  display: grid;
  width: min(100%, 390px);
  padding: 24px 22px;
  gap: 11px;
  justify-items: center;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 26px;
  color: #f7f8ff;
  background: rgba(24, 29, 48, .96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .4);
  text-align: center;
}

.arcade-rotate__card .micro-label { color: rgba(255, 255, 255, .52); }

/*
 * Значок «повернуть телефон» у аркады развёрнут на 90°.
 *
 * Контур один и тот же: у занятия он просит положить телефон набок, у аркады —
 * поставить обратно. Второй контур на то же движение — это вторая картинка,
 * которая однажды разойдётся с первой.
 */
.arcade-rotate__icon--vertical { transform: rotate(90deg); }

.arcade-rotate__icon { width: 92px; height: 92px; color: #9d87ff; }

.arcade-rotate__card h2 { margin: 0; font-family: var(--font-heading); font-size: 1.45rem; }

.arcade-rotate__card p { margin: 0; color: rgba(255, 255, 255, .78); font-size: .78rem; line-height: 1.45; }

.arcade-rotate__card small { color: rgba(255, 255, 255, .52); font-size: .66rem; line-height: 1.4; }

.arcade-close {
  display: grid;
  width: 43px;
  height: 43px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.arcade-close svg {
  width: 21px;
  height: 21px;
}

.arcade-heading {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.arcade-heading .micro-label {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.55rem;
}

.arcade-heading strong {
  overflow: hidden;
  font-family: var(--font-heading);
  font-size: 1.02rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arcade-hud {
  display: flex;
  gap: 6px;
  align-items: center;
}

.arcade-hud > span:not(.arcade-lives) {
  display: grid;
  min-width: 52px;
  min-height: 42px;
  padding: 5px 8px;
  place-content: center;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.07);
  text-align: center;
}

.arcade-hud small {
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.45rem !important;
  line-height: 1;
}

.arcade-hud b {
  margin-top: 3px;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.arcade-lives {
  min-width: 48px;
  color: #ff7188;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.arcade-lives--danger {
  animation: arcade-heart 0.32s ease 2 alternate;
}

@keyframes arcade-heart {
  to { transform: scale(1.18); filter: brightness(1.4); }
}

.arcade-arena {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    radial-gradient(circle at 50% 35%, rgba(112, 77, 242, 0.16), transparent 45%),
    rgba(16, 22, 38, 0.93);
  background-size: 36px 36px, 36px 36px, auto, auto;
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.28),
    0 18px 48px rgba(0, 0, 0, 0.2);
  isolation: isolate;
}

.arcade-sky i {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 9px rgba(255, 255, 255, 0.8);
  opacity: 0.35;
  animation: arcade-star 1.7s ease-in-out infinite alternate;
}

.arcade-sky i:nth-child(1) { top: 13%; left: 11%; }

.arcade-sky i:nth-child(2) { top: 21%; right: 17%; animation-delay: -0.7s; }

.arcade-sky i:nth-child(3) { top: 46%; left: 22%; animation-delay: -1.1s; }

.arcade-sky i:nth-child(4) { top: 58%; right: 9%; animation-delay: -0.35s; }

.arcade-sky i:nth-child(5) { top: 37%; left: 72%; animation-delay: -1.35s; }

@keyframes arcade-star {
  to { opacity: 0.9; transform: scale(1.7); }
}

.arcade-danger-line {
  position: absolute;
  z-index: 2;
  right: 16px;
  bottom: 80px;
  left: 16px;
  height: 1px;
  border-top: 1px dashed rgba(255, 113, 136, 0.32);
}

.arcade-danger-line span {
  position: absolute;
  top: -8px;
  right: 0;
  padding-left: 7px;
  color: rgba(255, 113, 136, 0.58);
  background: #111726;
  font-size: 0.46rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.arcade-target-layer {
  position: absolute;
  z-index: 8;
  inset: 0;
  pointer-events: none;
}

.arcade-note-target {
  position: absolute;
  top: -102px;
  left: 50%;
  display: grid;
  width: 90px;
  height: 90px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 29px;
  color: #342366;
  background:
    radial-gradient(circle at 32% 22%, #fff, transparent 30%),
    linear-gradient(145deg, #f8f6ff, #dcd5ff);
  box-shadow:
    0 0 0 6px rgba(125, 89, 242, 0.14),
    0 18px 30px rgba(0, 0, 0, 0.28);
  will-change: transform;
}

.arcade-note-target::after {
  position: absolute;
  right: -7px;
  bottom: -7px;
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 3px solid #121827;
  border-radius: 50%;
  color: #fff;
  background: var(--violet);
  font-family: "Segoe UI Symbol", serif;
  font-size: 0.72rem;
  content: "♪";
}

.arcade-note-target svg {
  width: 76px;
  height: 76px;
  overflow: visible;
}

.arcade-note-target .mini-staff {
  fill: none;
  stroke: #7c748a;
  stroke-width: 1.2;
  opacity: 0.72;
}

.arcade-note-target .mini-clef {
  fill: #332c40;
  font-family: "Segoe UI Symbol", "Noto Music", serif;
  font-size: 36px;
}

.arcade-note-target .mini-note,
.arcade-note-target .mini-stem,
.arcade-note-target .mini-ledger {
  fill: var(--violet);
  stroke: var(--violet);
}

.arcade-note-target--hit {
  animation: arcade-pop 0.42s cubic-bezier(0.18, 0.89, 0.4, 1.4) forwards;
}

.arcade-note-target--missed {
  opacity: 0;
  filter: blur(5px);
  transition: opacity 0.25s ease, filter 0.25s ease;
}

@keyframes arcade-pop {
  35% { transform: translate(-50%, var(--target-y)) scale(1.22) rotate(7deg); }
  100% { transform: translate(-50%, var(--target-y)) scale(0.05) rotate(24deg); opacity: 0; }
}

.arcade-cannon {
  --cannon-angle: 0deg;
  position: absolute;
  z-index: 6;
  bottom: 8px;
  left: 50%;
  width: 82px;
  height: 68px;
  pointer-events: none;
  transform: translateX(-50%);
}

.arcade-cannon__barrel {
  position: absolute;
  z-index: 1;
  bottom: 29px;
  left: 34px;
  width: 14px;
  height: 42px;
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(90deg, #5b43d8, #a58eff 52%, #4f36c8);
  box-shadow: 0 0 16px rgba(127, 91, 244, 0.38);
  transform: rotate(var(--cannon-angle));
  transform-origin: 50% 100%;
  transition: transform 0.14s ease;
}

.arcade-cannon__body {
  position: absolute;
  z-index: 2;
  bottom: 9px;
  left: 20px;
  width: 42px;
  height: 35px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 19px 19px 12px 12px;
  background: linear-gradient(145deg, #8e72ff, #5035c9);
  box-shadow: 0 9px 18px rgba(0, 0, 0, 0.3);
}

.arcade-cannon__body i {
  position: absolute;
  top: 10px;
  left: 13px;
  width: 12px;
  height: 12px;
  border: 3px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
}

.arcade-cannon__base {
  position: absolute;
  right: 6px;
  bottom: 2px;
  left: 6px;
  height: 12px;
  border-radius: 9px 9px 4px 4px;
  background: #2c3244;
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.12);
}

.arcade-cannon--fire {
  animation: cannon-recoil 0.22s ease;
}

.arcade-feedback {
  position: absolute;
  z-index: 7;
  bottom: 77px;
  left: 50%;
  max-width: calc(100% - 150px);
  margin: 0;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(9, 13, 25, 0.72);
  font-size: 0.61rem;
  line-height: 1.2;
  text-align: center;
  transform: translateX(-50%);
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.arcade-feedback--right { color: #a8f0c9; border-color: rgba(74, 208, 137, 0.3); }

.arcade-feedback--wrong { color: #ff9bab; border-color: rgba(255, 113, 136, 0.3); }

.arcade-bullet {
  position: absolute;
  z-index: 20;
  width: 9px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  background: linear-gradient(#fff, #68dcff 45%, #7656ef);
  box-shadow:
    0 0 10px #6cddff,
    0 0 22px rgba(117, 86, 239, 0.75);
  pointer-events: none;
}

.arcade-burst-particle {
  position: absolute;
  z-index: 18;
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--particle-color, #7de8ff);
  box-shadow: 0 0 9px var(--particle-color, #7de8ff);
  pointer-events: none;
}

.arcade-keyboard {
  position: relative;
  display: flex;
  min-width: 0;
  overflow: hidden;
  border-radius: 8px 8px 16px 16px;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.25));
}

.arcade-key {
  position: relative;
  min-width: 0;
  border: 1px solid #cfd3de;
  color: #232735;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.arcade-key--white {
  z-index: 1;
  display: flex;
  height: 108px;
  padding: 10px 2px 10px;
  flex: 1 1 0;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  justify-content: flex-end;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(90deg, #f2f4f8, #fff 18%, #fff 78%, #e5e8ef);
  box-shadow: inset 0 -5px 0 #dfe2e9, inset -2px 0 rgba(24, 29, 42, .08), 0 4px 0 #bfc4ce;
  transition: background-color .12s ease, box-shadow .12s ease;
}

.arcade-key--white + .arcade-key--white { border-left: 0; }

.arcade-key--black {
  position: absolute;
  z-index: 4;
  top: 0;
  left: var(--arcade-black-left);
  display: flex;
  width: clamp(24px, 8.2%, 58px);
  height: 58%;
  padding: 0 2px 8px;
  align-items: flex-end;
  justify-content: center;
  border: 1px solid #070a10;
  border-top: 0;
  border-radius: 0 0 7px 7px;
  color: rgba(255, 255, 255, .72);
  background: linear-gradient(90deg, #090c13, #303541 48%, #080a0f);
  box-shadow: inset 0 -5px rgba(0,0,0,.5), 0 5px 7px rgba(0,0,0,.36);
  transform: translateX(-50%);
}

.arcade-key--black small { overflow: hidden; max-width: 100%; font-size: .43rem !important; text-overflow: ellipsis; white-space: nowrap; }

.arcade-key__note {
  color: var(--violet);
  font-family: "Segoe UI Symbol", serif;
  font-size: 1.32rem;
  line-height: 1;
}

.arcade-key strong {
  overflow: hidden;
  max-width: 100%;
  color: inherit;
  font-size: clamp(0.58rem, 2.5vw, 0.78rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arcade-key--white > small {
  color: #768092;
  font-size: 0.48rem !important;
  font-weight: 750;
}

.arcade-key--white:active,
.arcade-key--white.arcade-key--pressed {
  background: linear-gradient(180deg, #ece9ff, #f8f7ff 72%, #d8d3ed);
  box-shadow: inset 0 -2px 0 #d4d0e8, 0 1px 0 #afb4bf;
}

.arcade-key--black:active,
.arcade-key--black.arcade-key--pressed {
  height: 60%;
  background: linear-gradient(90deg, #07090e, #252a34 48%, #05070a);
  box-shadow: inset 0 -2px rgba(0,0,0,.55), 0 2px 3px rgba(0,0,0,.3);
}

.arcade-key--correct {
  border-color: #57d596;
  background: linear-gradient(180deg, #f0fff7, #c8f3dc);
  filter: drop-shadow(0 0 10px rgba(66, 218, 140, 0.42));
}

.arcade-key--wrong {
  border-color: #ff7188;
  animation: arcade-key-wrong 0.25s ease 2 alternate;
}

.arcade-key--white.arcade-key--wrong { background: linear-gradient(180deg, #fff5f6, #ffd5db); }

.arcade-key--black.arcade-key--wrong { background: linear-gradient(90deg, #3c0d17, #7b2335 48%, #280810); }

@keyframes arcade-key-wrong {
  to { filter: drop-shadow(0 0 9px rgba(255, 113, 136, .75)); }
}

.arcade-result {
  position: absolute;
  z-index: 40;
  inset: max(16px, var(--safe-top)) 14px max(16px, var(--safe-bottom));
  display: flex;
  padding: 28px 22px;
  overflow: hidden;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 32px;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 10%, rgba(136, 105, 255, 0.2), transparent 32%),
    var(--surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
  text-align: center;
}

.arcade-result[hidden] { display: none; }

.arcade-result__icon {
  position: relative;
  z-index: 2;
  display: grid;
  width: 92px;
  height: 92px;
  margin-bottom: 22px;
  place-items: center;
  border: 7px solid #fff;
  border-radius: 31px;
  color: #fff;
  background: linear-gradient(145deg, #9b82ff, #6041d8);
  box-shadow: 0 18px 38px rgba(96, 65, 216, 0.3);
  font-size: 2.4rem;
  transform: rotate(-5deg);
}

.arcade-result h2 {
  position: relative;
  z-index: 2;
  margin: 8px 0 9px;
  font-size: clamp(1.8rem, 7vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.055em;
}

.arcade-result > p {
  position: relative;
  z-index: 2;
  max-width: 330px;
  margin: 0 0 24px;
  color: var(--text-2);
  font-size: 0.78rem;
  line-height: 1.45;
}

.arcade-result__stats {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(100%, 420px);
  margin-bottom: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.arcade-result__stats span {
  display: flex;
  min-height: 88px;
  padding: 10px 5px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 19px;
  background: var(--surface-soft);
}

.arcade-result__stats b { font-size: 1.22rem; }

.arcade-result__stats small { margin-top: 3px; color: var(--text-3); font-size: 0.58rem !important; }

.arcade-result .ios-primary-button,
.arcade-result .secondary-button { position: relative; z-index: 2; width: min(100%, 420px); }

.arcade-result__burst {
  position: absolute;
  top: 12%;
  left: 50%;
  width: 300px;
  height: 150px;
  pointer-events: none;
  transform: translateX(-50%);
}

.arcade-result__burst i {
  position: absolute;
  width: 10px;
  height: 18px;
  border-radius: 4px;
  background: var(--violet);
  animation: confetti 1.5s ease-in-out infinite alternate;
}

.arcade-result__burst i:nth-child(1) { top: 5%; left: 8%; background: #53d8ff; transform: rotate(24deg); }

.arcade-result__burst i:nth-child(2) { top: 55%; left: 20%; background: var(--mint); transform: rotate(-30deg); }

.arcade-result__burst i:nth-child(3) { top: 8%; right: 15%; background: var(--orange); transform: rotate(18deg); }

.arcade-result__burst i:nth-child(4) { top: 65%; right: 5%; background: #e869c4; transform: rotate(-38deg); }

.arcade-result__burst i:nth-child(5) { top: 82%; left: 8%; transform: rotate(50deg); }

.arcade-result__burst i:nth-child(6) { top: 84%; right: 28%; background: #53d8ff; transform: rotate(-12deg); }

@media (max-width: 560px) {
  .arcade-shell {
    grid-template-rows: 62px minmax(0, 1fr) 102px;
    gap: 7px;
  }
  .arcade-heading .micro-label { display: none; }
  .arcade-heading strong { font-size: 0.88rem; }
  .arcade-hud > span:not(.arcade-lives) { min-width: 45px; padding-inline: 5px; }
  .arcade-lives { min-width: 39px; font-size: 0.72rem; }
  .arcade-note-target { width: 82px; height: 82px; border-radius: 26px; }
  .arcade-note-target svg { width: 70px; height: 70px; }
  .arcade-key--white { height: 94px; }
  .arcade-feedback { max-width: calc(100% - 130px); font-size: 0.55rem; }
}

@media (max-width: 359px) {
  .arcade-shell { padding-inline: 8px; }
  .arcade-heading { display: none; }
  .arcade-topbar { grid-template-columns: auto minmax(0, 1fr); }
  .arcade-hud { justify-content: flex-end; }
  .arcade-key strong { font-size: 0.54rem; }
  .arcade-launch__badge { display: none; }
}

@media (orientation: landscape) and (max-height: 600px) {
  .arcade-shell {
    width: min(100%, 980px);
    padding: var(--safe-top) 12px var(--safe-bottom);
    grid-template-rows: 48px minmax(0, 1fr) 76px;
    gap: 5px;
  }
  .arcade-close { width: 38px; height: 38px; }
  .arcade-hud > span:not(.arcade-lives) { min-height: 36px; }
  .arcade-key--white { height: 70px; padding-bottom: 7px; }
  .arcade-danger-line { bottom: 55px; }
  .arcade-cannon { bottom: -2px; transform: translateX(-50%) scale(0.74); transform-origin: bottom; }
  .arcade-feedback { bottom: 49px; }
  .arcade-note-target { width: 70px; height: 70px; border-radius: 22px; }
  .arcade-note-target svg { width: 61px; height: 61px; }
  .arcade-result { padding: 12px 22px; }
  .arcade-result__icon { width: 55px; height: 55px; margin-bottom: 7px; border-width: 4px; border-radius: 18px; font-size: 1.4rem; }
  .arcade-result h2 { margin-block: 4px; font-size: 1.55rem; }
  .arcade-result > p { margin-bottom: 8px; }
  .arcade-result__stats { margin-bottom: 8px; }
  .arcade-result__stats span { min-height: 54px; }
  .arcade-result .ios-primary-button,
  .arcade-result .secondary-button { min-height: 40px; margin-top: 5px; }
}

.profile-form .ios-primary-button {
  margin-top: 2px;
}

.game-result > *:not(.result-confetti) {
  position: relative;
  z-index: 2;
}

.toast {
  position: fixed;
  z-index: 300;
  right: 18px;
  bottom: calc(102px + var(--safe-bottom));
  left: 18px;
  max-width: 440px;
  min-height: 50px;
  margin: auto;
  padding: 13px 18px;
  border-radius: 17px;
  color: #fff;
  background: rgba(28, 26, 39, 0.94);
  box-shadow: 0 12px 35px rgba(25, 22, 42, 0.25);
  font-size: 0.76rem;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: 0.25s ease;
}

.toast--visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 374px) {
  .app-view,
  .game-view,
  .game-result {
    padding-inline: 14px;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .game-view {
    display: grid;
    width: 100%;
    max-width: 980px;
    height: 100vh;
    max-height: 100vh;
    min-height: 0;
    padding: var(--safe-top) max(12px, env(safe-area-inset-right)) var(--safe-bottom) max(12px, env(safe-area-inset-left));
    grid-template-columns: minmax(260px, 0.92fr) minmax(300px, 1.08fr);
    grid-template-rows: 54px auto minmax(0, 1fr);
    gap: 7px 14px;
    overflow: hidden;
  }
  .game-topbar {
    grid-column: 1 / -1;
    height: 42px;
  }
  .game-close {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }
  .staff-card {
    grid-column: 1;
    grid-row: 2 / 4;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    padding: 4px 7px 7px;
    border-radius: 22px;
  }
  .staff-listen-hint {
    margin: 0 4px;
    font-size: 0.62rem;
  }
  .game-feedback {
    grid-column: 2;
    grid-row: 2;
    min-height: 0;
    padding: 8px 4px 3px;
    align-self: end;
  }
  .piano-white-key {
    height: 100%;
    padding-top: 76px;
  }
  .piano-black-key {
    left: calc((100% / 7) * var(--key-index) - min(17px, 2.15vw));
    width: min(34px, 4.3vw);
    height: 56%;
    max-height: 130px;
  }
  .game-result {
    width: min(100%, 720px);
    height: 100dvh;
    min-height: 0;
    padding: 8px 20px;
  }
  .game-result h1 {
    margin: 2px 0 3px;
    font-size: 2rem;
  }
  .game-result > p {
    margin-bottom: 8px;
    font-size: 0.72rem;
  }
  .game-result .ios-primary-button,
  .game-result .secondary-button {
    max-width: 520px;
    min-height: 40px;
    margin-top: 6px;
    padding-block: 7px;
    border-radius: 14px;
  }
}

@media (min-width: 700px) {
  .app-content {
    width: min(100%, 920px);
    border-inline: 1px solid rgba(30, 28, 45, 0.04);
    background: rgba(247, 247, 251, 0.93);
  }
  .app-view {
    padding-inline: 28px;
  }
  #homeView.app-view--active,
  #statsView.app-view--active,
  #reminderView.app-view--active,
  #profileView.app-view--active {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-content: start;
  }
  #homeView > .page-header,
  #homeView > .home-title,
  #homeView > .lv3-home,
  #homeView > .achievements-preview,
  #statsView > .page-header,
  #statsView > .stat-summary-grid,
  #statsView > .content-section,
  #reminderView > .page-header,
  #profileView > .page-header,
  #profileView > .profile-settings {
    grid-column: 1 / -1;
  }
  #homeView > .page-header,
  #homeView > .home-title {
    margin-bottom: 0;
  }
  #homeView > .daily-hero,
  #homeView > .content-section,
  #statsView > .chart-card,
  #statsView > .growth-card,
  #statsView > .insight-card,
  #statsView > .competition-card,
  #reminderView > .settings-group,
  #reminderView > .content-section,
  #profileView > .content-section {
    margin-top: 0;
  }
  #homeView > .daily-hero,
  #homeView > .content-section:first-of-type {
    align-self: stretch;
  }
  #homeView > .content-section:nth-of-type(2) {
    grid-column: 1 / -1;
  }
  #reminderView > .page-header {
    margin-bottom: 0;
  }
  #reminderView > .reminder-hero {
    grid-row: span 3;
  }
  #reminderView > .ios-primary-button,
  #reminderView > .reminder-note,
  #profileView > .profile-card,
  #profileView > .content-section {
    align-self: start;
  }
  #reminderView > .reminder-note {
    margin-top: 0;
  }
  .tab-bar {
    right: max(22px, calc((100vw - 720px) / 2));
    left: max(22px, calc((100vw - 720px) / 2));
  }
  .game-view {
    width: min(100%, 760px);
    padding-inline: 28px;
  }
  .note-answers,
  .piano-white-key {
    height: 210px;
  }
  .piano-black-key {
    height: 120px;
  }
}

@media (min-width: 1100px) and (min-height: 650px) {
  .app-content {
    width: min(100%, 1320px);
    padding: 0 26px 0 124px;
    border-inline: 0;
  }
  .app-view {
    height: 100vh;
    min-height: 0;
    padding: 22px 28px;
    overflow: hidden;
  }
  .page-header {
    min-height: 54px;
    margin-bottom: 0;
  }
  .page-header h1 {
    font-size: 2.35rem;
  }
  #homeView.app-view--active {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto auto minmax(300px, auto) minmax(150px, auto);
    gap: 14px 18px;
  }
  #homeView > .page-header,
  #homeView > .home-title,
  #homeView > .achievements-preview {
    grid-column: 1 / -1;
  }
  #homeView > .content-section:first-of-type {
    grid-column: 2;
    grid-row: 3;
  }
  #homeView > .content-section:nth-of-type(2) {
    grid-column: 3;
    grid-row: 3;
  }
  .home-title p {
    font-size: 1.25rem;
  }
  .home-title h1 {
    font-size: 2.7rem;
  }
  .achievements-preview .section-heading {
    margin-bottom: 8px;
  }
  #statsView.app-view--active {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: auto auto minmax(250px, 1fr) auto;
    gap: 14px;
  }
  #statsView > .page-header,
  #statsView > .stat-summary-grid {
    grid-column: 1 / -1;
  }
  #statsView > .content-section:not(.progress-achievements) {
    grid-column: 9 / -1;
    grid-row: 4;
  }
  #reminderView.app-view--active {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: auto auto auto auto 1fr;
    gap: 14px 20px;
  }
  #reminderView > .page-header {
    grid-column: 1 / -1;
  }
  #reminderView > .reminder-hero {
    grid-column: 1 / 7;
    grid-row: 2 / 6;
    min-height: 0;
    height: 100%;
  }
  #reminderView > .settings-group,
  #reminderView > .content-section,
  #reminderView > .ios-primary-button,
  #reminderView > .reminder-note {
    grid-column: 7 / -1;
  }
  #reminderView > .ios-primary-button {
    margin-top: 0;
  }
  #profileView.app-view--active {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: auto auto 1fr;
    gap: 16px 20px;
  }
  #profileView > .page-header {
    grid-column: 1 / -1;
  }
  #profileView > .content-section {
    grid-column: 5 / -1;
    grid-row: 2;
    margin-top: 0;
  }
  .tab-bar {
    top: 27px;
    right: auto;
    bottom: auto;
    left: max(18px, calc((100vw - 1320px) / 2 + 18px));
    width: 88px;
    height: auto;
    padding: 9px;
    grid-template-columns: 1fr;
    transform: none;
  }
  .tab-button {
    min-height: 72px;
  }
  .game-view {
    display: grid;
    width: min(100%, 1200px);
    max-width: 1200px;
    height: 100vh;
    min-height: 0;
    padding: 20px 28px;
    grid-template-columns: minmax(430px, 0.9fr) minmax(520px, 1.1fr);
    grid-template-rows: 58px auto minmax(0, 1fr);
    gap: 14px 28px;
    overflow: hidden;
  }
  .game-topbar {
    grid-column: 1 / -1;
  }
  .staff-card {
    grid-column: 1;
    grid-row: 2 / 4;
    min-height: 0;
  }
  .game-feedback {
    grid-column: 2;
    grid-row: 2;
    align-self: end;
  }
  .piano-white-key {
    height: 100%;
    padding-top: 120px;
  }
  .piano-black-key {
    left: calc((100% / 7) * var(--key-index) - min(22px, 1.8vw));
    width: min(44px, 3.6vw);
    height: 58%;
    max-height: 240px;
  }
}

/* Physical piano input and microphone calibration */
.input-calibration {
  position: fixed;
  z-index: 1200;
  inset: 0;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 14% 10%, rgba(165, 255, 44, 0.14), transparent 28%),
    radial-gradient(circle at 88% 86%, rgba(75, 145, 241, 0.14), transparent 30%),
    var(--background);
}

.input-calibration:not(.input-calibration--active) { display: none; }

.input-calibration__shell {
  display: grid;
  width: min(100%, 1180px);
  height: 100vh;
  height: 100dvh;
  min-height: 100%;
  margin: 0 auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.input-calibration__header {
  display: grid;
  min-height: 86px;
  padding: max(14px, env(safe-area-inset-top)) clamp(16px, 4vw, 42px) 12px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.input-calibration__header > div { min-width: 0; }

.input-calibration__header strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  font-size: 0.83rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calibration-step-badge {
  display: inline-grid;
  min-width: 52px;
  min-height: 32px;
  padding: 0 10px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--violet);
  background: var(--surface);
  font-size: 0.7rem;
  font-weight: 850;
  box-shadow: var(--shadow-soft);
}

.calibration-progress {
  overflow: hidden;
  height: 5px;
  grid-column: 1 / -1;
  border-radius: 999px;
  background: var(--track);
}

.calibration-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #43ddd4, var(--acid));
  transition: width 0.3s ease;
}

.input-calibration__content {
  overflow: auto;
  min-height: 0;
  padding: 12px clamp(16px, 5vw, 64px) 20px;
  scrollbar-color: var(--violet) transparent;
}

.calibration-panel {
  width: min(100%, 820px);
  min-height: 100%;
  margin: 0 auto;
}

.calibration-panel--intro,
.calibration-panel--summary {
  display: flex;
  max-width: 720px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.calibration-panel[hidden] { display: none; }

.calibration-hero-icon {
  display: grid;
  width: 82px;
  height: 82px;
  margin-bottom: 18px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 27px;
  background: linear-gradient(145deg, var(--surface), var(--violet-soft));
  box-shadow: var(--shadow);
  font-size: 2.35rem;
}

.calibration-panel h1 {
  max-width: 690px;
  margin: 10px 0 12px;
  font-size: clamp(1.65rem, 5vw, 3rem);
  line-height: 1.03;
  letter-spacing: -0.055em;
}

.calibration-panel > p,
.calibration-run-copy p {
  max-width: 650px;
  margin: 0;
  color: var(--text-2);
  font-size: clamp(0.8rem, 1.7vw, 1rem);
  line-height: 1.55;
}

.calibration-rules {
  display: grid;
  width: 100%;
  margin-top: 26px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.calibration-rules span,
.calibration-summary-stats span {
  display: flex;
  min-width: 0;
  padding: 16px 12px;
  flex-direction: column;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.calibration-rules b {
  display: grid;
  width: 31px;
  height: 31px;
  margin-bottom: 10px;
  place-items: center;
  border-radius: 11px;
  color: #152008;
  background: var(--acid);
  font-size: 0.76rem;
}

.calibration-rules strong,
.calibration-summary-stats strong { font-size: 0.8rem; }

.calibration-rules small,
.calibration-summary-stats small {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 0.65rem;
  line-height: 1.35;
}

.calibration-panel .calibration-privacy {
  margin-top: 17px;
  color: var(--text-3);
  font-size: 0.68rem;
}

.calibration-panel--run {
  display: grid;
  max-width: 940px;
  grid-template-columns: minmax(220px, 0.72fr) minmax(330px, 1.28fr);
  grid-template-areas:
    "copy piano"
    "note piano"
    "detected detected"
    "meter meter"
    "keys keys";
  gap: 14px 20px;
  align-content: center;
}

.calibration-run-copy { grid-area: copy; align-self: end; }

.calibration-run-copy h1 {
  margin-top: 7px;
  font-size: clamp(1.45rem, 3.6vw, 2.45rem);
}

.calibration-note-card {
  display: grid;
  min-height: 138px;
  padding: 18px;
  grid-area: note;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr auto;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.calibration-note-card > span {
  display: grid;
  width: 44px;
  height: 44px;
  grid-row: 1 / 3;
  place-items: center;
  border-radius: 15px;
  color: #172006;
  background: var(--acid);
  font-size: 1.3rem;
  font-weight: 900;
}

.calibration-note-card strong {
  align-self: end;
  margin-left: 14px;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 2.7rem);
  line-height: 1;
}

.calibration-note-card small {
  align-self: start;
  margin: 6px 0 0 14px;
  color: var(--text-3);
  font-size: 0.7rem;
  font-weight: 750;
}

.calibration-piano {
  position: relative;
  overflow: hidden;
  min-height: 255px;
  grid-area: piano;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: #d9dde5;
  box-shadow: var(--shadow);
}

.calibration-piano__whites {
  display: grid;
  position: absolute;
  inset: 0;
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.calibration-piano-key--white {
  position: relative;
  min-width: 0;
  border: 0;
  border-right: 1px solid #b8bec9;
  border-radius: 0 0 10px 10px;
  background: linear-gradient(100deg, #fff, #edf0f5 75%, #dfe3ea);
  box-shadow: inset 0 -7px 0 #c7ccd4;
}

.calibration-piano-key--white.is-target {
  background: linear-gradient(160deg, #eaffc8, var(--acid));
  box-shadow: inset 0 -7px 0 #80c900, 0 0 28px rgba(165, 255, 44, 0.55);
}

.calibration-piano-key--black {
  position: absolute;
  z-index: 2;
  top: 0;
  width: 8.5%;
  height: 62%;
  border: 0;
  border-radius: 0 0 9px 9px;
  background: linear-gradient(100deg, #090d14, #303746 55%, #080b11);
  box-shadow: 0 8px 8px rgba(8, 12, 20, 0.35), inset 0 -5px 0 #030508;
  transform: translateX(-50%);
}

.calibration-piano-key--black.is-target {
  background: linear-gradient(160deg, #d9ff97, #7fd600);
  box-shadow: 0 0 28px rgba(165, 255, 44, 0.7), inset 0 -5px 0 #5e9f00;
}

.calibration-piano-key i {
  position: absolute;
  right: 0;
  bottom: 17px;
  left: 0;
  color: #69717e;
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 850;
  text-align: center;
}

.calibration-piano-key--black i { bottom: 10px; color: #fff; }

.calibration-detected {
  display: grid;
  min-height: 66px;
  padding: 12px 16px;
  grid-area: detected;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
}

.calibration-detected strong,
.calibration-detected small { display: block; }

.calibration-detected strong { font-size: 0.83rem; }

.calibration-detected small { margin-top: 3px; color: var(--text-3); font-size: 0.67rem; }

.calibration-detected.is-success { border-color: rgba(29, 187, 121, 0.36); background: rgba(29, 187, 121, 0.1); }

.calibration-detected.is-warning { border-color: rgba(245, 151, 35, 0.38); background: rgba(245, 151, 35, 0.11); }

.calibration-listening-dot {
  width: 16px;
  height: 16px;
  border: 4px solid rgba(75, 145, 241, 0.2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: calibration-spin 0.85s linear infinite;
}

.is-success .calibration-listening-dot,
.is-warning .calibration-listening-dot { border: 0; background: currentColor; animation: none; }

.is-success .calibration-listening-dot { color: var(--green); }

.is-warning .calibration-listening-dot { color: var(--orange); }

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

.calibration-meter {
  overflow: hidden;
  height: 7px;
  grid-area: meter;
  border-radius: 999px;
  background: var(--track);
}

.calibration-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #45d8c8, var(--acid), var(--orange));
  transition: width 0.09s linear;
}

.calibration-key-progress {
  display: grid;
  grid-area: keys;
  grid-template-columns: repeat(49, minmax(3px, 1fr));
  gap: 3px;
}

.calibration-key-progress i { height: 7px; border-radius: 999px; background: var(--track); }

.calibration-key-progress i.is-done { background: var(--green); }

.calibration-key-progress i.is-current { background: var(--acid); box-shadow: 0 0 0 3px rgba(165, 255, 44, 0.2); }

.calibration-summary-stats {
  display: grid;
  width: 100%;
  margin-top: 24px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.calibration-summary-stats strong { font-family: var(--font-display); font-size: clamp(1.2rem, 4vw, 2rem); }

.calibration-diagnosis {
  width: 100%;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(29, 187, 121, 0.28);
  border-radius: 20px;
  color: var(--text-2);
  background: rgba(29, 187, 121, 0.09);
  font-size: 0.76rem;
  line-height: 1.5;
}

.calibration-diagnosis.is-warning { border-color: rgba(245, 151, 35, 0.34); background: rgba(245, 151, 35, 0.1); }

.calibration-diagnosis.is-danger { border-color: rgba(235, 82, 96, 0.34); background: rgba(235, 82, 96, 0.1); }

.input-calibration__footer {
  display: flex;
  min-height: 84px;
  padding: 12px clamp(16px, 5vw, 64px) max(12px, env(safe-area-inset-bottom));
  gap: 10px;
  justify-content: center;
  background: linear-gradient(180deg, transparent, var(--background) 24%);
}

.input-calibration__footer button { width: min(100%, 360px); min-height: 54px; margin: 0; }

.input-calibration__footer .secondary-button { max-width: 160px; }

.input-choice-list { display: grid; margin-top: 18px; gap: 10px; }

.input-choice {
  display: grid;
  width: 100%;
  min-height: 76px;
  padding: 12px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.input-choice > i {
  display: grid;
  width: 45px;
  height: 45px;
  place-items: center;
  border-radius: 15px;
  color: var(--violet);
  background: var(--violet-soft);
  font-size: 1.25rem;
  font-style: normal;
}

.input-choice strong,
.input-choice small { display: block; }

.input-choice strong { font-size: 0.83rem; }

.input-choice small { margin-top: 4px; color: var(--text-3); font-size: 0.67rem; line-height: 1.35; }

.input-choice > b { color: var(--text-3); font-size: 0.67rem; }

.input-choice.is-selected { border-color: rgba(115, 87, 239, 0.42); box-shadow: inset 0 0 0 1px rgba(115, 87, 239, 0.16); }

.input-choice[disabled] { opacity: 0.55; cursor: not-allowed; }

.midi-test-card {
  display: grid;
  margin-top: 12px;
  padding: 14px;
  gap: 11px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface-2);
}

.midi-test-status,
.midi-test-note,
.midi-audition-toggle {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 11px;
  align-items: center;
}

.midi-test-status > i {
  width: 12px;
  height: 12px;
  border: 3px solid rgba(75, 145, 241, 0.2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: calibration-spin 0.85s linear infinite;
}

.midi-test-status.is-connected > i {
  border: 0;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(52, 183, 122, 0.12);
  animation: none;
}

.midi-test-status.is-error > i {
  border: 0;
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(235, 91, 105, 0.12);
  animation: none;
}

.midi-test-status strong,
.midi-test-status small,
.midi-test-note strong,
.midi-test-note small,
.midi-audition-toggle strong,
.midi-audition-toggle small {
  display: block;
}

.midi-test-status strong,
.midi-test-note strong,
.midi-audition-toggle strong {
  font-size: 0.78rem;
}

.midi-test-status small,
.midi-test-note small,
.midi-audition-toggle small {
  overflow-wrap: anywhere;
  margin-top: 3px;
  color: var(--text-3);
  font-size: 0.65rem;
  line-height: 1.35;
}

.midi-test-note {
  min-height: 72px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.midi-test-note > span {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 15px;
  color: var(--violet);
  background: var(--violet-soft);
  font-family: var(--font-interface);
  font-size: 0.8rem;
  font-weight: 850;
}

.midi-test-note.is-hit > span {
  animation: midi-key-hit 0.35s ease-out;
}

.midi-audition-toggle {
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 48px;
  cursor: pointer;
}

.midi-audition-toggle input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--violet);
}

.midi-test-card > .secondary-button {
  width: 100%;
  min-height: 44px;
  margin: 0;
}

.input-calibration-card {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-2);
}

.input-calibration-card strong,
.input-calibration-card small { display: block; }

.input-calibration-card small { margin-top: 5px; color: var(--text-3); font-size: 0.68rem; line-height: 1.45; }

.input-calibration-card button { width: 100%; min-height: 46px; margin-top: 12px; }

.game-input-badge {
  display: inline-flex;
  min-height: 22px;
  padding: 0 8px;
  align-items: center;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 0.6rem;
  font-weight: 850;
}

@media (max-width: 680px) {
  .input-calibration__header { min-height: 76px; padding-bottom: 9px; }
  .input-calibration__content { padding-top: 6px; }
  .calibration-rules { grid-template-columns: 1fr; }
  .calibration-rules span {
    display: grid;
    min-height: 68px;
    padding: 10px 12px;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 11px;
    text-align: left;
  }
  .calibration-rules b { margin: 0; grid-row: 1 / 3; }
  .calibration-panel--run { grid-template-columns: 1fr; grid-template-areas: "copy" "note" "piano" "detected" "meter" "keys"; align-content: start; }
  .calibration-piano { min-height: 176px; }
  .calibration-note-card { min-height: 96px; }
  .calibration-key-progress { gap: 2px; }
}

@media (orientation: landscape) and (max-height: 560px) {
  .input-calibration__header { min-height: 60px; padding-top: 8px; padding-bottom: 7px; }
  .input-calibration__content { padding-top: 4px; padding-bottom: 5px; }
  .input-calibration__footer { min-height: 64px; padding-top: 5px; padding-bottom: 6px; }
  .input-calibration__footer button { min-height: 46px; }
  .calibration-panel--run {
    grid-template-columns: minmax(200px, 0.7fr) minmax(330px, 1.3fr);
    grid-template-areas: "copy piano" "note piano" "detected meter" "keys keys";
    gap: 8px 14px;
  }
  .calibration-run-copy h1 { margin-bottom: 5px; font-size: 1.28rem; }
  .calibration-run-copy p { display: none; }
  .calibration-note-card { min-height: 72px; padding: 9px; }
  .calibration-note-card strong { font-size: 1.7rem; }
  .calibration-piano { min-height: 145px; }
  .calibration-detected { min-height: 42px; padding: 5px 10px; }
  .calibration-detected small { margin-top: 1px; font-size: 0.6rem; }
  .calibration-meter { align-self: center; }
}

/* Магазин в общей линейке: та же плитка, но это переход на другую страницу. */
.tab-button--shop { color: var(--violet); text-decoration: none; }

.tab-button--shop .tab-icon { background: var(--violet-soft); }

.tab-button--shop:active { transform: translateY(1px); }
