/* ============================================================
   WIN ELNOVAR - components.css
   Reusable furniture: top bar, buttons, panels, chips, meters,
   list rows, modals, toasts, badges, tabs.
   ============================================================ */

/* ------------------------------------------------------------
   Top bar - scoreboard styling, deep green-blue with gold rule
   ------------------------------------------------------------ */
.top {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  padding: calc(10px + var(--safe-t)) var(--pad) 12px;
  background: linear-gradient(180deg, var(--deep) 0%, var(--deep-2) 100%);
  color: var(--cream);
  border-bottom-left-radius: var(--r-lg);
  border-bottom-right-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
}
.top::after {
  content: "";
  position: absolute;
  left: var(--pad); right: var(--pad); bottom: 6px;
  height: 2px;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, transparent, var(--gold-2), transparent);
  opacity: .8;
}

.top__row { display: flex; align-items: center; gap: 10px; min-height: 40px; }

.top__back {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: rgba(250, 245, 234, .12);
  color: var(--cream);
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.top__back:active { transform: scale(.93); background: rgba(250, 245, 234, .2); }

.top__titles { flex: 1 1 auto; min-width: 0; }
.top__title {
  font-family: var(--font-num);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .04em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.top__sub {
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(250, 245, 234, .6);
  margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.top__slot { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }

/* wallet chips inside the top bar */
.wallet { display: flex; gap: 6px; }
.wallet__chip {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 9px 5px 6px;
  border-radius: var(--r-pill);
  background: rgba(6, 41, 38, .42);
  border: 1px solid rgba(250, 245, 234, .14);
  font-family: var(--font-num);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--cream);
  font-variant-numeric: tabular-nums;
}
.wallet__chip svg { width: 15px; height: 15px; }

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border-radius: var(--r-md);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: .02em;
  background: var(--surface);
  color: var(--deep);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow-sm);
  transition: transform 140ms var(--ease), box-shadow var(--dur) var(--ease), opacity var(--dur);
  user-select: none;
}
.btn:active { transform: translateY(1px) scale(.985); }
.btn svg { width: 18px; height: 18px; flex: 0 0 auto; }

.btn--primary {
  background: linear-gradient(180deg, var(--deep-soft), var(--deep));
  color: var(--cream);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(14, 92, 86, .32);
}
.btn--gold {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #33260A;
  border-color: transparent;
  box-shadow: var(--shadow-gold);
}
.btn--ghost { background: transparent; box-shadow: none; border-color: var(--border-2); }
.btn--quiet { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.btn--danger { background: linear-gradient(180deg, #D8583F, var(--bad)); color: #FFF; border-color: transparent; }
.btn--block { display: flex; width: 100%; }
.btn--sm { padding: 9px 13px; font-size: 13px; border-radius: var(--r-sm); }
.btn--lg { padding: 16px 20px; font-size: 16px; border-radius: var(--r-lg); }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; }

.btn__hint {
  font-size: 11px;
  font-weight: 600;
  opacity: .72;
  letter-spacing: .04em;
}

.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1 1 0; }

/* icon button */
.ibtn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--deep);
  box-shadow: var(--shadow-sm);
  transition: transform 140ms var(--ease);
}
.ibtn:active { transform: scale(.92); }
.ibtn svg { width: 20px; height: 20px; }

/* ------------------------------------------------------------
   Panels / cards
   ------------------------------------------------------------ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px;
}
.panel--flat { box-shadow: none; }
.panel--deep {
  background: linear-gradient(160deg, var(--deep) 0%, var(--deep-2) 100%);
  color: var(--cream);
  border-color: transparent;
  box-shadow: var(--shadow-md);
}
.panel--gold {
  background: linear-gradient(160deg, #FFF6DF 0%, #F7E5B6 100%);
  border-color: rgba(201, 154, 46, .34);
}
.panel--pad-0 { padding: 0; overflow: hidden; }

.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel__title { font-family: var(--font-num); font-size: 15px; font-weight: 700; letter-spacing: .03em; }
.panel--deep .panel__title { color: var(--cream); }

/* section heading between blocks */
.sect {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 2px 10px;
}
.sect__t {
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--deep);
}
.sect__line { flex: 1 1 auto; height: 1px; background: linear-gradient(90deg, var(--border-2), transparent); }
.sect__act { font-size: 12px; font-weight: 700; color: var(--gold-deep); }

