/* 🎼 Сакура в такт — вкладка ритм-игры (24.09.2026).
   Палитра и рамки — общие с игрой (переменные из app.css): экран должен
   читаться как её часть, а не как отдельное приложение. */

/* -------------------------------------------------------------- экран меню */

.rhythm-head { text-align: center; }
.rhythm-title {
  font-family: var(--serif); font-size: 20px; font-weight: 700;
  letter-spacing: 3px;
}
.rhythm-sub { font-size: 12.5px; color: var(--ink-dim); margin-top: 6px; }

.rhythm-block { display: flex; flex-direction: column; gap: 8px; }
.rhythm-label {
  font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-faint);
}

.rhythm-songs { display: flex; flex-direction: column; gap: 7px; }
.rhythm-song {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  gap: 4px 10px; width: 100%; padding: 11px 13px; text-align: left;
  border-radius: var(--radius-sm); border: 1px solid var(--panel-line);
  background: rgba(255, 255, 255, 0.04); color: var(--ink);
  font: inherit; font-size: 14.5px;
}
.rhythm-song.on {
  background: rgba(255, 143, 208, 0.14); border-color: rgba(255, 143, 208, 0.55);
}
.rhythm-song-name { grid-column: 1; grid-row: 1; font-weight: 600; }
.rhythm-song.on .rhythm-song-name { color: var(--pink); }
.rhythm-song-sub {
  grid-column: 1; grid-row: 2; font-size: 11.5px; color: var(--ink-dim);
}
/* Колонку и строку задаём явно: без этого рекорд уезжал в первую колонку
   и вставал СЛЕВА от названия. */
.rhythm-song-rec {
  grid-column: 2; grid-row: 1 / span 2; justify-self: end;
  font-variant-numeric: tabular-nums; font-size: 13px; color: var(--gold);
}

.rhythm-diffs { display: flex; gap: 6px; }
.rhythm-diff {
  flex: 1; padding: 9px 4px; border-radius: var(--radius-sm);
  border: 1px solid var(--panel-line); background: rgba(255, 255, 255, 0.04);
  color: var(--ink-dim); font: inherit; font-size: 12.5px; text-align: center;
}
.rhythm-diff.on {
  color: var(--ink); font-weight: 600;
  background: rgba(154, 107, 255, 0.18); border-color: rgba(154, 107, 255, 0.6);
}
.rhythm-diff i { display: block; font-style: normal; font-size: 10px; color: var(--gold); }
.rhythm-diff i .dimmer { opacity: 0.25; }

.rhythm-follows {
  font-size: 12.5px; color: var(--pink);
  background: rgba(255, 143, 208, 0.10);
  border: 1px solid rgba(255, 143, 208, 0.22);
  border-radius: var(--radius-sm); padding: 7px 10px;
}
.rhythm-follows .ui-svg { vertical-align: -2px; }
.rhythm-about { font-size: 12.5px; color: var(--ink-faint); }
.rhythm-about b { color: var(--pink); }

/* --------------------------------------------------------- окно одного трека */

.rhythm-back {
  align-self: flex-start; padding: 6px 12px 6px 8px; border-radius: 999px;
  border: 1px solid var(--panel-line); background: rgba(255, 255, 255, 0.04);
  color: var(--ink-dim); font: inherit; font-size: 13px;
}
.rhythm-songhead { gap: 2px; }
.rhythm-song-title { font-family: var(--serif); font-size: 20px; font-weight: 700; }
.rhythm-file-mark { color: var(--gold); font-size: 14px; }
.rhythm-song-by { font-size: 12.5px; color: var(--ink-dim); }

/* Топ по карте: место, имя, точность и очки в одну строку. */
.rhythm-top { display: flex; flex-direction: column; gap: 4px; }
.rhythm-top-row {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 2px 8px;
  align-items: baseline; padding: 6px 8px; border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03); font-size: 13px;
}
.rhythm-top-row.mine {
  background: rgba(255, 143, 208, 0.13);
  border: 1px solid rgba(255, 143, 208, 0.35);
}
.rhythm-top-place {
  grid-row: 1 / span 2; font-family: var(--serif); font-weight: 700;
  color: var(--gold); text-align: center;
}
.rhythm-top-name { font-weight: 500; }
.rhythm-top-acc { grid-column: 2; font-size: 11.5px; color: var(--ink-dim); }
.rhythm-top-score {
  grid-column: 3; grid-row: 1 / span 2; align-self: center;
  color: var(--pink); font-variant-numeric: tabular-nums;
}

