:root {
  --bg: #000000;
  --bg-deep: #050505;
  --panel: rgba(20, 20, 23, 0.82);
  --panel-strong: rgba(24, 24, 28, 0.94);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f5f5f7;
  --muted: #a5a5ae;
  --accent: #7d92ff;
  --accent-strong: #5f76ff;
  --accent-soft: rgba(125, 146, 255, 0.16);
  --violet-soft: rgba(94, 112, 197, 0.18);
  --amber: #ffcf75;
  --danger: #ff8e94;
  --shadow: 0 20px 44px rgba(0, 0, 0, 0.4);
  --glass-shadow: 0 28px 80px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  --blur: 30px;
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-pill: 999px;
  --page-pad: 20px;
  --section-gap: 16px;
  --card-pad: 18px;
  --app-title-size: 34px;
  --section-title-size: 24px;
  --card-title-size: 20px;
  --body-size: 17px;
  --secondary-size: 15px;
  --caption-size: 13px;
  --button-height: 56px;
  --match-height: 60px;
  --tabbar-hit: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.2, 0.8, 0.2, 1);
  --duration-fast: 180ms;
  --duration-medium: 320ms;
  --duration-slow: 560ms;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "SF Pro Display", "SF Pro Text", "PingFang TC", "Noto Sans TC", "Segoe UI", sans-serif;
  background: #000000;
  color: var(--text);
  font-size: var(--body-size);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.device-shell {
  position: relative;
  width: min(100vw, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top) + 8px)
    var(--page-pad)
    calc(env(safe-area-inset-bottom) + 104px);
  overflow: hidden;
}

.ambient-glow {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(48px);
  pointer-events: none;
  z-index: 0;
  will-change: transform, opacity;
}

.ambient-glow-a {
  top: auto;
  bottom: 72px;
  left: -16px;
  width: 148px;
  height: 148px;
  background: rgba(255, 255, 255, 0.035);
  animation: ambientFloatA 16s ease-in-out infinite;
}

.ambient-glow-b {
  top: auto;
  bottom: 38px;
  right: 32px;
  width: 124px;
  height: 124px;
  background: rgba(255, 255, 255, 0.028);
  animation: ambientFloatB 20s ease-in-out infinite;
}

.tabbar,
.glass-panel,
.surface-card,
.metric-card,
.match-card,
.entry-card,
.empty-card {
  position: relative;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0.014)),
    var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--glass-shadow);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: var(--caption-size);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-title,
.card-title {
  margin: 0;
  letter-spacing: -0.03em;
}

.card-copy,
.muted-copy {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.pill-btn,
.primary-btn,
.secondary-btn,
.ghost-btn,
.chip-btn,
.trash-btn,
.tabbar-btn,
.match-btn {
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-spring),
    background-color var(--duration-fast) var(--ease),
    border-color var(--duration-fast) var(--ease),
    opacity var(--duration-fast) var(--ease),
    box-shadow var(--duration-medium) var(--ease),
    filter var(--duration-medium) var(--ease);
  will-change: transform, opacity;
}

.pill-btn:active,
.primary-btn:active,
.secondary-btn:active,
.ghost-btn:active,
.chip-btn:active,
.trash-btn:active,
.tabbar-btn:active,
.match-btn:active {
  transform: scale(0.98);
}

.app-main {
  position: relative;
  z-index: 1;
  display: grid;
  gap: var(--section-gap);
  margin-top: 0;
  transform: translateZ(0);
}

.view-stack {
  display: grid;
  gap: var(--section-gap);
}

.app-main.route-enter > .view-stack {
  animation: routeFadeIn var(--duration-slow) var(--ease) both;
}

.app-main.route-enter .view-stack > * {
  animation: surfaceRise var(--duration-slow) var(--ease-spring) both;
}

.app-main.route-enter .view-stack > *:nth-child(1) {
  animation-delay: 0ms;
}

.app-main.route-enter .view-stack > *:nth-child(2) {
  animation-delay: 50ms;
}

.app-main.route-enter .view-stack > *:nth-child(3) {
  animation-delay: 90ms;
}

.app-main.route-enter .view-stack > *:nth-child(4) {
  animation-delay: 130ms;
}

