:root {
  color-scheme: dark;
  --bg: #101418;
  --panel: #181e24;
  --panel-soft: #202831;
  --line: #303a45;
  --text: #eef4f8;
  --muted: #96a5b2;
  --accent: #65c7b5;
  --accent-strong: #48a895;
  --warning: #f4c66b;
  --danger: #ff7b74;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.26);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(101, 199, 181, 0.09), transparent 340px),
    var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

a {
  color: var(--accent);
}

.app-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 1rem;
}

.topbar-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.notice,
.status-panel,
.panel {
  border: 1px solid var(--line);
  background: rgba(24, 30, 36, 0.92);
  box-shadow: var(--shadow);
}

.notice {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-left: 4px solid var(--warning);
  color: #f7ead0;
}

.purpose-panel {
  margin: -4px 0 18px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 30, 36, 0.72);
}

.purpose-panel summary {
  width: fit-content;
}

.purpose-panel p {
  max-width: 920px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.sidebar {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding-right: 5px;
  scrollbar-gutter: stable;
}

.panel {
  padding: 16px;
  border-radius: 8px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #10151a;
  color: var(--text);
  padding: 10px 11px;
  min-height: 40px;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

form,
.custom-app,
.panel {
  display: grid;
  gap: 12px;
}

.toggle-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.toggle-row label {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #12181e;
}

.toggle-row input {
  width: auto;
  min-height: 0;
}

.primary-button,
.secondary-button,
.coffee-button,
.icon-button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.primary-button {
  min-height: 42px;
  padding: 0 16px;
  background: var(--accent);
  color: #08110f;
  font-weight: 800;
}

.primary-button:hover {
  background: #7ad8c8;
}

.steam-connected-button,
.steam-connected-button:hover {
  background: #b8f3e8;
  color: #08110f;
}

.secondary-button,
.icon-button {
  min-height: 40px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-soft);
  color: var(--text);
  border: 1px solid var(--line);
}

.secondary-button:hover,
.icon-button:hover {
  border-color: var(--accent);
}

.coffee-button {
  min-height: 40px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--panel-soft);
  color: var(--warning);
  border: 1px solid rgba(244, 198, 107, 0.48);
  font-weight: 700;
}

.coffee-button:hover {
  background: var(--warning);
  color: #221804;
}

.full-width {
  width: 100%;
}

.app-list {
  display: grid;
  gap: 8px;
}

.app-choice {
  display: grid;
  grid-template-columns: auto 56px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #12181e;
}

.app-choice input {
  width: auto;
  min-height: 0;
}

.app-icon {
  width: 56px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--accent);
  font-weight: 900;
  overflow: hidden;
}

.app-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.app-copy {
  display: grid;
  gap: 2px;
}

.app-copy small,
.muted {
  color: var(--muted);
}

.small {
  font-size: 0.8rem;
  line-height: 1.45;
}

.content {
  min-width: 0;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-top: 24px;
  padding: 18px 2px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.site-footer p {
  max-width: 760px;
  margin-bottom: 0;
}

.site-footer nav {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.legal-page {
  max-width: 860px;
}

.legal-card {
  display: grid;
  gap: 20px;
  padding: clamp(20px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 30, 36, 0.92);
  box-shadow: var(--shadow);
}

.legal-card section {
  display: grid;
  gap: 8px;
}

.legal-card h2,
.legal-card p,
.legal-card ul {
  margin-bottom: 0;
}

.legal-card li + li {
  margin-top: 6px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 190px) minmax(140px, 170px) auto auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.stats {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.stats strong {
  color: var(--text);
}

.filter-toggle {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #12181e;
  white-space: nowrap;
}

.filter-toggle input {
  width: auto;
  min-height: 0;
}

.status-panel {
  padding: 15px 16px;
  border-radius: 8px;
  color: var(--muted);
}

.status-panel.error {
  color: #ffd6d3;
  border-color: rgba(255, 123, 116, 0.55);
}

.privacy-helper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid rgba(244, 198, 107, 0.62);
  border-left: 4px solid var(--warning);
  border-radius: 8px;
  background: rgba(45, 36, 20, 0.96);
  box-shadow: var(--shadow);
}

.privacy-helper p {
  max-width: 760px;
  margin: 5px 0 0;
  color: #f7ead0;
  line-height: 1.5;
}

.helper-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.tour-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  width: min(390px, calc(100vw - 28px));
  padding: 18px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: #172027;
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.58);
}

.tour-panel h2 {
  margin: 10px 0 8px;
  font-size: 1.15rem;
}

.tour-panel p {
  margin-bottom: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.tour-progress,
.tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tour-progress {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.tour-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

.tour-close:hover {
  color: var(--text);
}

.tour-highlight {
  position: relative;
  z-index: 20;
  outline: 3px solid var(--warning);
  outline-offset: 5px;
  box-shadow: 0 0 0 8px rgba(244, 198, 107, 0.13), var(--shadow);
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.item-card {
  position: relative;
  display: grid;
  gap: 10px;
  grid-template-rows: 140px auto auto auto auto;
  min-height: 338px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 30, 36, 0.9);
}

.item-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.select-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.item-card img {
  position: relative;
  z-index: 1;
}

.item-card input,
.item-card a {
  position: relative;
  z-index: 3;
}

.item-card img {
  width: 100%;
  height: 140px;
  object-fit: contain;
  border-radius: 6px;
  background: #0d1116;
}

.item-copy {
  min-width: 0;
}

.item-copy h3 {
  margin-bottom: 5px;
  font-size: 0.96rem;
  line-height: 1.25;
}

.item-copy p,
.item-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
}

.tag.market {
  color: #b8f3e8;
}

.tag.duplicate {
  background: rgba(244, 198, 107, 0.14);
  color: #ffe2a3;
}

.tag.blocked {
  color: #ffd6d3;
}

.price-field {
  position: relative;
  z-index: 3;
}

summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}

@media (max-width: 920px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

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

  .stats {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100vw - 20px, 1480px);
    padding-top: 18px;
  }

  .topbar,
  .toolbar,
  .toggle-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topbar-actions {
    align-items: stretch;
  }

  .topbar-actions > * {
    width: 100%;
  }

  .site-footer {
    display: grid;
  }

  .site-footer nav {
    justify-content: flex-start;
  }

  .privacy-helper,
  .helper-actions {
    display: grid;
  }

  .helper-actions > * {
    width: 100%;
  }

  .tour-panel {
    right: 14px;
    bottom: 14px;
  }
}
