:root {
  --bg: #08080a;
  --panel: #121216;
  --panel-2: #191920;
  --line: #2a2a33;
  --text: #f5f5f7;
  --muted: #8f8f9d;
  --lime: #d6ff3f;
  --red: #ff3b30;
  --orange: #ff8a00;
  --teal: #00d1b2;
  --green: #30d158;
  --radius: 22px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(214, 255, 63, 0.14), transparent 62%),
    radial-gradient(700px 420px at -10% 12%, rgba(255, 59, 48, 0.1), transparent 60%),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 72%);
}

[hidden] {
  display: none !important;
}

#app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  padding: 16px 16px calc(102px + env(safe-area-inset-bottom));
}

.brand {
  font-size: 18px;
  font-weight: 950;
  letter-spacing: -0.045em;
  text-transform: uppercase;
  color: var(--lime);
  line-height: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px 14px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(18, 18, 22, 0.8);
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.icon-btn:active {
  transform: scale(0.94);
  border-color: var(--lime);
  color: var(--lime);
}

.profile {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(25, 25, 32, 0.95), rgba(18, 18, 22, 0.92));
  box-shadow: var(--shadow);
}

.profile-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hello {
  font-size: 21px;
  font-weight: 950;
  letter-spacing: -0.035em;
  line-height: 1.06;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-line {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.stats {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.stat {
  min-width: 44px;
  text-align: right;
}

.stat span {
  display: block;
  font-size: 23px;
  font-weight: 950;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--lime);
}

.stat small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.wheel-card {
  padding: 16px 16px 18px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(25, 25, 32, 0.96), rgba(14, 14, 18, 0.96));
  box-shadow: var(--shadow);
}

.wheel-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  margin: 2px auto 14px;
}

#wheel {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.5));
}

.pointer {
  position: absolute;
  z-index: 4;
  top: -3px;
  left: 50%;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-top: 24px solid var(--lime);
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.6));
}

.hub {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 23%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 3px solid var(--lime);
  border-radius: 50%;
  background: #0b0b0e;
  box-shadow:
    0 0 0 8px rgba(8, 8, 10, 0.72),
    0 0 28px rgba(214, 255, 63, 0.25),
    inset 0 0 20px rgba(214, 255, 63, 0.06);
  display: grid;
  place-items: center;
  color: var(--lime);
  font-size: 12px;
  font-weight: 950;
  line-height: 1.06;
  letter-spacing: -0.04em;
  text-align: center;
  pointer-events: none;
}

.primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 58px;
  padding: 16px 20px;
  border: 0;
  border-radius: 18px;
  background: var(--lime);
  color: #050506;
  font-size: 16px;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(214, 255, 63, 0.18);
  transition: transform 0.14s ease, filter 0.14s ease, opacity 0.14s ease;
}

.primary-btn:active {
  transform: scale(0.975);
  filter: brightness(0.94);
}

.primary-btn:disabled {
  background: #26262d;
  color: #6d6d78;
  box-shadow: none;
  cursor: default;
  transform: none;
  filter: none;
}

.ghost-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.ghost-btn:active {
  transform: scale(0.975);
  border-color: var(--lime);
  color: var(--lime);
}

.ghost-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.task-card {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--lime);
  border-radius: var(--radius);
  background: linear-gradient(155deg, rgba(25, 25, 32, 0.98), rgba(15, 15, 19, 0.98));
  box-shadow: var(--shadow);
  animation: rise 0.4s ease both;
}

.task-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.kicker {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.points-badge {
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--lime);
  color: #050506;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.task-card h2 {
  margin: 12px 0 8px;
  font-size: 27px;
  font-weight: 950;
  letter-spacing: -0.045em;
  line-height: 1.02;
  text-transform: uppercase;
}

.task-card > p {
  margin: 0;
  color: #b9b9c4;
  font-size: 14px;
  line-height: 1.55;
}

.task-actions {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.task-actions .primary-btn,
.task-actions .ghost-btn {
  min-height: 54px;
}

.task-actions + .hint {
  text-align: left;
}

.rules-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 14px;
}

.rules-mini span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.view {
  animation: fade 0.2s ease both;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 8px 2px 14px;
}

.section-head h2 {
  margin: 4px 0 0;
  font-size: 30px;
  font-weight: 950;
  letter-spacing: -0.05em;
  line-height: 1;
  text-transform: uppercase;
}

.top-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(18, 18, 22, 0.9);
}

.top-row.me {
  border-color: var(--lime);
  box-shadow: 0 0 0 1px rgba(214, 255, 63, 0.14), 0 12px 30px rgba(0, 0, 0, 0.3);
}

.top-row.gap {
  justify-content: center;
  border-style: dashed;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.2em;
}

.rank {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 950;
}

.top-row:nth-child(1) .rank {
  background: #d6ff3f;
  color: #050506;
}

.top-row:nth-child(2) .rank {
  background: #e8e8ee;
  color: #050506;
}

.top-row:nth-child(3) .rank {
  background: #d98745;
  color: #050506;
}

.who {
  min-width: 0;
  flex: 1;
}

.top-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 800;
}

.top-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.top-points {
  flex-shrink: 0;
  color: var(--lime);
  font-size: 18px;
  font-weight: 950;
  letter-spacing: -0.03em;
}

.top-points small {
  margin-left: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.tabbar {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(8px + env(safe-area-inset-bottom));
  width: calc(100% - 24px);
  max-width: 516px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(18, 18, 22, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

.tab {
  min-height: 46px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab.active {
  background: var(--lime);
  color: #050506;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.overlay-card {
  width: 100%;
  max-width: 420px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(160deg, #191920, #0f0f13);
  box-shadow: var(--shadow);
  animation: rise 0.25s ease both;
}

.overlay-card h2 {
  margin: 12px 0 10px;
  font-size: 28px;
  font-weight: 950;
  letter-spacing: -0.05em;
  line-height: 1.02;
  text-transform: uppercase;
}

.overlay-card p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.overlay-card .primary-btn {
  margin-top: 14px;
}

.rules-list {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.rules-list li {
  position: relative;
  padding: 9px 0 9px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #c7c7d1;
  font-size: 14px;
  line-height: 1.4;
}

.rules-list li:last-child {
  border-bottom: 0;
}

.rules-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.boot-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid #2a2a33;
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--lime);
  color: #050506;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
  transform: translateX(-50%);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.2s ease both;
}

.toast.error {
  background: var(--red);
  color: #fff;
}

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

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

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@media (max-width: 380px) {
  #app {
    padding-left: 12px;
    padding-right: 12px;
  }

  .profile {
    padding: 13px;
  }

  .hello {
    font-size: 18px;
  }

  .stats {
    gap: 8px;
  }

  .stat {
    min-width: 38px;
  }

  .stat span {
    font-size: 20px;
  }

  .wheel-card {
    padding: 12px 12px 14px;
  }

  .task-card h2 {
    font-size: 23px;
  }

  .task-actions {
    grid-template-columns: 1fr;
  }

  .section-head h2 {
    font-size: 26px;
  }
}

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