:root {
  --ink: #171429;
  --muted: #696580;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-solid: #ffffff;
  --line: rgba(23, 20, 41, 0.12);
  --cyan: #18d5ff;
  --pink: #ff4faf;
  --lemon: #ffd84d;
  --lime: #7df26d;
  --purple: #8067ff;
  --coral: #ff7867;
  --shadow: 0 18px 40px rgba(24, 18, 68, 0.18);
  --deep-shadow: 0 28px 80px rgba(29, 22, 89, 0.28);
  --radius: 28px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(255, 216, 77, 0.32), transparent 28%),
    linear-gradient(225deg, rgba(24, 213, 255, 0.34), transparent 30%),
    linear-gradient(160deg, #f9f6ff 0%, #ecfbff 48%, #fff4df 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.hero-panel,
.difficulty-strip,
.game-layout {
  position: relative;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(360px, 0.98fr);
  gap: 28px;
  min-height: min(760px, calc(100vh - 48px));
  padding: clamp(28px, 5vw, 72px);
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 36px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 79, 175, 0.18), transparent 34%),
    linear-gradient(235deg, rgba(125, 242, 109, 0.2), transparent 35%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.24) 0 1px, transparent 1px 52px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.24) 0 1px, transparent 1px 52px),
    rgba(255, 255, 255, 0.62);
  box-shadow: var(--deep-shadow);
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(128, 103, 255, 0.16) 0 16%, transparent 16% 100%),
    linear-gradient(295deg, rgba(24, 213, 255, 0.2) 0 14%, transparent 14% 100%);
  pointer-events: none;
}

.hero-copy,
.hero-visual {
  position: relative;
  z-index: 1;
}

.hero-copy {
  align-self: center;
  max-width: 760px;
}

.brand-chip,
.section-kicker {
  margin: 0 0 12px;
  color: #5f35ea;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 30px rgba(128, 103, 255, 0.18);
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 5px rgba(125, 242, 109, 0.24);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 18px;
  font-size: clamp(4rem, 10vw, 9.4rem);
  line-height: 0.82;
  letter-spacing: 0;
  font-weight: 900;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 620px;
  color: #39334d;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 700;
  line-height: 1.45;
}

