@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&family=DM+Sans:wght@300;400;500&display=swap');

/* ── Reset & root ───────────────────────────────────────────── */
#smt-root *, #smt-root *::before, #smt-root *::after { box-sizing: border-box; margin: 0; padding: 0; }

#smt-root {
  --bg:        #0d0f14;
  --surface:   #161923;
  --card:      #1e2435;
  --border:    #2a3150;
  --accent:    #f5a623;
  --accent2:   #4f9eff;
  --green:     #3ecf8e;
  --red:       #ff5c5c;
  --text:      #e8eaf0;
  --muted:     #7a82a0;
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --radius:    12px;
  --shadow:    0 8px 32px rgba(0,0,0,.45);

  font-family: var(--font-body);
  background:  var(--bg);
  color:       var(--text);
  min-height:  600px;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  user-select: none;
}

/* ── Typography ─────────────────────────────────────────────── */
#smt-root h1, #smt-root h2, #smt-root h3 { font-family: var(--font-head); letter-spacing: -.5px; }

/* ── Screens ────────────────────────────────────────────────── */
.smt-screen { display: none; flex-direction: column; height: 100%; animation: smtFade .35s ease; }
.smt-screen.active { display: flex; }
@keyframes smtFade { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

/* ══ SPLASH ═════════════════════════════════════════════════ */
#smt-splash {
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 48px 24px;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, #1a2240 0%, var(--bg) 100%);
  text-align: center;
}
.smt-logo {
  font-family: var(--font-head);
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent) 30%, #ff8c00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}
.smt-logo span { display: block; font-size: .45em; font-weight: 700; color: var(--accent2); -webkit-text-fill-color: var(--accent2); }
.smt-tagline { color: var(--muted); font-size: .95rem; max-width: 340px; line-height: 1.6; }
.smt-shelf {
  display: flex;
  gap: 12px;
  font-size: 2.2rem;
  animation: smtFloat 3s ease-in-out infinite alternate;
}
@keyframes smtFloat { from { transform: translateY(0); } to { transform: translateY(-8px); } }

/* ══ BUTTONS ════════════════════════════════════════════════ */
.smt-btn {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: .95rem;
  border: none;
  border-radius: 8px;
  padding: 12px 28px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.smt-btn:hover  { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.4); filter: brightness(1.1); }
.smt-btn:active { transform: translateY(0); }
.smt-btn-primary { background: var(--accent); color: #0d0f14; }
.smt-btn-secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.smt-btn-danger { background: var(--red); color: #fff; }
.smt-btn-success { background: var(--green); color: #0d0f14; }
.smt-btn-sm { padding: 7px 16px; font-size: .82rem; }

/* ══ HUD ════════════════════════════════════════════════════ */
#smt-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.smt-hud-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: .82rem;
  font-weight: 500;
}
.smt-hud-pill .ico { font-size: 1rem; }
.smt-hud-pill .val { font-family: var(--font-head); font-size: .95rem; }
.smt-hud-pill .val.money  { color: var(--accent); }
.smt-hud-pill .val.rep    { color: var(--accent2); }
.smt-hud-pill .val.day    { color: var(--green); }

#smt-hud .smt-btn-sm { margin-left: auto; }

/* ══ MAIN GAME ══════════════════════════════════════════════ */
#smt-game { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

.smt-tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.smt-tab {
  flex: 1;
  padding: 10px 6px;
  text-align: center;
  font-family: var(--font-head);
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color .2s, border-color .2s;
}
.smt-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.smt-tab:hover:not(.active) { color: var(--text); }

.smt-panel { display: none; flex: 1; overflow-y: auto; padding: 16px; flex-direction: column; gap: 14px; }
.smt-panel.active { display: flex; }

/* ── Cards ──────────────────────────────────────────────────── */
.smt-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.smt-card-title {
  font-family: var(--font-head);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ── Shop grid ──────────────────────────────────────────────── */
.smt-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}
.smt-product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color .2s, transform .15s;
}
.smt-product-card:hover { border-color: var(--accent2); transform: translateY(-2px); }
.smt-product-icon { font-size: 1.8rem; text-align: center; }
.smt-product-name { font-weight: 500; font-size: .85rem; }
.smt-product-stock { font-size: .78rem; color: var(--muted); }
.smt-product-price {
  font-family: var(--font-head);
  font-size: .95rem;
  color: var(--accent);
}
.smt-price-row { display: flex; align-items: center; gap: 6px; }
.smt-price-input {
  width: 72px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-head);
  font-size: .88rem;
  padding: 4px 8px;
  outline: none;
}
.smt-price-input:focus { border-color: var(--accent); }

