@font-face {
  font-family: 'Actay';
  src: url('../shared/fonts/Actay-Regular.otf') format('opentype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Actay';
  src: url('../shared/fonts/ActayWide-Bold.otf') format('opentype');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Kekur';
  src: url('../shared/fonts/Kekur-Regular.otf') format('opentype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Kekur';
  src: url('../shared/fonts/Kekur-Bold.otf') format('opentype');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #08070a;
  --card-dark: #130f18;
  --surface-2: #201a29;
  --text: #f8f5f0;
  --text-muted: #9a93a6;
  --text-dim: #655f72;

  --gold-light: #ffe3a8;
  --gold-mid: #e0a63f;
  --gold-deep: #7a4f16;

  --coral-light: #ff9d7a;
  --coral-mid: #ec6a45;
  --coral-deep: #341410;

  --teal-light: #7fe3cc;
  --teal-mid: #26ab93;
  --teal-deep: #0c2b26;

  --violet-light: #b39bff;
  --violet-mid: #8862ea;
  --violet-deep: #1c1338;

  --error: #ff6b76;
  --success: #3fdb9a;

  /* Формула вложенных скруглений: radius-внутреннего = radius-внешнего − отступ.
     --radius-sm получается из --radius-xl минус --sheet-inset (44 − 14 = 30),
     поэтому угол листа и угол кнопки внутри него визуально совпадают по кривизне. */
  --radius-xl: 44px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 30px;
  --sheet-inset: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* убираем системную синюю подсветку/рамку при тапе на мобильных браузерах —
     outline:none у button/input ниже её не перекрывает, это отдельный эффект */
  -webkit-tap-highlight-color: transparent;
}

button, input, textarea {
  border: none;
  outline: none;
  font-family: inherit;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Actay', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  position: relative;
  overflow-x: hidden;
}

/* --- фон на весь экран: мягкое цветное свечение + айдентика, под всем контентом --- */

.page-glow {
  position: fixed;
  inset: -10%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(65% 48% at 10% 2%, var(--coral-light) 0%, var(--coral-mid) 38%, transparent 74%),
    radial-gradient(62% 46% at 92% 8%, var(--gold-light) 0%, var(--gold-mid) 38%, transparent 74%),
    var(--bg);
  filter: blur(70px);
  opacity: 0.8;
}

.page-identity {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: url('../shared/brand/logo.svg');
  background-size: cover;
  background-position: center 22%;
  background-repeat: no-repeat;
  opacity: 0.025;
}

/* лёгкая зернистость по всей странице */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: overlay;
  opacity: 0.35;
}

#app {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.offline-banner {
  flex: none;
  width: 100%;
  padding: 10px 16px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
  background: color-mix(in srgb, var(--gold-mid) 55%, var(--card-dark) 45%);
  color: var(--gold-light);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.view {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hidden {
  display: none !important;
}

.view-home,
.view-sub {
  gap: 0;
}

/* --- герой: свой цветной акцент поверх общего фона, без своей рамки --- */

.hero {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 20px 36px;
}

.view-home .hero {
  position: sticky;
  top: 0;
}

.hero-brand {
  background: radial-gradient(150% 85% at 50% -15%, color-mix(in srgb, var(--gold-mid) 32%, transparent) 0%, transparent 72%);
}

.hero-coral {
  background: radial-gradient(150% 85% at 50% -15%, color-mix(in srgb, var(--coral-mid) 32%, transparent) 0%, transparent 72%);
}

.hero-teal {
  background: radial-gradient(150% 85% at 50% -15%, color-mix(in srgb, var(--teal-mid) 32%, transparent) 0%, transparent 72%);
}

.hero-gold {
  background: radial-gradient(150% 85% at 50% -15%, color-mix(in srgb, var(--gold-mid) 32%, transparent) 0%, transparent 72%);
}

.hero-violet {
  background: radial-gradient(150% 85% at 50% -15%, color-mix(in srgb, var(--violet-mid) 32%, transparent) 0%, transparent 72%);
}

.view-sub .hero {
  padding-bottom: 36px;
  gap: 18px;
  display: flex;
  flex-direction: column;
}

.view-sub .hero .back {
  margin-bottom: 4px;
}

.hero-top {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.hero-tagline {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-tagline::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 10px;
  margin-left: 2px;
  background: var(--gold-light);
  vertical-align: middle;
  animation: cursor-blink 1s step-end infinite;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.brand-mark-box,
.avatar {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--gold-mid) 55%, var(--card-dark) 45%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.brand-mark-box {
  cursor: default;
  padding: 9px;
}

.brand-mark-box::before {
  content: '';
  width: 100%;
  height: 100%;
  background: #fff9ec;
  -webkit-mask-image: url('../shared/brand/forum-mark.svg');
  mask-image: url('../shared/brand/forum-mark.svg');
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

#home-avatar {
  color: #2b1c05;
  font-size: 15px;
  font-weight: 700;
}

.hero-stat {
  position: relative;
  z-index: 1;
}

.hero-number-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.balance {
  font-family: 'Kekur', 'Actay', sans-serif;
  font-size: 84px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-shadow: 0 0 34px rgba(224, 166, 63, 0.5);
}

.balance-unit {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-muted);
}

.hero-status {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--gold-light);
}

#home-name {
  color: var(--gold-light);
}

/* --- лист: стеклянная панель, заходит внахлёст на герой сверху --- */

.sheet {
  position: relative;
  z-index: 2;
  flex: 1;
  margin-top: -30px;
  background: color-mix(in srgb, var(--card-dark) 46%, transparent);
  backdrop-filter: blur(30px) saturate(160%);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--sheet-inset) var(--sheet-inset) calc(env(safe-area-inset-bottom, 0px) + var(--sheet-inset));
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
}

