/* POLIQ — design from new_design prototype */

:root {
  --font-display: "Bricolage Grotesque", var(--font);
  --page-bg: #f6f6f7;
  --card-border: #ececee;
  --card-shadow: 0 1px 2px rgba(16, 16, 16, 0.04), 0 12px 24px -20px rgba(16, 16, 16, 0.22);
  --pill-red-bg: #fff1f3;
  --pill-red-border: #f6c6cf;
  --text-secondary: #6b7280;
  --text-muted: #9aa0a8;
  --container-wide: 1360px;
  --container-max: 1360px;
  --header-h: 64px;
  --tabbar-h: 72px;
  --gold: #d4a017;
  --silver: #8a9199;
  --bronze: #b87333;
}

body.app-shell {
  background: var(--page-bg);
  padding-bottom: calc(var(--site-footer-h) + env(safe-area-inset-bottom, 0px));
}

body.app-shell.has-tabbar {
  padding-bottom: calc(var(--tabbar-h) + var(--site-footer-h) + env(safe-area-inset-bottom, 0px));
}

body.section-active,
body.game-active,
body.exercise-active {
  overflow: hidden;
  padding-bottom: 0 !important;
  height: 100vh;
  height: 100dvh;
}

html:has(body.section-active),
html:has(body.game-active),
html:has(body.exercise-active) {
  overflow: hidden;
  height: 100%;
}

body.section-active .app-site-footer,
body.game-active .app-site-footer,
body.exercise-active .app-site-footer {
  display: none !important;
}

.app-header {
  min-height: var(--header-h);
  box-shadow: none;
  border-bottom: 1px solid #ececee;
}

.app-header-inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  min-height: var(--header-h);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding-inline: var(--container-pad);
}

.header-left {
  justify-self: start;
  min-width: 0;
}

.main-nav {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: #f3f3f4;
  border: 1px solid #e8e8eb;
  border-radius: 13px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.main-nav::-webkit-scrollbar {
  display: none;
}

.header-right {
  justify-self: end;
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  text-decoration: none;
}

.nav-link {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  white-space: nowrap;
}
.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
}
.nav-link.active {
  color: var(--text);
  background: #fff;
  border-color: #e2e2e5;
  box-shadow: none;
}

.header-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 14px;
  padding: 7px 13px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}
.header-stat-pill--streak {
  background: var(--pill-red-bg);
  color: var(--pl-red);
  border-color: var(--pill-red-border);
}
.header-stat-pill--score {
  background: #f4f4f5;
  color: var(--text);
  border-color: #e8e8eb;
}

.header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #e8e8eb;
  background: linear-gradient(135deg, var(--pl-red), var(--pl-red-dark));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  flex-shrink: 0;
}

.pt-page {
  width: 100%;
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: clamp(16px, 2.5vh, 24px) var(--container-pad) 32px;
}

/* Full-viewport section screens (hub, account, settings, competitions) */
.screen-section {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  margin: 0;
  padding: 0 !important;
  min-height: 0 !important;
  overflow: hidden;
  background: var(--page-bg);
}

@media (max-width: 880px) {
  body.has-tabbar .screen-section {
    bottom: var(--tabbar-h);
  }
}

.section-scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.pt-display {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

/* Hero */
.pt-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  background: linear-gradient(135deg, var(--pl-red) 0%, var(--pl-red-dark) 100%);
  border-radius: 24px;
  padding: clamp(26px, 4vw, 46px);
  color: #fff;
  box-shadow: 0 28px 56px -24px rgba(200, 16, 46, 0.6);
}
.pt-hero::before,
.pt-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}
.pt-hero::before {
  top: -70px;
  right: -50px;
  width: 260px;
  height: 260px;
}
.pt-hero::after {
  bottom: -100px;
  right: 150px;
  width: 190px;
  height: 190px;
  background: rgba(255, 255, 255, 0.06);
}
.pt-hero-content {
  position: relative;
  min-width: 240px;
  flex: 1;
}
.pt-hero-kicker {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  opacity: 0.82;
  margin: 0 0 10px;
}
.pt-hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 5vw, 50px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
}
.pt-hero-lead {
  font-size: 16px;
  line-height: 1.55;
  opacity: 0.92;
  max-width: 42ch;
  margin: 0 0 24px;
}
.pt-hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: var(--pl-red);
  font-weight: 700;
  font-size: 15px;
  border: none;
  padding: 14px 24px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s;
}
.pt-hero-cta:hover {
  transform: translateY(-2px);
}
.pt-hero-goal {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.pt-goal-ring {
  width: 134px;
  height: 134px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pt-goal-ring-inner {
  width: 106px;
  height: 106px;
  border-radius: 50%;
  background: #b30e29;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.pt-goal-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 27px;
}
.pt-goal-label {
  font-size: 11px;
  opacity: 0.85;
  letter-spacing: 0.04em;
  margin-top: 5px;
}
.pt-hero-goal-caption {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.9;
}

/* Stat cards */
.pt-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.pt-stat-card {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: var(--card-shadow);
}
.pt-stat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.pt-stat-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.pt-stat-value small {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
}
.pt-stat-value--accent {
  color: var(--pl-red);
}
.pt-stat-value--ok {
  color: var(--ok);
}

/* Section headings */
.pt-section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 38px 0 16px;
}
.pt-section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  margin: 0;
}
.pt-section-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* Game cards v2 */
.pt-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 16px;
}
.pt-game-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 20px;
  min-height: 196px;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  box-shadow: 0 1px 2px rgba(16, 16, 16, 0.04);
  text-align: left;
  font: inherit;
  color: inherit;
  text-decoration: none;
}
.pt-game-card:hover {
  transform: translateY(-3px);
  border-color: #d8d8dc;
  box-shadow: 0 12px 28px -18px rgba(16, 16, 16, 0.28);
}
.pt-game-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.pt-game-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  background: var(--pill-red-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.pt-game-card-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pl-red);
  background: var(--pill-red-bg);
  padding: 5px 10px;
  border-radius: 8px;
}
.pt-game-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin: 0 0 7px;
}
.pt-game-card-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
  flex: 1;
  margin: 0;
}
.pt-game-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #f0f0f2;
}
.pt-game-card-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.pt-game-card-go {
  font-size: 13px;
  font-weight: 700;
  color: var(--pl-red);
}
.pt-game-card--soon {
  opacity: 0.72;
  cursor: default;
}
.pt-game-card--soon:hover {
  transform: none;
  border-color: var(--card-border);
  box-shadow: 0 1px 2px rgba(16, 16, 16, 0.04);
}

