:root{
  --bg: #f4f4f6;
  --card: #ffffff;
  --shadow: 0 10px 28px rgba(0,0,0,.12);
  --shadow2: 0 6px 18px rgba(0,0,0,.10);

  --red: #7a0013;         /* แดงร้านทอง */
  --red2:#b10022;
  --gold:#d6b25e;         /* ทอง */
  --gold2:#f6e3a5;
  --text:#121212;
  --muted:#7b7b7b;

  --up:#18a44b;
  --down:#d63a3a;

  --radius: 22px;
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: "Noto Sans Thai", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 500px at 20% 0%, rgba(122,0,19,.08), transparent 55%),
              radial-gradient(900px 500px at 90% 10%, rgba(214,178,94,.10), transparent 55%),
              var(--bg);
  color: var(--text);
}

.container{
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 16px 40px;
}

.topbar{
  position: sticky;
  top:0;
  z-index: 10;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.78));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0,0,0,.06);
}

.title__h1{
  font-weight: 800;
  font-size: 28px;
  letter-spacing: .2px;
}

.title__sub{
  margin-top: 4px;
  display:flex;
  align-items:center;
  gap:10px;
  color: #3a3a3a;
  font-weight: 600;
}

.gold-text{
  background: linear-gradient(180deg, var(--gold2), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.chip{
  display:inline-flex;
  align-items:center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .4px;
}
.chip--gold{
  color:#3b2a00;
  background: linear-gradient(180deg, var(--gold2), var(--gold));
  box-shadow: 0 6px 14px rgba(214,178,94,.25);
  border: 1px solid rgba(122,0,19,.10);
}

.icon-btn{
  border: 0;
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(122,0,19,.10), rgba(122,0,19,.04));
  box-shadow: 0 8px 18px rgba(122,0,19,.12);
  font-size: 18px;
}
.icon-btn:active{ transform: scale(.98); }

.status{
  display:flex;
  gap:10px;
  flex-wrap: wrap;
  margin: 14px 2px 18px;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  box-shadow: var(--shadow2);
  border: 1px solid rgba(0,0,0,.06);
  font-size: 12px;
  font-weight: 800;
}
.pill--muted{ color: var(--muted); font-weight: 700; }

.section{ margin-top: 18px; }
.section__title{
  font-size: 22px;
  font-weight: 900;
  margin: 10px 4px 12px;
  letter-spacing: .2px;
}
.rt{
  font-weight: 900;
  color: var(--red);
}

.card{
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,.06);
  padding: 18px 16px;
  position: relative;
  overflow: hidden;
}

.ribbon .ribbon__tag{
  position:absolute;
  top: 14px;
  right: 14px;
  background: linear-gradient(180deg, #ff2d55, #d8002a);
  color: #fff;
  font-weight: 900;
  padding: 10px 14px;
  border-radius: 10px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 14% 100%, 0 70%);
  box-shadow: 0 10px 22px rgba(216,0,42,.25);
}

.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
  padding: 10px 2px;
}

.left{
  display:flex;
  align-items:flex-start;
  gap: 12px;
  min-width: 0;
}

.flag-badge{
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 20px;
  background: linear-gradient(180deg, rgba(122,0,19,.10), rgba(214,178,94,.10));
  border: 1px solid rgba(122,0,19,.12);
  box-shadow: 0 10px 18px rgba(0,0,0,.10);
  position: relative;
  flex: 0 0 auto;
}
.flag-badge .mini{
  position:absolute;
  bottom:-8px;
  right:-6px;
  font-size: 9px;
  font-weight: 900;
  color: #3b2a00;
  background: linear-gradient(180deg, var(--gold2), var(--gold));
  padding: 4px 6px;
  border-radius: 999px;
  border: 1px solid rgba(122,0,19,.10);
}

.label{
  font-weight: 900;
  font-size: 22px;
}
.time{
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}
.desc{
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.35;
  max-width: 340px;
}

.right{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap: 18px;
  flex: 0 0 auto;
}

.price{
  min-width: 120px;
  text-align:right;
  font-weight: 950;
  font-size: 26px;
  letter-spacing: .3px;
}
.price.up{ color: var(--up); }
.price.down{ color: var(--down); }

.divider{
  height:1px;
  background: rgba(0,0,0,.06);
  margin: 6px 0;
}

/* LIST */
.list{ display:flex; flex-direction:column; gap: 14px; }

.market-card{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 16px;
  padding: 16px 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,.06);
}

.market-left{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 0;
}
.brand-icon{
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(122,0,19,.12), rgba(214,178,94,.10));
  border: 1px solid rgba(122,0,19,.10);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  color: var(--red);
  box-shadow: 0 10px 18px rgba(0,0,0,.10);
}
.market-name{
  font-weight: 900;
  font-size: 22px;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}
.market-time{
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.market-right{
  display:flex;
  align-items:center;
  gap: 18px;
}
.big{
  min-width: 120px;
  text-align:right;
  font-weight: 950;
  font-size: 34px;
}
.big.buy{ color: var(--down); }  /* ซื้อ = แดง */
.big.sell{ color: var(--up); }  /* ขาย = เขียว */

/* ALERTS */
.alerts{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.alerts__right{
  display:flex;
  align-items:flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.field{
  display:flex;
  flex-direction:column;
  gap: 6px;
}
.field__label{
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
}
input[type="number"]{
  width: 180px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.10);
  outline: none;
  font-weight: 900;
}
.field--inline{
  flex-direction:row;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(122,0,19,.06);
  border: 1px solid rgba(122,0,19,.10);
  font-weight: 900;
}
.note{
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.footer{
  margin-top: 18px;
  text-align:center;
  color: rgba(0,0,0,.45);
  font-weight: 800;
  font-size: 12px;
}

/* Responsive */
@media (max-width: 520px){
  .title__h1{ font-size: 24px; }
  .label{ font-size: 20px; }
  .price{ font-size: 24px; min-width: 110px; }
  .big{ font-size: 30px; min-width: 110px; }
  .market-name{ max-width: 210px; }
}