body.cards-active .app-main.route-enter > .view-stack,
body.cards-active .app-main.route-enter .view-stack > * {
  animation: none;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.section-title {
  font-size: var(--section-title-size);
}

.section-kicker {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--caption-size);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.surface-card,
.metric-card,
.match-card,
.entry-card,
.empty-card {
  padding: var(--card-pad);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.022), rgba(255, 255, 255, 0.012)),
    rgba(18, 18, 22, 0.86);
  transform: translateZ(0);
}

.hero-card {
  display: grid;
  gap: 18px;
}

.hero-card:first-child {
  background:
    radial-gradient(circle at 85% 16%, rgba(158, 174, 255, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(34, 38, 58, 0.96), rgba(24, 26, 44, 0.94) 72%, rgba(18, 20, 34, 0.96));
  border-color: rgba(255, 255, 255, 0.1);
}

.hero-card:first-child .eyebrow,
.hero-card:first-child .card-copy,
.hero-card:first-child .small-copy,
.hero-card:first-child .section-kicker,
.hero-card:first-child .metric-card span {
  color: rgba(255, 255, 255, 0.82);
}

.hero-card:first-child .metric-card,
.hero-card:first-child .status-pill {
  background: rgba(0, 0, 0, 0.16);
  border-color: rgba(255, 255, 255, 0.1);
}

.hero-grid,
.metric-grid,
.home-actions,
.start-grid,
.insight-grid,
.trash-grid {
  display: grid;
  gap: 12px;
}

.hero-grid,
.metric-grid,
.insight-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-card strong,
.hero-metric strong {
  display: block;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.hero-metric span,
.metric-card span,
.label-row,
.mini-copy {
  font-size: var(--caption-size);
  color: var(--muted);
}

.hero-badge-row,
.entry-meta-row,
.chip-row,
.source-years,
.match-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.match-launch-card {
  padding: 22px 18px 18px;
}

.match-launch-heading {
  align-items: flex-start;
  margin-bottom: 18px;
}

.match-launch-heading .eyebrow {
  margin-bottom: 10px;
}

.match-launch-heading .section-title {
  line-height: 1.08;
}

.match-launch-heading .section-kicker {
  align-self: center;
}

.match-launch-grid {
  gap: 18px;
  margin-top: 2px;
}

.match-launch-summary {
  margin-top: 18px;
  gap: 10px;
}

.cards-panel {
  padding: 22px 18px 18px;
}

body.cards-active .cards-panel,
body.cards-active .entry-card,
body.cards-active .empty-card {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0.008)),
    rgba(18, 18, 22, 0.92);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.cards-panel-heading {
  align-items: flex-start;
  margin-bottom: 18px;
}

.cards-panel-heading .eyebrow {
  margin-bottom: 10px;
}

.cards-panel-heading .section-title {
  line-height: 1.08;
}

.cards-panel-heading .section-kicker {
  align-self: center;
}

.cards-panel-segmented {
  margin-top: 2px;
  margin-bottom: 18px;
  padding: 8px;
  border-radius: 20px;
}

.cards-panel-search {
  margin-bottom: 16px;
}

.cards-panel-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 0;
}

.insights-overview-card {
  padding: 22px 18px 18px;
}

.insights-overview-heading {
  align-items: flex-start;
  margin-bottom: 18px;
}

.insights-overview-heading .eyebrow {
  margin-bottom: 10px;
}

.insights-overview-heading .section-title {
  line-height: 1.08;
}

.insights-overview-heading .section-kicker {
  align-self: center;
}

.insights-overview-grid {
  gap: 20px;
  margin-top: 2px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: var(--caption-size);
  transition:
    transform var(--duration-fast) var(--ease-spring),
    background-color var(--duration-medium) var(--ease),
    border-color var(--duration-medium) var(--ease),
    color var(--duration-medium) var(--ease),
    box-shadow var(--duration-medium) var(--ease);
}

.status-pill.mastered {
  color: #eef2ff;
  background: rgba(125, 146, 255, 0.16);
  border-color: rgba(125, 146, 255, 0.24);
}

.status-pill.learning {
  color: #e6ebff;
  background: rgba(94, 112, 197, 0.16);
  border-color: rgba(94, 112, 197, 0.24);
}