/* ------------------------------------------------------------
   Chips / badges
   ------------------------------------------------------------ */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-2);
  white-space: nowrap;
}
.chip svg { width: 13px; height: 13px; }
.chip--deep { background: rgba(14, 92, 86, .1); border-color: rgba(14, 92, 86, .2); color: var(--deep); }
.chip--gold { background: rgba(232, 184, 75, .18); border-color: rgba(201, 154, 46, .34); color: var(--gold-deep); }
.chip--good { background: rgba(46, 158, 107, .14); border-color: rgba(46, 158, 107, .3); color: #1D6B48; }
.chip--bad  { background: rgba(193, 70, 47, .12); border-color: rgba(193, 70, 47, .28); color: #90311F; }
.chip--lock { background: rgba(8, 36, 33, .07); border-color: transparent; color: var(--ink-3); }

.badge {
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--bad);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
}

/* ------------------------------------------------------------
   Meters
   ------------------------------------------------------------ */
.meter {
  height: 8px;
  border-radius: var(--r-pill);
  background: rgba(8, 36, 33, .1);
  overflow: hidden;
}
.meter > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--deep-soft), var(--deep));
  transition: width 420ms var(--ease);
}
.meter--gold > i { background: linear-gradient(90deg, var(--gold-2), var(--gold)); }
.meter--sm { height: 5px; }
.panel--deep .meter { background: rgba(250, 245, 234, .16); }
.panel--deep .meter > i { background: linear-gradient(90deg, var(--gold-3), var(--gold-2)); }

