/* ========================================================================== */
/*  KBNETZ — Global Styles                                                    */
/* ========================================================================== */

/* === Design tokens === */
:root {
  --brand-1: #111111;
  --brand-2: #FF6437;
  --brand-3: #22c55e;
  --text:    #eaeaea;
  --muted:   #9aa1a9;
  --card:        #1a1f29;
  --card-raise:  #222838;

  --copper: #B87333;
  --copper-dark: #8B5A2B;
  --silver: #C0C0C0;
  --dark-silver: #6B6B6B;

  --header-h: 88px;
}

/* === Reset / base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
img { max-width: 100%; display: block; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
  background-color: var(--brand-1);
  color: var(--text);
  line-height: 1.6;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

a {
  color: var(--brand-2);
  text-decoration: none;
  transition: color .2s ease;
}
a:hover { color: var(--brand-3); }
a:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ========================================================================== */
/*  Header                                                                    */
/* ========================================================================== */

.header-sticky {
  position: sticky; top: 0; z-index: 1000;
  background: linear-gradient(to bottom, rgba(17,17,17,.97), rgba(17,17,17,.90));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(184, 184, 184, .12);
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  height: var(--header-h);
}

/* 3-column: logo | centre | actions */
.header-container {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 100%;
  padding: 0 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
  gap: 1rem;
}

/* Left: KBNetz wordmark */
.header-logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  transition: filter .2s ease;
  flex-shrink: 0;
}
.header-logo:hover { filter: drop-shadow(0 0 6px rgba(184,115,51,.5)); }

.logo-wordmark {
  height: 77px;
  width: auto;
  object-fit: contain;
}

/* Centre: title + nav stacked */
.header-centre {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .3rem;
}

/* Main Gamez site title */
.site-title {
  margin: 0;
  line-height: 1;
}

.site-title-text {
  display: inline-block;
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  font-weight: 900;
  letter-spacing: -1.5px;
  font-style: italic;
  background: linear-gradient(
    to bottom,
    #ffb347 0%,
    #ff8c00 35%,
    #e07000 65%,
    #b85400 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,.6));
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.nav-link {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .02em;
  position: relative;
  padding: .2rem 0;
  transition: color .2s ease;
  white-space: nowrap;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 100%; height: 1px;
  background: var(--brand-2);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .2s ease-out;
}
.nav-link:hover { color: var(--text); }
.nav-link:hover::after { transform: scaleX(1); transform-origin: left; }

/* Right: search / settings / login */
.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
}

.search-input {
  background-color: var(--card);
  border: 1px solid rgba(107,107,107,.35);
  color: var(--text);
  padding: .3rem .65rem;
  border-radius: 5px;
  font-size: .82rem;
  height: 30px;
  width: 150px;
  transition: border-color .2s ease, box-shadow .2s ease, width .25s ease;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.3);
}
.search-input::placeholder { color: var(--dark-silver); font-size: .8rem; }
.search-input:focus {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 2px rgba(255,100,55,.3), inset 0 1px 2px rgba(0,0,0,.2);
  width: 190px;
}

