  :root{
    --primary:#6C63FF;
    --bg:#0f1221;
    --card:#171a2a;
    --soft:#22263a;
    --text:#e9ecff;
    --muted:#9aa1c7;
    --ok:#2ecc71;
  }
  *{box-sizing:border-box}
  html {
  background-color: #0f1221; /* สีพื้นหลังหลัก */
}
  body{
    margin:0;
    padding: 0;
    background:linear-gradient(180deg,#0f1221,#0b0e1a);
    font-family:"Noto Sans Thai",system-ui;
    color:var(--text)
  }
  .wrap{max-width:640px;margin:0 auto;padding:16px}
  .brand{display:flex;align-items:center;gap:10px;margin:8px 0 12px}
  .brand img{width:44px;height:44px;border-radius:12px}
  .brand h1{font-size:20px;margin:0}
  .search{
    position:sticky;
    top:0;
    background:rgba(15,18,33,.8);
    backdrop-filter:blur(8px);
    padding:10px 0 16px;
    z-index:10
  }
  .search input{
    width:100%;
    padding:14px 16px;
    border-radius:16px;
    border:1px solid #2a3050;
    background:var(--card);
    color:var(--text);
    outline:none
  }
  /* ✅ ปุ่มประวัติของฉัน */
.myhistory{
  margin-top:10px;
}
.myhistory a{
  display:block;
  width:100%;
  background:var(--primary);
  color:#fff;
  font-weight:700;
  text-align:center;
  border-radius:12px;
  padding:10px 0;            /* ✅ ลดความสูงลง */
  text-decoration:none;
  box-shadow:0 2px 6px rgba(108,99,255,.4);
  transition:background .2s ease,transform .1s ease;
}
.myhistory a:hover{background:#7a74ff}
.myhistory a:active{transform:scale(.97)}

/* ✅ สวิตช์เลือกโหมดแสดงผล */
.viewmode{
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:10px;
  color:#ccc;
  font-size:14px;
}

.switch{
  position:relative;
  display:inline-block;
  width:46px;
  height:26px;
}
.switch input{opacity:0;width:0;height:0}
.slider{
  position:absolute;cursor:pointer;
  top:0;left:0;right:0;bottom:0;
  background-color:#555;border-radius:26px;
  transition:.3s;
}
.slider:before{
  position:absolute;content:"";
  height:20px;width:20px;left:3px;bottom:3px;
  background:white;border-radius:50%;
  transition:.3s;
}
input:checked + .slider{
  background-color:var(--primary);
}
input:checked + .slider:before{
  transform:translateX(20px);
}

/* ===============================
   🌐 Custom Language Dropdown
   =============================== */
.lang-dropdown {
  position: relative;
  display: inline-block;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(145deg,#15182a,#0f1221);
  border: 1.5px solid #6c63ff;
  border-radius: 999px;
  padding: 6px 14px;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all .25s ease;
  box-shadow: 0 0 8px rgba(108,99,255,.25);
}
.lang-btn:hover {
  border-color: #8a7cff;
  box-shadow: 0 0 12px rgba(138,124,255,.4);
}
.lang-btn .flag-icon {
  width: 22px;
  height: 16px;
  border-radius: 4px;
  object-fit: cover;
}
.lang-btn .arrow {
  margin-left: 6px;
  font-size: 12px;
  opacity: 0.7;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #171a2a;
  border: 1px solid #2a3050;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(0,0,0,.5);
  display: none;
  z-index: 999;
}
.lang-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  color: #e9ecff;
  transition: all .2s ease;
}
.lang-item:hover {
  background: rgba(108,99,255,0.15);
}
.lang-item .flag-icon {
  width: 22px;
  height: 16px;
  border-radius: 4px;
  object-fit: cover;
}





/*list*/

  .grid{
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:12px;
    margin-top:14px
  }
  .card{
  background:var(--card);
  border:1px solid #222642;
  border-radius:18px;
  overflow:hidden;
  position:relative;
  text-decoration:none;
  color:inherit;
  transition: all .25s ease;
  box-shadow:0 2px 5px rgba(0,0,0,0.3);
}
.card:hover{
  transform:translateY(-3px) scale(1.03);
  box-shadow:0 6px 16px rgba(108,99,255,.35);
  border-color:var(--primary);
}
.card.touching{
  transform:translateY(-3px) scale(1.03);
  box-shadow:0 6px 16px rgba(108,99,255,.35);
  border-color:var(--primary);
}

.card:active{
  transform:scale(.97);
  box-shadow:0 1px 6px rgba(108,99,255,.2);
}

  .thumb{
    display:flex;
    align-items:center;
    gap:10px;
    padding:12px 14px;
    position:relative;
  }
  .thumb img{
    width:36px;
    height:36px;
    border-radius:9px;
    flex-shrink:0;
  }
  .title{
    font-weight:700;
    font-size:12px;
    line-height:1.2;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .foot{
    padding:10px 12px;
    border-top:1px dashed #2a3050;
    display:flex;
    justify-content:space-between;
    align-items:center;
    font-size:13px;
    color:#bfc6ff
  }
  .ok{color:var(--ok);font-weight:600}
  .empty{padding:30px;text-align:center;color:var(--muted)}
  a{color:inherit;text-decoration:none}

/*close*/
.popup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.popup-box {
  background: #171a2a;
  border: 1px solid #2a3050;
  border-radius: 16px;
  text-align: center;
  padding: 22px 18px;
  color: #e9ecff;
  max-width: 300px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  animation: fadeUp .3s ease;
}
.popup-box h3 { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.popup-box p { margin: 0 0 14px; color: #c9cff6; font-size: 15px; }
.popup-box button {
  background: linear-gradient(135deg,#6c63ff,#8a7cff);
  border: none;
  color: #fff;
  font-weight: 700;
  border-radius: 10px;
  padding: 10px 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(108,99,255,0.3);
  transition: all .25s ease;
}
.popup-box button:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(108,99,255,0.45); }
.popup-box button:active { transform: scale(0.97); }
@keyframes fadeUp { from { transform: translateY(15px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