/* --- карточка входа/установки/ожидания: не лист во весь экран, а компактный
   прямоугольник со скруглением со всех сторон --- */

.view.view-card {
  max-width: 640px;
}

.view-card .sheet {
  flex: none;
  border-radius: var(--radius-xl);
  padding-bottom: var(--sheet-inset);
  margin-bottom: 24px;
}

.tile-row {
  width: 100%;
  flex: none;
  display: flex;
  flex-direction: row;
  gap: 12px;
}

.tile {
  position: relative;
  overflow: hidden;
  flex: 1;
  border-radius: var(--radius-sm);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  color: var(--text);
  text-align: center;
}

.tile-icon-wrap {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile-icon {
  width: 20px;
  height: 20px;
}

.tile-label {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.tile-coral {
  background: color-mix(in srgb, var(--coral-mid) 40%, transparent);
}

.tile-coral .tile-icon-wrap {
  background: color-mix(in srgb, var(--coral-light) 35%, transparent);
  color: var(--coral-light);
}

.tile-teal {
  background: color-mix(in srgb, var(--teal-mid) 40%, transparent);
}

.tile-teal .tile-icon-wrap {
  background: color-mix(in srgb, var(--teal-light) 35%, transparent);
  color: var(--teal-light);
}

/* --- история операций (появляется, только если операции есть) --- */

.activity {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 8px;
}

.activity-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.activity-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.activity-icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.activity-icon svg {
  width: 16px;
  height: 16px;
}

.activity-icon-in {
  background: var(--teal-deep);
  color: var(--success);
}

.activity-icon-out {
  background: var(--coral-deep);
  color: var(--coral-light);
}

.activity-name {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.activity-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.activity-amount {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.activity-amount.amount-in {
  color: var(--success);
}

.activity-amount.amount-out {
  color: var(--coral-light);
}

.activity-time {
  font-size: 12px;
  color: var(--text-dim);
}

/* --- задания (пока пример-заглушка под будущую функцию) --- */

.tasks {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 8px;
}

.tasks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.link-btn {
  background: none;
  color: var(--coral-light);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.tasks-soon {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold-light);
  background: var(--gold-deep);
  padding: 3px 9px;
  border-radius: 8px;
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: color-mix(in srgb, var(--gold-mid) 12%, var(--surface-2) 88%);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.task-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--gold-mid) 30%, transparent);
  color: var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-icon svg {
  width: 18px;
  height: 18px;
}

.task-name {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.task-reward {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold-light);
  background: var(--gold-deep);
  padding: 5px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

/* --- предложка --- */

.suggest {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 8px;
}

.suggest .hint {
  text-align: left;
}

.suggest-textarea {
  width: 100%;
  min-height: 84px;
  padding: 14px 16px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.4;
  resize: vertical;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text);
}

.suggest-textarea::placeholder {
  color: var(--text-dim);
}

/* --- полная история --- */

.history-list {
  width: 100%;
}

/* --- второстепенные экраны --- */

.screen-heading {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}


.screen-title {
  font-family: 'Kekur', 'Actay', sans-serif;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text);
}

.name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.hint {
  font-size: 15px;
  color: var(--text-muted);
  text-align: center;
}

.error {
  font-size: 14px;
  color: var(--error);
  text-align: center;
}

.success {
  font-size: 15px;
  font-weight: 700;
  color: var(--success);
  text-align: center;
}

.group {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.btn {
  width: 100%;
  padding: 19px;
  font-size: 17px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  text-align: center;
}

.btn-coral-solid {
  background: color-mix(in srgb, var(--coral-mid) 45%, transparent);
}

.btn-violet-solid {
  background: color-mix(in srgb, var(--violet-mid) 45%, transparent);
}

.btn-ghost {
  background: var(--surface-2);
  color: var(--text-muted);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 700;
  width: auto;
}

.profile-delete-btn {
  color: var(--error);
}

.back {
  align-self: flex-start;
}

.amount-input {
  width: 100%;
  padding: 22px;
  font-size: 34px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
}

.amount-presets {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.amount-chip {
  padding: 20px 0;
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.amount-chip.is-selected {
  background: color-mix(in srgb, var(--coral-mid) 45%, transparent);
  color: var(--coral-light);
}

.amount-input::placeholder {
  color: var(--text-dim);
  font-weight: 700;
}

video {
  width: 100%;
  max-width: 300px;
  border-radius: var(--radius-md);
  background: #000;
}

.qr-frame {
  align-self: center;
  background: #ffffff;
  padding: 18px;
  border-radius: var(--radius-lg);
}

.qr-canvas {
  display: block;
}
