@import url("https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Manrope:wght@400;500;600;700&display=swap");

:root {
  --ink: #0b1e35;
  --muted: #4a6888;
  --accent: #ff9b3c;
  --accent-2: #29c6ff;
  --surface: #ffffff;
  --surface-soft: #eaf2ff;
  --divider: rgba(255, 255, 255, 0.45);
  --glow: rgba(41, 198, 255, 0.35);
  --panel: rgba(5, 35, 71, 0.72);
  --panel-soft: rgba(6, 44, 88, 0.6);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 15% 15%, rgba(79, 207, 255, 0.35), transparent 55%),
    radial-gradient(circle at 80% 20%, rgba(255, 172, 79, 0.28), transparent 60%),
    linear-gradient(160deg, #0b3770 0%, #0a2f5c 40%, #071c39 100%);
  display: grid;
  place-items: center;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom)) 24px;
  position: relative;
  overflow: hidden;
}

body::before,
body::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  z-index: 0;
}

body::before {
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.45) 1px, transparent 1.5px);
  background-size: 48px 48px;
  transform: translateY(-10px);
}

body::after {
  background-image: radial-gradient(circle at 20% 20%, rgba(41, 198, 255, 0.18) 0, transparent 40%),
    radial-gradient(circle at 75% 30%, rgba(255, 155, 60, 0.16) 0, transparent 45%);
}

.phone {
  width: min(420px, 100%);
  height: min(860px, calc(100vh - 48px - env(safe-area-inset-bottom) - env(safe-area-inset-top)));
  background: linear-gradient(180deg, rgba(11, 42, 84, 0.65), rgba(9, 30, 61, 0.85));
  border-radius: 32px;
  padding: 18px;
  box-shadow: 0 40px 80px rgba(5, 10, 25, 0.45);
  backdrop-filter: blur(8px);
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 16px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  z-index: 1;
}

.phone::before,
.phone::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  opacity: 0.35;
  pointer-events: none;
}

.phone::before {
  width: 220px;
  height: 220px;
  background: rgba(41, 198, 255, 0.7);
  top: -110px;
  right: -70px;
}

.phone::after {
  width: 240px;
  height: 240px;
  background: rgba(255, 155, 60, 0.65);
  bottom: -140px;
  left: -110px;
}

.card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(233, 245, 255, 0.92));
  border-radius: 28px;
  padding: 22px;
  box-shadow: 0 18px 40px rgba(5, 22, 44, 0.2);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  z-index: 1;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.75);
}