/* ── Market panel ───────────────────────────────────────────── */
.smt-market-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  transition: border-color .2s;
}
.smt-market-item:hover { border-color: var(--accent2); }
.smt-market-icon { font-size: 1.6rem; }
.smt-market-info { flex: 1; }
.smt-market-name { font-weight: 500; font-size: .88rem; }
.smt-market-cost { font-size: .78rem; color: var(--muted); }
.smt-qty-row { display: flex; align-items: center; gap: 6px; }
.smt-qty-btn {
  width: 26px; height: 26px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: background .15s;
  display: flex; align-items: center; justify-content: center;
}
.smt-qty-btn:hover { background: var(--border); }
.smt-qty-val { font-family: var(--font-head); font-size: .9rem; min-width: 24px; text-align: center; }

/* ── Upgrades ───────────────────────────────────────────────── */
.smt-upgrade-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.smt-upgrade-icon { font-size: 1.7rem; }
.smt-upgrade-info { flex: 1; }
.smt-upgrade-name { font-weight: 600; font-size: .9rem; }
.smt-upgrade-desc { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.smt-upgrade-level { font-size: .75rem; color: var(--green); margin-top: 4px; }
.smt-upgrade-cost { font-family: var(--font-head); font-size: .82rem; color: var(--accent); }
.smt-upgrade-item.maxed { opacity: .5; pointer-events: none; }

/* ── Log ────────────────────────────────────────────────────── */
.smt-log {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 4px;
}
.smt-log-entry {
  font-size: .8rem;
  padding: 6px 10px;
  background: var(--surface);
  border-left: 3px solid var(--border);
  border-radius: 0 6px 6px 0;
  color: var(--muted);
  animation: smtFade .3s ease;
}
.smt-log-entry.good  { border-color: var(--green);  color: var(--green); }
.smt-log-entry.bad   { border-color: var(--red);    color: var(--red); }
.smt-log-entry.info  { border-color: var(--accent2); color: var(--accent2); }
.smt-log-entry.money { border-color: var(--accent);  color: var(--accent); }

/* ── Stats dashboard ────────────────────────────────────────── */
.smt-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.smt-stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}
.smt-stat-val {
  font-family: var(--font-head);
  font-size: 1.5rem;
  color: var(--accent);
}
.smt-stat-label { font-size: .75rem; color: var(--muted); margin-top: 4px; }

/* ── Progress bar ───────────────────────────────────────────── */
.smt-progress-wrap { background: var(--bg); border-radius: 999px; height: 8px; overflow: hidden; }
.smt-progress-bar  {
  height: 100%;
  background: linear-gradient(90deg, var(--accent2), var(--green));
  border-radius: 999px;
  transition: width .5s ease;
}

/* ── End / overlay ──────────────────────────────────────────── */
#smt-end {
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 40px 24px;
  text-align: center;
  background: radial-gradient(ellipse 70% 50% at 50% 40%, #1a2240, var(--bg));
}
.smt-end-title {
  font-family: var(--font-head);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  background: linear-gradient(135deg, var(--accent), #ff8c00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.smt-end-score {
  font-family: var(--font-head);
  font-size: 1.1rem;
  color: var(--muted);
}
.smt-end-score span { color: var(--accent2); font-size: 1.4rem; }
.smt-confetti { font-size: 2.5rem; animation: smtFloat 2s ease-in-out infinite alternate; }

/* ── Toast ──────────────────────────────────────────────────── */
#smt-toast {
  position: absolute;
  top: 16px; left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: .85rem;
  font-weight: 500;
  z-index: 100;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow);
}
#smt-toast.show { transform: translateX(-50%) translateY(0); }
#smt-toast.good { border-color: var(--green); color: var(--green); }
#smt-toast.bad  { border-color: var(--red); color: var(--red); }

/* ── Scrollbars ─────────────────────────────────────────────── */
#smt-root ::-webkit-scrollbar { width: 5px; }
#smt-root ::-webkit-scrollbar-track { background: var(--bg); }
#smt-root ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── Next day button strip ──────────────────────────────────── */
.smt-next-day-strip {
  padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.smt-next-day-strip p { font-size: .78rem; color: var(--muted); }
