:root {
  --bg: #f5efe7;
  --bg-2: #efe5d7;
  --ink: #1d1c18;
  --muted: #5f5a52;
  --line: rgba(29, 28, 24, 0.12);
  --panel: rgba(255, 253, 249, 0.86);
  --accent: #9d2f1f;
  --accent-2: #b87f28;
  --success: #1f7a56;
  --danger: #9f2b22;
  --warn: #a66c12;
  --shadow: 0 24px 70px rgba(30, 20, 5, 0.14);
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(70rem 70rem at 10% -10%, rgba(157, 47, 31, 0.10), transparent 60%),
    radial-gradient(60rem 60rem at 90% 0%, rgba(184, 127, 40, 0.12), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, #f8f2ea 55%, #f2e8d7 100%);
  font: 16px/1.45 "Space Grotesk", system-ui, sans-serif;
  min-height: 100vh;
}

.bg-orb {
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(30px);
  opacity: 0.45;
  z-index: -1;
}

.orb-a {
  width: 340px;
  height: 340px;
  left: -60px;
  top: 140px;
  background: rgba(157, 47, 31, 0.18);
}

.orb-b {
  width: 420px;
  height: 420px;
  right: -90px;
  top: 320px;
  background: rgba(184, 127, 40, 0.18);
}

a { color: inherit; }

.site-header {
  width: min(1180px, calc(100% - 2rem));
  margin: 1rem auto 0;
  padding: 1rem 1.1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 253, 249, 0.72);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 18px;
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: .9rem;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #6a1a11);
  box-shadow: inset 0 -10px 18px rgba(0,0,0,.18);
}

.brand strong {
  display: block;
  font-family: "Newsreader", serif;
  font-size: 1.2rem;
  line-height: 1.1;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46ch;
}

.nav {
  display: flex;
  gap: .6rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.balance-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(31,122,86,.22);
  background: rgba(31,122,86,.08);
  color: #155c41;
  border-radius: 999px;
  padding: .45rem .75rem;
  font-size: .86rem;
  font-weight: 600;
}

.verify-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .45rem .75rem;
  font-size: .82rem;
  border: 1px solid var(--line);
}

.verify-pill.ok {
  color: #155c41;
  border-color: rgba(31,122,86,.2);
  background: rgba(31,122,86,.07);
}

.verify-pill.warn {
  color: #82550f;
  border-color: rgba(166,108,18,.2);
  background: rgba(166,108,18,.08);
}

.nav a,
.ghost-btn,
button,
.cta {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  border-radius: 12px;
  padding: .65rem .9rem;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.nav a:hover,
.ghost-btn:hover,
button:hover,
.cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(29, 28, 24, 0.1);
}

button:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.cta,
button[type="submit"] {
  background: linear-gradient(135deg, var(--accent), #7b2418);
  color: #fff;
  border-color: rgba(122, 36, 24, 0.6);
}

.btn-small {
  background: linear-gradient(135deg, var(--accent-2), #8f631f);
  color: #fff !important;
  border-color: rgba(143, 99, 31, 0.6);
}

.inline-form { display: inline; margin: 0; }

.container {
  width: min(1180px, calc(100% - 2rem));
  margin: 1rem auto 2rem;
  display: grid;
  gap: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.hero {
  display: grid;
  grid-template-columns: 1.3fr auto;
  gap: 1rem;
  align-items: end;
  background: linear-gradient(135deg, rgba(255,255,255,.72), rgba(255,246,236,.82));
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 1.3rem;
}

.hero h1 {
  margin: 0;
  font: 700 clamp(1.6rem, 2.8vw, 2.6rem)/1.03 "Newsreader", serif;
  max-width: 18ch;
}

.eyebrow {
  margin: 0 0 .3rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: .78rem;
}

.subtle, .muted {
  color: var(--muted);
  margin: .4rem 0 0;
}

.tiny { font-size: .82rem; }

.segment-tabs {
  display: inline-flex;
  gap: .4rem;
  padding: .3rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.55);
}

.segment-tab {
  text-decoration: none;
  padding: .6rem .85rem;
  border-radius: 10px;
  border: 1px solid transparent;
}

.segment-tab.active {
  background: rgba(157,47,31,.08);
  border-color: rgba(157,47,31,.18);
  color: #7b2418;
  font-weight: 600;
}

.filters {
  display: grid;
  grid-template-columns: 1.3fr .8fr .8fr auto;
  gap: .8rem;
}

.filters-apps {
  grid-template-columns: 1.2fr .9fr .8fr .8fr auto;
}

input, select, textarea {
  width: 100%;
  padding: .75rem .85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font: inherit;
}

textarea { resize: vertical; }

.chip-list {
  display: flex;
  gap: .55rem;
  flex-wrap: wrap;
}

.chip {
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .45rem .8rem;
  background: rgba(255,255,255,.68);
  font-size: .9rem;
}

.chip.active {
  background: rgba(184,127,40,.12);
  border-color: rgba(184,127,40,.22);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.game-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255,255,255,.72);
  box-shadow: 0 14px 30px rgba(30,20,5,.08);
  display: grid;
}

.game-avatar-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: #e8dfd2;
  border-bottom: 1px solid var(--line);
}

