/* ─────────────────────────────────────────────────────────────
   Albero group · кабинет лояльности
   Тёплая вечерняя гамма Amarena, мобайл-фёрст, крупные тач-таргеты.
   ───────────────────────────────────────────────────────────── */

:root {
  --bg: #14100C;
  --bg-deep: #0E0B08;
  --surface: #1D1712;
  --surface-2: #241C15;
  --line: #3A2C1E;
  --line-soft: #2A2018;

  --text: #EFE3CE;
  --muted: #A9987C;
  --dim: #7A6A52;

  --gold: #EF9F27;
  --gold-l: #FAC775;
  --gold-d: #B87F3E;
  --cherry: #C0455F;
  --cherry-l: #D9738A;
  --green: #5C8A5E;

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --pad: 18px;
  --radius: 14px;
  --shell: 520px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
  /* тёплое зарево снизу — как отблеск печи */
  background-image:
    radial-gradient(120% 60% at 50% 104%, rgba(239, 159, 39, 0.16), transparent 62%),
    radial-gradient(90% 50% at 12% -8%, rgba(192, 69, 95, 0.10), transparent 60%);
  background-attachment: fixed;
}

[hidden] { display: none !important; }

canvas { image-rendering: pixelated; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ─────────────── плёнка: зерно и развёртка ─────────────── */

.grain,
.scan {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}

.grain {
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.scan {
  opacity: 0.35;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.22) 0 1px,
    transparent 1px 3px
  );
}

/* ─────────────── каркас ─────────────── */

.screen { display: block; }

.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 28px var(--pad) calc(40px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#screen-auth .shell {
  min-height: 100dvh;
  justify-content: center;
  padding-top: 40px;
}

/* ─────────────── шапка входа ─────────────── */

.brand {
  text-align: center;
  margin-bottom: 6px;
}

.brand__emblem {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  display: block;
  filter: drop-shadow(0 6px 18px rgba(239, 159, 39, 0.22));
}

.brand__kicker {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--gold-d);
}

.brand__title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(28px, 9vw, 38px);
  line-height: 1.08;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
}

/* ─────────────── панели ─────────────── */

.panel {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--pad);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
}

.panel__label {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
}

.panel__note {
  margin: -6px 0 14px;
  font-size: 14px;
  color: var(--muted);
}

.panel__note data {
  color: var(--text);
  font-family: var(--mono);
  letter-spacing: 0.06em;
}

.panel__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.panel__head .panel__label { margin: 0; }

.panel--alert { border-color: rgba(192, 69, 95, 0.45); }

.panel--alert .panel__label { color: var(--cherry-l); }

.alert__title {
  margin: 6px 0 10px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 21px;
  letter-spacing: 0.02em;
}

.fineprint {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--dim);
}

/* ─────────────── поля и кнопки ─────────────── */

.field {
  display: block;
  margin-bottom: 12px;
}

.field__label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--dim);
}

.field__input {
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 17px;
  letter-spacing: 0.06em;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field__input::placeholder { color: #5C4E3A; }

.field__input:focus {
  outline: none;
  border-color: var(--gold-d);
  box-shadow: 0 0 0 3px rgba(239, 159, 39, 0.14);
}

.field__input--code,
.field__input--promo {
  text-align: center;
  font-size: 24px;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
}

.field__input--promo {
  font-size: 18px;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  text-transform: uppercase;
}

.is-invalid { border-color: var(--cherry) !important; }

.btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 14px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--gold-l);
  outline-offset: 2px;
}

.btn--primary {
  background: linear-gradient(180deg, var(--gold-l), var(--gold));
  color: #251803;
  font-weight: 600;
  box-shadow: 0 10px 22px rgba(239, 159, 39, 0.2);
}

.btn--primary:active { transform: translateY(1px); }
.btn--primary:hover { filter: brightness(1.06); }

.btn--ghost {
  width: auto;
  min-height: 44px;
  padding: 10px 14px;
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  font-size: 11px;
}

.btn--ghost:hover:not(:disabled) {
  border-color: var(--gold-d);
  color: var(--text);
}

.btn--sm {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 10px;
}

.btn:disabled {
  cursor: default;
  opacity: 0.5;
  filter: none;
  box-shadow: none;
}

.btn.is-busy .btn__text { opacity: 0.75; }

