:root {
  --night: #141833;
  --night-2: #1C2140;
  --card: #FFFFFF;
  --card-2: #EEF0F6;
  --ink: #1C2140;
  --muted: #5A607E;
  --gold: #F2A33A;
  --gold-dark: #B86E0B;
  --red: #E2583E;
  --green: #2E7D7A;
  --radius: 16px;
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--card-2); line-height: 1.45; }
button, input, textarea { font: inherit; }
img { max-width: 100%; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  color: #fff;
  background: var(--night) url("header.jpg") center right / cover no-repeat;
  padding: 40px 16px 88px;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(14,16,40,.9) 0%, rgba(14,16,40,.55) 55%, rgba(14,16,40,.1) 100%);
}
.hero-inner { position: relative; max-width: 1100px; margin: 0 auto; }
.pill {
  display: inline-block; background: var(--gold); color: var(--ink);
  font-weight: 800; padding: 6px 16px; border-radius: 999px; font-size: 14px;
}
.hero h1 {
  font-size: clamp(32px, 6vw, 56px); line-height: 1.05; margin: 18px 0 12px;
  max-width: 620px; font-weight: 900;
}
.hero h1 em { color: var(--gold); font-style: normal; }
.hero p { max-width: 520px; font-size: 18px; color: #E6E8F2; margin: 0; }

/* ---------- stats ---------- */
.stats {
  position: relative; max-width: 1100px; margin: -56px auto 0; padding: 0 16px;
  display: grid; grid-template-columns: 2fr 1fr; gap: 16px;
}
.stat {
  background: var(--card); border-radius: var(--radius); padding: 18px 22px;
  box-shadow: 0 8px 24px rgba(20,24,51,.12);
}
.stat-label { font-size: 14px; color: var(--muted); font-weight: 700; }
.stat-value { font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 16px; color: var(--muted); font-weight: 700; }
.progress { height: 12px; background: var(--card-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--gold), var(--red)); border-radius: 99px; transition: width .6s; }

/* ---------- grid ---------- */
main { max-width: 1100px; margin: 0 auto; padding: 28px 16px 64px; }
.how { color: var(--muted); margin: 0 0 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.item {
  background: var(--card); border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 2px 8px rgba(20,24,51,.06);
  transition: box-shadow .3s, transform .3s;
}
.item.flash { box-shadow: 0 0 0 3px var(--gold), 0 8px 24px rgba(242,163,58,.35); }
.item.mine { box-shadow: 0 0 0 3px var(--green); }
.item-head { display: flex; gap: 14px; align-items: center; }
.icon {
  flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--night-2);
  display: grid; place-items: center; font-size: 26px;
}
.item h2 { font-size: 19px; margin: 0; line-height: 1.2; }
.item p { margin: 0; color: var(--muted); font-size: 15px; }
.price-row { display: flex; justify-content: space-between; align-items: end; margin-top: auto; padding-top: 8px; }
.price { font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; }
.price-label { font-size: 13px; color: var(--muted); font-weight: 700; }
.leader { font-size: 14px; color: var(--muted); }
.leader b { color: var(--ink); }
.badge-mine { display: inline-block; font-size: 13px; font-weight: 800; color: #fff; background: var(--green); padding: 2px 10px; border-radius: 99px; }
.badge-outbid { display: inline-block; font-size: 13px; font-weight: 800; color: #fff; background: var(--red); padding: 2px 10px; border-radius: 99px; }
.time { font-size: 13px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.time.soon { color: var(--red); }

.btn {
  border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 800; cursor: pointer;
  background: var(--red); color: #fff; font-size: 16px;
}
.btn:hover { filter: brightness(1.07); }
.btn:disabled { background: #B9BDCC; cursor: not-allowed; }
.btn.secondary { background: var(--card-2); color: var(--ink); }
.btn.small { padding: 6px 12px; font-size: 14px; border-radius: 10px; }

/* ---------- dialog ---------- */
dialog {
  border: 0; border-radius: 20px; padding: 0; width: min(440px, calc(100vw - 32px));
  box-shadow: 0 24px 64px rgba(0,0,0,.35);
}
dialog::backdrop { background: rgba(14,16,40,.6); }
.dlg { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.dlg h3 { margin: 0; font-size: 22px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 14px; }
input, textarea, select {
  border: 2px solid #D6D9E4; border-radius: 10px; padding: 10px 12px; font-size: 16px; color: var(--ink); background: #fff;
}
input:focus, textarea:focus { outline: none; border-color: var(--gold); }
.amount-wrap { display: flex; align-items: center; gap: 8px; }
.amount-wrap span { font-size: 24px; font-weight: 900; }
.amount-wrap input { font-size: 24px; font-weight: 900; width: 100%; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.hint { font-size: 13px; color: var(--muted); font-weight: 400; }
.error { color: var(--red); font-weight: 700; font-size: 14px; min-height: 1em; }
.actions { display: flex; gap: 10px; justify-content: flex-end; }
.history { font-size: 14px; color: var(--muted); border-top: 1px solid var(--card-2); padding-top: 10px; }
.history:empty { display: none; }
.history ol { margin: 6px 0 0; padding-left: 20px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px);
  background: var(--ink); color: #fff; padding: 14px 22px; border-radius: 14px; font-weight: 700;
  transition: transform .35s; z-index: 10; max-width: calc(100vw - 32px);
}
.toast.show { transform: translateX(-50%) translateY(0); }

footer { text-align: center; color: var(--muted); font-size: 14px; padding: 0 16px 40px; }

@media (max-width: 640px) {
  .hero { padding-bottom: 80px; background-position: 70% center; }
  .hero::before { background: linear-gradient(180deg, rgba(14,16,40,.92) 0%, rgba(14,16,40,.8) 60%, rgba(14,16,40,.55) 100%); }
  .stats { grid-template-columns: 1fr; }
  .stat-value { font-size: 28px; }
}