.card-top {
  justify-content: space-between;
  overflow: auto;
  background: linear-gradient(180deg, rgba(237, 247, 255, 0.98), rgba(255, 255, 255, 0.92));
  border: 1px solid rgba(41, 198, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.card-bottom {
  justify-content: flex-start;
  gap: 16px;
  border: 1px solid rgba(11, 56, 110, 0.12);
  padding-bottom: 18px;
  overflow: auto;
}

.match-score {
  position: absolute;
  top: 16px;
  right: 18px;
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(35, 36, 48, 0.12);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.match-score.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.match-score-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: conic-gradient(
    #2edb88 calc(var(--score, 0) * 1%),
    #ff6b6b 0
  );
  padding: 4px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(41, 198, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.match-score-value {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.92);
  color: #2b2f38;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.card-bottom.show-favorite .feedback-favorite {
  animation: feedback-pop 1400ms ease-out;
}

.card-bottom.show-discard .feedback-discard {
  animation: feedback-pop 1400ms ease-out;
}

.card-bottom.throw-left {
  animation: throw-left 520ms cubic-bezier(0.16, 1, 0.3, 1);
}

.card-bottom.throw-right {
  animation: throw-right 640ms cubic-bezier(0.16, 1, 0.3, 1);
}

.card-bottom.wiggle {
  animation: card-wiggle 900ms ease-in-out;
}

.view {
  display: none;
  min-height: 0;
}

.view.is-active {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 14px;
}

.phone.is-transitioning .view,
.phone.is-transitioning .bottom-panel {
  opacity: 0;
  pointer-events: none;
}

.tab-transition {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  z-index: 4;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.95), rgba(60, 185, 255, 0.35));
}

.tab-transition img {
  width: min(220px, 70%);
  height: auto;
  opacity: 0;
  transform: scale(0.94) translateY(12px);
  filter: drop-shadow(0 18px 32px rgba(27, 28, 33, 0.25));
}

.tab-transition.is-animating {
  animation: tab-transition 900ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-transition.is-animating img {
  animation: tab-image 900ms cubic-bezier(0.16, 1, 0.3, 1);
}

.view-stats.is-active {
  grid-template-rows: 1fr;
}

.view-strategy.is-active {
  grid-template-rows: 1fr;
}

.card-stats {
  justify-content: flex-start;
  gap: 16px;
  border: 1px solid rgba(60, 60, 70, 0.06);
  overflow: hidden;
}

.card-strategy {
  justify-content: flex-start;
  gap: 16px;
  border: 1px solid rgba(60, 60, 70, 0.06);
}

.bottom-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  background: var(--panel);
  padding: 8px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 1;
}

.tab-button {
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab-button.is-active {
  background: rgba(255, 255, 255, 0.98);
  color: #0b2a54;
  box-shadow: 0 14px 30px rgba(5, 22, 44, 0.28);
}

.tab-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.tab-status {
  width: 12px;
  height: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
}

.tab-button.is-loading .tab-status {
  border: 2px solid var(--accent-2);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.tab-button.is-ready .tab-status::after {
  content: "✓";
  color: var(--accent-2);
}

.drawer-list {
  display: grid;
  gap: 12px;
}

.drawer {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  border: 1px solid rgba(41, 198, 255, 0.16);
  box-shadow: 0 12px 24px rgba(5, 22, 44, 0.12);
  overflow: hidden;
}

.drawer-button {
  width: 100%;
  border: none;
  background: transparent;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.drawer-button span {
  letter-spacing: 0.01em;
}

.drawer-button::after {
  content: "+";
  font-size: 18px;
  color: var(--accent-2);
  transition: transform 160ms ease;
}

.drawer.is-open .drawer-button::after {
  transform: rotate(45deg);
}

.drawer-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 220ms ease;
  padding: 0 18px;
}

.drawer.is-open .drawer-panel {
  max-height: 280px;
  padding-bottom: 16px;
}

.drawer-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;
}

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

.stats-empty {
  grid-column: 1 / -1;
  padding: 16px;
  border-radius: 16px;
  background: rgba(234, 242, 255, 0.8);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.card-header h1,
.card-header h2 {
  margin: 4px 0 0;
  font-family: "Fredoka", "Trebuchet MS", sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-header h1 {
  font-size: 32px;
}

.card-header h2 {
  font-size: 26px;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 11px;
  color: #1b9cd6;
  font-weight: 600;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  background: rgba(41, 198, 255, 0.16);
  color: #0c4a7a;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.card-body {
  display: grid;
  gap: 12px;
}

.lead {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  color: #183450;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(41, 198, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.card-bottom .card-body {
  background: rgba(234, 242, 255, 0.72);
  border-radius: 18px;
  padding: 14px;
  border: 1px solid rgba(255, 155, 60, 0.18);
}

.row {
  display: grid;
  gap: 4px;
}

.label {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(11, 30, 53, 0.6);
}

.value {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.sub {
  margin: 6px 0 0;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.stat {
  background: rgba(234, 242, 255, 0.92);
  border-radius: 18px;
  padding: 12px;
  display: grid;
  gap: 4px;
  border: 1px solid rgba(41, 198, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.stat-wide {
  grid-column: 1 / -1;
}

.stat strong {
  font-size: 18px;
}

.stat-list strong {
  font-size: 14px;
}

.stat span {
  font-size: 12px;
  color: var(--muted);
}

.stat em {
  font-size: 11px;
  color: #1188c8;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.stat-tags {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stat-tags li {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(41, 198, 255, 0.18);
  color: #183450;
}

.stat-tags li.stat-empty {
  padding: 6px 0;
  background: transparent;
  border: none;
  color: var(--muted);
}

.divider {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  margin: 0 16px;
}

.swipe-hint {
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(11, 30, 53, 0.65);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--glow);
}

.swipe-feedback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.feedback {
  position: absolute;
  left: 50%;
  top: 50%;
  padding: 14px 26px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.85);
  backdrop-filter: blur(6px);
}

.feedback-favorite {
  background: rgba(46, 219, 136, 0.18);
  color: #0f6a36;
  border: 1px solid rgba(46, 219, 136, 0.4);
  box-shadow: 0 12px 36px rgba(46, 219, 136, 0.28);
}

.feedback-discard {
  background: rgba(255, 107, 107, 0.18);
  color: #a02222;
  border: 1px solid rgba(255, 107, 107, 0.42);
  box-shadow: 0 12px 30px rgba(255, 107, 107, 0.24);
}

@keyframes slide-left {
  from {
    transform: translateX(16px);
    opacity: 0.8;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slide-right {
  from {
    transform: translateX(-16px);
    opacity: 0.8;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes throw-left {
  0% {
    transform: translateX(0) rotate(0deg) scale(1);
    opacity: 1;
  }
  35% {
    transform: translateX(-14px) rotate(-2deg) scale(0.99);
  }
  100% {
    transform: translateX(-140%) rotate(-12deg) scale(0.94);
    opacity: 0;
  }
}

@keyframes throw-right {
  0% {
    transform: translateX(0) rotate(0deg) scale(1);
    opacity: 1;
  }
  35% {
    transform: translateX(16px) rotate(2deg) scale(1.01);
    box-shadow: 0 0 40px rgba(255, 122, 69, 0.35);
  }
  100% {
    transform: translateX(140%) rotate(12deg) scale(0.94);
    opacity: 0;
    box-shadow: 0 0 70px rgba(255, 122, 69, 0.2);
  }
}

@keyframes card-wiggle {
  0% {
    transform: translateX(0) rotate(0deg);
  }
  20% {
    transform: translateX(-8px) rotate(-1.5deg);
  }
  45% {
    transform: translateX(6px) rotate(1deg);
  }
  70% {
    transform: translateX(-4px) rotate(-0.6deg);
  }
  100% {
    transform: translateX(0) rotate(0deg);
  }
}

@keyframes feedback-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.85);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.02);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.05);
  }
}

@keyframes tab-transition {
  0% {
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes tab-image {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(18px);
  }
  35% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  75% {
    opacity: 1;
    transform: scale(1.02) translateY(-4px);
  }
  100% {
    opacity: 0;
    transform: scale(1.06) translateY(-12px);
  }
}

@media (max-width: 480px) {
  body {
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom)) 16px;
  }

  .logout-floating {
    top: 12px;
    right: 16px;
  }

  .phone {
    height: min(820px, calc(100vh - 32px - env(safe-area-inset-bottom) - env(safe-area-inset-top)));
    border-radius: 28px;
    padding: 16px;
  }

  .card {
    padding: 18px;
  }
}

@supports (height: 100dvh) {
  body {
    min-height: 100dvh;
  }

  .phone {
    height: min(860px, calc(100dvh - 48px - env(safe-area-inset-bottom) - env(safe-area-inset-top)));
  }

  @media (max-width: 480px) {
    .phone {
      height: min(820px, calc(100dvh - 32px - env(safe-area-inset-bottom) - env(safe-area-inset-top)));
    }
  }
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logout-form {
  margin: 0;
}

.logout-floating {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 6;
}

.logout-link {
  border: none;
  background: rgba(255, 255, 255, 0.75);
  color: #0b2a54;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.logout-link:hover {
  background: rgba(255, 255, 255, 0.95);
}

.login-page {
  padding: 32px 24px;
}

.login-shell {
  width: min(560px, 100%);
  z-index: 1;
}

.login-card {
  padding: 28px;
  gap: 18px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.field input {
  border: 1px solid rgba(11, 56, 110, 0.2);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: "Manrope", "Segoe UI", sans-serif;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
}

.field input:focus {
  outline: 2px solid rgba(41, 198, 255, 0.4);
  border-color: rgba(41, 198, 255, 0.5);
}

.field input:disabled {
  background: rgba(240, 244, 250, 0.9);
  color: rgba(11, 30, 53, 0.5);
}

.primary-button {
  border: none;
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(120deg, #2cc6ff, #ff9b3c);
  color: #061d38;
  cursor: pointer;
  box-shadow: 0 16px 26px rgba(5, 22, 44, 0.18);
}

.primary-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.sso-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.login-divider {
  position: relative;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 45%;
  height: 1px;
  background: rgba(11, 56, 110, 0.15);
}

.login-divider::before {
  left: 0;
}

.login-divider::after {
  right: 0;
}

.login-divider span {
  background: rgba(255, 255, 255, 0.9);
  padding: 0 8px;
}

.login-error {
  background: rgba(255, 107, 107, 0.16);
  color: #a12929;
  border: 1px solid rgba(255, 107, 107, 0.3);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
}

.login-success {
  background: rgba(46, 219, 136, 0.16);
  color: #0f7a3e;
  border: 1px solid rgba(46, 219, 136, 0.3);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
}

.login-links {
  text-align: center;
  padding-top: 4px;
}

.login-links a {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.login-links a:hover {
  text-decoration: underline;
}

.link-separator {
  color: var(--muted);
  padding: 0 8px;
}

.login-note {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}