/* The approved sketch's colours; inside Telegram its theme, dark included, takes their place. */
:root {
  --bg: var(--tg-theme-secondary-bg-color, #f1f2f4);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #15181e);
  --hint: var(--tg-theme-subtitle-text-color, var(--tg-theme-hint-color, #5b6370));
  --accent: var(--tg-theme-button-color, #1f74bd);
  --on-accent: var(--tg-theme-button-text-color, #ffffff);
  --link: var(--tg-theme-link-color, #175e9a);
  --line: var(--tg-theme-section-separator-color, #e6e8ec);
  --danger: var(--tg-theme-destructive-text-color, #b3261e);
  --soft: #e8f1f9;
  --segments: var(--bg);
  --chevron: var(--tg-theme-hint-color, #8a93a1);
  --good: #1b7a43;
  --coin: #a85a08;
  --bottom: var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
}

@supports (color: color-mix(in srgb, red, blue)) {
  :root {
    --soft: color-mix(in srgb, var(--accent) 14%, var(--card));
    --good: color-mix(in srgb, #2ea86a 70%, var(--text));
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
}

button,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
}

button:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: var(--tg-viewport-stable-height, 100vh);
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 16px 16px;
  min-width: 0;
}

.centered {
  align-items: center;
  justify-content: center;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 650;
}

.hint,
.row-sub {
  color: var(--hint);
}

.hint {
  margin: 0;
}

.row-sub {
  font-size: 13px;
}

.good {
  color: var(--good);
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 10px 16px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--hint);
}

.card-head .good {
  color: var(--good);
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 0;
}

.link {
  min-height: 28px;
  color: var(--link);
  font-weight: 600;
}

.memory {
  margin: 0;
  padding: 4px 16px 10px;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.card-title {
  padding: 10px 16px 0;
  font-weight: 600;
}

.card > .row-sub {
  padding: 2px 16px 10px;
}

.card > .segments + .row-sub {
  padding-top: 8px;
  padding-bottom: 2px;
}

.card > .segments + .row-sub + .row-sub {
  padding-top: 2px;
}

.stub {
  margin: 0;
  padding: 12px 16px;
  color: var(--hint);
}

.note {
  margin: 0;
  padding: 8px 16px 12px;
  font-size: 13px;
  color: var(--hint);
  border-top: 1px solid var(--line);
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  text-align: left;
}

.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.row-title {
  font-weight: 600;
}

.row-value {
  color: var(--hint);
  font-size: 14px;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-amount {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row-on .row-title {
  color: var(--accent);
}

.icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.chevron {
  color: var(--chevron);
}

.coin {
  flex: none;
}

.coin-face {
  fill: var(--coin);
}

.coin-ring {
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.5;
}

.hello,
.plan {
  display: flex;
  align-items: center;
  gap: 12px;
}

.plan {
  padding: 10px 16px;
}

.avatar {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 22px;
  background: var(--accent);
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 600;
}

.greeting {
  font-size: 20px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.plan-name {
  font-size: 17px;
  font-weight: 650;
}

.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-height: 44px;
  padding: 8px 12px;
  background: var(--card);
  border-radius: 18px;
  font-weight: 650;
}

.btn {
  min-height: 44px;
  min-width: 96px;
  padding: 0 14px;
  border-radius: 12px;
  font-weight: 600;
  flex: none;
}

.btn-off {
  background: var(--segments);
  color: var(--hint);
}

.done {
  color: var(--good);
  font-weight: 600;
  font-size: 14px;
}

.btn-accent {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-soft {
  background: var(--soft);
  color: var(--link);
}

.btn-main {
  margin-top: auto;
  min-height: 50px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 650;
}

.btn-danger {
  min-height: 44px;
  color: var(--danger);
  font-weight: 600;
}

.back {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  align-self: flex-start;
  color: var(--link);
  font-weight: 600;
}

.balance {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
}

.balance-count {
  font-size: 40px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.offer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 16px;
  min-height: 44px;
}

.offer + .offer {
  border-top: 1px solid var(--line);
}

.offer .row-main {
  flex: 1 1 140px;
}

.offer-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segments {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 10px 16px 0;
  padding: 4px;
  background: var(--segments);
  border-radius: 12px;
}

.segment {
  min-height: 44px;
  border-radius: 9px;
  font-weight: 600;
  padding: 0 4px;
}

.segment-on {
  background: var(--card);
}

.field {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--card);
  resize: vertical;
  line-height: 1.4;
}

.tabbar {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(10px + var(--bottom));
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  color: var(--hint);
  font-size: 12px;
  font-weight: 600;
}

.tab-on {
  color: var(--accent);
}

#toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(84px + var(--bottom));
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  text-align: center;
}

#toast[hidden] {
  display: none;
}
