@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&family=Inter:wght@400;500;600;700;800&display=swap');

/* =========================================================
   1. VARIABLES & RESET
   ========================================================= */
:root {
  --ink: #172033;
  --muted: #758096;
  --line: #e9edf4;
  --navy: #101828;
  --blue: #5267ed;
  --pale: #f5f7ff;
  --primary: #5867e8;
  --primary-hover: #4a54d9;
  --accent-green: #91f3d2;
  --bg-main: #ffffff;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: 'Kanit', sans-serif;
  background: var(--bg-main);
  line-height: 1.5;
}

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

button, input, select {
  font: inherit;
}

/* =========================================================
   2. TOPBAR & NAVIGATION
   ========================================================= */
.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  padding: 0 max(calc((100% - 1180px)/2), 5.5%);
  gap: 46px;
  border-bottom: 1px solid #f0f1f5;
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 800 19px Inter, sans-serif;
  letter-spacing: -.8px;
  white-space: nowrap;
}

.brand-mark {
  height: 38px;
  width: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #687cff, #4a54d9);
  color: white;
  font-size: 20px;
  box-shadow: 0 6px 15px #5867e83b;
}

.accent {
  color: var(--primary);
}

.brand small {
  display: block;
  font: 600 7px Inter, sans-serif;
  color: #98a1b3;
  letter-spacing: 1.35px;
  margin-top: 3px;
}

.topbar nav {
  display: flex;
  gap: 32px;
  align-items: center;
  flex: 1;
}

.topbar nav a {
  font-size: 13px;
  color: #788297;
  transition: .2s;
  font-weight: 500;
}

.topbar nav a:hover,
.topbar nav a.active {
  color: #4f61e5;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.lang-select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  outline: none;
}

.icon-btn, .menu {
  border: 0;
  background: none;
  font-size: 24px;
  color: #5c6680;
  cursor: pointer;
}

.menu {
  display: none;
}

/* =========================================================
   3. HERO SECTION
   ========================================================= */
.hero {
  background: radial-gradient(ellipse at 75% 48%, #28366d 0, #172344 34%, #111a30 72%);
  min-height: 440px;
  display: flex;
  align-items: center;
  padding: 52px max(calc((100% - 1120px)/2), 7%);
  overflow: hidden;
  position: relative;
  color: white;
}

.hero:after {
  content: '';
  position: absolute;
  width: 550px;
  height: 550px;
  border: 1px solid #ffffff0b;
  border-radius: 50%;
  right: 7%;
  top: -24%;
  box-shadow: 0 0 0 65px #ffffff05, 0 0 0 130px #ffffff04;
}

.hero-copy {
  width: 55%;
  position: relative;
  z-index: 2;
}

.eyebrow {
  font: 700 9px Inter, sans-serif;
  letter-spacing: 2px;
  color: #aebaff;
  margin-bottom: 17px;
  text-transform: uppercase;
}

.pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--accent-green);
  border-radius: 50%;
  margin-right: 8px;
  box-shadow: 0 0 0 4px #91f3d21c;
}

.hero h1 {
  font-size: 42px;
  line-height: 1.28;
  font-weight: 600;
  letter-spacing: -.8px;
  margin: 0 0 13px;
}

.hero h1 span {
  color: #91a0ff;
}

.hero-copy > p {
  font-size: 13px;
  line-height: 1.9;
  color: #b7c0d5;
  max-width: 430px;
  margin: 0 0 22px;
  font-weight: 300;
}

.searchbar {
  width: min(440px, 100%);
  height: 48px;
  background: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  padding: 5px 6px 5px 15px;
  gap: 10px;
  color: #8e97ab;
}

.searchbar > span {
  font-size: 22px;
}

.searchbar input {
  border: 0;
  outline: 0;
  flex: 1;
  min-width: 0;
  color: #202b42;
  font-size: 12px;
}

.searchbar button {
  border: 0;
  background: #5869ee;
  color: #fff;
  padding: 9px 17px;
  border-radius: 7px;
  font-size: 12px;
  cursor: pointer;
  transition: .2s;
}

.searchbar button:hover {
  background: var(--primary-hover);
}