/* Account */
.pt-account-screen {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.pt-profile-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 22px;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: clamp(20px, 3vw, 30px);
  box-shadow: 0 1px 2px rgba(16, 16, 16, 0.04), 0 18px 40px -28px rgba(16, 16, 16, 0.3);
}
.pt-profile-avatar {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pl-red), var(--pl-red-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  box-shadow: 0 14px 30px -12px rgba(200, 16, 46, 0.6);
  flex-shrink: 0;
}
.pt-profile-info {
  flex: 1;
  min-width: 180px;
}
.pt-profile-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(24px, 3.5vw, 32px);
  letter-spacing: -0.02em;
  margin: 0 0 5px;
}
.pt-profile-email {
  color: var(--text-secondary);
  font-size: 15px;
  margin: 0 0 10px;
}
.pt-rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--pill-red-bg);
  color: var(--pl-red);
  font-weight: 700;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
}
.pt-profile-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pt-panel {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 24px;
}
.pt-panel-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.pt-panel-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.pt-progress-row {
  margin-top: 18px;
}
.pt-progress-row:first-of-type {
  margin-top: 0;
}
.pt-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 8px;
}
.pt-progress-labels span:last-child {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.pt-progress-bar {
  height: 12px;
  border-radius: 999px;
  background: #f0f0f2;
  overflow: hidden;
}
.pt-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pl-red), #e14860);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.pt-heatmap-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
}
.pt-heatmap {
  display: flex;
  gap: 4px;
  min-width: max-content;
}
.pt-heatmap-week {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pt-heatmap-cell {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}
.pt-heatmap-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}
.pt-heatmap-legend-cells {
  display: flex;
  gap: 4px;
}

.pt-achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.pt-achievement {
  border-radius: 16px;
  padding: 18px 16px;
  text-align: center;
}
.pt-achievement--earned {
  background: #fff;
  border: 1px solid var(--card-border);
}
.pt-achievement--locked {
  background: #fafafa;
  border: 1px dashed #dedee1;
}
.pt-achievement-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 12px;
}
.pt-achievement--earned .pt-achievement-icon {
  background: var(--pill-red-bg);
}
.pt-achievement--locked .pt-achievement-icon {
  background: #f0f0f2;
  filter: grayscale(1);
  opacity: 0.55;
}
.pt-achievement-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
}
.pt-achievement-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0 0 10px;
}
.pt-achievement-status {
  font-size: 11.5px;
  letter-spacing: 0.02em;
}
.pt-achievement--earned .pt-achievement-status {
  color: var(--ok);
  font-weight: 700;
}
.pt-achievement--locked .pt-achievement-status {
  color: var(--text-muted);
  font-weight: 600;
}

/* Settings */
.pt-settings-screen {
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.pt-settings-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(26px, 4vw, 36px);
  letter-spacing: -0.03em;
  margin: 0;
}
.pt-settings-section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.pt-settings-lead {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}
.pt-tier-current {
  color: var(--pl-red);
  font-weight: 700;
  font-size: 15px;
  margin: 16px 0 12px;
}
.pt-account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid #f0f0f2;
  font-size: 14px;
}
.pt-account-row span:first-child {
  color: var(--text-secondary);
}
.pt-account-row span:last-child {
  font-weight: 600;
}
.pt-account-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.pt-btn-outline-danger {
  border: 1px solid var(--pill-red-border);
  background: #fff;
  color: var(--pl-red);
}
.pt-btn-ghost-muted {
  border: none;
  background: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 11px 6px;
}