/* ------------------------------------------------------------
   Stat tiles
   ------------------------------------------------------------ */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tiles--3 { grid-template-columns: repeat(3, 1fr); }

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 11px 12px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.tile__k {
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 700;
  display: flex; align-items: center; gap: 5px;
}
.tile__k svg { width: 13px; height: 13px; opacity: .8; }
.tile__v {
  font-family: var(--font-num);
  font-size: 21px;
  font-weight: 700;
  color: var(--deep);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile__s { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.tile--gold .tile__v { color: var(--gold-deep); }

/* ------------------------------------------------------------
   List rows
   ------------------------------------------------------------ */
.rows { display: flex; flex-direction: column; gap: 8px; }

.rowc {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  text-align: left;
  width: 100%;
  transition: transform 140ms var(--ease), border-color var(--dur);
}
button.rowc:active { transform: scale(.99); }
.rowc--done { border-color: rgba(46, 158, 107, .34); background: linear-gradient(180deg, #F6FFFA, var(--surface)); }
.rowc--lock { opacity: .62; }
.rowc--gold { border-color: rgba(201, 154, 46, .4); background: linear-gradient(180deg, #FFFBF0, var(--surface)); }

.rowc__ic {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  border-radius: 13px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, rgba(14,92,86,.12), rgba(14,92,86,.05));
  color: var(--deep);
}
.rowc__ic svg { width: 22px; height: 22px; }
.rowc__ic--gold { background: linear-gradient(160deg, rgba(232,184,75,.3), rgba(232,184,75,.12)); color: var(--gold-deep); }
.rowc__ic--good { background: rgba(46, 158, 107, .14); color: #1D6B48; }
.rowc__ic--lock { background: rgba(8, 36, 33, .07); color: var(--ink-3); }

.rowc__body { flex: 1 1 auto; min-width: 0; }
.rowc__t { display: block; font-size: 14px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rowc__s { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.35; }
.rowc__end { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* ------------------------------------------------------------
   Segmented tabs
   ------------------------------------------------------------ */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
}
.tabs__i {
  flex: 1 1 0;
  padding: 8px 6px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-3);
  text-align: center;
  transition: background var(--dur), color var(--dur);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tabs__i.is-on { background: var(--deep); color: var(--cream); box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------
   Stars
   ------------------------------------------------------------ */
.stars { display: inline-flex; gap: 2px; }
.stars svg { width: 14px; height: 14px; color: var(--cream-3); }
.stars svg.on { color: var(--gold-2); filter: drop-shadow(0 1px 2px rgba(201,154,46,.4)); }
.stars--lg svg { width: 26px; height: 26px; }

/* ------------------------------------------------------------
   Empty state
   ------------------------------------------------------------ */
.empty {
  text-align: center;
  padding: 34px 22px;
  color: var(--ink-3);
}
.empty__ic {
  width: 62px; height: 62px;
  margin: 0 auto 12px;
  border-radius: 20px;
  display: grid; place-items: center;
  background: var(--surface-2);
  color: var(--deep);
}
.empty__ic svg { width: 30px; height: 30px; }
.empty__t { font-size: 15px; font-weight: 700; color: var(--ink-2); }
.empty__s { font-size: 12.5px; margin-top: 5px; line-height: 1.5; }

/* ------------------------------------------------------------
   Modal
   ------------------------------------------------------------ */
.modal__scrim {
  position: absolute; inset: 0;
  background: rgba(6, 35, 31, .58);
  backdrop-filter: blur(3px);
  animation: fadeIn 200ms var(--ease) both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal__box {
  position: absolute;
  left: 14px; right: 14px;
  bottom: calc(14px + var(--safe-b));
  max-height: calc(100% - 60px);
  overflow-y: auto;
  background: var(--paper);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 18px 16px calc(16px);
  animation: sheetUp 280ms var(--ease) both;
}
@keyframes sheetUp {
  from { opacity: 0; transform: translateY(28px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.modal__box--center {
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
  animation: popIn 240ms var(--ease) both;
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(-50%) scale(.94); }
  to   { opacity: 1; transform: translateY(-50%) scale(1); }
}
.modal__grip {
  width: 40px; height: 4px;
  border-radius: var(--r-pill);
  background: var(--cream-3);
  margin: -6px auto 12px;
}
.modal__t { font-family: var(--font-num); font-size: 19px; font-weight: 700; text-align: center; color: var(--deep); }
.modal__s { font-size: 13px; text-align: center; color: var(--ink-3); margin-top: 6px; line-height: 1.5; }
.modal__body { margin-top: 14px; }
.modal__foot { margin-top: 16px; display: flex; gap: 10px; }
.modal__foot > .btn { flex: 1 1 0; }

/* ------------------------------------------------------------
   Toast
   ------------------------------------------------------------ */
#toast-layer { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: calc(66px + var(--safe-t)); gap: 8px; }
.toast {
  pointer-events: none;
  max-width: 82%;
  padding: 10px 15px;
  border-radius: var(--r-pill);
  background: rgba(8, 36, 33, .92);
  color: var(--cream);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 8px;
  animation: toastIn 240ms var(--ease) both;
}
.toast svg { width: 16px; height: 16px; flex: 0 0 auto; }
.toast--gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #33260A; }
.toast--bad  { background: linear-gradient(180deg, #D8583F, var(--bad)); color: #fff; }
.toast--good { background: linear-gradient(180deg, #37B57B, var(--good)); color: #fff; }
.toast.out { animation: toastOut 220ms var(--ease) both; }
@keyframes toastIn  { from { opacity: 0; transform: translateY(-12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) scale(.97); } }

/* ------------------------------------------------------------
   Flying reward chip (coins/xp animation)
   ------------------------------------------------------------ */
.fly {
  position: absolute;
  display: flex; align-items: center; gap: 4px;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #33260A;
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 800;
  box-shadow: var(--shadow-gold);
  animation: flyUp 900ms var(--ease) both;
}
@keyframes flyUp {
  0%   { opacity: 0; transform: translate(-50%, 0) scale(.8); }
  18%  { opacity: 1; transform: translate(-50%, -14px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70px) scale(.94); }
}

/* ------------------------------------------------------------
   Avatar
   ------------------------------------------------------------ */
.avatar {
  width: 56px; height: 56px;
  border-radius: 18px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--deep-soft), var(--deep-2));
  color: var(--cream);
  box-shadow: var(--shadow-md);
  position: relative;
  flex: 0 0 auto;
}
.avatar svg { width: 34px; height: 34px; }
.avatar--lg { width: 82px; height: 82px; border-radius: 26px; }
.avatar--lg svg { width: 50px; height: 50px; }
.avatar__lvl {
  position: absolute;
  right: -6px; bottom: -6px;
  min-width: 26px; height: 22px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #33260A;
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 800;
  display: grid; place-items: center;
  border: 2px solid var(--paper);
}

/* ------------------------------------------------------------
   Note / callout
   ------------------------------------------------------------ */
.note {
  display: flex; gap: 10px;
  padding: 11px 12px;
  border-radius: var(--r-md);
  background: rgba(44, 122, 155, .09);
  border: 1px solid rgba(44, 122, 155, .22);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-2);
}
.note svg { width: 17px; height: 17px; flex: 0 0 auto; color: var(--info); margin-top: 1px; }
.note--warn { background: rgba(217, 131, 36, .1); border-color: rgba(217, 131, 36, .26); }
.note--warn svg { color: var(--warn); }
.note--gold { background: rgba(232, 184, 75, .14); border-color: rgba(201, 154, 46, .3); }
.note--gold svg { color: var(--gold-deep); }