.row-between {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

/* ─────────────── сообщения ─────────────── */

.msg {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 2px solid var(--cherry);
  background: rgba(192, 69, 95, 0.1);
  font-size: 13px;
  line-height: 1.45;
  color: var(--cherry-l);
}

.msg--ok {
  border-left-color: var(--green);
  background: rgba(92, 138, 94, 0.12);
  color: #9CC79E;
}

.msg--info {
  border-left-color: var(--gold-d);
  background: rgba(239, 159, 39, 0.1);
  color: var(--gold-l);
}

/* ─────────────── иконки ─────────────── */

.icon { display: block; flex: none; }
.icon--32 { width: 26px; height: 26px; }
.icon--48 { width: 40px; height: 40px; }
.icon--56 { width: 48px; height: 48px; }

/* ─────────────── экран загрузки ─────────────── */

.screen--loading {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-deep);
}

.loader {
  width: 100%;
  max-width: 640px;
}

.loader__canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: #191430;
}

.loader__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 16px 2px 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.loader__bar {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: var(--line-soft);
  overflow: hidden;
}

.loader__bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--p, 0) * 100%);
  background: linear-gradient(90deg, #C98246, var(--gold), #FFD98A);
  transition: width 0.28s ease;
}

/* ─────────────── кабинет ─────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.topbar__mark {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--gold-d);
}

.guest {
  display: flex;
  align-items: center;
  gap: 14px;
}

.guest__text { min-width: 0; }

.guest__text .panel__label { margin-bottom: 4px; }

.guest__name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.guest__text .fineprint { margin-top: 6px; }

.level {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.level__emblem {
  width: 46px;
  height: 46px;
  flex: none;
}

.level__text .panel__label { margin-bottom: 4px; }

.level__title {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-l);
}

.level__text .fineprint { margin-top: 4px; }

/* баланс */

.panel--hero {
  text-align: center;
  padding: 24px var(--pad) 18px;
  border-color: rgba(239, 159, 39, 0.3);
  background:
    radial-gradient(80% 90% at 50% 0%, rgba(239, 159, 39, 0.12), transparent 70%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
}

.hero__head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.hero__head .panel__label { margin: 0; }

.hero__value {
  display: block;
  font-family: var(--serif);
  font-size: clamp(46px, 16vw, 64px);
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--gold-l);
  text-shadow: 0 8px 26px rgba(239, 159, 39, 0.28);
  font-variant-numeric: tabular-nums;
}

.hero__unit {
  margin: 8px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--dim);
}

.breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 20px 0 0;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}

.breakdown__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.breakdown__cell .icon { margin-bottom: 2px; }

.breakdown__cell dt {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--dim);
  text-align: center;
}

.breakdown__cell dd {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* сгорание */

.burn__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
}

.burn__inactive {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--gold-l);
}

/* общий список: пакеты бонусов и покупки */

.stack {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stack:not(:first-child) { margin-top: 14px; }

.item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-deep);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}

.item__main { min-width: 0; }

.item__title {
  font-size: 14px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.item__sub {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--dim);
}

.item__side {
  flex: none;
  text-align: right;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.item__bonus {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.item__bonus--on { color: var(--green); }
.item__bonus--off { color: var(--cherry-l); }

.item--burn .item__side { color: var(--gold-l); }

.empty {
  margin: 0;
  padding: 18px 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  text-align: center;
  font-size: 13px;
  color: var(--dim);
}

/* скелет загрузки списка */

.skeleton {
  height: 62px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: linear-gradient(90deg, var(--bg-deep) 0%, #241C15 50%, var(--bg-deep) 100%);
  background-size: 220% 100%;
  animation: sheen 1.4s linear infinite;
}

@keyframes sheen {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

/* подвал */

.foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding-top: 4px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: #514534;
}

/* ─────────────── появление ─────────────── */

.screen > .shell > * {
  animation: rise 0.42s cubic-bezier(0.22, 0.68, 0.32, 1) backwards;
}

.screen > .shell > *:nth-child(2) { animation-delay: 0.05s; }
.screen > .shell > *:nth-child(3) { animation-delay: 0.1s; }
.screen > .shell > *:nth-child(4) { animation-delay: 0.15s; }
.screen > .shell > *:nth-child(5) { animation-delay: 0.2s; }
.screen > .shell > *:nth-child(6) { animation-delay: 0.25s; }
.screen > .shell > *:nth-child(n + 7) { animation-delay: 0.3s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (min-width: 560px) {
  :root { --pad: 22px; }
  .icon--32 { width: 28px; height: 28px; }
  .breakdown__cell dt { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .scan { display: none; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