.hero-actions,
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.primary-action,
.secondary-action,
.control-stack button,
.leaderboard-header button,
.modal-actions button {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 16px;
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 12px 0 rgba(23, 20, 41, 0.13);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.primary-action {
  background: linear-gradient(135deg, var(--lemon), #ff9f43);
}

.secondary-action,
.control-stack button,
.leaderboard-header button,
.modal-actions button {
  background: var(--panel-solid);
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: saturate(1.08);
  box-shadow: 0 14px 0 rgba(23, 20, 41, 0.12);
}

button:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 7px 0 rgba(23, 20, 41, 0.14);
}

.hero-visual {
  display: grid;
  align-content: center;
  gap: 18px;
}

.mini-podium {
  display: grid;
  grid-template-columns: 1fr 1.18fr 1fr;
  gap: 12px;
  align-items: end;
}

.podium-card {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 16px 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.podium-card.first {
  min-height: 166px;
  background: linear-gradient(180deg, #fff4b5, #fff);
}

.podium-card.second {
  min-height: 130px;
  background: linear-gradient(180deg, #e9ecff, #fff);
}

.podium-card.third {
  min-height: 112px;
  background: linear-gradient(180deg, #ffd8bd, #fff);
}

.podium-card span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.podium-card strong {
  font-size: 1.05rem;
}

.podium-card small {
  color: var(--muted);
  font-weight: 800;
}

.preview-board {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 5px;
  padding: 14px;
  border-radius: 26px;
  background: #231a4b;
  box-shadow: var(--deep-shadow);
  transform: rotate(-2deg);
}

.preview-board span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 9px;
  background: #f7f9ff;
  color: #231a4b;
  font-size: clamp(0.85rem, 2vw, 1.3rem);
  font-weight: 900;
}

.preview-board span:empty {
  background: linear-gradient(135deg, rgba(24, 213, 255, 0.9), rgba(255, 79, 175, 0.85));
}

.difficulty-strip {
  display: grid;
  grid-template-columns: minmax(260px, 0.32fr) 1fr;
  gap: 22px;
  align-items: start;
  margin: 24px 0;
  padding: 28px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
}

.difficulty-card {
  position: relative;
  overflow: hidden;
  min-height: 128px;
  padding: 16px;
  border: 2px solid transparent;
  border-radius: 22px;
  background: var(--panel-solid);
  color: var(--ink);
  text-align: left;
}

.difficulty-card span {
  display: block;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.difficulty-card strong {
  display: block;
  font-size: 1.12rem;
}

.difficulty-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
}

.difficulty-card.active {
  border-color: var(--ink);
  background: linear-gradient(135deg, var(--cyan), #ffffff 68%);
  box-shadow: 0 12px 0 rgba(23, 20, 41, 0.12);
}

.difficulty-card.has-save::after {
  content: "Paused";
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #fff0a8;
  color: #5f35ea;
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(230px, 0.72fr) minmax(420px, 1.28fr) minmax(300px, 0.9fr);
  gap: 20px;
  align-items: start;
}

.status-panel,
.board-panel,
.leaderboard-panel {
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 30px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.status-panel,
.leaderboard-panel {
  padding: 18px;
}

.board-panel {
  padding: 18px;
}

.timer-card {
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(135deg, #211747, #3b2a89);
  color: #fff;
}

.timer-card .label,
.timer-card small {
  display: block;
  color: rgba(255, 255, 255, 0.68);
  font-weight: 800;
}

.timer-card strong {
  display: block;
  margin: 6px 0;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  letter-spacing: 0;
}

.habit-card {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 216, 77, 0.22), transparent 44%),
    #fff;
}

.habit-card div {
  min-height: 70px;
  padding: 12px;
  border-radius: 17px;
  background: #f8f7ff;
}

.habit-card span,
.habit-result span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.habit-card strong,
.habit-result strong {
  display: block;
  margin-top: 7px;
  font-size: 1.35rem;
  font-weight: 900;
}

.habit-card p {
  grid-column: 1 / -1;
  margin: 0;
  color: #5f35ea;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.35;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.stats-grid div {
  min-height: 82px;
  padding: 12px;
  border-radius: 18px;
  background: #fff;
}

.stats-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stats-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 1.45rem;
}

.control-stack {
  display: grid;
  gap: 10px;
}

.control-stack button {
  width: 100%;
}

.player-field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.player-field input {
  width: 100%;
  min-height: 46px;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 0 14px;
  color: var(--ink);
  font-weight: 800;
  outline: none;
}

.player-field input:focus {
  border-color: var(--purple);
}

.board-header,
.leaderboard-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.date-pill {
  padding: 10px 12px;
  border-radius: 999px;
  background: #ecfff4;
  color: #187145;
  font-size: 0.8rem;
  font-weight: 900;
  white-space: nowrap;
}

.board-wrap {
  position: relative;
}

.sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  overflow: hidden;
  border: 4px solid var(--ink);
  border-radius: 20px;
  background: var(--ink);
}

.cell {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(23, 20, 41, 0.14);
  background: #ffffff;
  color: var(--ink);
  font-size: clamp(1.08rem, 3.8vw, 1.7rem);
  font-weight: 900;
  outline: 0;
  transition: background 120ms ease, transform 120ms ease, color 120ms ease;
}

.cell:nth-child(3n) {
  border-right-width: 3px;
}

.cell:nth-child(9n) {
  border-right-width: 1px;
}

.cell:nth-child(n + 19):nth-child(-n + 27),
.cell:nth-child(n + 46):nth-child(-n + 54) {
  border-bottom-width: 3px;
}

.cell.given {
  background: #f0f2ff;
  color: #3f35a8;
}

.cell.selected {
  background: #fff5bd;
  transform: scale(0.96);
}

.cell.related {
  background: #edfaff;
}

.cell.filled {
  color: #101937;
}

.cell.has-notes {
  padding: 3px;
}

.cell-notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  gap: 1px;
  color: #5f35ea;
  font-size: clamp(0.48rem, 1.4vw, 0.7rem);
  font-weight: 900;
  line-height: 1;
}

.cell-notes span {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
}

.cell.wrong {
  background: #ffe1e7;
  color: #d80e4f;
  animation: shake 220ms ease;
}

.cell.hint {
  background: #e7ffdd;
  color: #187145;
}

.cell.line-complete {
  animation: lineGlow 820ms ease both;
}

.cell.box-complete {
  animation: boxGlow 900ms ease both;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-4px);
  }
  70% {
    transform: translateX(4px);
  }
}