/* Competitions */
.pt-comp-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(26px, 4vw, 38px);
  letter-spacing: -0.03em;
  margin: 0 0 6px;
}
.pt-comp-lead {
  color: var(--text-secondary);
  font-size: 15px;
  margin: 0 0 20px;
}
.pt-podium-panel {
  background: linear-gradient(180deg, var(--surface), var(--surface-hover));
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: clamp(20px, 3vw, 34px) clamp(14px, 3vw, 28px);
  box-shadow: 0 1px 2px rgba(16, 16, 16, 0.04), 0 18px 40px -30px rgba(16, 16, 16, 0.3);
}
.pt-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(8px, 2vw, 22px);
}
.pt-podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 180px;
}
.pt-podium-medal {
  font-size: 24px;
  line-height: 1;
}
.pt-podium-place--first .pt-podium-medal {
  font-size: 30px;
}
.pt-podium-avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
}
.pt-podium-place--second .pt-podium-avatar,
.pt-podium-place--third .pt-podium-avatar {
  width: 58px;
  height: 58px;
  font-size: 18px;
}
.pt-podium-place--first .pt-podium-avatar {
  width: 72px;
  height: 72px;
  font-size: 22px;
  box-shadow: 0 10px 26px -10px rgba(230, 178, 62, 0.7);
}
.pt-podium-place--second .pt-podium-avatar {
  background: #efeff1;
  border: 3px solid #c9cdd3;
  color: #5b626b;
}
.pt-podium-place--first .pt-podium-avatar {
  background: linear-gradient(135deg, #fbe9c3, #f6d079);
  border: 3px solid #e6b23e;
  color: #8a6a12;
}
.pt-podium-place--third .pt-podium-avatar {
  background: #f6e4d6;
  border: 3px solid #d9a87e;
  color: #9a6b43;
}
.pt-podium-name {
  font-weight: 600;
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.pt-podium-place--first .pt-podium-name {
  font-weight: 700;
  font-size: 14px;
}
.pt-podium-score {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.pt-podium-place--first .pt-podium-score {
  font-weight: 800;
  font-size: 19px;
  color: var(--gold);
}
.pt-podium-place--second .pt-podium-score {
  color: var(--silver);
}
.pt-podium-place--third .pt-podium-score {
  color: var(--bronze);
}
.pt-podium-pedestal {
  width: 100%;
  border-radius: 14px 14px 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10px;
  font-family: var(--font-display);
  font-weight: 800;
}
.pt-podium-place--second .pt-podium-pedestal {
  height: 78px;
  background: linear-gradient(180deg, #f2f3f5, #e7e9ec);
  font-size: 24px;
  color: #a7aeb6;
}
.pt-podium-place--first .pt-podium-pedestal {
  height: 112px;
  background: linear-gradient(180deg, #fbefcb, #f3dc97);
  font-size: 30px;
  color: #c99a1f;
  padding-top: 12px;
}
.pt-podium-place--third .pt-podium-pedestal {
  height: 58px;
  background: linear-gradient(180deg, #f5e6da, #ead2bf);
  font-size: 22px;
  color: #c08a5a;
  padding-top: 8px;
}

.pt-podium-place--me .pt-podium-avatar {
  box-shadow: 0 0 0 2px var(--accent);
}

.pt-podium-you {
  margin-top: 4px;
}

.pt-leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}
.pt-leaderboard-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px 16px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--card-border);
}
.pt-leaderboard-row--me {
  background: var(--pill-red-bg);
  border-color: var(--pill-red-border);
}
.pt-leaderboard-rank {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #f4f4f5;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
.pt-leaderboard-user {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.pt-leaderboard-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--pill-red-bg);
  color: var(--pl-red);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pt-leaderboard-user-text {
  min-width: 0;
}
.pt-leaderboard-user-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pt-leaderboard-user-meta {
  font-size: 12px;
  color: var(--text-muted);
}
.pt-leaderboard-you-badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pl-red);
  background: #fff;
  border: 1px solid var(--pill-red-border);
  padding: 3px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.pt-leaderboard-points {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}
.pt-leaderboard-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
}

/* Mobile tab bar */
.pt-tabbar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid #eaeaec;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
  align-items: center;
}
.pt-tabbar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 0;
  color: var(--text-muted);
}
.pt-tabbar-btn.active {
  color: var(--pl-red);
  font-weight: 700;
}
.pt-tabbar-btn svg {
  display: block;
}

.pt-panel .tier-presets {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.pt-panel .tier-slider {
  width: 100%;
  accent-color: var(--pl-red);
}
.pt-panel .tier-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.pt-panel .tier-row-name { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.pt-panel .tier-row-value { font-size: 13px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.pt-panel .tier-row .tier-slider { margin: 0; }
.pt-panel .tier-range-ends {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}
.pt-panel .tier-note {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.45;
}

.hide-mobile {
  display: flex;
}

@media (max-width: 880px) {
  :root {
    --header-h: 52px;
  }
  .app-header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }
  .brand {
    font-size: 16px;
  }
  .header-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  .main-nav {
    display: none;
  }
  .pt-tabbar {
    display: flex;
  }
  .hide-mobile {
    display: none !important;
  }
  .header-user-name,
  .header-login {
    display: none;
  }
  .app-site-footer {
    display: none;
  }
  body.app-shell.has-tabbar {
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 640px) {
  .pt-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── immersive game screens (no page scroll) ── */

body.game-active .app-site-footer,
body.game-active .pt-tabbar,
body.exercise-active .pt-tabbar {
  display: none !important;
}

.game-screen {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  margin: 0;
  padding: 0 !important;
  min-height: 0 !important;
  background: var(--page-bg);
  overflow: hidden;
}

.game-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: clamp(10px, 1.5vh, 14px) var(--container-pad) clamp(12px, 2vh, 16px);
  box-sizing: border-box;
}

.game-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 10px;
}

.game-topbar .btn.ghost {
  flex-shrink: 0;
}

.game-topbar-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.game-topbar-meta {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.game-topbar-end {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.game-topbar:has(.game-topbar-end) .game-topbar-meta {
  margin-left: 0;
}

.game-mode-toggle {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.game-shell > .game-split,
.game-shell > .game-split--list,
.game-shell > .game-body,
.game-shell > .game-scroll-pane {
  flex: 1;
  min-height: 0;
}

.game-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.game-body > .game-split:not(.hidden),
.game-body > .game-stage:not(.hidden),
.game-body > .game-empty:not(.hidden) {
  flex: 1;
  min-height: 0;
}

.game-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 36vw);
  gap: clamp(12px, 2vw, 20px);
  align-items: stretch;
  min-height: 0;
}

.game-stage .game-card-panel {
  max-width: none;
  width: 100%;
  border-radius: 24px;
}

.game-list-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  align-self: stretch;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 24px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.game-split > .game-list-pane,
.game-split > .game-sidebar,
.game-split > .game-stage {
  min-height: 0;
}

.game-list-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}

#screen-wordlist .wordlist-table-wrap.game-list-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
}

.game-list-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 12px 12px;
}

