:root {
  --primary-dark: #0f172a;
  --accent-orange: #f97316;
  --text-white: #f8fafc;
  --sub-text: #94a3b8;

  --bg: #0f172a; 
  --panel: #1e293b; 
  --ink: #f8fafc; 
  --muted: #94a3b8; 
  --line: #334155;
  --tape: #f97316; 
  --tape-ink: #ffffff; 
  --cable: #38bdf8; 
  --ok: #10b981; 
  --miss: #f43f5e; 
  --order: #a855f7;
  
  box-sizing: border-box;
}

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

body {
  background-color: var(--primary-dark);
  color: var(--text-white);
  font-family: 'Mitr', sans-serif;
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-image: url('https://www.transparenttextures.com/patterns/circuit-board.png');
  opacity: 0.05;
  z-index: 0;
  pointer-events: none;
}

.glow {
  position: absolute;
  width: 450px; height: 450px;
  background: var(--accent-orange);
  filter: blur(130px);
  opacity: 0.08;
  z-index: 0;
  top: 200px; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px 60px;
  position: relative;
  z-index: 1;
}

/* Header Section */
.header-siamdiy { text-align: center; margin-bottom: 20px; }
.logo-container { margin-bottom: 15px; }

.main-logo {
  width: clamp(120px, 25vw, 160px);
  height: auto;
  border-radius: 50%;
  box-shadow: 0 0 35px rgba(249, 115, 22, 0.25);
  border: 4px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.5s ease;
}
.main-logo:hover { transform: scale(1.03) rotate(2deg); }

header h1 {
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  letter-spacing: 1px;
  margin-bottom: 6px;
  font-weight: 500;
}
.domain { color: var(--accent-orange); font-weight: 600; }

.tagline {
  color: var(--sub-text);
  font-weight: 300;
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  margin-bottom: 20px;
}

/* Social Icons */
.social-container {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
}
.social-item {
  color: var(--sub-text);
  font-size: 1.3rem;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-decoration: none;
}
.social-item:hover {
  color: var(--accent-orange);
  transform: translateY(-4px) scale(1.15);
}

.donate-wrapper { margin-bottom: 25px; }
.bmc-btn {
  height: 48px !important;
  width: 174px !important;
  border-radius: 8px;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.bmc-btn:hover { transform: scale(1.05); }

.hero {
  margin: 15px 0 0;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
}
.hero img { display: block; width: 100%; max-height: 380px; object-fit: cover; cursor: zoom-in; }
.hero figcaption { display: none; padding: 20px; text-align: center; color: var(--muted); font-size: 14px; }
.hero.empty img { display: none; }
.hero.empty figcaption { display: block; }
.hero:not(.empty) { border-style: solid; }

/* Sticky Control Bar */
.bar {
  position: sticky;
  top: 10px;
  z-index: 10;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  padding: 14px 16px;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.5);
}

.meter { flex: 1 1 220px; min-width: 200px; }
.meter .track { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; }
.meter .fill { height: 100%; background: var(--ok); width: 0; transition: width .3s; }
.meter small { color: var(--muted); font-size: 12px; }

.bar input[type=search] {
  font: inherit;
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  flex: 1 1 160px;
}
.bar input[type=search]:focus { outline: 2px solid var(--accent-orange); border-color: transparent; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
button {
  font: inherit;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s ease;
}
button[aria-pressed=true] {
  background: var(--accent-orange);
  color: #ffffff;
  border-color: var(--accent-orange);
  font-weight: 500;
}
button:hover:not([aria-pressed=true]) { border-color: var(--accent-orange); color: var(--accent-orange); }

.updated { color: var(--muted); font-size: 13px; margin: 12px 0 0; text-align: right; }

/* Sections & Items */
section { margin-top: 32px; }
.tape {
  display: inline-block;
  background: var(--tape);
  color: var(--tape-ink);
  font-weight: 500;
  font-size: 16px;
  padding: 4px 16px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2);
}
.count { margin-left: 10px; color: var(--muted); font-size: 13px; }

