* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-primary: #9356A0;
  --color-primary-dark: #7a4688;
  --color-bg: #DCCAE9;
  --color-bg-active: #cbb8da;
  --color-bg-90: rgba(220, 202, 233, 0.9);
  --color-bg-85: rgba(220, 202, 233, 0.85);
  --color-bg-80: rgba(220, 202, 233, 0.8);
  --color-bg-60: rgba(220, 202, 233, 0.6);
  --color-bg-35: rgba(220, 202, 233, 0.35);
  --color-bg-25: rgba(220, 202, 233, 0.25);
  --color-bg-30: rgba(220, 202, 233, 0.3);
  --color-primary-30: rgba(147, 86, 160, 0.3);
  --color-primary-15: rgba(147, 86, 160, 0.15);
  --color-primary-10: rgba(147, 86, 160, 0.1);
  --color-primary-70: rgba(147, 86, 160, 0.7);
  --color-error: #ffcccc;

  --radius-btn: 30px;
  --radius-card: 16px;
  --radius-input: 12px;
}

html, body {
  height: 100%;
  overflow: hidden;
  max-width: 430px;
  margin: 0 auto;
}

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--color-bg);
  color: var(--color-primary);
  min-height: 100vh;
  min-height: 100dvh;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
  position: relative;
}

/* Splash Screen */
.splash {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  z-index: 1000;
  transition: opacity 0.5s ease-out;
}

.splash.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: fadeIn 0.8s ease-out;
}

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

.logo-container {
  margin-bottom: 2rem;
}

.logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.9; }
}

.welcome-text {
  text-align: center;
  margin-bottom: 3rem;
}

.welcome-sub {
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.welcome-main {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.03em;
  line-height: 1.3;
}

/* Screen base */
.screen {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  display: flex;
  flex-direction: column;
  transition: opacity 0.4s ease-in;
}

.screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.screen.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Onboarding Screen */
.onboarding {
  background: var(--color-bg);
  z-index: 900;
}

.onboarding-slide {
  position: absolute;
  inset: 0;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.onboarding-slide.active {
  display: flex;
  opacity: 1;
}

.onboarding-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  padding-top: env(safe-area-inset-top, 2rem);
  padding-bottom: env(safe-area-inset-bottom, 2rem);
}

.onboarding-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-primary);
  text-align: center;
  line-height: 1.4;
  margin-bottom: 2rem;
  max-width: 320px;
}

.onboarding-card {
  width: 100%;
  max-width: 340px;
  background: var(--color-primary);
  border-radius: var(--radius-card);
  padding: 2rem 1.5rem;
}

.onboarding-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.onboarding-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  filter: brightness(1.2);
}

.onboarding-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-bg);
  text-align: center;
}

.onboarding-card-text {
  font-size: 0.9rem;
  color: var(--color-bg-90);
  text-align: center;
  line-height: 1.5;
}

/* Final Onboarding Screen */
.onboarding-final {
  background: var(--color-bg);
  z-index: 950;
}

.onboarding-final-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: env(safe-area-inset-top, 0);
}

.onboarding-final-img-wrap {
  width: 100%;
  height: 55%;
  overflow: hidden;
  position: relative;
}

.onboarding-final-img {
  width: 160%;
  height: auto;
  position: absolute;
  bottom: -13%;
  left: -45%;
}

.onboarding-final-text {
  text-align: center;
  padding: 1.5rem 1.5rem 0;
}

.onboarding-final-text h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
}

.onboarding-final-text p {
  font-size: 0.9rem;
  color: var(--color-primary);
  line-height: 1.5;
}

.onboarding-final-btn {
  position: absolute;
  bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 100%;
  max-width: 280px;
}

/* Onboarding Footer */
.onboarding-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.5rem;
  padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
}

/* Pagination Dots */
.pagination {
  display: flex;
  gap: 10px;
  margin-bottom: 2rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary-30);
  transition: background 0.3s, transform 0.3s;
}

.dot.active {
  background: var(--color-primary);
  transform: scale(1.1);
}