@keyframes lineGlow {
  0% {
    background: #ffffff;
    box-shadow: inset 0 0 0 0 rgba(24, 213, 255, 0);
  }
  42% {
    background: #dcfbff;
    box-shadow: inset 0 0 0 4px rgba(24, 213, 255, 0.72), 0 0 22px rgba(24, 213, 255, 0.48);
    transform: scale(0.96);
  }
  100% {
    box-shadow: inset 0 0 0 0 rgba(24, 213, 255, 0);
  }
}

@keyframes boxGlow {
  0% {
    background: #ffffff;
    box-shadow: inset 0 0 0 0 rgba(255, 216, 77, 0);
  }
  40% {
    background: #fff3a8;
    box-shadow: inset 0 0 0 4px rgba(255, 216, 77, 0.86), 0 0 26px rgba(255, 79, 175, 0.42);
    transform: scale(0.95);
  }
  70% {
    background: #e7ffdd;
  }
  100% {
    box-shadow: inset 0 0 0 0 rgba(255, 216, 77, 0);
  }
}

.pause-cover {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 24px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 25% 20%, rgba(255, 216, 77, 0.2), transparent 25%),
    radial-gradient(circle at 75% 70%, rgba(24, 213, 255, 0.16), transparent 28%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.09) 0 10px, rgba(255, 255, 255, 0.02) 10px 20px),
    #171429;
  color: #fff;
  text-align: center;
  z-index: 5;
}

.pause-cover strong {
  font-size: clamp(2rem, 5vw, 4.4rem);
  font-weight: 900;
}

.pause-cover span {
  max-width: 330px;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 800;
}

.pause-cover[hidden] {
  display: none;
}

.number-pad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.number-pad button {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffffff, #f3f6ff);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
  box-shadow: 0 8px 0 rgba(23, 20, 41, 0.1);
}

.number-pad button::after {
  content: attr(data-progress);
  position: absolute;
  right: 5px;
  bottom: 4px;
  color: rgba(23, 20, 41, 0.36);
  font-size: 0.52rem;
  font-weight: 900;
}

.number-pad button.used-up {
  filter: grayscale(1) blur(0.25px);
  opacity: 0.32;
  transform: none;
  box-shadow: none;
}

.number-pad button.used-up::before {
  content: "";
  position: absolute;
  width: 62%;
  height: 4px;
  border-radius: 999px;
  background: rgba(23, 20, 41, 0.55);
  transform: rotate(-18deg);
}