/* Сетка наград: ранг слева, золото справа, в одну колонку на узком экране. */
.rhythm-pay { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.rhythm-pay-row {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 12.5px; color: var(--ink-dim);
}
.rhythm-pay-row b { font-weight: 500; }
.rhythm-pay-row i {
  font-style: normal; color: var(--gold); font-variant-numeric: tabular-nums;
}

.rhythm-rec { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rhythm-rec-score {
  font-family: var(--serif); font-size: 26px; font-weight: 700; color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.rhythm-rec-side { font-size: 12.5px; color: var(--ink-dim); }
.rhythm-lead { font-size: 12.5px; color: var(--ink-dim); margin-top: 6px; }
.rhythm-lead b { color: var(--pink); font-variant-numeric: tabular-nums; }

.rhythm-go { width: 100%; }
.rhythm-go:disabled { opacity: 0.5; }
.rhythm-note { font-size: 12px; text-align: center; margin-top: -2px; }

/* Песня с настоящим файлом — отдельная строка в списке: у неё свой значок и
   подпись, чтобы её было видно среди синтезированных. */
.rhythm-song.file .rhythm-song-name::after {
  content: '♪'; color: var(--gold); margin-left: 6px; font-size: 12px;
}

/* ------------------------------------------------------- слой самого захода */

.rhythm-play {
  position: fixed; inset: 0; z-index: 60;
  background: radial-gradient(70% 50% at 50% 0%, #241536, #0b0713 70%, #070410);
  touch-action: none; user-select: none; -webkit-user-select: none;
  overflow: hidden;
}
.rhythm-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.rhythm-hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3; pointer-events: none;
  /* Справа оставлено место под крестик — иначе очки уезжали под него. */
  padding: calc(12px + env(safe-area-inset-top, 0px)) 58px 12px 14px;
  background: linear-gradient(to bottom, rgba(7, 4, 16, 0.85), transparent);
}
.rhythm-hud-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rhythm-hud-name { font-family: var(--serif); font-size: 16px; font-weight: 700; }
.rhythm-hud-diff { font-size: 11px; color: var(--ink-dim); }
.rhythm-hud-score {
  font-family: var(--serif); font-size: 22px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.rhythm-hud-acc { font-size: 12px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.rhythm-hpbar {
  height: 7px; margin-top: 9px; border-radius: 4px; overflow: hidden;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 138, 205, 0.22);
}
.rhythm-hpbar i {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--pink-deep), var(--pink));
  transition: width 0.12s linear;
}

.rhythm-close {
  position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: 10px;
  z-index: 4; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--panel-line); background: rgba(10, 6, 18, 0.7);
  color: var(--ink); font-size: 16px; line-height: 1;
}

.rhythm-combo {
  position: absolute; left: 16px; z-index: 3; pointer-events: none;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  font-family: var(--serif); font-size: 26px; font-weight: 700; color: var(--pink);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.8);
  transform-origin: left bottom;
}

/* Полоска прохождения песни — по самому низу, чтобы не спорить с полем. */
.rhythm-progress {
  position: absolute; left: 0; right: 0; z-index: 3; pointer-events: none;
  bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  height: 5px; margin: 0 14px; border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 138, 205, 0.18);
  overflow: hidden;
}
.rhythm-progress i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--violet), var(--pink), var(--gold));
}
.rhythm-left {
  position: absolute; right: 14px; z-index: 3; pointer-events: none;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums;
}

.rhythm-result {
  position: absolute; inset: 0; z-index: 5; display: flex;
  align-items: center; justify-content: center; padding: 22px;
  background: rgba(8, 6, 13, 0.88); backdrop-filter: blur(8px);
}
.rhythm-res-card {
  width: 100%; max-width: 340px; text-align: center;
  padding: 20px 18px; border-radius: var(--radius);
  border: 1px solid var(--panel-line); background: var(--panel);
}
.rhythm-res-title { font-family: var(--serif); font-size: 21px; font-weight: 700; }
.rhythm-res-sub { font-size: 12.5px; color: var(--ink-dim); margin-top: 2px; }
/* Ранг — главное на экране итога: по нему считается награда. */
.rhythm-res-rank {
  font-family: var(--serif); font-size: 30px; font-weight: 700; margin: 10px 0 2px;
  letter-spacing: 1px;
}
.rhythm-res-score {
  font-family: var(--serif); font-size: 34px; font-weight: 700; color: var(--gold);
  font-variant-numeric: tabular-nums; margin: 8px 0 2px;
}
.rhythm-res-unit {
  display: block; font: 400 11px/1 var(--sans);
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint);
}
.rhythm-pay-row u { text-decoration: none; color: var(--ink-faint); font-weight: 400; }

/* Цвет ранга — один и тот же в HUD, на итоге и в топе. */
.rank-ss { color: #ffe9a8; }
.rank-s { color: var(--gold); }
.rank-a { color: #67d98b; }
.rank-b { color: var(--pink); }
.rank-c { color: var(--violet); }
.rank-d { color: var(--ink-faint); }
.rhythm-res-line { font-size: 13px; margin-top: 2px; }
.rhythm-res-line b { color: var(--pink); }
.rhythm-res-wait { font-size: 12.5px; margin-top: 10px; min-height: 18px; }
.rhythm-res-gold {
  margin-top: 6px; font-family: var(--serif); font-size: 20px; font-weight: 700;
  color: var(--gold); font-variant-numeric: tabular-nums;
}
.rhythm-res-gold .dim { font: 400 11.5px/1.4 inherit; color: var(--ink-faint); }
.rhythm-res-gold .coin-svg, .rhythm-res-gold svg { vertical-align: -2px; }
.rhythm-record { color: var(--gold); }
.rhythm-res-actions { display: flex; gap: 8px; margin-top: 14px; }
.rhythm-res-actions button { flex: 1; }