/* Buttons */
.btn-primary {
  width: 100%;
  max-width: 280px;
  padding: 16px 32px;
  background: var(--color-primary);
  color: var(--color-bg);
  border: none;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:active {
  background: var(--color-primary-dark);
  transform: scale(0.97);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  width: 100%;
  max-width: 280px;
  padding: 16px 32px;
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn-secondary:active {
  background: var(--color-primary-10);
  transform: scale(0.97);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Auth Screens */
.auth-screen {
  background: var(--color-primary);
  z-index: 950;
}

.auth-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 24px;
  padding-top: env(safe-area-inset-top, 0);
}

.auth-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-bg);
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 0.95rem;
  color: var(--color-bg-85);
  margin-bottom: 24px;
}

.auth-input {
  width: 100%;
  padding: 16px 20px;
  background: var(--color-bg-25);
  border: none;
  border-radius: var(--radius-input);
  font-size: 1rem;
  color: var(--color-bg);
  outline: none;
  transition: background 0.2s;
}

.auth-input::placeholder {
  color: var(--color-bg-60);
}

.auth-input:focus {
  background: var(--color-bg-35);
}

.auth-error {
  font-size: 0.85rem;
  color: var(--color-error);
  margin-top: 8px;
  min-height: 1.2em;
}

.auth-link {
  display: inline-block;
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--color-bg-80);
  text-decoration: underline;
}

.auth-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--color-bg);
}

.auth-footer .btn-primary {
  background: var(--color-primary);
  color: var(--color-bg);
}

.auth-footer .btn-primary:active:not(:disabled) {
  background: var(--color-bg-active);
}

.auth-footer .btn-secondary {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: transparent;
}

/* Data Input Screen */
.data-screen {
  background: var(--color-primary);
}

.data-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top, 0) 24px 0;
  overflow-y: auto;
}

.data-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--color-bg);
  text-align: center;
  line-height: 1.4;
  margin: 40px 0 32px;
}

.data-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.data-row {
  display: flex;
  gap: 12px;
}

.data-row .data-field {
  flex: 1;
}

.data-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.data-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-bg);
}

.data-input {
  width: 100%;
  padding: 16px;
  background: rgba(255, 255, 255, 0.25);
  border: none;
  border-radius: var(--radius-input);
  font-size: 1rem;
  color: var(--color-bg);
  outline: none;
  transition: background 0.2s;
}

.data-input::placeholder {
  color: var(--color-bg-60);
}

.data-input:focus {
  background: var(--color-bg-35);
}

.data-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--color-bg);
}

.data-footer .btn-primary {
  background: var(--color-primary);
  color: var(--color-bg);
}

.data-footer .btn-primary:active:not(:disabled) {
  background: var(--color-bg-active);
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(147, 86, 160, 0.7);
  z-index: 100;
}

.loading-overlay.hidden {
  display: none;
}

.loader-spinner {
  width: 120px;
  height: 120px;
}

.loader-spinner.spinning {
  animation: spin 1s linear infinite;
}

/* Main App */
.app {
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  height: 100%;
  overflow: hidden;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0));
  background: #724C9D;
  border-radius: 0 0 16px 16px;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-cards-letters {
  display: flex;
  align-items: center;
  gap: 6px;
}

.app-card-letter-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s;
}

.app-card-letter-wrap:active {
  transform: scale(0.95);
}

.app-card-letter-bg {
  width: 44px;
  height: 44px;
}

.app-card-letter {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-bg);
  font-size: 18px;
  font-weight: 600;
  font-family: 'Roboto', sans-serif;
  pointer-events: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-menu-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.app-menu-btn:active {
  transform: scale(0.95);
}

.menu-kebab-icon {
  width: 44px;
  height: 44px;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.lang-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lang-btn {
  background: #724C9D;
  border: none;
  color: var(--color-bg);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 102;
}

.lang-dropdown {
  position: absolute;
  top: 50%;
  width: 36px;
  background: var(--color-bg);
  border-radius: 0 0 18px 18px;
  z-index: 101;
  overflow: hidden;
  padding-top: 20px;
  box-shadow: 0 4px 16px rgba(114, 76, 157, 0.4);
}

.lang-dropdown.hidden {
  display: none;
}

.lang-option {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  padding: 10px 0;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s;
}

.lang-option:hover {
  background: rgba(147, 86, 160, 0.15);
}

.app-credits {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-bg);
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
}