.status-pill.weak {
  color: #fff3f4;
  background: rgba(255, 142, 148, 0.14);
  border-color: rgba(255, 142, 148, 0.24);
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cards-page-indicator {
  min-height: var(--button-height);
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: var(--caption-size);
}

.cards-page-btn[disabled] {
  opacity: 0.42;
  cursor: default;
  transform: none;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.pill-btn {
  min-height: var(--button-height);
  border-radius: 18px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.primary-btn {
  background: linear-gradient(180deg, rgba(122, 141, 255, 0.94), rgba(95, 118, 255, 0.88));
  border-color: rgba(140, 156, 255, 0.34);
  color: #f7f8ff;
  box-shadow: 0 12px 32px rgba(95, 118, 255, 0.24);
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.pill-btn:hover,
.chip-btn:hover,
.trash-btn:hover,
.tabbar-btn:hover,
.match-btn:hover {
  transform: translateY(-1px);
}

.secondary-btn {
  background: linear-gradient(180deg, rgba(52, 52, 58, 0.86), rgba(24, 24, 28, 0.96));
  border-color: rgba(255, 255, 255, 0.08);
  color: #f5f5f7;
}

.ghost-btn,
.pill-btn,
.chip-btn,
.trash-btn {
  border-color: rgba(255, 255, 255, 0.07);
  background: rgba(36, 36, 40, 0.84);
}

.chip-btn {
  min-height: 40px;
  width: 100%;
  padding: 0 10px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 13px;
}

.pill-btn.active,
.chip-btn.active {
  color: var(--text);
  border-color: rgba(125, 146, 255, 0.26);
  background: rgba(125, 146, 255, 0.14);
}

.input-shell,
.segmented,
.chip-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip-group.cards-panel-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  flex-wrap: unset;
}

.segmented {
  padding: 5px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.pill-btn {
  min-height: 38px;
  padding-inline: 14px;
  border-radius: 15px;
  font-size: 14px;
}

.search-input {
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(18, 18, 22, 0.92);
  color: var(--text);
  outline: none;
}

.search-input::placeholder {
  color: #91a0b2;
}

.entry-list,
.stat-list,
.trash-list {
  display: grid;
  gap: 12px;
}

body.cards-active .entry-list {
  contain: layout paint;
}

body.cards-active .entry-card {
  contain: layout paint style;
}

.entry-card-head,
.entry-actions,
.list-row,
.match-header,
.trash-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.entry-card-head {
  align-items: flex-start;
}

.entry-title {
  font-size: var(--card-title-size);
}

.entry-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.entry-subtitle,
.small-copy {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: var(--secondary-size);
  line-height: 1.45;
}

.related-phrases {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.phrase-chip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.trash-btn {
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border-radius: 14px;
}

.icon-trash-btn {
  min-width: 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(58, 62, 79, 0.34), rgba(18, 20, 30, 0.92)),
    rgba(16, 18, 28, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 8px 18px rgba(0, 0, 0, 0.16);
}

.icon-trash-btn svg {
  width: 16px;
  height: 16px;
}

.trash-btn.word {
  color: #ffdadd;
  border-color: rgba(255, 142, 148, 0.24);
}

.trash-btn.restore {
  color: #f9eef4;
  border-color: rgba(255, 255, 255, 0.11);
}

.progress-meter {
  margin-top: 14px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.progress-meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff6a88, #ff2d55 68%, #d91d68);
}

.start-grid {
  grid-template-columns: 1fr;
}

.match-mode-btn {
  min-height: 74px;
  justify-content: space-between;
  padding: 14px 18px;
  text-align: left;
  border-radius: 22px;
  transition:
    transform var(--duration-medium) var(--ease-spring),
    background var(--duration-medium) var(--ease),
    border-color var(--duration-medium) var(--ease),
    box-shadow var(--duration-medium) var(--ease);
}

.match-mode-btn.active {
  border-color: rgba(125, 146, 255, 0.26);
  background: linear-gradient(180deg, rgba(125, 146, 255, 0.16), rgba(125, 146, 255, 0.08));
}

.match-status {
  font-size: var(--secondary-size);
  color: var(--muted);
}

.match-status.done {
  color: #eef2ff;
}

.match-stage-card {
  padding: 12px 12px 14px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  background:
    linear-gradient(180deg, rgba(22, 22, 24, 0.96), rgba(10, 10, 12, 0.98));
}

.match-toolbar {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
}

.match-circle-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(48, 48, 52, 0.92), rgba(20, 20, 22, 0.96));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition:
    transform var(--duration-fast) var(--ease-spring),
    box-shadow var(--duration-medium) var(--ease),
    background var(--duration-medium) var(--ease);
}

.match-circle-btn svg {
  width: 20px;
  height: 20px;
}

.match-toolbar-actions {
  display: flex;
  gap: 10px;
}

.match-stage-meta {
  text-align: center;
}

.match-stage-meta strong {
  display: block;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.match-stage-meta span {
  font-size: var(--caption-size);
  color: var(--muted);
}

.match-stage-summary {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.match-stage-progress {
  margin: 12px 4px 0;
}

.match-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.match-tile {
  min-height: 112px;
  padding: 10px 8px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.038), rgba(255, 255, 255, 0.014)),
    linear-gradient(180deg, rgba(34, 34, 38, 0.96), rgba(16, 16, 18, 0.98));
  color: #f5f5f7;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 8px 20px rgba(0, 0, 0, 0.12);
  transition:
    transform var(--duration-medium) var(--ease-spring),
    opacity var(--duration-medium) var(--ease),
    border-color var(--duration-medium) var(--ease),
    background var(--duration-medium) var(--ease),
    box-shadow var(--duration-medium) var(--ease),
    filter var(--duration-medium) var(--ease);
  will-change: transform, opacity;
}

.match-tile.note-tile {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.032), rgba(255, 255, 255, 0.01)),
    linear-gradient(180deg, rgba(26, 26, 30, 0.98), rgba(12, 12, 14, 1));
}

.match-tile.selected {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateY(-3px) scale(1.01);
}

.match-tile.wrong {
  border-color: rgba(255, 142, 148, 0.32);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, rgba(65, 25, 36, 0.94), rgba(40, 14, 22, 0.98));
  animation: tileWrongShake 420ms var(--ease) both;
}

