/* ==========================================================================
   web-tabs — shared styles (hub page)
   ========================================================================== */

:root {
  --bg: #070d15;
  --bg-soft: #0b1420;
  --panel: #0f1a27;
  --panel-2: #131f2e;
  --line: #1e2c3d;
  --line-2: #2a3d52;
  --txt: #e4eefb;
  --muted: #8ea3ba;
  --acc: #4cc9ff;
  --acc-2: #7c5cff;
  --ok: #3ddc84;
  --r: 14px;
  --topbar-h: 58px;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  color: var(--txt);
  background:
    radial-gradient(900px 520px at 10% -10%, rgba(76, 201, 255, .15), transparent 60%),
    radial-gradient(760px 420px at 95% -6%, rgba(124, 92, 255, .13), transparent 58%),
    var(--bg);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Thai", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }

/* ------------------------------------------------------------------ topbar */

.topbar {
  position: relative;
  z-index: 10;
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 14px;
  background: rgba(8, 14, 22, .84);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex: none;
  min-width: 0;
}

.brand-logo {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #4cc9ff, #7c5cff);
  color: #05121d;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .3px;
  box-shadow: 0 6px 18px rgba(76, 201, 255, .28);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text b { font-size: 14.5px; letter-spacing: .2px; white-space: nowrap; }
.brand-text small { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* -------------------------------------------------------------- tab strip */

.tabstrip {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 3px 2px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
}
.tabstrip::-webkit-scrollbar { display: none; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  max-width: 220px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  color: #a6bcd3;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.tab .ico { font-size: 13px; line-height: 1; }
.tab .lbl { overflow: hidden; text-overflow: ellipsis; }
.tab:hover { background: #16283a; border-color: #35597f; color: #e6f3ff; }
.tab.on {
  color: #d5f3ff;
  border-color: #3aa6d8;
  background: linear-gradient(180deg, #12405f, #0e2c44);
  box-shadow: inset 0 0 0 1px rgba(58, 166, 216, .25);
}
.home-tab { color: var(--muted); }
.home-tab.on { color: #d5f3ff; }

/* ------------------------------------------------------------------ tools */

.tools { display: flex; align-items: center; gap: 8px; flex: none; }

.search {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0a121d;
  color: var(--muted);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: #3aa6d8; box-shadow: 0 0 0 3px rgba(76, 201, 255, .12); }
.search.wide { max-width: 380px; margin-top: 14px; }
.search svg {
  width: 15px; height: 15px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
}
.search input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--txt);
  font: inherit;
  font-size: 13.5px;
}
.search input::placeholder { color: #64798f; }
.search input::-webkit-search-cancel-button { filter: invert(.6); }

.iconbtn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0a121d;
  color: #a6bcd3;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.iconbtn:hover { background: #16283a; border-color: #35597f; color: #e6f3ff; }

/* ------------------------------------------------------------------- home */

#main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

.home {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px 36px;
}

.hero { margin-bottom: 20px; }
.hero h1 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: .2px;
  font-weight: 800;
}
.hero .count { color: var(--acc); font-weight: 700; font-size: 15px; vertical-align: 2px; }
.hero p { margin: 0; color: var(--muted); font-size: 13.5px; }

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
}

.card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: linear-gradient(180deg, rgba(21, 34, 49, .92), rgba(13, 21, 32, .92));
  text-decoration: none;
  transition: transform .16s, border-color .16s, box-shadow .16s, background .16s;
  overflow: hidden;
}
.card::after {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(76, 201, 255, .5), transparent);
  opacity: 0;
  transition: opacity .16s;
}
.card:hover {
  transform: translateY(-2px);
  border-color: rgba(76, 201, 255, .45);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .38);
  background: linear-gradient(180deg, rgba(26, 43, 62, .95), rgba(15, 25, 38, .95));
}
.card:hover::after { opacity: 1; }
.card:active { transform: translateY(0); }

.card .ico {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid rgba(76, 201, 255, .22);
  background: rgba(76, 201, 255, .1);
  font-size: 19px;
  line-height: 1;
}

.card .body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.card .t { font-size: 14px; font-weight: 700; letter-spacing: .1px; }
.card .d { font-size: 12.2px; color: var(--muted); line-height: 1.45; }

.card .arrow {
  flex: none;
  align-self: center;
  color: #4b6a86;
  font-size: 14px;
  transition: transform .16s, color .16s;
}
.card:hover .arrow { color: var(--acc); transform: translateX(3px); }

.empty { color: var(--muted); text-align: center; padding: 40px 0; font-size: 14px; }

.hintbox {
  grid-column: 1 / -1;
  padding: 18px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r);
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.9;
}
.hintbox code {
  padding: 2px 6px;
  border-radius: 6px;
  background: #0a121d;
  border: 1px solid var(--line);
  color: #9fe0ff;
  font-size: 12.5px;
}

.foot {
  margin-top: 34px;
  padding-top: 14px;
  border-top: 1px solid rgba(30, 44, 61, .7);
  color: #5f7489;
  font-size: 11.5px;
}

/* ------------------------------------------------------------------ stage */

.stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 12px 12px;
}

.stagebar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 4px 9px;
  font-size: 12.5px;
  color: var(--muted);
  min-width: 0;
}
.stagebar .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(61, 220, 132, .15);
  flex: none;
}
.stage-title {
  font-weight: 700;
  color: #cfe4f7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stagebar .spacer { flex: 1; }

.chipbtn {
  flex: none;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a121d;
  color: #a6bcd3;
  font: 600 12px/1 system-ui, Tahoma, sans-serif;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.chipbtn:hover { background: #16283a; border-color: #35597f; color: #e6f3ff; }

.frames {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-soft);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .35);
}

.frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: none;
  background: var(--bg-soft);
}
.frame.on { display: block; }

/* ------------------------------------------------------------- responsive */

@media (max-width: 820px) {
  .brand-text small { display: none; }
  .home { padding: 20px 14px 30px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
}

@media (max-width: 700px) {
  .topbar {
    flex-wrap: wrap;
    gap: 8px 10px;
    padding: 8px 10px;
  }
  .brand { order: 1; }
  .tools { order: 2; flex: 1 1 auto; justify-content: flex-end; }
  .tabstrip {
    order: 3;
    width: 100%;
    flex: 1 0 100%;
    margin: 0 -10px;
    padding: 2px 10px 0;
  }
  .stage { padding: 8px 8px 8px; }
  .stagebar .chipbtn:last-child { display: none; }
}

@media (max-width: 460px) {
  .hero h1 { font-size: 19px; }
  .grid { grid-template-columns: 1fr; }
  .search.wide { max-width: none; }
}