.number-pad.notes-active button {
  background: linear-gradient(135deg, #fff0a8, #ffffff);
  color: #5f35ea;
}

#notes-game[aria-pressed="true"] {
  background: linear-gradient(135deg, #fff0a8, #ffffff);
  color: #5f35ea;
}

.board-message {
  min-height: 26px;
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.leaderboard-header button {
  min-width: 92px;
}

.top-three {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.top-card {
  position: relative;
  overflow: hidden;
  min-height: 112px;
  padding: 12px 10px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(23, 20, 41, 0.12);
  text-align: center;
}

.top-card.rank-1 {
  min-height: 146px;
  background: linear-gradient(180deg, #fff2a8, #fff);
}

.top-card.rank-1::before {
  content: "";
  position: absolute;
  inset: -45% -25% auto;
  height: 90px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  transform: rotate(16deg);
  animation: podiumShine 2.8s ease-in-out infinite;
}

.top-card.is-player,
.leader-row.is-player {
  outline: 3px solid rgba(255, 216, 77, 0.9);
  box-shadow: 0 14px 34px rgba(255, 79, 175, 0.2), 0 0 0 6px rgba(255, 216, 77, 0.16);
}

@keyframes podiumShine {
  0%, 45% {
    transform: translateX(-120%) rotate(16deg);
  }
  80%, 100% {
    transform: translateX(120%) rotate(16deg);
  }
}

.top-card.rank-2 {
  min-height: 126px;
  background: linear-gradient(180deg, #e9edff, #fff);
}

.top-card.rank-3 {
  min-height: 112px;
  background: linear-gradient(180deg, #ffd4b8, #fff);
}

.rank-medal {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: 0 auto 8px;
  border-radius: 13px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.top-card strong,
.top-card span {
  display: block;
}

.top-card span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

.leaderboard-list {
  display: grid;
  gap: 8px;
}

.leaderboard-beta-note {
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(128, 103, 255, 0.18);
  border-radius: 16px;
  background: rgba(128, 103, 255, 0.08);
  color: #5f35ea;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.35;
}

.leader-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(23, 20, 41, 0.08);
  animation: slideIn 260ms ease both;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.leader-rank {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 13px;
  background: #f0f2ff;
  font-weight: 900;
}

.leader-name {
  min-width: 0;
}

.leader-name strong {
  display: block;
  overflow-wrap: anywhere;
}

.leader-name small {
  color: var(--muted);
  font-weight: 800;
}

.leader-time {
  font-weight: 900;
  white-space: nowrap;
}

.badge-line,
.result-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.badge,
.result-badges span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
  color: var(--ink);
  background: #f2f2f8;
}

.badge.clean {
  background: #dfffd7;
}

.badge.first-try {
  background: #fff0a8;
}

.badge.penalty {
  background: #ffdce5;
}

.badge.paused {
  background: #dff8ff;
}

.badge.restarted {
  background: #f0e8ff;
}

.badge-legend {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.badge-legend span {
  display: flex;
  gap: 8px;
  align-items: center;
}

.modal {
  width: min(430px, calc(100% - 32px));
  border: 0;
  border-radius: 28px;
  padding: 0;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--deep-shadow);
}

.result-modal {
  width: min(560px, calc(100% - 32px));
}

.share-modal {
  width: min(620px, calc(100% - 32px));
}

.result-modal form {
  position: relative;
  overflow: hidden;
}

.result-modal.clean-result form,
.result-modal.podium-result form {
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 216, 77, 0.32), transparent 24%),
    radial-gradient(circle at 80% 0%, rgba(24, 213, 255, 0.26), transparent 26%),
    #fff;
}

.celebration-burst {
  position: absolute;
  top: 52px;
  left: 50%;
  pointer-events: none;
  z-index: 0;
}

.celebration-burst span {
  position: absolute;
  width: 9px;
  height: 18px;
  border-radius: 999px;
  background: var(--tone);
  opacity: 0;
  transform: translate(-50%, -50%) rotate(0deg);
  animation: confettiPop 760ms ease-out var(--delay) both;
}

@keyframes confettiPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4) rotate(0deg);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1) rotate(210deg);
  }
}

.modal::backdrop {
  background: rgba(23, 20, 41, 0.48);
}

.modal form {
  padding: 26px;
}

.modal h2 {
  margin-bottom: 10px;
}

.modal p:not(.section-kicker) {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.45;
}

.result-score {
  display: grid;
  gap: 4px;
  margin: 18px 0;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, #211747, #4d38b6);
  color: #fff;
}

.rank-reveal {
  display: grid;
  grid-template-columns: 1fr 44px 1fr;
  align-items: center;
  gap: 10px;
  margin: 14px 0 6px;
  padding: 12px;
  border-radius: 22px;
  background: #f7f3ff;
}

.rank-reveal span,
.rank-reveal strong {
  display: grid;
  place-items: center;
  min-height: 58px;
  border-radius: 18px;
  font-size: 1.55rem;
  font-weight: 900;
}

.rank-reveal span {
  color: rgba(23, 20, 41, 0.45);
  background: #fff;
  animation: rankDrop 520ms ease both;
}

.rank-reveal strong {
  color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  box-shadow: 0 14px 28px rgba(128, 103, 255, 0.28);
  animation: rankClimb 720ms cubic-bezier(.2, .9, .2, 1.2) 180ms both;
}

.rank-reveal b {
  display: block;
  width: 44px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--lemon));
  position: relative;
}

.rank-reveal b::after {
  content: "";
  position: absolute;
  right: -2px;
  top: 50%;
  width: 13px;
  height: 13px;
  border-top: 4px solid var(--lemon);
  border-right: 4px solid var(--lemon);
  transform: translateY(-50%) rotate(45deg);
}

@keyframes rankDrop {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
}

@keyframes rankClimb {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.82);
  }
}

.rank-copy {
  margin-bottom: 14px;
  color: #5f35ea;
  font-weight: 900;
}