.credits-amount {
  color: var(--color-primary);
  font-size: 0.9rem;
  font-weight: 600;
}

.credits-star {
  width: 20px;
  height: 20px;
}

.app-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 16px;
  align-content: center;
  overflow: hidden;
  min-height: 0;
}

.app-card {
  background: var(--color-primary);
  border-radius: 16px;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  aspect-ratio: 1 / 1.25;
  cursor: pointer;
  transition: transform 0.2s;
}

.app-card:active {
  transform: scale(0.97);
}

.app-card-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.app-card-text {
  color: var(--color-bg);
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
  letter-spacing: 0;
}

.app-nav {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  background: #724C9D;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  flex-shrink: 0;
  width: 100%;
}

.app-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--color-bg-60);
  font-size: 0.75rem;
  font-weight: 400;
  font-family: inherit;
  cursor: pointer;
  padding: 10px 8px;
  border-radius: 0;
  transition: background 0.2s, color 0.2s;
  flex: 1;
  min-width: 0;
  line-height: 1.3;
  letter-spacing: 0;
}

.app-nav-item.active {
  background: var(--color-primary);
  color: var(--color-bg);
}

.app-nav-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.app-nav-label {
  text-align: center;
  max-width: 80px;
}

/* Analysis Screen */
.analysis-screen {
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
}

.analysis-title {
  font-size: 22px;
  font-weight: 500;
  font-style: normal;
  line-height: 120%;
  letter-spacing: 0;
  color: #724C9D;
  text-align: center;
  padding: 24px 16px 16px;
}

.screen-placeholder {
  text-align: center;
  padding: 40px 16px;
  color: #724C9D;
  font-size: 14px;
  opacity: 0.6;
}

/* Date Picker */
.date-picker {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-left: 16px;
}

.date-picker-arrow {
  width: 20px;
  height: 20px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #724C9D;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.date-picker-arrow svg {
  width: 20px;
  height: 20px;
}

.date-picker-prev svg {
  transform: rotate(180deg);
}

.date-picker-value {
  color: #724C9D;
  font-size: 16px;
  font-weight: 500;
  min-width: 60px;
  text-align: center;
}

.date-picker-btn {
  margin-left: auto;
  background: var(--color-primary);
  color: #DCCAE9;
  border: none;
  border-radius: var(--radius-btn);
  padding: 14px 44px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.date-picker-btn:hover {
  background: var(--color-primary);
}

/* Toggle */
.date-details-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 8px 0;
  color: #DCCAE9;
  font-size: 14px;
  font-weight: 400;
}

.toggle {
  width: 78px;
  height: 42px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle img {
  width: 100%;
  height: 100%;
  object-fit: fill;
}

/* Filter Bar */
.date-filter-bar {
  display: flex;
  align-items: stretch;
  background: #9356A0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 28px;
  padding: 0;
  margin-bottom: 12px;
  min-height: 48px;
}

.date-filter-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s;
  border-radius: 20px;
  min-height: 40px;
  font-size: 13px;
  font-weight: 500;
}

.date-filter-btn.active .date-filter-icon {
  color: #9356A0;
}

.date-filter-btn.active {
  background: #DCCAE9;
}

.date-filter-btn.active-filter {
  background: #DCCAE9;
  color: #9356A0;
  flex: 0.6;
  padding: 0 18px;
}

.date-filter-btn:not(.active):not(.active-filter) .date-filter-icon {
  color: #DCCAE9;
}

.date-filter-btn:not(.active):not(.active-filter) {
  color: #DCCAE9;
}

.date-filter-icon {
  display: flex;
  width: 24px;
  height: 24px;
  color: #DCCAE9;
}

.date-filter-icon svg {
  width: 100%;
  height: 100%;
}

/* Date Entries */
.date-entry {
  display: flex;
  align-items: center;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  gap: 12px;
}

.date-favorable {
  background: #DCCAE9;
  color: #724C9D;
}

.date-unfavorable {
  background: #724C9D;
  color: #DCCAE9;
}

.date-neutral {
  background: transparent;
  color: #DCCAE9;
}

.date-entry-period {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 48px;
}

