/*
 * Household Mini App — mobile-first, restrained.
 *
 * Colours come from Telegram's themeParams. Telegram injects --tg-theme-* CSS
 * variables itself; the fallbacks below keep a sensible light theme in a normal
 * browser (and script.js mirrors themeParams onto documentElement inline style
 * so themeChanged updates apply immediately).
 */

:root {
  --tg-theme-bg-color: #ffffff;
  --tg-theme-text-color: #1a1a1a;
  --tg-theme-hint-color: #707579;
  --tg-theme-link-color: #2481cc;
  --tg-theme-button-color: #2481cc;
  --tg-theme-button-text-color: #ffffff;
  --tg-theme-secondary-bg-color: #f1f1f4;
  --tg-theme-section-bg-color: #ffffff;
  --tg-theme-section-separator-color: #e6e6e8;
  --tg-theme-destructive-text-color: #d1453b;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: var(--tg-viewport-stable-height, 100vh);
  background-color: var(--tg-theme-bg-color);
  color: var(--tg-theme-text-color);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding: calc(16px + env(safe-area-inset-top)) 16px
    calc(16px + env(safe-area-inset-bottom));
}

.app {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.app__header {
  padding: 4px 2px;
}

.app__title {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.app__identity {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--tg-theme-hint-color);
}

.card {
  background-color: var(--tg-theme-section-bg-color);
  border: 1px solid var(--tg-theme-section-separator-color);
  border-radius: 12px;
  padding: 20px;
}

.card__title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
}

.muted {
  margin: 0;
  color: var(--tg-theme-hint-color);
}

.small {
  font-size: 14px;
  margin-top: 12px;
  min-height: 1.5em;
}

.count {
  margin: 4px 0 20px;
  font-size: 48px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.button {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  min-height: 44px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.button:active {
  opacity: 0.8;
}

.button:disabled {
  opacity: 0.5;
  cursor: default;
}

.button--primary {
  width: 100%;
  background-color: var(--tg-theme-button-color);
  color: var(--tg-theme-button-text-color);
}

.button--secondary {
  background-color: var(--tg-theme-secondary-bg-color);
  color: var(--tg-theme-text-color);
}

.noscript {
  max-width: 480px;
  margin: 16px auto;
  padding: 16px;
  text-align: center;
  color: var(--tg-theme-hint-color);
}

:focus-visible {
  outline: 2px solid var(--tg-theme-link-color);
  outline-offset: 2px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tg-theme-bg-color: #17212b;
    --tg-theme-text-color: #ffffff;
    --tg-theme-hint-color: #7d8b99;
    --tg-theme-secondary-bg-color: #232e3c;
    --tg-theme-section-bg-color: #1e2a36;
    --tg-theme-section-separator-color: #2c3a47;
  }
}