.game-card-body {
  padding: .85rem;
  display: grid;
  gap: .55rem;
}

.game-card-body h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255,255,255,.72);
  box-shadow: 0 14px 30px rgba(30,20,5,.08);
  display: grid;
}

.card-image-wrap { display: block; text-decoration: none; }
.card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: #e8dfd2;
}
.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  background: repeating-linear-gradient(
    45deg,
    rgba(95, 90, 82, 0.08),
    rgba(95, 90, 82, 0.08) 8px,
    rgba(95, 90, 82, 0.04) 8px,
    rgba(95, 90, 82, 0.04) 16px
  );
}

.card-body { padding: .9rem; }
.card-body h3 {
  margin: .25rem 0 .4rem;
  font-size: 1.05rem;
  line-height: 1.2;
}
.card-body h3 a { text-decoration: none; }
.meta { margin: 0; color: var(--muted); font-size: .8rem; }
.desc { margin: 0; color: #3b382f; font-size: .9rem; min-height: 2.5rem; }
.card-row {
  margin-top: .7rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.price { font-weight: 700; font-size: 1rem; }
.seller { color: var(--muted); font-size: .86rem; }

.auth-shell {
  display: grid;
  place-items: center;
  padding: 1rem 0;
}

.auth-panel {
  width: min(520px, 100%);
}

.auth-panel h1 {
  margin-top: 0;
  font-family: "Newsreader", serif;
  font-size: 2rem;
}

.stack-form {
  display: grid;
  gap: .85rem;
}

.stack-form label {
  display: grid;
  gap: .35rem;
  color: #2a281f;
  font-weight: 500;
}

.checkbox-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: flex-start;
  gap: .6rem !important;
  font-weight: 400 !important;
  color: var(--ink) !important;
}

.checkbox-row input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: .15rem;
  padding: 0;
  flex: 0 0 auto;
}

.checkbox-row span {
  line-height: 1.35;
}

.wide-form { max-width: 840px; }
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .8rem;
}

.actions-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

.auto-delivery-box,
.notice-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.65);
  padding: .85rem;
}

.notice-box {
  margin-top: .8rem;
  display: grid;
  gap: .25rem;
}

.detail-layout {
  display: grid;
  grid-template-columns: 1.5fr .8fr;
  gap: 1rem;
  align-items: start;
}

.detail-card {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 1rem;
}

.detail-image-wrap {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  min-height: 300px;
}

.detail-image {
  width: 100%;
  height: 100%;
  max-height: 480px;
  object-fit: cover;
  display: block;
  background: #e8dfd2;
}

.detail-content h1 {
  margin: .15rem 0 .2rem;
  font-family: "Newsreader", serif;
  font-size: clamp(1.6rem, 2.1vw, 2.25rem);
  line-height: 1.05;
}

.price-big {
  margin: .35rem 0 .8rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.description-box {
  white-space: pre-wrap;
  background: rgba(255,255,255,.68);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .9rem;
  margin-top: .8rem;
}

.purchase-panel h2 {
  margin-top: 0;
  font-family: "Newsreader", serif;
}

.purchase-side-links {
  margin-top: .85rem;
  display: grid;
  gap: .35rem;
}

.purchase-side-links a {
  color: var(--muted);
}

.status-pill {
  display: inline-block;
  padding: .25rem .55rem;
  border-radius: 999px;
  font-size: .8rem;
  text-transform: capitalize;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.7);
}

.status-active { color: var(--success); border-color: rgba(31,122,86,.25); }
.status-hidden { color: var(--warn); border-color: rgba(166,108,18,.25); }
.status-sold { color: var(--danger); border-color: rgba(159,43,34,.25); }

.flash-stack { display: grid; gap: .5rem; }
.flash {
  border-radius: 12px;
  padding: .75rem .9rem;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.75);
}
.flash-success { border-color: rgba(31,122,86,.2); color: #155c41; }
.flash-error { border-color: rgba(159,43,34,.2); color: #7b1f19; }
.flash-warning { border-color: rgba(166,108,18,.2); color: #82550f; }

.dashboard-grid {
  display: grid;
  gap: 1rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}

th, td {
  text-align: left;
  padding: .65rem .35rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th { color: var(--muted); font-weight: 500; }

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: .75rem;
}

.timeline li {
  display: grid;
  gap: .2rem;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.72);
}

.timeline span, .timeline small { color: var(--muted); }

.admin-money-form {
  display: grid;
  grid-template-columns: 130px 150px auto;
  gap: .45rem;
  align-items: center;
}

.chat-layout {
  display: grid;
  grid-template-columns: 1.4fr .9fr;
  gap: 1rem;
  align-items: start;
}

.chat-panel h2,
.chat-compose-panel h2 {
  margin-top: 0;
  font-family: "Newsreader", serif;
}

.payment-state-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.65);
  padding: .9rem;
  margin-bottom: .9rem;
  display: grid;
  gap: .5rem;
}

