* {
  box-sizing: border-box;
}

:root {
  --bg: #101410;
  --panel: #171d18;
  --panel-2: #1f281f;
  --line: rgba(255, 255, 255, .11);
  --text: #f4f1e7;
  --muted: #a9ad9f;
  --soft: #d7c58b;
  --accent: #84b83f;
  --accent-2: #d0a63e;
  --danger: #d76f5d;
  --ok: #75b86a;
  --shadow: 0 18px 60px rgba(0, 0, 0, .34);
  --radius: 8px;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    linear-gradient(180deg, rgba(16, 20, 16, .70), #101410 78%),
    url('/template/img/bg_custom.jpg') center top / cover fixed;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

img {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.site-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(16, 20, 16, .86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.site-nav {
  max-width: 1800px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 150px;
  font-weight: 800;
  letter-spacing: .02em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #15180f;
  font-weight: 900;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
}

.nav-links a,
.nav-links button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 9px 8px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links button:hover,
.nav-links .active {
  background: rgba(255, 255, 255, .07);
  color: var(--text);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.balance-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--soft);
  background: rgba(255, 255, 255, .05);
  font-size: 13px;
}

.mobile-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
}

.mobile-panel {
  display: none;
  border-top: 1px solid var(--line);
  padding: 10px 18px 16px;
  background: rgba(16, 20, 16, .96);
}

.mobile-panel.open {
  display: grid;
  gap: 8px;
}

.mobile-panel a {
  padding: 10px 12px;
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, .05);
  white-space: nowrap;
}

.mobile-panel a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .09);
}

.site-main {
  flex: 1;
  width: 100%;
}

.page {
  max-width: 1160px;
  margin: 0 auto;
  padding: 34px 18px 54px;
}

.narrow {
  max-width: 760px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: 24px;
  align-items: stretch;
  min-height: 430px;
}

.hero-panel,
.card,
.panel {
  background: rgba(23, 29, 24, .90);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  margin-top: 10px;
  font-size: clamp(34px, 6vw, 68px);
  letter-spacing: 0;
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 17px;
}

.lead {
  color: var(--muted);
  max-width: 680px;
  margin: 18px 0 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
}

.btn-primary {
  background: var(--accent);
  color: #101410;
}

.btn-secondary {
  border-color: var(--line);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #190d0b;
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  padding: 22px;
}

.metric {
  display: grid;
  gap: 6px;
}

.metric-value {
  font-size: 32px;
  font-weight: 900;
  color: var(--soft);
}

.metric-label,
.muted {
  color: var(--muted);
}

.mini-metric {
  padding: 14px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
}

.section {
  margin-top: 24px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--text);
  font-weight: 700;
}

.field small {
  color: var(--muted);
  font-weight: 400;
}

.input,
.select,
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .22);
  color: var(--text);
}

.input:focus,
.select:focus,
.field input:focus,
.field select:focus {
  outline: 2px solid rgba(132, 184, 63, .32);
  border-color: rgba(132, 184, 63, .55);
}

.alert {
  padding: 12px 14px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .06);
}

.alert-ok {
  border-color: rgba(117, 184, 106, .45);
  color: #bfe7b8;
}

.alert-err {
  border-color: rgba(215, 111, 93, .5);
  color: #f0b5aa;
}

.blur-alert {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .06);
}

.blur-alert.success {
  border-color: rgba(117, 184, 106, .45);
  color: #bfe7b8;
}

.blur-alert.warning,
.blur-alert.info {
  border-color: rgba(208, 166, 62, .42);
  color: #f1dc9b;
}

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

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05);
  color: var(--muted);
  border-radius: 7px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 800;
}

.tab-btn.active {
  background: rgba(132, 184, 63, .16);
  color: var(--text);
  border-color: rgba(132, 184, 63, .42);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

.item-card {
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.item-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  image-rendering: pixelated;
}

.play-head {
  align-items: center;
}

.play-page-active {
  width: 100%;
  max-width: none;
  padding: 14px 14px 20px;
}

.play-page-active .play-head {
  margin-bottom: 12px;
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.play-layout-active {
  grid-template-columns: 1fr;
}

.play-stage {
  min-height: 620px;
  padding: 0;
  overflow: hidden;
}

.play-layout-active .play-stage {
  height: calc(100dvh - 132px);
  min-height: 620px;
}

.play-frame {
  width: 100%;
  height: 620px;
  border: 0;
  display: block;
  background: #080a08;
}

.play-layout-active .play-frame {
  height: 100%;
  min-height: 620px;
}

.play-placeholder {
  min-height: 620px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  padding: 32px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(132, 184, 63, .16), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(0, 0, 0, .16));
}

.play-placeholder h2 {
  max-width: 620px;
}

.play-placeholder .muted {
  max-width: 680px;
  margin: 0;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  padding: 11px 12px;
  outline: 0;
}

.field input:focus {
  border-color: rgba(132, 184, 63, .55);
}

.play-mark {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #15180f;
  font-size: 38px;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.play-side {
  display: grid;
  gap: 16px;
}

.status-list {
  display: grid;
  gap: 10px;
}

.status-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.status-row:last-child {
  border-bottom: 0;
}

.status-row span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}

.status-row.ok span {
  background: var(--ok);
}

.status-row.warn span {
  background: var(--accent-2);
}

.status-row strong {
  min-width: 0;
}

.status-row em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
  white-space: nowrap;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(12, 15, 12, .92);
}

.footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 24px 18px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
}

@media (max-width: 1600px) {
  .nav-actions .balance-chip {
    display: none;
  }
}

@media (max-width: 1240px) {
  .nav-links,
  .nav-actions {
    display: none;
  }

  .mobile-toggle {
    display: inline-grid;
    place-items: center;
    margin-left: auto;
  }

  .hero,
  .play-layout,
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    padding: 28px;
  }

  .play-stage,
  .play-placeholder {
    min-height: 460px;
  }

  .play-page-active {
    padding: 10px;
  }

  .play-layout-active .play-stage,
  .play-layout-active .play-frame {
    height: calc(100dvh - 112px);
    min-height: 520px;
  }

  .play-frame {
    height: 460px;
  }

  .footer-inner {
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .page {
    padding: 24px 12px 42px;
  }

  .card {
    padding: 16px;
  }

  .section-head {
    align-items: flex-start;
  }

  .section-head > .actions,
  .section-head > .btn {
    margin-top: 0;
  }

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

  .item-card {
    min-height: 0;
  }

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .tab-btn {
    flex: 0 0 auto;
  }
}

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