.game-list-pane .dict-tabs,
.game-list-pane .wordlist-toolbar {
  flex-shrink: 0;
  margin: 0;
  padding: 14px 14px 10px;
  border-bottom: 1px solid #f0f0f2;
}

.game-list-body.dict-list,
.game-list-pane .dict-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.game-list-row {
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.game-list-row.is-selected {
  border-color: var(--pl-red) !important;
  background: var(--pill-red-bg);
}

.dict-row.game-list-row,
.wordlist-table-row.game-list-row {
  display: grid;
  align-items: center;
  gap: 8px 10px;
  background: #fff;
  border: none;
  border-radius: 0;
  padding: 8px 12px;
  margin: 0;
}

.game-split--list {
  flex: 1;
  min-height: 0;
  align-content: stretch;
}

#screen-dict .game-split--list,
#screen-wordlist .game-split--list {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 34vw);
  grid-template-rows: minmax(0, 1fr);
}

.dict-empty,
.dict-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
  font-size: 14px;
  line-height: 1.5;
}

#screen-wordquiz .game-footer,
#screen-review .game-footer--review {
  display: grid;
  grid-template-columns: 1fr;
  padding-top: 14px;
}

#screen-wordquiz .game-footer .game-action-btn,
#screen-review .game-footer--review .game-action-btn {
  width: 100%;
  max-width: none;
}

.game-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 1.5vh, 12px) 0;
}

.game-stage--swipe {
  justify-content: flex-start;
  align-items: stretch;
  align-self: stretch;
  width: 100%;
  padding: 0;
  min-height: 0;
}

/* Quiz / word quiz — full-height card aligned with grammar sidebar */
.game-stage--quiz {
  justify-content: flex-start;
  align-items: stretch;
  align-self: stretch;
  width: 100%;
  padding: 0;
  min-height: 0;
}

.game-stage--quiz .game-card-panel {
  height: 100%;
  max-height: 100%;
  flex: 1 1 auto;
  min-height: 0;
}

.game-stage--quiz .game-card-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  justify-content: flex-start;
  overflow-y: auto;
  padding: clamp(16px, 2.5vh, 22px) clamp(20px, 3vw, 28px);
}

.game-stage--quiz .words-choices {
  margin-bottom: 0;
}

.game-stage--quiz .review-example {
  margin-top: auto;
  margin-bottom: 0;
  max-width: none;
  width: 100%;
}

.game-stage--quiz .game-card-panel-foot {
  flex-shrink: 0;
  border-top: 1px solid #f0f0f2;
  padding: clamp(12px, 2vh, 16px) clamp(20px, 3vw, 28px) clamp(16px, 2.5vh, 22px);
}

.game-stage--quiz .game-card-panel-foot:not(:has(.feedback.good, .feedback.bad)) {
  border-top: none;
  padding-top: 0;
}

.game-stage--quiz .game-card-panel-foot .feedback {
  min-height: 0;
  margin-bottom: 0;
}

.game-stage--quiz .game-card-panel-foot .feedback:empty {
  display: none;
}

#screen-select .game-split {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 36vw);
}

#screen-select .game-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr; /* пропустить · вернуть · учить — в одну строку */
  align-items: stretch;
  gap: 12px;
  padding-top: 14px;
}

#screen-select .game-action-btn {
  max-width: none;
  width: 100%;
}

.swipe-card-hint {
  flex-shrink: 0;
  width: 100%;
  margin: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f2;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.4;
}

#screen-review .game-topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "back title meta"
    "modes modes modes";
  align-items: center;
  gap: 8px 10px;
}

#screen-review .game-topbar .btn.ghost {
  grid-area: back;
}

#screen-review .game-topbar-title {
  grid-area: title;
}

#screen-review .game-topbar-meta {
  grid-area: meta;
  margin-left: 0;
}

#screen-review .game-mode-toggle {
  grid-area: modes;
  width: 100%;
  margin-top: 0;
  justify-content: stretch;
}

#screen-review .game-mode-toggle .btn {
  flex: 1;
}

.game-sidebar {
  min-height: 0;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--card-shadow);
}

.game-footer {
  flex-shrink: 0;
  display: flex;
  gap: 12px;
  justify-content: center;
  padding-top: 12px;
  /* без линии сверху: карточка и «Грамматика» над ней в своих рамках — линия складывалась в двойную */
}

.game-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-secondary);
  font-size: 16px;
  padding: 24px;
}