.payment-state-box h2 {
  margin: 0;
  font-family: "Newsreader", serif;
}

.payment-release-form {
  margin-top: .2rem;
}

.auto-delivery-payload {
  border: 1px dashed rgba(31,122,86,.28);
  background: rgba(240,255,248,.75);
  border-radius: 12px;
  padding: .75rem .85rem;
  display: grid;
  gap: .35rem;
}

.auto-delivery-payload pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: 500 .9rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(255,255,255,.8);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .65rem;
}

.chat-thread {
  display: grid;
  gap: .75rem;
  margin-top: .6rem;
  max-height: 62vh;
  overflow-y: auto;
  padding-right: .25rem;
}

.chat-message {
  display: grid;
  gap: .25rem;
}

.chat-message.mine {
  justify-items: end;
}

.chat-meta {
  display: flex;
  gap: .6rem;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: .82rem;
}

.chat-bubble {
  max-width: min(100%, 42rem);
  white-space: pre-wrap;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.78);
  border-radius: 14px;
  padding: .75rem .85rem;
  box-shadow: 0 8px 18px rgba(29,28,24,.05);
}

.chat-message.mine .chat-bubble {
  background: linear-gradient(135deg, rgba(157,47,31,.95), rgba(123,36,24,.95));
  color: #fff;
  border-color: rgba(123,36,24,.6);
}

.chat-system-note {
  border: 1px dashed rgba(166,108,18,.35);
  background: rgba(255,251,240,.8);
  border-radius: 12px;
  padding: .75rem .85rem;
  display: grid;
  gap: .2rem;
  color: #4b3e28;
}

.chat-empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 1rem;
  background: rgba(255,255,255,.5);
}

.review-box {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  display: grid;
  gap: .5rem;
}

.review-box h2 {
  margin: 0;
  font-family: "Newsreader", serif;
}

.reviews-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: .8rem;
}

.review-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.7);
  padding: .8rem;
}

.review-head {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  align-items: center;
}

.review-head span {
  color: #b87f28;
}

.profile-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
}

.profile-avatar-wrap {
  width: 104px;
  height: 104px;
}

.profile-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #e8dfd2;
}

.profile-avatar.placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 18px;
  border: 1px solid var(--line);
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(157,47,31,.12), rgba(184,127,40,.12));
}

.support-filters {
  grid-template-columns: 240px auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .8rem;
  margin-top: .8rem;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.7);
  padding: .9rem;
  display: grid;
  gap: .25rem;
}

.stat-card span { color: var(--muted); }
.stat-card strong { font-size: 1.5rem; }

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
}
.empty-state h1, .empty-state h2 {
  margin: 0 0 .45rem;
  font-family: "Newsreader", serif;
  font-size: 2rem;
}

.site-footer {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto 1.2rem;
  color: var(--muted);
  font-size: .85rem;
}

.toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: .65rem;
  width: min(360px, calc(100vw - 24px));
  z-index: 9999;
  pointer-events: none;
}

.toast-card {
  pointer-events: auto;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255,255,255,.24);
  background: linear-gradient(180deg, rgba(34,34,34,.92), rgba(22,22,22,.95));
  color: #f3f3f3;
  border-radius: 14px;
  padding: .75rem .8rem;
  box-shadow: 0 14px 40px rgba(0,0,0,.35);
  cursor: pointer;
  transform: translateY(10px);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
}

.toast-card.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-card.toast-permission {
  background: linear-gradient(180deg, rgba(157,47,31,.95), rgba(110,33,23,.95));
}

.toast-type {
  color: rgba(255,255,255,.72);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: .2rem;
}

.toast-title {
  font-weight: 700;
  margin-bottom: .2rem;
}

.toast-body {
  color: rgba(255,255,255,.88);
  font-size: .9rem;
  line-height: 1.25;
  word-break: break-word;
}

.payment-banner {
  margin: .85rem 0 1rem;
}

.payment-banner a {
  display: block;
  max-width: 468px;
}

.payment-banner img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}

@media (max-width: 980px) {
  .detail-layout,
  .detail-card,
  .chat-layout,
  .profile-header {
    grid-template-columns: 1fr;
  }

  .hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .filters-apps,
  .support-filters {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .site-header {
    flex-direction: column;
    align-items: stretch;
  }

  .brand small {
    white-space: normal;
    max-width: none;
  }

  .nav { justify-content: flex-start; }
  .grid-2,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .admin-money-form {
    grid-template-columns: 1fr;
  }

  .segment-tabs {
    width: 100%;
    justify-content: space-between;
  }

  .segment-tab {
    flex: 1 1 auto;
    text-align: center;
  }

  .toast-host {
    left: 12px;
    right: 12px;
    width: auto;
    bottom: 12px;
  }
}
