/* ============================================
   Shared styles
   ============================================ */

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

:root {
  --color-bg: #ffffff;
  --color-surface: #f2f2f7;
  --color-text: #1a1a1a;
  --color-text-secondary: #666;
  --color-accent: #3b82f6;
  --color-accent-hover: #2563eb;
  --font-family:
    "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  body:has(.app-store) {
    --color-bg: #0a0a0a;
    --color-surface: #1a1a1a;
    --color-text: #f5f5f5;
    --color-text-secondary: #999;
  }
}

body {
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  transition: background-color 0.3s ease;
}

html:has(body.splash-page) {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body.splash-page {
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  position: fixed;
  inset: 0;
}

/* ============================================
   Splash page
   ============================================ */

.splash {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  height: 100%;
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

.splash-content {
  max-width: 480px;
}

.logo {
  width: 120px;
  height: 120px;
  margin: unset;
  display: block;
  cursor: pointer;
  background-color: #000;
  -webkit-mask-image: url(../assets/logo_black.png);
  mask-image: url(../assets/logo_black.png);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  transition: background-color 0.3s ease;
}

.footer {
  position: fixed;
  flex-direction: row;
  bottom: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 2rem;
  gap: 0.5rem;
  font-size: 1.1rem;

  @media screen and (max-width: 600px) {
    flex-direction: column;
  }
}

.footer a {
  color: inherit;
}

.footer-left,
.footer-right {
  display: flex;
  flex-direction: column;
  font-size: 0.875em;
  gap: 0.5rem;
  justify-content: flex-end;
}

.footer-left p {
  max-width: 360px;
}

/* ============================================
   App store page
   ============================================ */

.app-store {
  max-width: 600px;
  margin: 0 auto;
  padding: 1.5rem;
}

.app-store-header {
  margin-bottom: 1.5rem;
}

.back-link {
  color: var(--color-accent);
  text-decoration: none;
  font-size: 1rem;
}

.app-store-top {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--color-bg);
  padding-top: 1.1rem;
  margin-top: -1.5rem;
  padding-bottom: 0.25rem;
}

/* Hero: icon + info */
.app-store-hero {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.65rem;
}

.app-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  justify-content: center;
}

.app-icon-placeholder {
  width: 100px;
  height: 100px;
  flex-shrink: 0;
  background: var(--color-surface);
  border: 2px dashed var(--color-text-secondary);
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  letter-spacing: 0.1em;
}

.app-icon {
  width: 100px;
  height: 100px;
  flex-shrink: 0;
  border-radius: 22px;
  object-fit: cover;
  display: block;
}

.app-info h1 {
  font-size: 1.625rem;
  font-weight: 700;
  margin-bottom: 0;
  line-height: 1.15;
}