.date-entry-month {
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
}

.date-entry-range {
  font-size: 16px;
  font-weight: 600;
}

.date-entry-label {
  flex: 1;
  font-size: 13px;
  font-weight: 400;
}

.date-entry-icon {
  width: 28px;
  height: 28px;
  color: #724C9D;
  flex-shrink: 0;
}

.date-entry-icon svg {
  width: 100%;
  height: 100%;
}

.date-unfavorable .date-entry-icon {
  color: #DCCAE9;
}

.date-neutral .date-entry-icon {
  color: #DCCAE9;
}

.spheres-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 8px;
}

.sphere-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
  position: relative;
}

.sphere-item::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -16px;
  right: -16px;
  background: var(--color-primary);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: -1;
  pointer-events: none;
}

.sphere-item.open::before {
  opacity: 1;
}

.sphere-item.open {
  color: #DCCAE9;
}

.sphere-item.open .sphere-text {
  color: #DCCAE9;
}

.sphere-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sphere-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  color: #724C9D;
  transition: color 0.3s;
}

.sphere-item.open .sphere-icon {
  color: #DCCAE9;
}

.sphere-text {
  color: #724C9D;
  font-size: 16px;
  font-weight: 500;
  font-style: normal;
  line-height: 120%;
  letter-spacing: 0px;
}

.sphere-arrow {
  width: 20px;
  height: 20px;
  object-fit: contain;
  transition: transform 0.3s, color 0.3s;
  color: #724C9D;
}

.sphere-item.open .sphere-arrow {
  transform: rotate(90deg);
  color: #DCCAE9;
}

.sphere-questions {
  display: none;
  padding: 8px 16px 12px 16px;
}

.sphere-item.open + .sphere-questions {
  display: block;
}

.sphere-question {
  background: transparent;
  border: 1px solid var(--color-primary-70);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
  cursor: pointer;
}

.sphere-question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sphere-question[data-answered="true"] .sphere-question-count,
.sphere-question[data-answered="true"] .sphere-question-stars > img {
  display: none;
}

.sphere-question[data-answered="true"] .sphere-question-stars svg {
  color: #9356A0;
  width: 36px;
  height: 36px;
}

.sphere-question-arrow {
  display: none;
  width: 20px;
  height: 20px;
  color: #724C9D;
}

.mini-loader {
  width: 36px;
  height: 36px;
}

.mini-loader.spinning {
  animation: spin 1s linear infinite;
}

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

.sphere-question[data-opened="true"] .sphere-question-arrow {
  display: block;
}

.sphere-question[data-opened="true"] .sphere-question-stars {
  display: none;
}

.sphere-question[data-opened="true"] {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.sphere-question[data-opened="true"] .sphere-question-text {
  color: #DCCAE9;
}

.sphere-question[data-opened="true"] .sphere-question-arrow {
  color: #DCCAE9;
}

#date-selection .sphere-question[data-opened="true"] {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

#date-selection .sphere-question[data-opened="true"] .sphere-question-text {
  color: #DCCAE9;
}

#date-selection .sphere-question[data-opened="true"] .sphere-question-arrow {
  color: #DCCAE9;
}

#date-selection .sphere-question[data-opened="true"].expanded {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.sphere-question[data-opened="true"].expanded .sphere-question-arrow {
  transform: rotate(90deg);
}

.sphere-question[data-opened="true"].expanded .sphere-answer {
  color: #DCCAE9;
}

.sphere-answer {
  display: none;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 400;
  font-style: normal;
  line-height: 130%;
  letter-spacing: 0px;
  color: #724C9D;
}

.sphere-question.expanded .sphere-answer {
  display: block;
}

.sphere-answer p {
  margin-bottom: 8px;
}

.sphere-answer ul {
  margin: 0;
  padding-left: 20px;
}

.sphere-answer li {
  margin-bottom: 6px;
  line-height: 1.4;
}

.sphere-question-text {
  color: #724C9D;
  font-size: 14px;
  font-weight: 500;
  font-style: normal;
  line-height: 130%;
  letter-spacing: 0px;
  flex: 1;
}

.sphere-question-stars {
  display: flex;
  align-items: center;
  position: relative;
  margin-left: 8px;
  flex-shrink: 0;
}

