/* Tradely — black / white / purple */
:root {
  --bg: #09090b;
  --surface: #121215;
  --surface-2: #1a1a1f;
  --border: #26262c;
  --text: #f4f4f6;
  --muted: #8b8b94;
  --purple: #8b5cf6;
  --purple-bright: #a78bfa;
  --purple-soft: rgba(139, 92, 246, 0.14);
  --green: #ffffff;   /* stay on palette: verdicts use purple/white/gray */
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
/* buttons/inputs do NOT inherit colour from body by default — without this they
   fall back to the UA default (black) and vanish on our dark background. */
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::placeholder { color: var(--muted); opacity: 1; }

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px; }

/* header */
header {
  border-bottom: 1px solid var(--border);
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 40;
}
.nav { display: flex; align-items: center; gap: 22px; height: 60px; }
.logo { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.logo span { color: var(--purple-bright); }
.nav a.link { color: var(--muted); font-weight: 500; padding: 6px 2px; }
.nav a.link:hover, .nav a.link.active { color: var(--text); }
.nav .spacer { flex: 1; }
.game-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--purple-soft); color: var(--purple-bright);
  border: 1px solid rgba(139, 92, 246, 0.35);
  padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.game-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--purple-bright); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  padding: 9px 16px; font-weight: 600; transition: 0.15s;
}
.btn:hover { border-color: var(--purple); }
.btn.primary { background: var(--purple); border-color: var(--purple); color: #fff; }
.btn.primary:hover { background: var(--purple-bright); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* hero */
.hero { text-align: center; padding: 72px 0 48px; }
.hero h1 { font-size: 44px; letter-spacing: -0.03em; margin: 0 0 12px; }
.hero h1 em { font-style: normal; color: var(--purple-bright); }
.hero p { color: var(--muted); font-size: 17px; max-width: 560px; margin: 0 auto 28px; }
.hero .cta { display: flex; gap: 12px; justify-content: center; }

/* cards / grids */
.grid { display: grid; gap: 14px; }
.games-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); padding-bottom: 56px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.game-card { display: block; transition: 0.15s; position: relative; }
.game-card:hover { border-color: var(--purple); transform: translateY(-2px); }
.game-card.soon { opacity: 0.55; pointer-events: none; }
.game-card h3 { margin: 0 0 4px; font-size: 17px; }
.game-card p { margin: 0; color: var(--muted); font-size: 13px; }
.badge-soon {
  position: absolute; top: 12px; right: 12px; font-size: 11px; font-weight: 700;
  color: var(--muted); border: 1px solid var(--border); padding: 2px 8px; border-radius: 999px;
}
.badge-live {
  position: absolute; top: 12px; right: 12px; font-size: 11px; font-weight: 700;
  color: var(--purple-bright); background: var(--purple-soft); padding: 3px 9px; border-radius: 999px;
}
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 34px 0 14px; }

/* calculator */
.calc-grid { display: grid; grid-template-columns: 1fr 44px 1fr; gap: 14px; align-items: start; margin-top: 22px; }
@media (max-width: 800px) { .calc-grid { grid-template-columns: 1fr; } .swap-col { display: none; } }
.side-panel { min-height: 220px; }
.side-panel h2 { margin: 0 0 2px; font-size: 16px; }
.side-panel .sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.swap-col { display: flex; align-items: center; justify-content: center; padding-top: 90px; }
.swap-btn { width: 40px; height: 40px; border-radius: 50%; padding: 0; font-size: 17px; }

