/* cny-spin.css | v20260208-1110 | single source of truth */

/* ===== Theme ===== */
:root{
  --bg1:#0b1220;
  --bg2:#121a2c;
  --line:rgba(255,255,255,.10);
  --text:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.65);
  --gold:rgba(243,196,106,.92);
  --orange:#ff6600;
  --red:#b81f2d;
  --red2:#d12a36;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background:
    radial-gradient(1200px 800px at 20% 10%, rgba(243,196,106,.12), transparent 60%),
    radial-gradient(900px 700px at 80% 20%, rgba(209,42,54,.10), transparent 55%),
    linear-gradient(135deg, var(--bg1), var(--bg2));
  color:var(--text);
  font-family: system-ui, -apple-system, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

/* ===== Container ===== */
.shell{
  max-width:1200px;
  margin:0 auto;
  padding:18px 16px 26px;
}

/* ===== Header (glass card, keep compact) ===== */
.header{
  padding:14px 14px 12px;
  border-radius:20px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}

/* top tiny brand row */
.brandline{
  display:flex;
  align-items:center;
  gap:10px;
  color:var(--muted);
  font-size:13px;
  line-height:1.2;
}
.dot{
  width:8px;
  height:8px;
  border-radius:999px;
  background:var(--gold);
  display:inline-block;
}

/* ===== ✅ TWO COMPARTMENTS: Left (text) + Right (image) ===== */
.toprow{
  margin-top:10px;
  display:grid;                 /* important: stable across browsers */
  grid-template-columns: 1fr auto;
  align-items:center;
  gap:18px;
}

/* left compartment */
.toprow .left{
  min-width:0;                  /* prevents overflow pushing layout */
}
.title{
  margin:0;
  font-size:44px;
  letter-spacing:.5px;
  line-height:1.05;
}

/* right compartment image (fixed, will not steal left space) */
.toprow .happy{
  width:150px !important;
  height:150px !important;
  flex:0 0 auto;
  border-radius:20px;
  object-fit:cover;
  border:2px solid rgba(255,255,255,.25);
  box-shadow:0 12px 28px rgba(0,0,0,.35);
}

/* ===== Buttons row ===== */
.toolbar{
  display:flex;
  gap:10px;
  align-items:center;
  margin-top:12px;
  flex-wrap:wrap;
}

.hint{
  margin-top:10px;
  color:rgba(255,170,80,.95);
  font-size:14px;
  line-height:1.55;
}

/* Base button */
.btn{
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:var(--text);
  padding:10px 14px;
  border-radius:999px;
  cursor:pointer;
  font-size:14px;
  user-select:none;
}

/* ===== Optional 3D embroidered red (you already like this) ===== */
.btn.primary,
.btn.big{
  background:
    linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,0) 35%),
    linear-gradient(180deg, var(--red2), var(--red));
  border:1px solid rgba(255,255,255,.22);
  color:#fff;
  font-weight:900;
  box-shadow:
    0 10px 22px rgba(0,0,0,.35),
    inset 0 1px 0 rgba(255,255,255,.22),
    inset 0 -2px 0 rgba(0,0,0,.28);
  text-shadow:0 1px 0 rgba(0,0,0,.25);
}

.btn.primary:active,
.btn.big:active{
  transform: translateY(1px);
  box-shadow:
    0 8px 16px rgba(0,0,0,.32),
    inset 0 1px 0 rgba(255,255,255,.18),
    inset 0 -1px 0 rgba(0,0,0,.25);
}

.btn.big{
  width:100%;
  padding:14px 16px;
  font-size:16px;
}

.btn.small{ padding:8px 12px; font-size:13px; }

/* ===== Main layout ===== */
.layout{
  margin-top:14px;
  display:grid;
  grid-template-columns: 1fr 360px;
  gap:14px;
  align-items:start;
}

.main{
  background:rgba(255,255,255,.04);
  border:1px solid var(--line);
  border-radius:18px;
  padding:12px;
}

.grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); /* 2x2 fixed */
  gap:12px;
}

.card{
  position:relative;
  background:rgba(8,12,20,.55);
  border:1px solid var(--line);
  border-radius:18px;
  overflow:hidden;
}