.settings-button {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(184,115,51,.3);
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: 5px;
  cursor: pointer;
  transition: all .2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.settings-button:hover {
  background: rgba(255,255,255,.05);
  border-color: var(--brand-2);
  color: var(--text);
}
.settings-button svg {
  width: 15px;
  height: 15px;
  transition: transform .3s ease;
}
.settings-button:hover svg { transform: rotate(45deg); }

.login-button {
  background: linear-gradient(135deg, #2a2a2a, #1f1f1f);
  color: var(--text);
  border: 1px solid rgba(184,115,51,.4);
  padding: 0 .75rem;
  height: 30px;
  border-radius: 5px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.login-button:hover {
  background: linear-gradient(135deg, #333, #2a2a2a);
  border-color: var(--brand-2);
}
.login-button:active { transform: translateY(1px); }

/* ========================================================================== */
/*  GDPR Banner                                                               */
/* ========================================================================== */

.kbz-privacy-banner {
  position: fixed; left: 0; right: 0; bottom: 0;
  background-color: var(--card-raise);
  padding: .85rem 2rem;
  display: none;
  flex-direction: column;
  gap: .75rem;
  box-shadow: 0 -4px 12px rgba(0,0,0,.3);
  z-index: 2000;
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
}

:root[data-kbz-privacy="pending"] .kbz-privacy-banner {
  display: flex;
  opacity: 1;
  visibility: visible;
}

:root[data-kbz-privacy="uncertain"] .kbz-privacy-banner {
  display: none;
  opacity: 0;
  visibility: hidden;
}

.kbz-privacy-banner p { margin: 0; color: var(--text); line-height: 1.5; text-align: center; font-size: .9rem; }
.kbz-privacy-banner a { color: var(--brand-2); font-weight: 500; }
.kbz-privacy-actions { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: center; align-items: center; }
.kbz-privacy-button {
  padding: .4rem .9rem; border-radius: 5px; cursor: pointer; font-weight: 500; font-size: .85rem;
  border: 1px solid transparent; background: transparent; color: var(--text);
  transition: all .2s ease;
}
#kbzAllowBtn {
  background: linear-gradient(135deg, var(--brand-3), #16a34a);
  color: #fff; border: none;
  box-shadow: 0 2px 8px rgba(34,197,94,.3);
}
#kbzAllowBtn:hover { background: linear-gradient(135deg, #16a34a, #15803d); }
#kbzDeclineBtn {
  background: linear-gradient(135deg, #2a2a2a, #1f1f1f);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.2);
}
#kbzDeclineBtn:hover { background: linear-gradient(135deg, #333, #2a2a2a); }

:root[data-kbz-privacy="pending"] body { padding-bottom: 72px; }

/* ========================================================================== */
/*  Shared tree/nav primitives                                                */
/* ========================================================================== */

.pz-left {
  position: relative; min-width: 180px; max-width: 50vw;
  border-right: 1px solid var(--card);
  display: flex; flex-direction: column; overflow: hidden; overflow-x: hidden;
}

.pz-resizer {
  position: absolute; top: 0; right: 0; width: 6px;
  cursor: col-resize; height: 100%; background: transparent;
}
.pz-resizer:focus { outline: 2px dashed #888; outline-offset: -2px; }

.pz-tools {
  order: -1; position: sticky; top: 0; z-index: 5;
  display: flex; gap: .5rem; padding: .5rem;
  background: rgba(0,0,0,.3); backdrop-filter: saturate(120%) blur(2px);
  border-bottom: 1px solid var(--card);
  justify-content: center; align-items: center;
}

#pz-tree { flex: 1 1 auto; overflow: auto; overflow-x: hidden; padding: .5rem .25rem .5rem .5rem; }
.pz-tree ul { list-style: none; margin: 0 0 0 .75rem; padding: 0; }
.pz-tree .ti { display: block; }
.pz-tree .ti > ul { display: none; padding-left: .9rem; margin-left: .15rem; }
.pz-tree .ti.open > ul { display: block; }
.pz-tree .ti-row {
  display: flex; align-items: center; gap: .4rem;
  padding: .25rem .25rem; border-radius: .4rem; min-width: 0;
}
.pz-tree .ti-row:hover { background: rgba(255,255,255,.06); }
.pz-tree .ti button.tree-label { all: unset; cursor: pointer; color: var(--muted); transition: color .2s ease; }
.pz-tree .ti .tree-label { display: inline-block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pz-tree .ti button.tree-label:hover { color: var(--text); }
.pz-tree .ti .chev { transition: transform .15s ease; color: var(--muted); }
.pz-tree .ti.open > .ti-row > .chev { transform: rotate(90deg); }
.pz-tree .ti.leaf .chev { opacity: .35; }

/* Tree section divider */
.pz-tree-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(184,115,51,.35) 20%, rgba(184,115,51,.35) 80%, transparent);
  margin: .55rem .75rem;
  list-style: none;
}

.btn {
  display: inline-block; padding: .35rem .6rem;
  border: 1px solid rgba(107,107,107,.4);
  border-radius: .4rem;
  background: linear-gradient(135deg, rgba(42,42,42,.8), rgba(31,31,31,.8));
  color: var(--text); cursor: pointer; text-decoration: none;
  transition: all .15s ease; white-space: nowrap;
}
.btn:hover {
  background: linear-gradient(135deg, rgba(51,51,51,.9), rgba(42,42,42,.9));
  border-color: var(--copper);
  transform: translateY(-1px);
}
.btn.small { padding: .25rem .5rem; font-size: .85rem; }

#pz-tools .btn.small { width: 28px; height: 28px; padding: 0; font-size: 0; display: inline-grid; place-items: center; }
#pz-expand-all.btn.small::before { content: "▾▾"; font-size: 13px; line-height: 1; }
#pz-collapse-all.btn.small::before { content: "▸▸"; font-size: 13px; line-height: 1; }

/* ========================================================================== */
/*  Reduced Motion                                                            */
/* ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========================================================================== */
/*  Responsive — header + mobile drawer                                       */
/* ========================================================================== */

.pz-mobile-nav-toggle,
.pz-mobile-nav-backdrop { display: none; }

@media (max-width: 900px) {
  :root { --header-h: 64px; }

  .pz-left {
    position: fixed;
    z-index: 30;
    top: var(--header-h, 0);
    left: 0; bottom: 0;
    width: min(56vw, 220px);
    max-width: none; min-width: 0;
    height: auto;
    background: rgba(10,12,16,.98);
    border-right: 1px solid rgba(255,255,255,.14);
    box-shadow: 16px 0 30px rgba(0,0,0,.45);
    transform: translateX(-105%);
    transition: transform .22s ease;
  }

  .pz-left.open { transform: translateX(0); }
  .pz-resizer { display: none; }

  .pz-mobile-nav-toggle {
    display: flex;
    position: fixed; z-index: 31;
    left: 0; top: 42vh;
    transform: translateY(-50%);
    width: 30px; min-height: 100px;
    align-items: center; justify-content: center;
    padding: .4rem .15rem;
    border: 1px solid rgba(184,106,42,.6);
    border-left: none;
    border-radius: 0 .5rem .5rem 0;
    background: linear-gradient(180deg, rgba(24,26,30,.96), rgba(10,12,16,.96));
    color: var(--brand-2);
    cursor: pointer;
    box-shadow: 4px 4px 14px rgba(0,0,0,.35);
  }

  .pz-mobile-nav-toggle span {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: .12em;
    font-size: .65rem;
    font-weight: 700;
  }

  .pz-mobile-nav-backdrop {
    display: block;
    position: fixed; z-index: 20;
    inset: 0;
    background: rgba(0,0,0,.45);
  }
  .pz-mobile-nav-backdrop[hidden] { display: none; }
}

@media (max-width: 768px) {
  :root { --header-h: 64px; }

  .header-container {
    grid-template-columns: auto 1fr auto;
    padding: 0 1rem; gap: .5rem;
  }

  .logo-wordmark { height: 44px; }

  .site-title-text { font-size: clamp(1.6rem, 5vw, 2.2rem); }

  .main-nav { gap: .65rem; }

  .nav-link { font-size: .76rem; }

  .search-input {
    width: 110px;
    height: 28px;
    font-size: .78rem;
  }
  .search-input:focus { width: 140px; }

  .settings-button,
  .login-button {
    height: 28px;
  }

  .login-button { padding: 0 .6rem; font-size: .78rem; }

  .kbz-privacy-banner {
    padding: .6rem 1rem;
    gap: .5rem;
  }
  .kbz-privacy-actions { flex-wrap: wrap; justify-content: center; }
}

@media (max-width: 540px) {
  .main-nav { display: none; }
  .search-input { width: 90px; }
  .search-input:focus { width: 120px; }
  .logo-wordmark { height: 34px; }
}

/* ========================================================================== */
/*  Gamez Portal                                                               */
/* ========================================================================== */

/* Three-column layout: nav | viewport | promo */
.gz-layout {
  display: grid;
  grid-template-columns: clamp(190px, 15vw, 260px) 1fr clamp(170px, 16vw, 230px);
  min-height: calc(100vh - var(--header-h));
  position: relative;
}

/* ---- Left nav ---- */
.gz-nav {
  border-right: 1px solid var(--card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gz-tree {
  flex: 1 1 auto;
  overflow: auto;
  overflow-x: hidden;
  padding: .5rem .25rem .5rem .5rem;
}

/* Category rows fully clickable */
.gz-cat-row { cursor: pointer; }
.gz-cat-row:hover { background: rgba(255,255,255,.06); }

/* Game status badges */
.gz-status-badge {
  font-size: .62rem;
  font-weight: 600;
  padding: .1rem .3rem;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: .03em;
  vertical-align: middle;
  margin-left: .3rem;
}

.gz-status-badge.live {
  background: rgba(34,197,94,.15);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,.3);
}

.gz-status-badge.coming-soon {
  background: rgba(255,140,0,.1);
  color: #ff8c00;
  border: 1px solid rgba(255,140,0,.25);
}

/* ---- Center viewport ---- */
.gz-center {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--brand-1);
}

.gz-view {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Welcome splash */
.gz-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex: 1 1 auto;
  padding: 3rem 2rem;
  text-align: center;
  color: var(--muted);
}

.gz-welcome-icon {
  font-size: 4rem;
  line-height: 1;
  filter: grayscale(20%);
  animation: gz-float 3s ease-in-out infinite;
}

@keyframes gz-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.gz-welcome h2 {
  font-size: 1.5rem;
  color: var(--text);
  margin: 0;
}

.gz-welcome p { margin: 0; font-size: 1rem; }

/* Game card */
.gz-game-card {
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1 1 auto;
  overflow-y: auto;
}

.gz-game-header {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  flex-wrap: wrap;
}

.gz-game-icon { font-size: 2rem; line-height: 1; }

.gz-game-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: -.5px;
}

.gz-game-blurb {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 0;
}

.gz-game-tags { display: flex; gap: .5rem; flex-wrap: wrap; }

.gz-game-tag {
  font-size: .75rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  color: var(--muted);
  border: 1px solid rgba(255,255,255,.1);
}

/* iframe viewport */
.gz-iframe-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 400px;
  background: #0a0c10;
  border-radius: .5rem;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.06);
}

.gz-iframe-wrap iframe {
  width: 100%; height: 100%; min-height: 400px;
  border: none; display: block;
}

/* Coming soon state */
.gz-coming-soon {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem 2rem;
  text-align: center;
  background: rgba(255,140,0,.03);
  border-radius: .5rem;
  border: 1px dashed rgba(255,140,0,.2);
  min-height: 280px;
}

.gz-coming-soon-icon { font-size: 3rem; }

.gz-coming-soon h3 {
  font-size: 1.25rem;
  color: #ff8c00;
  margin: 0;
}

.gz-coming-soon p {
  color: var(--muted);
  margin: 0;
  font-size: .95rem;
}

/* Center bottom ad bar */
.gz-ad-bar {
  flex-shrink: 0;
  height: 64px;
  background: rgba(255,255,255,.015);
  border-top: 1px solid rgba(255,255,255,.05);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gz-ad-label {
  color: rgba(255,255,255,.1);
  font-size: .7rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
}

/* Breadcrumb bar */
.gz-breadcrumb {
  font-size: .82rem;
  color: var(--muted);
  padding: .45rem 1.5rem .2rem;
  border-bottom: 1px solid rgba(255,255,255,.04);
}

/* ---- Right promo panel ---- */
.gz-promo {
  border-left: 1px solid var(--card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gz-promo-inner {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem .85rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.gz-promo-heading {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin: 0 0 .4rem;
}

.gz-promo-list {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.gz-promo-item {
  background: var(--card);
  border-radius: .45rem;
  padding: .5rem .65rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s ease;
}

.gz-promo-item:hover {
  border-color: rgba(255,140,0,.3);
  background: var(--card-raise);
  transform: translateX(2px);
}

.gz-promo-item.active {
  border-color: #ff8c00;
  background: rgba(255,140,0,.08);
}

.gz-promo-item-icon { font-size: 1.1rem; line-height: 1; flex-shrink: 0; }

.gz-promo-item-title {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gz-promo-item-badge {
  font-size: .58rem;
  padding: .08rem .28rem;
  border-radius: 999px;
  font-weight: 700;
  flex-shrink: 0;
}

.gz-promo-item-badge.live {
  background: rgba(34,197,94,.2);
  color: #4ade80;
}

.gz-promo-item-badge.coming-soon {
  background: rgba(255,140,0,.15);
  color: #ff8c00;
}

/* Future ad block in promo panel */
.gz-promo-ad {
  flex-shrink: 0;
  height: 120px;
  margin: 0 .85rem .85rem;
  border-radius: .45rem;
  background: rgba(255,255,255,.015);
  border: 1px dashed rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Gamez responsive ---- */
@media (max-width: 1100px) {
  .gz-layout {
    grid-template-columns: clamp(170px, 14vw, 230px) 1fr clamp(150px, 15vw, 200px);
  }
}

@media (max-width: 900px) {
  .gz-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto auto;
  }

  .gz-promo {
    border-left: none;
    border-top: 1px solid var(--card);
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .gz-promo-inner {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: .6rem .85rem;
    overflow: visible;
  }

  .gz-promo-heading { display: none; }

  .gz-promo-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: .4rem;
  }

  .gz-promo-item { min-width: 130px; }

  .gz-promo-ad { display: none; }
}

@media (max-width: 600px) {
  .gz-game-card { padding: 1rem; }
  .gz-promo-inner { padding: .5rem .75rem; }
}