.sphere-question-stars img {
  width: 36px;
  height: 36px;
}

.sphere-question-count {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #DCCAE9;
  font-size: 13.33px;
  font-weight: 500;
  font-style: normal;
  line-height: 130%;
  text-align: center;
}

/* Card List Screen */
.card-list-screen {
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
}

.card-list-add-top {
  margin: 0 16px 8px;
  border: 1px solid var(--color-primary-30);
  border-radius: var(--radius-btn);
  opacity: 1;
}

.card-list-footer {
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

/* Compatibility Screen */
.compat-screen {
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
}

.compat-tabs {
  display: flex;
  margin: 12px 16px 0;
  margin-top: calc(12px + env(safe-area-inset-top, 0));
  border: 2px solid #724C9D;
  border-radius: var(--radius-btn);
  overflow: hidden;
}

.compat-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 0;
  background: transparent;
  color: #724C9D;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.2s, color 0.2s;
  position: relative;
}

.compat-tab.active {
  background: #724C9D;
  color: var(--color-bg);
  border-radius: calc(var(--radius-btn) - 2px);
}

.compat-tab-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: filter 0.2s;
}

.compat-tab.active .compat-tab-icon {
  filter: brightness(0) invert(0.86);
}

.compat-tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
}

.compat-tab-content.hidden {
  display: none;
}

.compat-title {
  font-size: 20px;
  font-weight: 500;
  color: var(--color-primary);
  text-align: center;
  padding: 48px 16px 8px;
}

.compat-card-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow-y: auto;
}

.compat-card-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--color-primary-15);
  cursor: pointer;
  transition: background 0.2s, margin 0.2s, border-radius 0.2s;
}

.compat-card-item:last-child {
  border-bottom: none;
}

.compat-card-avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.compat-card-avatar-bg {
  width: 44px;
  height: 44px;
}

.compat-card-avatar-letter {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-bg);
  font-size: 1.1rem;
  font-weight: 600;
  pointer-events: none;
}

.compat-card-info {
  flex: 1;
  min-width: 0;
}

.compat-card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compat-card-date {
  font-size: 13px;
  color: var(--color-primary);
  opacity: 0.7;
  margin-top: 2px;
}

.compat-card-radio {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.compat-card-item.locked {
  opacity: 0.5;
}

.compat-card-lock {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  filter: brightness(0) saturate(100%) invert(36%) sepia(32%) saturate(1275%) hue-rotate(254deg) brightness(89%) contrast(92%);
}

.compat-card-item.selected {
  background: var(--color-primary);
  border-radius: 0;
  margin: 4px 0;
  padding: 8px 16px;
}

.compat-card-item.selected .compat-card-name,
.compat-card-item.selected .compat-card-date {
  color: var(--color-bg);
}

.compat-card-item.selected .compat-card-avatar-letter {
  color: var(--color-bg);
}

.compat-add-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  background: none;
  border: none;
  color: var(--color-primary);
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.compat-add-card:active {
  opacity: 1;
}

.compat-add-plus {
  font-size: 22px;
  font-weight: 300;
}

.compat-footer {
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

.compat-calc-btn {
  width: 100%;
  padding: 16px 32px;
  background: var(--color-primary);
  color: var(--color-bg);
  border: none;
  border-radius: var(--radius-btn);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s, transform 0.1s;
}

.compat-calc-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.compat-calc-btn:active:not(:disabled) {
  background: var(--color-primary-dark);
  transform: scale(0.97);
}

/* Compatibility Loading */
.compat-loading {
  position: fixed;
  inset: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  z-index: 200;
}

.compat-loading.hidden {
  display: none;
}

.compat-loading-avatars {
  position: relative;
  width: 220px;
  height: 220px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compat-loading-avatar {
  position: absolute;
  width: 120px;
  height: 120px;
}

.compat-loading-avatar:first-child {
  left: 10px;
  z-index: 1;
}

.compat-loading-avatar:last-of-type {
  right: 10px;
  z-index: 2;
}

.compat-loading-avatar-bg {
  width: 100%;
  height: 100%;
}

.compat-loading-avatar-letter {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-bg);
  font-size: 2.5rem;
  font-weight: 600;
  pointer-events: none;
}

.compat-loading-spinner {
  position: absolute;
  width: 200px;
  height: 200px;
  z-index: 3;
  animation: spin 1s linear infinite;
}

.compat-loading-names {
  font-size: 18px;
  font-weight: 500;
  color: var(--color-primary);
}

/* Compatibility No Results */
.compat-no-results {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px;
}

.compat-no-results-text {
  font-size: 16px;
  color: #724C9D;
  text-align: center;
  line-height: 1.5;
  margin-top: 160px;
  margin-bottom: 120px;
}

.compat-loading.hidden { display: none; }
.compat-tab-content.hidden { display: none; }
.compat-no-results.hidden { display: none; }
.compat-results-header.hidden { display: none; }
.compat-results-list.hidden { display: none; }
.compat-result-footer.hidden { display: none; }

.compat-no-results-img-wrap {
  width: 160%;
  margin-left: 0%;
  margin-top: auto;
  margin-bottom: -45%;
  line-height: 0;
}

.compat-no-results-img {
  width: 100%;
  height: auto;
  display: block;
}

/* Compatibility Results */
.compat-results-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 16px 16px 0;
}

.compat-results-sort {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--color-primary);
  transition: transform 0.2s ease;
}