.developer {
  color: var(--color-accent);
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.tagline {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  margin-bottom: 0;
  line-height: 1.3;
}

.rating {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.stars {
  color: #fbbf24;
  margin-right: 0.25rem;
}

/* Install button */
.app-store-actions {
  text-align: center;
  margin-bottom: 0.1rem;
}

.install-button-wrap {
  padding: 0;
}

.install-button {
  display: block;
  width: 100%;
  padding: 0.6rem;
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  transition: background 0.2s;
  letter-spacing: 0.05em;
}

.install-button:hover {
  background: var(--color-accent-hover);
}

.install-test-page {
  padding-top: 3rem;
}

.install-test-title {
  margin-bottom: 0.6rem;
}

.install-test-copy {
  margin-bottom: 1rem;
  color: var(--color-text-secondary);
}

.install-test-copy + .install-test-copy {
  margin-bottom: 1.2rem;
}

.install-test-page .install-button {
  max-width: 260px;
}

.install-subtext {
  margin-top: 0.15rem;
  margin-bottom: 0.45rem;
  font-size: 0.8rem;
  line-height: 1.2;
  color: var(--color-text-secondary);
  text-align: center;
}

/* Screenshots */
.app-screenshots {
  margin-bottom: 0.85rem;
  margin-top: 0.1rem;
}

.screenshot-row {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
}

.screenshot-placeholder {
  width: 180px;
  height: 320px;
  flex-shrink: 0;
  background: var(--color-surface);
  border: 2px dashed var(--color-text-secondary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.screenshot {
  width: 140px;
  height: auto;
  flex-shrink: 0;
  border-radius: 12px;
  object-fit: cover;
}

/* Description */
.app-description {
  margin-bottom: 2rem;
}

.app-description h2 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.app-description p {
  color: var(--color-text-secondary);
  font-size: 0.9375rem;
}

/* Details grid */
.app-details {
  display: flex;
  justify-content: space-around;
  border-top: 1px solid var(--color-surface);
  padding-top: 1.5rem;
  margin-bottom: 2rem;
}

.detail-item {
  text-align: center;
}

.detail-label {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.25rem;
}

.detail-value {
  font-size: 0.875rem;
  font-weight: 600;
}
/* Meta info bar */
.app-meta-info {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid var(--color-surface);
  border-bottom: 1px solid var(--color-surface);
  padding: 0;
  margin-bottom: 0.55rem;
}

.meta-item {
  position: relative;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.8rem 0.55rem 0.75rem;
}

.meta-item:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0;
  top: 14%;
  width: 1px;
  height: 72%;
  background: var(--color-surface);
}

.meta-item:first-child {
  gap: 0.3rem;
}

.meta-icon {
  display: inline-flex;
  width: 1.05rem;
  height: 1.05rem;
  line-height: 1;
  color: var(--color-text-secondary);
}

.meta-icon-svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.meta-label {
  display: block;
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  letter-spacing: 0.06em;
}

.meta-value {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  line-height: 1.2;
}

.meta-value.large {
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
  color: var(--color-text-secondary);
}

.meta-stars {
  display: block;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  line-height: 1;
}

.developer-meta .meta-icon {
  width: 1rem;
  height: 1rem;
}

.developer-meta .meta-value {
  font-size: 0.74rem;
}

@media screen and (max-width: 600px) {
  .app-screenshots {
    margin-top: -0.6rem;
  }

  .screenshot {
    width: 132px;
    border-radius: 10px;
  }

  .app-meta-info {
    display: flex;
    overflow-x: auto;
    gap: 0;
    padding: 0.75rem 0;
    border: none;
    border-bottom: 1px solid var(--color-surface);
    margin-bottom: 1rem;
  }

  .meta-item {
    flex: 0 0 calc(50% - 0.35rem);
    padding: 0.75rem 0.5rem;
  }

  .meta-item:not(:last-child)::after {
    right: -0.05rem;
    top: 16%;
    height: 68%;
  }

  .meta-icon {
    width: 0.95rem;
    height: 0.95rem;
  }

  .meta-label {
    font-size: 0.54rem;
  }

  .meta-value {
    font-size: 0.76rem;
  }

  .meta-value.large {
    font-size: 1.4rem;
  }

  .meta-stars {
    font-size: 0.7rem;
  }

  .developer-meta .meta-icon {
    width: 0.9rem;
    height: 0.9rem;
  }

  .developer-meta .meta-value {
    font-size: 0.7rem;
  }
}

/* Ratings & Reviews */
.app-ratings-reviews {
  margin-bottom: 2rem;
}

.app-ratings-reviews h2 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
}

.rating-summary {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: transparent;
  border: 1px solid var(--color-surface);
  border-radius: 12px;
}

.rating-score {
  text-align: center;
  min-width: 80px;
}

.big-rating {
  display: block;
  font-size: 2.5rem;
  font-weight: 900;
  margin-bottom: 0.25rem;
}

.rating-label {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.5rem;
}

.rating-count-summary {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.rating-breakdown {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rating-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
}

.star-label {
  min-width: 30px;
  color: var(--color-text-secondary);
}

.bar {
  flex: 1;
  height: 4px;
  background: var(--color-text-secondary);
  border-radius: 2px;
  overflow: hidden;
  opacity: 0.2;
}

.bar .fill {
  height: 100%;
  background: #000000;
}

.reviews-section h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.review-card {
  padding: 1rem;
  border: 1px solid var(--color-surface);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

.review-title {
  font-size: 0.9375rem;
  font-weight: 600;
  flex: 1;
}

.review-rating {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.review-date {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.25rem;
}

.review-user {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 0.1rem;
}

.review-author {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

@media screen and (max-width: 600px) {
  .rating-summary {
    gap: 1.5rem;
    padding: 1.25rem;
  }

  .rating-score {
    flex-shrink: 0;
  }

  .big-rating {
    font-size: 2.25rem;
  }

  .rating-breakdown {
    gap: 0.35rem;
  }

  .rating-bar {
    gap: 0.5rem;
  }

  .star-label {
    font-size: 0.7rem;
    min-width: 28px;
  }

  .bar {
    height: 3px;
  }
}
