:root {
  --brand: #42f099;
  --brand-2: #18c47b;
  --ink: #17211d;
  --muted: #6b746f;
  --line: #e8eee9;
  --bg: #f6faf7;
  --card: #ffffff;
  --dark: #0b1020;
  --dark-2: #151b32;
  --orange: #ffb020;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; border: 0; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px max(24px, calc((100vw - 1180px) / 2)); background: rgba(255,255,255,.86); backdrop-filter: blur(18px); border-bottom: 1px solid rgba(232,238,233,.75); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .01em; }
.logo { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--brand); color: #102019; box-shadow: 0 12px 28px rgba(66,240,153,.34); font-size: 13px; }
.logo.dark { background: linear-gradient(135deg, #4ade80, #22c55e); color: white; }
nav { display: flex; align-items: center; gap: 6px; padding: 6px; background: white; border-radius: 999px; }
nav a { padding: 10px 18px; border-radius: 999px; color: var(--muted); font-size: 14px; font-weight: 650; }
nav a.active { background: var(--brand); color: #0b1a13; box-shadow: 0 10px 24px rgba(66,240,153,.28); }
.ghost { padding: 10px 14px; border-radius: 12px; background: #f0f7f2; color: var(--ink); font-weight: 700; }
.primary { border-radius: 13px; padding: 12px 18px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #082016; font-weight: 800; box-shadow: 0 14px 32px rgba(66,240,153,.26); }
.primary:disabled { opacity: .55; cursor: not-allowed; }
.full { width: 100%; }

main { max-width: 1180px; margin: 0 auto; padding: 0 24px 48px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 36px; align-items: center; min-height: 360px; padding: 48px 0 28px; }
.shop-hero { position: relative; }
.shop-hero:before { content: ""; position: absolute; inset: 20px -8vw auto auto; width: 460px; height: 260px; background: radial-gradient(circle, rgba(66,240,153,.2), transparent 62%); pointer-events: none; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: rgba(66,240,153,.14); color: #139060; font-size: 13px; font-weight: 800; }
h1 { margin: 16px 0 12px; font-size: clamp(32px, 5vw, 54px); line-height: 1.05; letter-spacing: 0; }
h2 { margin: 0; font-size: 22px; }
p { color: var(--muted); line-height: 1.7; }
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.stats span { padding: 12px 16px; background: rgba(255,255,255,.85); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 28px rgba(28,45,36,.06); }
.stats b { font-size: 22px; }
.feature-grid { display: grid; grid-template-columns: repeat(1, 1fr); gap: 12px; }
.feature-grid article { min-height: 96px; padding: 18px; border: 1px solid rgba(66,240,153,.25); background: rgba(255,255,255,.75); border-radius: 18px; box-shadow: 0 18px 36px rgba(28,45,36,.08); }
.feature-grid b { display: block; margin-bottom: 8px; font-size: 18px; }
.feature-grid span { color: var(--muted); }

.catalog { margin-top: 16px; padding: 22px; background: white; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 18px 42px rgba(28,45,36,.06); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.search { display: flex; align-items: center; gap: 10px; min-width: 320px; }
.search.wide { max-width: 720px; min-width: 0; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; outline: 0; background: #fbfdfb; color: var(--ink); }
textarea { min-height: 84px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px rgba(66,240,153,.16); }
.filters, .sorts { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.filters button, .sorts button { padding: 9px 14px; border-radius: 999px; background: #f5f8f6; color: var(--muted); font-weight: 750; }
.filters button.active, .sorts button.active { background: var(--brand); color: #0b1a13; }
.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.product-card { position: relative; overflow: hidden; display: flex; flex-direction: column; min-height: 330px; border: 1px solid var(--line); border-radius: 18px; background: white; transition: transform .2s ease, box-shadow .2s ease; }
.product-card:hover { transform: translateY(-4px); box-shadow: 0 20px 40px rgba(28,45,36,.1); }
.product-art { height: 150px; background-image: url("/assets/product-sprite.png"); background-size: 200% 200%; background-repeat: no-repeat; }
.art-gamepad { background-position: 0 0; }
.art-spark { background-position: 100% 0; }
.art-screen { background-position: 0 100%; }
.art-bolt { background-position: 100% 100%; }
.product-body { flex: 1; display: flex; flex-direction: column; padding: 14px; }
.product-title { margin: 0 0 6px; font-weight: 850; }
.product-subtitle { min-height: 42px; margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag-row span { padding: 4px 7px; border-radius: 8px; background: #effaf4; color: #159060; font-size: 12px; font-weight: 750; }
.price-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: auto; }
.price { color: #e17900; font-size: 24px; font-weight: 900; }
.stock { color: var(--muted); font-size: 12px; }
.buy { margin-top: 12px; width: 100%; }
.soldout { opacity: .5; }

.drawer { position: fixed; inset: 0; z-index: 30; display: none; align-items: stretch; justify-content: flex-end; background: rgba(11,16,32,.32); backdrop-filter: blur(4px); }
.drawer.show { display: flex; }
.drawer-panel { position: relative; width: min(430px, 100vw); padding: 28px; background: white; box-shadow: -24px 0 50px rgba(11,16,32,.15); }
.close { position: absolute; top: 16px; right: 18px; width: 36px; height: 36px; border-radius: 50%; background: #f3f6f4; font-size: 22px; }
label { display: grid; gap: 8px; margin: 14px 0; color: var(--muted); font-size: 14px; font-weight: 750; }
.result, .redeem-result { margin-top: 16px; }
.success-box { padding: 16px; border: 1px solid rgba(66,240,153,.45); border-radius: 16px; background: #effff6; word-break: break-word; }
.error-box { padding: 14px; border: 1px solid #ffd0d0; border-radius: 14px; background: #fff4f4; color: #b42318; }

footer { padding: 32px; text-align: center; color: var(--muted); }

.redeem { min-height: 100vh; color: white; background: radial-gradient(circle at 20% 0%, rgba(74,222,128,.22), transparent 32%), linear-gradient(135deg, #080b18, #151b32 58%, #101827); }
.redeem-shell { max-width: 1080px; padding-top: 26px; }
.redeem-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 34px; }
.home-link { padding: 10px 14px; border: 1px solid rgba(255,255,255,.18); border-radius: 12px; color: rgba(255,255,255,.82); }
.redeem-card { padding: clamp(26px, 5vw, 48px); border: 1px solid rgba(255,255,255,.12); border-radius: 28px; background: rgba(255,255,255,.07); backdrop-filter: blur(18px); box-shadow: 0 30px 70px rgba(0,0,0,.32); }
.dark-pill { background: rgba(74,222,128,.16); color: #86efac; }
.redeem h1 { max-width: 720px; color: white; }
.redeem p { color: rgba(255,255,255,.72); }
.redeem-form { display: grid; grid-template-columns: 1fr auto; gap: 12px; max-width: 680px; margin-top: 22px; }
.redeem input { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.16); color: white; }
.redeem input::placeholder { color: rgba(255,255,255,.5); }
.game-menu { margin-top: 28px; }
.invert h2, .invert span { color: white; }
.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.game-card { overflow: hidden; border: 1px solid rgba(255,255,255,.12); border-radius: 18px; background: rgba(255,255,255,.06); }
.game-thumb { height: 118px; background-image: url("/assets/product-sprite.png"); background-size: 200% 200%; background-repeat: no-repeat; }
.game-card-content { padding: 18px; }
.game-card b { display: block; margin-bottom: 8px; }
.account-card { display: grid; gap: 10px; margin-top: 16px; }
.copy-line { display: grid; grid-template-columns: 84px 1fr auto; gap: 8px; align-items: center; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.08); }
.copy-line code { color: white; word-break: break-all; }
.copy-line button { padding: 8px 10px; border-radius: 10px; background: #667eea; color: white; font-weight: 750; }

.admin { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; background: #f4f7fb; }
.sidebar { padding: 20px; background: #101827; color: white; }
.sidebar .brand { margin-bottom: 28px; }
.sidebar a:not(.brand) { display: block; padding: 12px 14px; margin: 8px 0; border-radius: 12px; color: rgba(255,255,255,.7); }
.sidebar a.active { background: rgba(66,240,153,.15); color: #86efac; }
.admin-main { max-width: none; padding: 28px; }
.login-card, .table-card, .edit-card { background: white; border: 1px solid #e5eaf0; border-radius: 18px; box-shadow: 0 14px 34px rgba(16,24,39,.06); }
.login-card { max-width: 420px; margin: 10vh auto; padding: 28px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.admin-head h1 { margin: 0; font-size: 34px; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(340px, .6fr); gap: 18px; align-items: start; }
.table-card, .edit-card { padding: 18px; }
.product-row, .order-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid #edf1f5; }
.product-row:first-child, .order-row:first-child { border-top: 0; }
.row-title { font-weight: 850; }
.row-meta { margin-top: 4px; color: #667085; font-size: 13px; }
.row-actions { display: flex; gap: 8px; }
.small { padding: 8px 10px; border-radius: 10px; background: #eef2f6; color: #344054; font-weight: 800; }
.small.danger { background: #fff1f1; color: #b42318; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.check input { width: auto; }
.orders-card { margin-top: 18px; }
.orders-page { padding-top: 32px; }

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; padding: 12px 16px; }
  nav { order: 3; width: 100%; justify-content: space-between; overflow-x: auto; }
  main { padding-left: 14px; padding-right: 14px; }
  .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 28px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-head { align-items: stretch; flex-direction: column; }
  .search { min-width: 0; width: 100%; }
  .redeem-form { grid-template-columns: 1fr; }
  .game-grid { grid-template-columns: 1fr; }
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  h1 { font-size: 32px; }
  .product-grid { grid-template-columns: 1fr; }
  .product-card { min-height: auto; }
  .copy-line { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
}