.game-scroll-pane {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 8px;
}

.game-scroll-pane .wordlist-sections {
  max-width: none;
  margin: 0;
}

.game-card-panel {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 22px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.game-stage--match .game-card-panel,
.game-stage--flash .game-card-panel,
.game-stage--quiz .game-card-panel,
.game-card-panel--wide,
.game-card-panel--flash {
  height: 100%;
  max-height: 100%;
}

.game-card-panel.is-entering {
  animation: game-card-in 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.game-card-panel--wide {
  max-width: min(920px, 100%);
}

.game-card-panel--flash {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(16px, 3vh, 28px);
  gap: 12px;
}

.game-card-panel-head {
  flex-shrink: 0;
  text-align: center;
  padding: clamp(18px, 3vh, 28px) clamp(20px, 4vw, 32px) clamp(12px, 2vh, 18px);
  border-bottom: 1px solid #f0f0f2;
}

.game-card-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(14px, 2.5vh, 22px) clamp(16px, 3vw, 24px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.game-card-panel-body--scroll {
  justify-content: flex-start;
}

.game-card-panel-foot {
  flex-shrink: 0;
  padding: clamp(12px, 2vh, 18px) clamp(16px, 3vw, 24px) clamp(16px, 2.5vh, 22px);
  border-top: 1px solid #f0f0f2;
  text-align: center;
}

.game-kicker {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pl-red);
  margin-bottom: 10px;
}

.game-card-prompt {
  font-family: var(--font-display);
  font-size: clamp(26px, 4.5vw, 34px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 10px 0 8px;
}

.game-card-sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
}

.game-card-panel .words-choices {
  max-width: none;
  width: 100%;
  margin: 0;
}

.game-action-btn {
  flex: 1;
  max-width: 220px;
  font-size: 15px;
  font-weight: 700;
  padding: 14px 20px;
  border-radius: 14px;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.game-action-btn:active {
  transform: scale(0.97);
}

.game-action-btn--learn {
  color: var(--ok);
  border-color: var(--ok);
  background: var(--ok-bg);
}

.game-action-btn--learn:hover {
  background: #dcfce7;
}

.game-action-btn--skip {
  color: var(--pl-red);
  border-color: var(--pill-red-border);
  background: var(--pill-red-bg);
}

.game-action-btn--skip:hover {
  background: #ffe4e8;
}

/* swipe stack */
.swipe-stack {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: none;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  position: relative;
}

.game-screen .swipe-card {
  flex: 1;
  width: 100%;
  max-width: none;
  min-height: 0;
  height: 100%;
  max-height: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  text-align: center;
  padding: clamp(16px, 2.5vh, 24px) clamp(22px, 3.5vw, 36px) clamp(20px, 3vh, 32px);
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 24px;
  box-shadow: 0 1px 2px rgba(16, 16, 16, 0.04), 0 24px 48px -24px rgba(200, 16, 46, 0.28);
  cursor: grab;
  user-select: none;
  position: relative;
  touch-action: pan-y;
  overflow: hidden;
  will-change: transform, opacity;
}

.swipe-card-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: clamp(8px, 2vh, 20px) 0;
}

.game-screen .swipe-pos {
  margin-bottom: clamp(8px, 2vh, 16px);
  background: var(--pill-red-bg);
  color: var(--pl-red);
  border: 1px solid var(--pill-red-border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.game-screen .swipe-word {
  font-family: var(--font-display);
  font-size: clamp(40px, 7vw, 56px);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.05;
}

.game-screen .swipe-ru {
  font-size: clamp(20px, 3.2vw, 26px);
  color: var(--text-secondary);
  margin: 0;
}

.game-screen .swipe-example {
  flex-shrink: 0;
  width: 100%;
  font-size: 14px;
  line-height: 1.55;
  background: var(--page-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 14px 16px;
  text-align: left;
  max-height: min(22vh, 160px);
  overflow-y: auto;
}

.game-screen .swipe-example:empty {
  display: none;
}

.game-screen .swipe-card:active {
  cursor: grabbing;
}

.game-screen .swipe-card.is-entering {
  animation: game-card-in 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.game-screen .swipe-stamp {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 6px 16px;
  border-radius: 10px;
  transition: opacity 0.1s ease, transform 0.1s ease;
}

.game-screen .swipe-card.show-learn .stamp-learn {
  opacity: 1;
  transform: rotate(-10deg) scale(1.02);
}

.game-screen .swipe-card.show-skip .stamp-skip {
  opacity: 1;
  transform: rotate(10deg) scale(1.02);
}

.game-screen .swipe-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 18px;
  color: var(--text-secondary);
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 24px;
  width: 100%;
  max-width: none; /* .empty-state ограничивает 420px — тут на всю область до «Грамматики», как карточка слова */
  margin: 0;
  box-shadow: var(--card-shadow);
}

.game-screen .flash-card {
  width: 100%;
  max-width: 480px;
  flex: 1;
  min-height: 180px;
  max-height: min(52vh, 420px);
  margin: 0;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  transition: transform 0.18s ease;
}

.game-screen .flash-card:active {
  transform: scale(0.99);
}

.game-screen .flash-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  margin: 0;
}

.game-screen .match-grid {
  height: 100%;
}

@keyframes game-card-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 960px) {
  .game-shell {
    padding-top: 20px;
  }

  .game-split {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(180px, 28vh);
  }

  #screen-dict .game-split--list,
  #screen-wordlist .game-split--list {
    grid-template-rows: minmax(0, 1fr) minmax(160px, 28vh);
  }

  .game-sidebar {
    max-height: none;
    order: 2;
  }

  .game-stage--swipe {
    min-height: 0;
  }

  .game-topbar-meta {
    width: 100%;
    text-align: center;
    margin-left: 0;
    order: 3;
  }

  .game-mode-toggle {
    order: 4;
  }

  /* Card games (select / wordquiz / review): the card fills the screen
     edge-to-edge; grammar sits right below it and is reached by scrolling
     down — a small sliver peeks above the fold as a hint that it's there. */
  .game-split:not(.game-split--list) {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .game-split:not(.game-split--list) > .game-stage {
    flex: none;
    min-height: calc(100% - 30px);
  }

  .game-split:not(.game-split--list) > .game-sidebar {
    flex: none;
    overflow-y: visible;
    margin-top: 12px;
    scroll-margin-top: 12px;
  }

  .game-split:not(.game-split--list) > .game-sidebar::before {
    content: "";
    display: block;
    width: 36px;
    height: 4px;
    margin: 0 auto 12px;
    border-radius: 999px;
    background: var(--border-strong);
  }

  /* Keyboard hint is meaningless on touch devices — drop it so the
     swipe hint fits on one line instead of wrapping awkwardly. */
  .swipe-hint-kbd {
    display: none;
  }

  .swipe-card-hint {
    padding-bottom: 10px;
  }
}

@media (max-width: 640px) {
  .game-shell {
    padding-inline: 12px;
  }

  .game-footer {
    gap: 10px;
  }

  .game-action-btn {
    max-width: none;
    padding: 13px 12px;
    font-size: 14px;
  }

  .game-card-panel-body .words-choices {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-card-panel,
  .game-screen .swipe-card.is-entering {
    animation: none;
  }
}

/* ── дашборд: «Мой уровень» и поиск слова ── */
.pt-hub-tools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: 14px;
  margin-top: 14px;
}
.pt-tool-card { padding: 20px; min-width: 0; }
.pt-tool-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.pt-tool-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}
.pt-tool-sub { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); }
.pt-tool-card .tier-note { margin-top: 8px; font-size: 12px; }
.hub-goal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--card-border);
}
.hub-goal-name { font-size: 13px; font-weight: 600; }
.hub-goal-chips { display: flex; gap: 6px; }
.hub-goal-chips .tier-preset { min-width: 44px; }