.match-tile.matched {
  opacity: 0.22;
  transform: scale(0.96);
  filter: saturate(0.7) blur(0.1px);
}

.match-tile.just-matched {
  animation: tileMatchedFlash 360ms var(--ease-spring) both;
}

.match-tile-label {
  display: block;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -0.03em;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: manual;
}

.match-tile.word-tile .match-tile-label {
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
  hyphens: none;
  font-size: 18px;
  letter-spacing: -0.045em;
}

.match-tile.note-tile .match-tile-label {
  font-size: 18px;
  letter-spacing: -0.045em;
}

.match-tile.word-tile.label-compact .match-tile-label {
  font-size: 16px;
}

.match-tile.word-tile.label-tight .match-tile-label {
  font-size: 14px;
  letter-spacing: -0.05em;
}

.match-tile.word-tile.label-ultra-tight .match-tile-label {
  font-size: 12px;
  letter-spacing: -0.055em;
}

body.match-immersive .tabbar {
  display: none;
}

body.match-immersive {
  background:
    radial-gradient(circle at 50% -18%, rgba(255, 255, 255, 0.04), transparent 34%),
    linear-gradient(180deg, #080808 0%, #020202 100%);
}

body.match-immersive .device-shell {
  width: min(100vw, 448px);
  max-width: 448px;
  padding-top: calc(env(safe-area-inset-top) + 8px);
  padding-left: 12px;
  padding-right: 12px;
  padding-bottom: calc(env(safe-area-inset-bottom) + 12px);
}

body.match-immersive .app-main {
  margin-top: 0;
}

body.match-immersive .view-stack {
  gap: 0;
}

body.match-immersive .match-screen-active {
  min-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 20px);
}

.list-row {
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.list-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.ranking-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 14px;
}

.ranking-copy {
  min-width: 0;
}

.ranking-copy strong {
  display: block;
  font-size: 24px;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.ranking-copy .small-copy {
  margin-top: 8px;
}

.ranking-pill {
  justify-self: end;
  white-space: nowrap;
}

.list-rank {
  font-size: 24px;
  letter-spacing: -0.03em;
  color: var(--muted);
  min-width: 36px;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  transform: translateX(-50%);
  width: min(calc(100vw - 48px), 368px);
  max-width: min(calc(100vw - 48px), 368px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 1px;
  padding: 5px 6px;
  border-radius: 999px;
  z-index: 3;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(82, 83, 88, 0.28), rgba(36, 36, 39, 0.54) 32%, rgba(16, 16, 18, 0.92) 100%),
    rgba(18, 18, 20, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.072);
  backdrop-filter: blur(34px) saturate(132%);
  -webkit-backdrop-filter: blur(34px) saturate(132%);
  box-shadow:
    0 22px 56px rgba(0, 0, 0, 0.42),
    0 6px 14px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    inset 0 -16px 26px rgba(0, 0, 0, 0.26);
}

.tabbar::before,
.tabbar::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.tabbar::before {
  inset: 1px 1px auto 1px;
  height: 46%;
  border-radius: 999px 999px 28px 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.145), rgba(255, 255, 255, 0.024) 54%, transparent 100%);
  opacity: 0.9;
}