.items {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.items li {
  display: grid;
  grid-template-columns: 28px 60px 1fr auto;
  gap: 4px 14px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  transition: background 0.2s;
}
.items li:first-child { border-top: 0; }
.items li:hover { background: rgba(255, 255, 255, 0.02); }
.items li.hidden { display: none; }

.no { color: var(--muted); font-size: 13px; text-align: right; }
.thumb {
  grid-row: 1/4;
  width: 60px; height: 60px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.empty { cursor: default; border-style: dashed; }
.thumb.empty svg { width: 24px; height: 24px; stroke: var(--muted); opacity: .6; }

.name { font-weight: 400; font-size: 15px; }
.rec {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  font-weight: 400;
  padding: 1px 8px;
  border-radius: 10px;
  border: 1px solid var(--accent-orange);
  color: var(--accent-orange);
}

.right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; grid-row: 1/3; grid-column: 4; }
.qty { font-weight: 500; font-size: 14px; }
.st { display: inline-block; font-size: 12px; font-weight: 400; padding: 2px 10px; border-radius: 12px; white-space: nowrap; }
.st.y { background: rgba(16, 185, 129, 0.15); color: var(--ok); border: 1px solid rgba(16, 185, 129, 0.3); }
.st.p { background: rgba(249, 115, 22, 0.15); color: var(--tape); border: 1px solid rgba(249, 115, 22, 0.3); }
.st.o { background: rgba(168, 85, 247, 0.15); color: var(--order); border: 1px solid rgba(168, 85, 247, 0.3); }
.st.n { background: rgba(244, 63, 94, 0.15); color: var(--miss); border: 1px solid rgba(244, 63, 94, 0.3); }

.note { grid-column: 3; color: var(--muted); font-size: 13px; }
.buy { grid-column: 3; font-size: 12px; margin-top: 2px; }
.buy a { color: var(--cable); margin-right: 12px; text-decoration: none; font-weight: 500; }
.buy a:hover { text-decoration: underline; color: var(--accent-orange); }

.soft { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; margin-top: 14px; }
.soft a { color: var(--cable); text-decoration: none; }
.soft a:hover { text-decoration: underline; }
.soft ul { margin: 0; padding-left: 20px; font-size: 14px; }
.soft li { padding: 4px 0; color: var(--sub-text); }

/* SIAMDIY Legal Footer */
.legal-footer {
  margin-top: 60px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 25px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--sub-text);
  font-weight: 300;
}
.affiliate-notice { margin-bottom: 15px; opacity: 0.7; font-size: 0.7rem; }
.footer-links { margin-bottom: 12px; }
.footer-links a { color: var(--sub-text); text-decoration: none; transition: color 0.3s ease; padding: 0 5px; }
.footer-links a:hover { color: var(--accent-orange); }
.separator { opacity: 0.3; margin: 0 5px; }
.copyright { opacity: 0.5; letter-spacing: 0.5px; }
.copyright a { color: var(--text-white); text-decoration: none; font-weight: 400; transition: 0.3s; }
.copyright a:hover { color: var(--accent-orange); text-decoration: underline; }

/* Lightbox Modal */
dialog { border: 0; border-radius: 12px; padding: 16px; max-width: min(92vw, 850px); background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
dialog::backdrop { background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(4px); }
dialog img { display: block; max-width: 100%; max-height: 75vh; margin: 0 auto; border-radius: 8px; }
dialog p { margin: 12px 0 8px; text-align: center; color: var(--sub-text); font-size: 14px; }

@media (max-width: 560px) {
  .items li { grid-template-columns: 20px 48px 1fr auto; gap: 2px 10px; padding: 10px 12px; }
  .thumb { width: 48px; height: 48px; }
  .footer-links { display: flex; flex-direction: column; gap: 8px; }
  .separator { display: none; }
  .social-container { gap: 18px; }
}
/* บังคับขนาดโลโก้บน Navbar ให้เล็กลงมาขนาดพอดี */
.site-header .header-logo img {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    max-width: 38px !important;
    max-height: 38px !important;
    border-radius: 50% !important;
    margin-right: 10px !important;
    object-fit: cover !important;
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.35) !important;
}

/* ล็อกความสูงของแถบ Navbar ให้กระทัดรัด */
.site-header {
    padding: 10px 20px !important;
}