.hub-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--surface-2, transparent);
}
.hub-search:focus-within { border-color: var(--pl-red); }
.hub-search i { color: var(--text-muted); font-size: 18px; }
.hub-search input[type="search"] {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 15px;
}
.hub-search-results { list-style: none; margin: 8px 0 0; padding: 0; }
.hub-search-item {
  display: grid;
  /* последний столбец общей ширины: «Учить» и «Пора повторить» не сдвигают колонки соседних строк */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 116px 32px;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--card-border);
}
.hub-search-word { display: flex; align-items: center; min-width: 0; }
.hub-search-word b { overflow-wrap: anywhere; }
.hub-search-tr { display: flex; flex-direction: column; min-width: 0; font-size: 14px; }
.hub-search-tr small { font-size: 11px; color: var(--text-muted); }
.hub-search-lemma { font-weight: 700; color: inherit; text-decoration: none; }
.hub-search-lemma:hover { color: var(--accent, #C8102E); text-decoration: underline; text-underline-offset: 3px; }
.hub-search-go {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  color: var(--text-muted); text-decoration: none; font-size: 16px;
}
.hub-search-go:hover, .hub-search-go:focus-visible { background: var(--surface-2, #f3f3f5); color: var(--accent, #C8102E); }
.hub-search-alt { font-size: 12.5px; line-height: 1.35; color: var(--text-muted); overflow-wrap: anywhere; }
.hub-search-learn { padding: 6px 12px; font-size: 13px; }
.hub-search-learn, .hub-search-status { justify-self: end; }
.hub-search-status { font-size: 12px; font-weight: 600; color: var(--ok, #1f8a4c); white-space: nowrap; }
.hub-search-empty { padding: 12px 2px; font-size: 13px; color: var(--text-muted); }
.hub-search-more { padding-top: 10px; }
.pt-link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--pl-red);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.pt-link-btn:hover { text-decoration: underline; }

/* ── мастер первого запуска ── */
.onboarding-dialog { width: min(560px, calc(100vw - 32px)); }
.onboarding-steps { display: flex; gap: 6px; margin: 0 0 16px; padding: 0; list-style: none; }
.onboarding-steps li { flex: 1; height: 4px; border-radius: 2px; background: var(--card-border); }
.onboarding-steps li.active { background: var(--pl-red); }
.onboarding-choices { grid-template-columns: repeat(3, 1fr); }
.onboarding-choices .session-size b { font-size: 18px; }
.onboarding-tour { display: grid; gap: 12px; margin: 16px 0 20px; padding: 0; list-style: none; }
.onboarding-tour li { display: flex; gap: 12px; align-items: flex-start; }
.onboarding-tour i { font-size: 22px; color: var(--pl-red); flex-shrink: 0; margin-top: 2px; }
.onboarding-tour li > div > b { display: block; }
.onboarding-tour span b { color: var(--text); font-weight: 600; }
.onboarding-tour span { font-size: 13px; color: var(--text-muted); }
@media (max-width: 560px) {
  .onboarding-choices { grid-template-columns: 1fr; }
  .hub-search-item { grid-template-columns: minmax(0, 1fr) 116px 32px; }
  .hub-search-tr { grid-column: 1 / -1; grid-row: 2; }
}
.onboarding-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.onboarding-top .onboarding-steps { flex: 1; margin: 0; }
.onboarding-skip { color: var(--text-muted); font-weight: 500; }
.hub-search input[type="search"]:focus { box-shadow: none; background: transparent; }

/* таблица форм: падеж с польским названием и вопросами на обоих языках */
.grammar-table td.grammar-case { vertical-align: top; }
.grammar-case-name { display: block; }
.grammar-case-name span { color: var(--text-muted); font-size: 11px; }
.grammar-case-q { display: block; margin-top: 1px; font-size: 11px; line-height: 1.3; }
.grammar-case-q [lang="pl"] { color: var(--pl-red); }
.grammar-case-q span:not([lang]) { color: var(--text-muted); }
.pt-legal-links { margin-top: 16px; font-size: 12px; color: var(--text-muted); }
.pt-legal-links a { color: inherit; text-decoration: underline; }

/* ── ник в рейтинге ── */
.pt-nick-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 16px 0 4px;
  padding: 14px 18px;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--surface-2, transparent);
  font-size: 14px;
}
.pt-nick-card.is-empty { border-color: var(--pl-red); background: var(--accent-soft, transparent); }
.pt-nick-card:empty { display: none; }
.pt-account-nick { display: inline-flex; align-items: center; gap: 10px; }
.nickname-dialog { width: min(440px, calc(100vw - 32px)); }
.nickname-input {
  width: 100%;
  margin-top: 14px;
  padding: 11px 14px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 16px;
}
.nickname-input:focus { outline: none; border-color: var(--pl-red); }
.nickname-error { margin-top: 8px; font-size: 13px; color: var(--pl-red); }
.nickname-dialog .report-actions { margin-top: 18px; }

/* ── главная: только сводка. Поиск — широкая строка (заметнее и не растёт по высоте:
   результаты выпадают поверх), «Мой уровень» — во всю ширину ── */
.hub-search-card,
.hub-level-card { margin-top: 14px; }
.hub-search-card {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(220px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 8px 24px;
  padding: 18px 20px;
}
.hub-search-card .pt-tool-head { margin: 0; }
.hub-search-card .hub-search { padding: 0 16px; border-radius: 14px; background: var(--surface); }
.hub-search-card .hub-search i { font-size: 20px; }
.hub-search-card .hub-search input[type="search"] { height: 52px; font-size: 17px; }
.hub-search-card .hub-search-results:empty { display: none; }
.hub-search-card .hub-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(60vh, 460px);
  overflow-y: auto;
  margin: 0;
  padding: 6px 16px 10px;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(17, 24, 39, 0.14);
}
.hub-search-card .hub-search-item:last-child { border-bottom: 0; }
.hub-level-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  grid-template-areas:
    "head  goal"
    "range goal"
    "note  goal";
  column-gap: 32px;
  align-items: start;
}
.hub-level-card .pt-tool-head { grid-area: head; }
.hub-level-card .dual-range-block { grid-area: range; }
.hub-level-card .tier-note { grid-area: note; text-align: left; }
.hub-level-card .hub-goal {
  grid-area: goal;
  align-self: stretch;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  margin: 0;
  padding: 0 0 0 28px;
  border-top: 0;
  border-left: 1px solid var(--card-border);
}
@media (max-width: 860px) {
  .hub-search-card { grid-template-columns: 1fr; }
  .hub-level-card { grid-template-columns: 1fr; grid-template-areas: "head" "range" "note" "goal"; }
  .hub-level-card .hub-goal {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    padding: 14px 0 0;
    border-left: 0;
    border-top: 1px solid var(--card-border);
  }
}

/* ── «одна линия — две точки»: диапазон слов от–до ── */
.dual-range-block { margin: 6px 0 2px; }
.dual-range-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.dual-range-values { font-size: 15px; font-weight: 700; color: var(--pl-red, var(--accent)); font-variant-numeric: tabular-nums; }
.dual-range {
  --from: 0%;
  --to: 10%;
  position: relative;
  height: 32px;
}
.dual-range-track {
  position: absolute;
  left: 11px;
  right: 11px;
  top: 50%;
  height: 6px;
  margin-top: -3px;
  border-radius: 999px;
  background: var(--card-border, #e5e7eb);
}
.dual-range-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--from);
  width: calc(var(--to) - var(--from));
  border-radius: inherit;
  background: var(--pl-red, var(--accent));
}
.dual-range-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}
.dual-range-input--from.is-top { z-index: 2; }
.dual-range-input::-webkit-slider-runnable-track { background: none; border: 0; }
.dual-range-input::-moz-range-track { background: none; border: 0; }
.dual-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--pl-red, var(--accent));
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.18);
  cursor: grab;
  transition: transform 0.12s, box-shadow 0.12s;
}
.dual-range-input::-moz-range-thumb {
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--pl-red, var(--accent));
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.18);
  cursor: grab;
}
.dual-range-input:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.12); }
.dual-range-input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px color-mix(in srgb, var(--pl-red, #c8102e) 22%, transparent); }
.dual-range-input:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 5px color-mix(in srgb, var(--pl-red, #c8102e) 22%, transparent); }
.dual-range-scale { display: flex; justify-content: space-between; margin-top: 2px; font-size: 11px; color: var(--text-muted); }

/* ── цель на день: сегмент-переключатель + «сегодня X из N» ── */
.hub-goal-name { display: inline-flex; align-items: center; gap: 6px; }
.hub-goal-name i { color: var(--pl-red, var(--accent)); font-size: 16px; }
.goal-seg {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-2, #f3f4f6);
}
.goal-seg-btn {
  min-width: 46px;
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.goal-seg-btn:hover { color: var(--text); }
.goal-seg-btn.active { background: var(--surface, #fff); color: var(--pl-red, var(--accent)); box-shadow: 0 1px 4px rgba(17, 24, 39, 0.12); }
.goal-seg-btn:focus-visible { outline: 2px solid var(--pl-red, var(--accent)); outline-offset: 1px; }
.hub-goal-today { display: flex; flex-direction: column; gap: 6px; width: 100%; font-size: 12px; color: var(--text-muted); }
.hub-goal-bar { height: 6px; border-radius: 999px; background: var(--card-border, #e5e7eb); overflow: hidden; }
.hub-goal-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--pl-red, var(--accent)); transition: width 0.4s ease; }
#hub-goal-today-text.is-done { color: var(--ok, #1f8a4c); font-weight: 600; }
.hub-level-card .hub-goal { gap: 12px; }
@media (max-width: 860px) {
  .hub-level-card .hub-goal { flex-wrap: wrap; }
  .hub-goal-today { order: 3; }
}

/* кабинет: имя (часто это email) — переносить, а не упираться в край */
.pt-profile-name { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .pt-profile-name { font-size: 22px; } }

/* «Все слова»: карточка выбранного слова над таблицей форм */
.wl-card:empty { display: none; }
.wl-card { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border, var(--card-border)); }
.wl-card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.wl-card-lemma { font-size: 22px; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.wl-card-pos { flex-basis: 100%; font-size: 12px; color: var(--text-muted); }
.wl-card-tr { margin: 8px 0 0; font-size: 16px; font-weight: 600; }
.wl-card-alt { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); }
.wl-card-gloss { margin: 8px 0 0; font-size: 13px; font-style: italic; color: var(--text-secondary, var(--text-muted)); }
.wl-card-ex { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.wl-card-ex li { display: grid; gap: 1px; font-size: 13px; padding-left: 10px; border-left: 2px solid var(--border, var(--card-border)); }
.wl-card-ex small { font-size: 12px; color: var(--text-muted); }
.wl-card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 12px; }
.wl-card-learn { padding: 5px 12px; font-size: 13px; }

/* Онбординг: уровень ползунком */
.onboarding-note { margin: 10px 0 0; font-size: 13px; line-height: 1.45; color: var(--text-muted); }
.onboarding-note .ph { color: var(--pl-red); }
.onboarding-level { margin-top: 16px; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.onboarding-level-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.onboarding-level-name { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.onboarding-level-value { font-size: 14px; font-weight: 600; color: var(--pl-red); font-variant-numeric: tabular-nums; }
.onboarding-level-slider {
  --fill: 5%;
  width: 100%;
  height: 8px;
  margin: 16px 0 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pl-red) var(--fill), var(--border) var(--fill));
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.onboarding-level-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--pl-red);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.onboarding-level-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--pl-red);
}
.onboarding-level-slider:focus-visible { outline: 2px solid var(--pl-red); outline-offset: 6px; }
.onboarding-level-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); }
.onboarding-level-desc { margin: 10px 0 0; font-size: 14px; line-height: 1.45; color: var(--text); }
.onboarding-step .report-actions { margin-top: 18px; }

/* Флеш-карточка: свайп и ответ — как в отборе слов (зелёный — помню, красный — не помню) */
.game-screen .flash-card {
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.game-screen .flash-card.show-learn,
.game-screen .flash-card.is-remembered {
  border-color: var(--ok);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 35%, transparent), var(--card-shadow);
}
.game-screen .flash-card.show-skip,
.game-screen .flash-card.is-forgotten {
  border-color: var(--bad);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bad) 30%, transparent), var(--card-shadow);
}

/* Соревнования: период рейтинга и прошлый победитель */
.pt-comp-tabs { margin: 0 0 10px; }
.pt-comp-tabs .btn.toggle { flex: 1 1 0; min-width: 0; }
.pt-comp-period {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--text-secondary);
}
.pt-comp-prev {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: var(--surface);
  font-size: 14px;
  line-height: 1.4;
}
.pt-comp-prev.hidden { display: none; }
.pt-comp-prev-icon { font-size: 22px; line-height: 1; }

/* Кабинет: награды соревнований */
.pt-awards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px; }
.pt-award {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: var(--surface);
}
.pt-award--month { border-color: color-mix(in srgb, #d4a017 45%, var(--card-border)); }
.pt-award-icon { font-size: 28px; line-height: 1; }
.pt-award-title { font-weight: 700; font-size: 15px; line-height: 1.3; }
.pt-award-meta { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.pt-awards-empty { margin: 0; font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

/* Изучение: вопрос формой на карточке — какая форма нужна и её перевод на обороте */
.flash-task {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--pl-red);
}
.flash-form-ru {
  margin-top: 4px;
  font-size: 15px;
  color: var(--text-secondary);
}