/* per-card reroll button */
.keep{
  position:absolute;
  top:10px; right:10px;
  z-index:2;
  border:1px solid rgba(255,255,255,.16);
  background:rgba(0,0,0,.35);
  color:#fff;
  padding:6px 10px;
  border-radius:999px;
  cursor:pointer;
  font-weight:900;
}

.imgwrap{
  position:relative;
  width:100%;
  aspect-ratio: 1 / 1;
  background:rgba(0,0,0,.18);
}
.ph{
  position:absolute; inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  color:rgba(255,255,255,.55);
  font-weight:800;
}
.img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.meta{ padding:10px 10px 12px; }
.badges{ display:flex; gap:8px; align-items:center; margin-bottom:6px; }
.badge{
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.12);
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  color:rgba(255,255,255,.75);
}
.name{
  font-weight:900;
  font-size:15px;
  line-height:1.25;
  margin-bottom:10px;
}
.go{
  display:inline-block;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.18);
  background:rgba(0,0,0,.25);
  color:#fff;
  text-decoration:none;
  font-weight:900;
}

.bottom{ margin-top:12px; }

/* ===== Aside ===== */
.aside{
  background:rgba(255,255,255,.04);
  border:1px solid var(--line);
  border-radius:18px;
  padding:12px;
}

.asideHead{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.asideTitle{ font-weight:900; }
.asideTitle .k{ color:rgba(255,170,80,.95); }

.result{
  list-style:none;
  padding:0;
  margin:12px 0 0;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.result li{
  display:flex;
  gap:10px;
  align-items:center;
  padding:10px;
  border:1px solid rgba(255,255,255,.10);
  border-radius:14px;
  background:rgba(0,0,0,.18);
}

/* thumbnails never giant */
.result img{
  width:44px !important;
  height:44px !important;
  flex:0 0 44px;
  border-radius:12px;
  object-fit:cover;
  border:1px solid rgba(255,255,255,.12);
}

.result .rTitle{ flex:1; font-weight:900; line-height:1.25; }
.result .rGo{
  padding:8px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.16);
  color:#fff;
  text-decoration:none;
  font-weight:900;
}

.source{
  margin-top:12px;
  color:rgba(255,255,255,.60);
  font-size:13px;
  line-height:1.6;
}
.srcPill{
  margin-top:8px;
  padding:8px 10px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.15);
  word-break:break-all;
}

/* ===== Responsive ===== */
@media (max-width: 980px){
  .layout{ grid-template-columns: 1fr; }
  .aside{ margin-top:12px; }
}

/* keep left+right feel on mobile (not stacked to “too散”) */
@media (max-width: 520px){
  .shell{ padding:14px 10px 22px; }

  .toprow{
    grid-template-columns: 1fr auto;   /* still two compartments */
    gap:12px;
  }
  .title{ font-size:34px; }

  .toprow .happy{
    width:120px !important;
    height:120px !important;
    border-radius:18px;
  }

  .header{ padding:12px; }
}
/* ===== Fix: top button too long on desktop ===== */
/* Desktop：#jsSpin 唔好全寬，變成內容寬 + 有上限 */
#jsSpin{
  width:auto !important;
  min-width: 260px;
  max-width: 420px;      /* 你可以改 380/420/460 */
  padding-left:18px;
  padding-right:18px;
}

/* Desktop：toolbar 左側排列，唔拉到成條 */
.toolbar{
  justify-content:flex-start;
}

/* Mobile：保持大粒易撳（全寬） */
@media (max-width: 520px){
  #jsSpin{
    width:100% !important;
    max-width:none;
    min-width:0;
  }
}
/* ===== Fix: top button too long on desktop ===== */
/* Desktop：#jsSpin 唔好全寬，變成內容寬 + 有上限 */
#jsSpin{
  width:auto !important;
  min-width: 260px;
  max-width: 420px;      /* 你可以改 380/420/460 */
  padding-left:18px;
  padding-right:18px;
}

/* Desktop：toolbar 左側排列，唔拉到成條 */
.toolbar{
  justify-content:flex-start;
}

/* Mobile：保持大粒易撳（全寬） */
@media (max-width: 520px){
  #jsSpin{
    width:100% !important;
    max-width:none;
    min-width:0;
  }
}