.share-card {
  margin: 18px 0;
  padding: 16px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(24, 213, 255, 0.16), transparent 42%),
    linear-gradient(225deg, rgba(255, 216, 77, 0.22), transparent 45%),
    #f8faff;
  border: 1px solid rgba(128, 103, 255, 0.18);
}

.share-card-label {
  color: #5f35ea;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.share-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.1rem;
}

.share-card p {
  margin: 8px 0 12px;
}

.share-card button {
  margin-right: 8px;
  margin-bottom: 8px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  box-shadow: none;
}

.result-card-canvas {
  display: block;
  width: min(100%, 340px);
  height: auto;
  margin: 14px 0;
  border-radius: 22px;
  box-shadow: 0 14px 34px rgba(23, 20, 41, 0.16);
}

.share-card small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.share-preview {
  margin: 16px 0;
  padding: 14px;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(24, 213, 255, 0.12), transparent 42%),
    #f8faff;
  border: 1px solid rgba(128, 103, 255, 0.18);
}

.share-preview span {
  color: #5f35ea;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.share-preview p {
  margin: 7px 0 0;
}

.social-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.social-option {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 54px;
  padding: 9px 11px;
  border-radius: 18px;
  color: #fff;
  font-size: 0.84rem;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(23, 20, 41, 0.14);
}

.social-option span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 900;
}

.social-option.whatsapp {
  background: #1faf62;
}

.social-option.tiktok {
  background: linear-gradient(135deg, #121212, #ff2d55);
}

.social-option.facebook {
  background: #1877f2;
}

.social-option.twitter {
  background: #111;
}

.social-option.instagram {
  background: linear-gradient(135deg, #f9ce34, #ee2a7b 46%, #6228d7);
}

.social-option.threads {
  background: #241f2f;
}

.social-option.native-share {
  background: linear-gradient(135deg, var(--purple), var(--cyan));
}

.share-helper {
  margin-bottom: 14px;
  color: #5f35ea;
  font-size: 0.86rem;
  font-weight: 900;
}

.result-score span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.84rem;
  font-weight: 900;
  text-transform: uppercase;
}

.result-score strong {
  font-size: 2.7rem;
  letter-spacing: 0;
}

.habit-result {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.habit-result div {
  padding: 13px;
  border-radius: 20px;
  background: #f7f3ff;
}

.habit-result div.is-new {
  background: linear-gradient(135deg, #fff0a8, #e7ffdd);
  box-shadow: 0 12px 26px rgba(255, 216, 77, 0.22);
}

.habit-result p {
  grid-column: 1 / -1;
  margin: 0;
  color: #5f35ea;
  font-weight: 900;
}

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

@media (max-width: 1180px) {
  .hero-panel,
  .difficulty-strip,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .game-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  }

  .leaderboard-panel {
    grid-column: 1 / -1;
  }

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

@media (max-width: 780px) {
  .app-shell {
    width: min(100% - 20px, 680px);
    padding-top: 10px;
  }

  .hero-panel {
    min-height: auto;
    padding: 24px;
    border-radius: 28px;
  }

  h1 {
    font-size: clamp(3.3rem, 18vw, 5.4rem);
  }

  .mini-podium {
    order: 2;
  }

  .preview-board {
    transform: none;
  }

  .difficulty-grid,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .difficulty-card {
    min-height: 112px;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .control-stack {
    grid-template-columns: repeat(2, 1fr);
  }

  .number-pad {
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 5px;
  }

  .number-pad button {
    border-radius: 10px;
    font-size: 0.92rem;
  }

  .top-three {
    grid-template-columns: 1fr;
  }

  .top-card,
  .top-card.rank-1,
  .top-card.rank-2,
  .top-card.rank-3 {
    min-height: auto;
  }
}

@media (max-width: 480px) {
  .hero-actions,
  .modal-actions,
  .board-header,
  .leaderboard-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary-action,
  .secondary-action,
  .leaderboard-header button,
  .modal-actions button {
    width: 100%;
  }

  .difficulty-strip,
  .status-panel,
  .board-panel,
  .leaderboard-panel {
    padding: 14px;
    border-radius: 24px;
  }

  .cell {
    font-size: clamp(0.94rem, 6vw, 1.35rem);
  }
}