.compat-results-sort img {
  display: block;
}

.compat-results-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 16px;
  overflow-y: auto;
  gap: 8px;
}

.compat-result-item {
  background: var(--color-primary);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.compat-result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  cursor: pointer;
}

.compat-result-avatars {
  display: flex;
  align-items: center;
}

.compat-result-avatar-wrap {
  position: relative;
  width: 36px;
  height: 36px;
}

.compat-result-avatar-bg {
  width: 36px;
  height: 36px;
}

.compat-result-avatar-letter {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-bg);
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}

.compat-result-avatar-wrap:nth-child(2) {
  margin-left: -10px;
}

.compat-result-percent {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-bg);
  margin-left: 8px;
}

.compat-result-chevron {
  width: 20px;
  height: 20px;
  color: var(--color-bg);
  margin-left: auto;
  transition: transform 0.3s;
}

.compat-result-item.open .compat-result-chevron {
  transform: rotate(180deg);
}

.compat-result-body {
  display: none;
  padding: 0 16px 16px;
  color: var(--color-bg);
}

.compat-result-item.open .compat-result-body {
  display: block;
}

.compat-result-names {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 12px;
}

.compat-result-desc {
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.9;
}

.compat-result-footer {
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

/* Shop Screen */
.shop-screen {
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
}

.shop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.shop-header .analysis-title {
  padding: 24px 0 16px;
}

.shop-credits {
  cursor: default;
}

.shop-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 16px 16px;
  overflow-y: auto;
}

/* Subscription Card */
.shop-sub-card {
  background: transparent;
  border: 2px solid var(--color-primary);
  border-radius: 8px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shop-sub-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shop-sub-icon {
  flex-shrink: 0;
}

.shop-sub-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #724C9D;
}

.shop-sub-desc {
  font-size: 0.85rem;
  color: #724C9D;
  font-weight: 400;
}

.shop-sub-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shop-sub-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid rgba(114, 76, 157, 0.3);
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #724C9D;
}

.shop-sub-tag-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  object-fit: contain;
}

.shop-sub-tag-bonus {
  font-weight: 600;
}

.shop-sub-btn {
  width: 100%;
  margin-top: 4px;
  padding: 16px 0;
  background: var(--color-primary);
  color: var(--color-bg);
  border: none;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.shop-sub-btn:active {
  background: var(--color-primary-dark);
  transform: scale(0.97);
}

/* Stars Grid */
.shop-stars-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.shop-star-card {
  position: relative;
  background: var(--color-primary);
  border-radius: 20px;
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  aspect-ratio: 1 / 1.1;
}

.shop-star-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.shop-star-center .shop-star-icon + .shop-star-count {
  margin-top: 6px;
}

.shop-star-badge {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-bg);
  pointer-events: none;
}

.shop-badge-popular {
  background: var(--color-bg);
  color: var(--color-primary);
  border-radius: 0 0 10px 10px;
  padding: 4px 14px;
  white-space: nowrap;
}

