*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

@font-face {
  font-family: 'TF2Secondary';
  src: url('/fonts/TF2secondary.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'TF2Build';
  src: url('/fonts/tf2build.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root {
  --bg: #1a1a1a;
  --bg2: #141414;
  --bg3: #2a2a2a;
  --border: #333333;
  --text: #e4e4e7;
  --text2: #9999a8;
  --accent: #d97706;
  --accent-hover: #b45309;
  --ok: #22c55e;
  --err: #ef4444;
  --warn: #f59e0b;
  --radius: 6px;
  --font-body: 'TF2Secondary', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-title: 'TF2Build', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-y: scroll;
}

#bg-map {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.03;
  pointer-events: none;
  z-index: 0;
}

.navbar, .main, .footer {
  position: relative;
  z-index: 1;
}

.footer {
  background: var(--bg2);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1 { font-family: var(--font-title); font-size: 1.5rem; font-weight: normal; margin-bottom: 1rem; }
h2 { font-family: var(--font-title); font-size: 1.1rem; font-weight: normal; margin: 1.2rem 0 0.5rem; }


.navbar {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  width: 100%;
}
.navbar-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  padding: 0 24px;
}
.navbar-inner .nav-links {
  justify-self: center;
}
.navbar-inner .nav-auth {
  justify-self: end;
}
.nav-logo{
display:flex;
align-items:center;
}

.nav-logo img{
height:24px;
width:auto;
}
.nav-links { display: flex; gap: 4px; }
.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 15px;
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--bg3); }
.nav-auth { display: flex; align-items: center; gap: 10px; }
.nav-user { display: flex; align-items: center; gap: 8px; }
.nav-avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); }
.nav-username { font-size: 15px; color: var(--text2); }
.nav-link--logout { color: var(--err); }
.nav-btn-login {
  padding: 8px 18px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  transition: background 0.15s;
}
.nav-btn-login:hover { background: var(--accent-hover); color: #fff; }


.main { flex: 1; width: 100%; display: flex; justify-content: center; }
.main-inner { width: 100%; max-width: 1200px; padding: 40px 32px; }
.footer { border-top: 1px solid var(--border); width: 100%; display: flex; justify-content: center; }
.footer-inner { width: 100%; max-width: 1200px; padding: 16px 24px; color: var(--text2); font-size: 13px; text-align: center; }


.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 15px;
  border: 1px solid;
}
.alert--error { background: #1f0808; border-color: #7f1d1d; color: #fca5a5; }
.alert--success { background: #052010; border-color: #14532d; color: #86efac; }
.alert--warn { background: #1c1000; border-color: #78350f; color: #fcd34d; }


.btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, opacity 0.15s;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); color: #fff; }
.btn--primary:disabled { opacity: 0.45; cursor: not-allowed; background: var(--accent); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text2); }
.btn--ghost:hover { background: var(--bg3); color: var(--text); }

button, input, textarea, select {
  font-family: inherit;
}

.page-home {}
.home-hero { padding: 48px 0 40px; }
.home-title { font-family: var(--font-title); font-size: 2rem; font-weight: normal; margin-bottom: 10px; }
.home-sub { color: var(--text2); max-width: 460px; margin-bottom: 24px; }
.home-features { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.feature { flex: 1 1 200px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.feature-title { font-weight: 600; margin-bottom: 6px; }
.feature-text { color: var(--text2); font-size: 15px; }


.page-static { max-width: 680px; margin: 0 auto; }
.page-static p { color: var(--text2); margin-bottom: 10px; }
.help-list { padding-left: 20px; color: var(--text2); }
.help-list li { margin-bottom: 8px; }

.page-settings { max-width: 520px; margin: 0 auto; }
.settings-form { display: flex; flex-direction: column; gap: 10px; }
.form-label { font-size: 15px; font-weight: 500; }
.form-input {
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--accent); }
.form-hint { font-size: 13px; color: var(--text2); }


.page-trade {}
.trade-header { display: flex; align-items: baseline; gap: 16px; margin-bottom: 16px; }
.trade-updated { font-size: 13px; color: var(--text2); }

.trade-summary {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 18px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.summary-block { display: flex; align-items: baseline; gap: 5px; }
.summary-label { font-size: 13px; color: var(--text2); margin-right: 4px; }
.summary-val { font-size: 1.3rem; font-weight: 600; }
.summary-currency { font-size: 13px; color: var(--text2); }
.summary-arrow { font-size: 1.3rem; color: var(--text2); }
.summary-status { font-size: 13px; margin-left: auto; }
.summary-status--ok { color: var(--ok); }
.summary-status--error { color: var(--err); }
.summary-status--neutral { color: var(--text2); }

.trade-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .trade-panels { grid-template-columns: 1fr; } }

.trade-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 500;
}
.panel-count { font-size: 13px; color: var(--text2); }
.panel-controls { display: flex; gap: 8px; padding: 8px 12px; }
.inv-search { flex: 1; background: #0e0e0e; border: 1px solid #3a3a42; border-radius: 6px; color: var(--text1); font-size: 13px; padding: 5px 10px; outline: none; }
.inv-search:focus { border-color: var(--accent); }
.inv-sort { background: #0e0e0e; border: 1px solid #3a3a42; border-radius: 6px; color: var(--text1); font-size: 13px; padding: 5px 8px; outline: none; cursor: pointer; }
.inv-sort:focus { border-color: var(--accent); }

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 8px;
  padding: 12px;
  max-height: 480px;
  overflow-y: auto;
}
.inv-empty { padding: 24px; color: var(--text2); font-size: 15px; text-align: center; }

.inv-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  user-select: none;
  text-align: center;
}
.inv-item:hover { opacity: 0.80; background: #252525; }
.inv-item.item--selected { opacity: 0.45; }
.inv-item.uncraftable { border-style: dashed; }

.item-img { width: 76px; height: 76px; display: block; margin: 0 auto 4px; object-fit: contain; }
.item-img--placeholder { background: var(--bg2); border-radius: 4px; }
.item-name { font-size: 12px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; margin-bottom: 3px; }
.item-price { font-size: 13px; font-weight: 600; }
.item-currency { font-size: 12px; color: var(--text2); font-weight: 400; }


.quality-0 .item-price { color: #b2b2b2; }
.quality-1 .item-price { color: #4d7455; }
.quality-3 .item-price { color: #476291; }
.quality-5 .item-price { color: #8650ac; }
.quality-6 .item-price { color: #ffd700; }
.quality-11 .item-price { color: #cf6a32; }
.quality-13 .item-price { color: #38f3ab; }
.quality-14 .item-price { color: #aa0000; }

.quality-6 { border-color: #FFD700; }
.quality-3 { border-color: #476291; }
.quality-1 { border-color: #4D7455; }
.quality-11 { border-color: #CF6A32; }
.quality-5 { border-color: #8650AC; }
.quality-14 { border-color: #AA0000; }

.quality-6:hover { border-color: #FFD700; }
.quality-3:hover { border-color: #476291; }
.quality-1:hover { border-color: #4D7455; }
.quality-11:hover { border-color: #CF6A32; }
.quality-5:hover { border-color: #8650AC; }
.quality-14:hover { border-color: #AA0000; }

.item-img-wrap {
  position: relative;
  width: 76px;
  height: 76px;
  margin: 0 auto 4px;
}
.item-img-wrap .item-img {
  position: relative;
  z-index: 1;
  width: 76px;
  height: 76px;
  margin: 0;
}
.item-effect-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 76px;
  height: 76px;
  background-size: cover;
  background-position: center;
  border-radius: 4px;
  z-index: 0;
}

.trade-actions { display: flex; gap: 10px; margin-top: 16px; }


.page-confirm { max-width: 640px; margin: 0 auto; }
.confirm-panels { display: flex; align-items: flex-start; gap: 24px; margin: 20px 0; flex-wrap: wrap; }
.confirm-side { flex: 1 1 200px; }
.confirm-side h2 { margin-top: 0; }
.confirm-item { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 15px; color: var(--text2); }
.confirm-total { margin-top: 8px; font-weight: 600; font-size: 15px; }
.confirm-arrow { font-size: 2rem; color: var(--text2); align-self: center; }
.confirm-actions { display: flex; gap: 10px; margin-top: 20px; }


.page-result { max-width: 400px; margin: 0 auto; text-align: center; padding-top: 48px; }
.result-icon { font-size: 3rem; margin-bottom: 12px; }
.result-icon--ok { color: var(--ok); }
.result-icon--fail { color: var(--err); }
.result-id { font-size: 13px; color: var(--text2); margin: 8px 0 16px; }
.page-result h1 { margin-bottom: 8px; }
.page-result p { color: var(--text2); margin-bottom: 16px; }


.page-error { text-align: center; padding-top: 80px; }
.error-code { font-size: 5rem; font-weight: 700; color: #b30000; }
.error-msg { color: var(--text2); margin-bottom: 24px; }


::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }


@media (max-width: 600px) {

  .navbar-inner { padding: 0 14px; }
  .nav-link--logout { padding: 5px 8px; font-size: 13px; }
  .nav-avatar { display: none; }
  .nav-links { gap: 1px; }
  .nav-link { padding: 5px 10px; font-size: 11px; }
  .nav-username { display: none; }

  .main-inner { padding: 20px 16px; }

  .home-title { font-size: 1.4rem; }
  .home-features { flex-direction: column; }

  .trade-summary { gap: 12px; padding: 10px 14px; }
  .summary-val { font-size: 1.1rem; }
  .summary-status { margin-left: 0; width: 100%; }

  .inventory-grid {
    grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
    max-height: 340px;
    gap: 6px;
    padding: 8px;
  }
  .item-img { width: 62px; height: 62px; }

  .trade-actions { flex-direction: column; }
  .trade-actions .btn { width: 100%; text-align: center; }

  .confirm-panels { flex-direction: column; gap: 16px; }
  .confirm-arrow { align-self: auto; font-size: 1.4rem; }
  .confirm-actions { flex-direction: column; }
  .confirm-actions .btn { width: 100%; text-align: center; }

  .page-result { padding-top: 28px; }
  .error-code { font-size: 3.5rem; }

}

.trade-status-label {
  margin: 8px 0 0;
  font-size: .95rem;
  color: var(--text-muted);
}
.trade-status-label--ok   { color: #4caf50; }
.trade-status-label--fail { color: var(--accent); }
.trade-status-label--neutral { color: var(--text-muted); }

.inv-item.unusual-hover .item-img-wrap,
.inv-item.unusual-hover .item-name,
.inv-item.unusual-hover .item-price { visibility: hidden; }

.inv-item { position: relative; }

.inv-item-effect-label {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #8650ac;
  text-align: center;
  line-height: 1.4;
  padding: 4px 2px;
  word-break: break-word;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.inv-item.unusual-hover .inv-item-effect-label { opacity: 1; }