.item-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px; margin-bottom: 8px;
}
.item-row .name { font-weight: 600; font-size: 14px; }
.item-row .meta { font-size: 12px; color: var(--muted); }
.item-row .grow { flex: 1; min-width: 0; }
.item-row .val { font-weight: 700; font-size: 14px; color: var(--purple-bright); white-space: nowrap; }
.perm-toggle {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
}
.perm-toggle.on { background: var(--purple-soft); color: var(--purple-bright); border-color: rgba(139,92,246,.4); }
.qty { display: inline-flex; align-items: center; gap: 6px; }
.qty button { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--text); padding: 0; line-height: 1; }
.qty span { min-width: 14px; text-align: center; font-weight: 700; font-size: 13px; }
.rm { background: none; border: none; color: var(--muted); font-size: 16px; padding: 2px 6px; }
.rm:hover { color: #fff; }
.add-slot {
  width: 100%; border: 1px dashed var(--border); background: transparent; color: var(--muted);
  border-radius: 10px; padding: 12px; font-weight: 600;
}
.add-slot:hover { border-color: var(--purple); color: var(--purple-bright); }
.side-total { display: flex; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 14px; color: var(--muted); }
.side-total b { color: var(--text); font-size: 16px; }

/* verdict */
.verdict { margin-top: 18px; text-align: center; padding: 22px; }
.verdict .word { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.verdict.win .word { color: var(--purple-bright); }
.verdict.lose .word { color: var(--muted); }
.verdict.fair .word { color: var(--text); }
.verdict .detail { color: var(--muted); margin-top: 4px; font-size: 14px; }
.verdict .bar { height: 8px; border-radius: 999px; background: var(--surface-2); margin: 16px auto 0; max-width: 420px; overflow: hidden; display: flex; }
.verdict .bar .fill { background: var(--purple); transition: width 0.3s; }
.verdict .bar .rest { background: #3a3a42; flex: 1; }

/* picker overlay */
.overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); z-index: 60;
  display: none; align-items: flex-start; justify-content: center; padding: 60px 16px;
}
.overlay.open { display: flex; }
.picker {
  width: 100%; max-width: 680px; max-height: 78vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.picker-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.picker-head input {
  flex: 1; background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 9px 12px; font: inherit; outline: none;
}
.picker-head input:focus { border-color: var(--purple); }
.chips { display: flex; gap: 8px; padding: 10px 16px 4px; flex-wrap: wrap; }
.chip {
  font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
}
.chip.on { background: var(--purple-soft); color: var(--purple-bright); border-color: rgba(139,92,246,.4); }
.picker-list { overflow-y: auto; padding: 12px 16px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.pick-item {
  text-align: left; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 10px 12px; transition: 0.12s;
  display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: baseline;
}
.pick-item:hover { border-color: var(--purple); }
.pick-item .ico { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
.pick-item .n { grid-column: 2; font-weight: 600; font-size: 14px; color: var(--text); }
.pick-item .r { grid-column: 2 / -1; font-size: 11.5px; color: var(--muted); }
.pick-item .v { grid-column: 3; grid-row: 1; font-size: 12.5px; font-weight: 700; color: var(--purple-bright); white-space: nowrap; }

/* item thumbnails (uploaded image, or the item's initial as a fallback) */
.ico {
  --ico: 30px;
  width: var(--ico); height: var(--ico); flex: none;
  border-radius: 8px; overflow: hidden; background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
}
.ico img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ico.ph {
  background: var(--purple-soft); color: var(--purple-bright);
  font-weight: 800; font-size: calc(var(--ico) * 0.44); line-height: 1;
}
.icell { display: flex; align-items: center; gap: 11px; }
.icell .itext { min-width: 0; }
.x-btn { background: none; border: none; color: var(--muted); font-size: 20px; padding: 4px 8px; }

/* trade ads */
.trades-head { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 16px; flex-wrap: wrap; gap: 12px; }
.trades-head h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.ad-card { margin-bottom: 12px; }
.ad-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--purple-soft);
  color: var(--purple-bright); display: flex; align-items: center; justify-content: center; font-weight: 800;
}
.ad-top .who { font-weight: 700; font-size: 14px; }
.ad-top .when { color: var(--muted); font-size: 12px; }
.ad-top .fair-badge { margin-left: auto; font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.fair-badge.deal { background: var(--purple-soft); color: var(--purple-bright); border-color: rgba(139,92,246,.4); }
.ad-sides { display: grid; grid-template-columns: 1fr 26px 1fr; gap: 10px; align-items: center; }
@media (max-width: 640px) { .ad-sides { grid-template-columns: 1fr; } .ad-arrow { transform: rotate(90deg); } }
.ad-side { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 62px; }
.ad-side .lab { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 7px; }
.ad-arrow { text-align: center; color: var(--purple-bright); font-size: 17px; }
.ad-item-chip {
  display: inline-flex; align-items: center; gap: 5px; margin: 0 6px 6px 0;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 4px 9px; font-size: 12.5px; font-weight: 600;
}
.ad-item-chip .p { color: var(--purple-bright); font-size: 10.5px; font-weight: 800; }
.ad-side .tot { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.ad-side .tot b { color: var(--purple-bright); }
.ad-note { margin-top: 10px; color: var(--muted); font-size: 13px; border-left: 2px solid var(--border); padding-left: 10px; }

/* create ad form */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.field input, .field textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 9px 12px; font: inherit; outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--purple); }
.form-msg { font-size: 13px; margin-top: 10px; min-height: 18px; }
.form-msg.err { color: #f0a5a5; }
.form-msg.ok { color: var(--purple-bright); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

footer { border-top: 1px solid var(--border); margin-top: 70px; padding: 26px 0; color: var(--muted); font-size: 13px; text-align: center; }
footer b { color: var(--text); }

/* game switcher */
.switcher { position: relative; }
.switch-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 12px; padding: 7px 12px;
}
.switch-btn:hover { border-color: var(--purple); }
.g-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--purple-soft);
  color: var(--purple-bright); display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; flex: none;
}
.switch-txt { text-align: left; line-height: 1.15; }
.switch-txt b { display: block; font-size: 14px; }
.switch-txt small { color: var(--muted); font-size: 11.5px; }
.switch-btn .caret { color: var(--muted); font-size: 11px; }
.switch-menu {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 70;
  min-width: 270px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 8px; box-shadow: 0 14px 40px rgba(0,0,0,.5);
}
.switch-menu.open { display: block; }
.switch-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px 10px 6px; }
.switch-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; line-height: 1.15;
}
.switch-item:hover { background: var(--surface-2); }
.switch-item.on { background: var(--surface-2); }
.switch-item b { display: block; font-size: 14.5px; }
.switch-item small { color: var(--muted); font-size: 12px; }
.switch-item .tick {
  margin-left: auto; width: 24px; height: 24px; border-radius: 50%; background: var(--purple);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
}
.links { display: flex; align-items: center; gap: 18px; }
.link .wl { color: var(--purple-bright); font-weight: 800; }
@media (max-width: 760px) { .links { gap: 12px; font-size: 13.5px; } .switch-txt small { display: none; } }