.shop-star-corner-icon {
  position: absolute;
  width: 24px;
  height: 24px;
  top: 10px;
}

.shop-star-corner-left {
  left: 10px;
}

.shop-star-corner-right {
  right: 10px;
}

.shop-star-count {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--color-bg);
}

.shop-star-btn {
  width: 100%;
  padding: 10px 0;
  background: transparent;
  color: var(--color-bg);
  border: 1.5px solid var(--color-bg-60);
  border-radius: var(--radius-btn);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: auto;
}

.shop-star-btn:active {
  background: var(--color-bg-25);
  transform: scale(0.97);
}

/* Safe area support for notch devices */
@supports (padding: env(safe-area-inset-top)) {
  .app-header {
    padding-top: calc(12px + env(safe-area-inset-top));
  }
}

/* Subscription Modal */
.sub-modal {
  position: fixed;
  inset: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.sub-modal.hidden {
  display: none;
}

.sub-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(147, 86, 160, 0.5);
  z-index: 0;
}

.sub-modal-content {
  position: relative;
  z-index: 1;
  width: 100%;
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.sub-modal-card {
  background: #E8D5F0;
  border: 2px solid var(--color-primary);
  border-radius: 12px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.sub-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #724C9D;
  text-align: center;
  line-height: 1.3;
}

.sub-modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  width: 100%;
}

.sub-modal-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid rgba(114, 76, 157, 0.3);
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #724C9D;
}

.sub-modal-tag-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  object-fit: contain;
}

.sub-modal-tag-bonus {
  font-weight: 600;
}

.sub-modal-subscribe-btn {
  width: 100%;
  padding: 16px 0;
  background: var(--color-primary);
  color: var(--color-bg);
  border: none;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.sub-modal-subscribe-btn:active {
  background: var(--color-primary-dark);
  transform: scale(0.97);
}

.sub-modal-cancel-btn {
  width: 100%;
  padding: 14px 0;
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.sub-modal-cancel-btn:active {
  background: var(--color-primary-10);
  transform: scale(0.97);
}

/* Congrats Modal */
.congrats-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #724C9D;
  text-align: center;
}

.congrats-text {
  font-size: 0.9rem;
  color: #724C9D;
  text-align: center;
  line-height: 1.5;
}

.congrats-action-btn {
  width: 100%;
  padding: 16px 0;
  background: var(--color-primary);
  color: var(--color-bg);
  border: none;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.congrats-action-btn:active {
  background: var(--color-primary-dark);
  transform: scale(0.97);
}

/* Star Success Card */
.star-success-card {
  gap: 12px;
}

.star-success-decoration {
  display: flex;
  justify-content: center;
}

.star-success-img {
  width: 80px;
  height: auto;
  opacity: 0.7;
}

/* Star Spend / Insufficient Modals */
.star-spend-card {
  gap: 12px;
}

.star-spend-label {
  font-size: 0.85rem;
  color: #724C9D;
  text-align: center;
}

.star-spend-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #724C9D;
  text-align: center;
}

.star-spend-balance {
  font-size: 0.9rem;
  color: #724C9D;
  text-align: center;
}

.star-spend-hint {
  font-size: 0.85rem;
  color: #724C9D;
  text-align: center;
  opacity: 0.8;
}

.star-spend-btns {
  display: flex;
  gap: 12px;
  width: 100%;
}

.star-spend-btn-cancel {
  flex: 1;
  padding: 14px 0;
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-btn);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.star-spend-btn-cancel:active {
  background: var(--color-primary-10);
  transform: scale(0.97);
}

.star-spend-btn-confirm {
  flex: 1;
  padding: 14px 0;
  background: var(--color-primary);
  color: var(--color-bg);
  border: none;
  border-radius: var(--radius-btn);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.star-spend-btn-confirm:active {
  background: var(--color-primary-dark);
  transform: scale(0.97);
}

.star-spend-btn-cancel-full {
  width: 100%;
  padding: 14px 0;
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-btn);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.star-spend-btn-cancel-full:active {
  background: var(--color-primary-10);
  transform: scale(0.97);
}
