/* Design tokens, page shell (topbar/tabbar/view), and generic primitives
   (buttons, inputs, section headings, empty/toast states) shared by every
   tab. Feature-specific styling lives in components.css / shop.css /
   trade.css instead of piling up here. */

:root {
  --bg: var(--tg-theme-bg-color, #0f0f14);
  --text: var(--tg-theme-text-color, #f2f2f5);
  --hint: var(--tg-theme-hint-color, #8b8b96);
  --link: var(--tg-theme-link-color, #6ab3f3);
  --button: var(--tg-theme-button-color, #3f7de3);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #1a1a22);
  --card-bg: #1e1e28;
  --border: #2c2c38;
}

* {
  box-sizing: border-box;
}

/* Buttons aren't text to select - without this, a long-press anywhere
   tappable (the tab bar most visibly, since long-pressing "Инвентарь" is
   how the admin panel opens) triggers the browser's text-selection/
   callout instead of the tap-and-hold gesture. */
button {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 64px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--secondary-bg);
  border-bottom: 1px solid var(--border);
}

.profile {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--secondary-bg);
  flex-shrink: 0;
}

.username {
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.stat {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* the coins/points currency icons - inline-sized to sit in the middle of
   running text wherever they're used (topbar, chips, rewards, prices) */
.currency-icon {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  object-fit: cover;
  vertical-align: -2px;
}

#view {
  padding: 12px;
  min-height: 60vh;
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--secondary-bg);
  border-top: 1px solid var(--border);
}

.tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--hint);
  padding: 14px 0;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab.active {
  color: var(--link);
}

h2 {
  margin: 4px 0 12px;
  font-size: 18px;
}

.section {
  margin-bottom: 20px;
}

.section-title {
  font-size: 14px;
  color: var(--hint);
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.title-row .section-title,
.title-row h2 {
  margin: 0;
}

.title-timer {
  font-size: 13px;
  font-weight: 700;
  color: var(--hint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

button.action {
  width: 100%;
  border: none;
  padding: 8px;
  background: var(--button);
  color: var(--button-text);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}

button.action:disabled {
  opacity: .45;
}

button.secondary {
  background: var(--secondary-bg);
  color: var(--text);
  border: 1px solid var(--border);
}

input,
select {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--secondary-bg);
  color: var(--text);
  margin-bottom: 8px;
  font-size: 13px;
}

/* shared "list item card" base - combos, trade offers, and daily tasks all
   render one row per entry in this same boxed style */
.combo,
.trade-item,
.task-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.combo .reward {
  color: var(--hint);
  font-size: 12px;
}

.task-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.task-item.done {
  opacity: .5;
}

.task-item-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.task-item .action {
  width: auto;
  margin-top: 0;
  padding: 6px 14px;
}

.empty {
  color: var(--hint);
  text-align: center;
  padding: 24px 0;
  font-size: 13px;
}

.toast {
  position: fixed;
  bottom: 78px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  z-index: 20;
}

.maintenance-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  gap: 8px;
}
.maintenance-icon { font-size: 42px; margin-bottom: 4px; }
.maintenance-screen h2 { margin: 0; }
.maintenance-screen p { color: var(--hint); margin: 0 0 12px; }
.maintenance-screen .action { width: auto; padding: 10px 28px; }