.tabbar::after {
  left: 12px;
  right: 12px;
  bottom: 5px;
  height: 14px;
  border-radius: 999px;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.045), transparent 72%);
  opacity: 0.42;
}

.tabbar-btn {
  min-height: 60px;
  min-width: 0;
  width: 100%;
  border-radius: 999px;
  color: rgba(245, 247, 250, 0.78);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 13px 6px;
  position: relative;
  overflow: hidden;
  transition:
    color var(--duration-fast) var(--ease),
    transform var(--duration-fast) var(--ease-spring),
    box-shadow var(--duration-medium) var(--ease),
    background var(--duration-medium) var(--ease);
}

.tabbar-btn:not(.active) {
  background: transparent;
}

.tabbar-btn.active {
  background:
    radial-gradient(circle at 24% 16%, rgba(255, 255, 255, 0.18), transparent 32%),
    linear-gradient(180deg, rgba(126, 129, 137, 0.38), rgba(65, 67, 74, 0.4) 42%, rgba(26, 28, 33, 0.82));
  color: #ff5a76;
  border: 1px solid rgba(255, 255, 255, 0.36);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -8px 14px rgba(0, 0, 0, 0.22),
    0 1px 0 rgba(255, 255, 255, 0.07),
    0 8px 20px rgba(0, 0, 0, 0.24);
}

.tabbar-btn.active::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.02) 46%, transparent 72%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.tabbar-btn.active::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background:
    radial-gradient(circle at 8% 48%, rgba(255, 75, 96, 0.24), transparent 24%),
    radial-gradient(circle at 20% 10%, rgba(82, 113, 255, 0.16), transparent 20%);
  mix-blend-mode: screen;
  opacity: 0.72;
  pointer-events: none;
}

.tabbar-icon {
  width: 21px;
  height: 21px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.94;
}

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

.tabbar-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.05;
  white-space: nowrap;
}

.tabbar-btn.active .tabbar-label,
.tabbar-btn.active .tabbar-icon {
  filter: saturate(1.08);
}

.toast-shell {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 66px);
  transform: translateX(-50%);
  width: min(calc(100vw - 36px), 360px);
  z-index: 5;
  display: grid;
  gap: 10px;
}

.toast {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(18, 24, 34, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: var(--secondary-size);
  animation: toastRise 2400ms var(--ease) both;
}

@keyframes routeFadeIn {
  from {
    opacity: 0.01;
  }
  to {
    opacity: 1;
  }
}

@keyframes surfaceRise {
  from {
    opacity: 0.01;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ambientFloatA {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.88;
  }
  50% {
    transform: translate3d(12px, -8px, 0) scale(1.06);
    opacity: 1;
  }
}

@keyframes ambientFloatB {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.82;
  }
  50% {
    transform: translate3d(-10px, 10px, 0) scale(1.04);
    opacity: 0.96;
  }
}

@keyframes tileMatchedFlash {
  0% {
    transform: scale(0.98);
    filter: brightness(1);
  }
  45% {
    transform: scale(1.035);
    filter: brightness(1.08);
  }
  100% {
    transform: scale(0.96);
    filter: brightness(1);
  }
}

@keyframes tileWrongShake {
  0% {
    transform: translateX(0);
  }
  22% {
    transform: translateX(-5px);
  }
  48% {
    transform: translateX(4px);
  }
  72% {
    transform: translateX(-2px);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes toastRise {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  10%, 82% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

.empty-card {
  color: var(--muted);
}

.empty-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.hidden {
  display: none !important;
}

@media (max-width: 389px) {
  :root {
    --page-pad: 16px;
    --app-title-size: 30px;
    --section-title-size: 22px;
    --card-title-size: 18px;
    --body-size: 16px;
  }

  .hero-grid,
  .metric-grid,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .match-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .match-tile {
    min-height: 108px;
  }
}