.hero-tags {
  display: flex;
  gap: 20px;
  margin-top: 17px;
  color: #a9b4cc;
  font-size: 10px;
}

/* Hero Art - Phone Mockup */
.hero-art {
  position: absolute;
  right: 11%;
  height: 100%;
  width: 350px;
  display: grid;
  place-items: center;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
}

.orb-a {
  height: 265px;
  width: 265px;
  background: linear-gradient(135deg, #586be85e, #a76df12e);
  right: 17px;
  top: 82px;
}

.orb-b {
  height: 140px;
  width: 140px;
  background: #5d7afc20;
  left: 5px;
  bottom: 40px;
}

.phone {
  position: relative;
  z-index: 1;
  width: 207px;
  height: 335px;
  border: 5px solid #293756;
  background: linear-gradient(160deg, #f6f7ff, #e9edff);
  border-radius: 30px;
  box-shadow: 0 24px 70px #050b1e9c;
  padding: 13px 12px;
  color: #18233c;
  transform: rotate(5deg);
}

.phone-top {
  display: flex;
  justify-content: space-between;
  font: 600 8px Inter, sans-serif;
  color: #68748e;
}

.phone-top i {
  position: absolute;
  width: 45px;
  height: 10px;
  background: #293756;
  top: -1px;
  left: 76px;
  border-radius: 0 0 8px 8px;
}

.phone-label {
  font: 800 9px Inter, sans-serif;
  letter-spacing: 1px;
  margin: 25px 0 12px;
}

.app-tile {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  padding: 9px;
  border-radius: 12px;
  box-shadow: 0 5px 16px #1a2a5710;
  min-width: 0;
  cursor: pointer;
}

.app-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: white;
  font-size: 18px;
  flex-shrink: 0;
}

.purple { background: linear-gradient(140deg, #9a70ef, #6754d9); }
.blue { background: linear-gradient(140deg, #60c8f0, #4e79db); }
.orange { background: linear-gradient(140deg, #ffb65e, #f07b55); }
.green { background: linear-gradient(140deg, #5fd6ad, #29a783); }

.app-tile b { font-size: 9px; display: block; }
.app-tile small { font-size: 7px; color: #9ba4b8; display: block; }
.tile-main { padding: 12px; }
.tile-arrow { margin-left: auto; color: #7182e9; }

.mini-row { display: flex; gap: 7px; margin-top: 9px; }
.mini-row .app-tile { flex: 1; padding: 7px 5px; }
.mini-row .app-icon { width: 28px; height: 28px; font-size: 14px; }

.phone-bottom {
  position: absolute;
  bottom: 12px;
  left: 22px;
  right: 22px;
  display: flex;
  justify-content: space-between;
  color: #7e8be2;
  font-size: 13px;
}

.float-card {
  position: absolute;
  z-index: 3;
  right: -40px;
  bottom: 62px;
  display: flex;
  gap: 9px;
  align-items: center;
  background: white;
  color: #19233b;
  padding: 11px 14px;
  border-radius: 12px;
  box-shadow: 0 12px 30px #050b1e55;
  transform: rotate(-4deg);
}

.float-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #f1efff;
  color: #7964e9;
  display: grid;
  place-items: center;
}

.float-card b { display: block; font-size: 10px; }
.float-card small { display: block; color: #9099ac; font-size: 8px; }

/* =========================================================
   4. LAYOUT WITH SIDEBAR ADS & CONTENT
   ========================================================= */
.site-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

.ad-sidebar {
  width: 160px;
  padding: 20px 5px;
  display: none;
  flex-shrink: 0;
}

.ad-sidebar-sticky {
  position: sticky;
  top: 90px;
  display: flex;
  justify-content: center;
}

.main-content {
  flex: 1;
  max-width: 1120px;
  width: 100%;
  padding: 0 20px;
}

@media (min-width: 1280px) {
  .ad-sidebar {
    display: block;
  }
}

/* =========================================================
   5. ADSTERRA SLOTS CONTAINER
   ========================================================= */
.ad-slot {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px auto;
  overflow: hidden;
  border-radius: 8px;
  background: #fafbfe;
}

.ad-300x250 { width: 300px; height: 250px; }
.ad-320x50 { width: 320px; height: 50px; }
.ad-160x300 { width: 160px; height: 300px; }

/* =========================================================
   6. MOD GRID & CARDS ( dynamic จาก Supabase )
   ========================================================= */
.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 15px;
}

.mod-card {
  border: 1px solid #edf0f5;
  border-radius: 12px;
  padding: 16px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  color: inherit;
  text-decoration: none;
}

.mod-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px #1e2b4b0d;
  border-color: #aab4ff;
}

.mod-card img {
  width: 75px;
  height: 75px;
  border-radius: 18px;
  object-fit: cover;
  margin-bottom: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.mod-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  background: #f0f2ff;
  color: #5267ed;
  margin-bottom: 8px;
}

.mod-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 36px;
}

.mod-meta {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px dashed #f0f2f6;
  padding-top: 10px;
  margin-top: auto;
}

/* =========================================================
   7. SUBMIT SECTION & FOOTER
   ========================================================= */
.submit-section {
  max-width: 1120px;
  margin: 58px auto 30px;
  padding: 25px 28px;
  border: 1px solid #e9ecf7;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(100deg, #f8f9ff, #fff);
}

.submit-section h4 {
  font-size: 18px;
  font-weight: 600;
  margin: 4px 0 0;
}

.submit-section p {
  font-size: 11px;
  color: #929caf;
  margin: 5px 0 0;
}

.submit-cta {
  background: #5668e9;
  color: white;
  padding: 11px 17px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 7px 16px #5969e52a;
  transition: .2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.submit-cta:hover {
  background: var(--primary-hover);
}

footer {
  border-top: 1px solid #edf0f5;
  padding: 30px max(calc((100% - 1080px)/2), 7%) 22px;
  text-align: center;
  color: #929bad;
  margin-top: 40px;
}

footer .brand {
  justify-content: center;
  color: #172033;
  font-size: 16px;
}

footer .brand-mark {
  width: 32px;
  height: 32px;
  font-size: 17px;
  border-radius: 10px;
}

footer p {
  font-size: 11px;
  margin: 12px 0 17px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 23px;
  flex-wrap: wrap;
  font-size: 11px;
  margin-bottom: 18px;
}

.footer-links a:hover {
  color: #5367e9;
}

.copyright {
  font: 10px Inter, sans-serif;
  color: #b4bbc8;
}

/* =========================================================
   8. RESPONSIVE MEDIA QUERIES
   ========================================================= */
@media(max-width: 900px) {
  .topbar { gap: 24px; }
  .topbar nav { gap: 18px; }
  .hero-art { right: 6%; }
  .hero-copy { width: 59%; }
  .mod-grid { grid-template-columns: repeat(3, 1fr); }
  .submit-section { margin-left: 20px; margin-right: 20px; }
}

@media(max-width: 600px) {
  .topbar { height: 62px; padding: 0 17px; gap: 12px; }
  .brand { font-size: 16px; gap: 7px; }
  .brand-mark { width: 33px; height: 33px; border-radius: 10px; }
  .brand small { font-size: 6px; }
  .topbar nav { display: none; }
  .menu { display: block; margin-left: auto; font-size: 21px; }
  .head-actions { gap: 8px; }
  
  .hero { min-height: 560px; padding: 38px 22px 260px; align-items: flex-start; }
  .hero-copy { width: 100%; }
  .hero h1 { font-size: 32px; }
  .hero-copy > p { font-size: 12px; max-width: 360px; }
  
  .hero-art { height: 270px; width: 270px; right: calc(50% - 135px); bottom: -2px; }
  .phone { transform: scale(.76) rotate(5deg); transform-origin: center bottom; }
  .orb-a { height: 215px; width: 215px; top: 22px; right: 25px; }
  .orb-b { bottom: 8px; }
  .float-card { right: -10px; bottom: 35px; transform: scale(.85) rotate(-4deg); }
  .hero-tags { gap: 12px; font-size: 9px; }
  
  .mod-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .submit-section { margin: 35px 14px; padding: 19px; gap: 12px; align-items: flex-start; flex-direction: column; }
  .submit-cta { align-self: flex-start; }
}