/* values table */
.values-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.values-tools input {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 8px 12px; font: inherit; outline: none; min-width: 220px;
}
.values-tools input:focus { border-color: var(--purple); }
.vtable { width: 100%; border-collapse: collapse; }
.vtable th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.vtable td { padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.vtable tr:hover td { background: var(--surface); }
.vtable .iname { font-weight: 700; }
.vtable .irar { color: var(--muted); font-size: 12px; }
.vtable .ival { font-weight: 700; color: var(--purple-bright); }
.vtable .num { text-align: right; white-space: nowrap; }
.pill {
  display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted);
}
.pill.hi { background: var(--purple-soft); color: var(--purple-bright); border-color: rgba(139,92,246,.4); }

/* giveaways */
.gv-card { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.gv-ico {
  width: 44px; height: 44px; border-radius: 12px; background: var(--purple-soft); flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.gv-card h3 { margin: 0 0 2px; font-size: 16px; }
.gv-card .gv-meta { color: var(--muted); font-size: 13px; }
.gv-card .grow { flex: 1; min-width: 0; }
.gv-right { text-align: right; flex: none; }
.gv-status { font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px; }
.gv-status.active { background: var(--purple-soft); color: var(--purple-bright); }
.gv-status.ended { border: 1px solid var(--border); color: var(--muted); }
.gv-count { color: var(--muted); font-size: 12px; margin-top: 5px; }

/* admin */
.admin-tabs { display: flex; gap: 8px; margin: 22px 0 16px; flex-wrap: wrap; }
.atable input, .atable select {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 7px; padding: 6px 8px; font: inherit; font-size: 13px; outline: none; width: 100%;
}
.atable input:focus, .atable select:focus { border-color: var(--purple); }
.atable td { padding: 6px 6px; }
.atable .num input { text-align: right; }
.mini { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.login-box { max-width: 380px; margin: 90px auto; text-align: center; }
.login-box input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 11px 14px; font: inherit; outline: none; margin: 14px 0;
}
.login-box input:focus { border-color: var(--purple); }
.saved-flash { color: var(--purple-bright); font-size: 12.5px; }

/* admin: image cell */
.img-cell { display: flex; align-items: center; gap: 6px; }
.img-drop {
  width: 40px; height: 40px; border-radius: 9px; border: 1px dashed var(--border);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--surface-2); color: var(--muted); font-size: 11px; overflow: hidden; flex: none;
}
.img-drop:hover { border-color: var(--purple); color: var(--purple-bright); }
.img-drop img { width: 100%; height: 100%; object-fit: contain; }
.img-drop input { display: none; }
.img-x { background: none; border: none; color: var(--muted); font-size: 13px; padding: 2px 4px; }
.img-x:hover { color: #fff; }
