:root {
  --bg: #0b1220;
  --panel: #0f1a2e;
  --text: #e7eefc;
  --muted: rgba(231, 238, 252, 0.7);
  --border: rgba(231, 238, 252, 0.12);
  --yellow: #ffcc00;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
    Helvetica, Arial;
  background: radial-gradient(1200px 900px at 10% 10%, #122148 0, var(--bg) 45%);
  color: var(--text);
}

.landing {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 18px;
}

.landing:has(.panel.is-wide) {
  height: auto;
  min-height: 100%;
  align-items: start;
}

html:has(.panel.is-wide),
body:has(.panel.is-wide) {
  height: auto;
  min-height: 100%;
}

.panel {
  width: 100%;
  max-width: 920px;
  border: 1px solid var(--border);
  background: rgba(15, 26, 46, 0.9);
  border-radius: 16px;
  padding: 22px;
}

.panel.is-wide {
  max-width: 1440px;
}

.panel.is-wide #adminIntro {
  display: none;
}

.admin-columns {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(320px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.admin-columns .update-bar,
.admin-columns .admin-col-scans {
  grid-column: 1 / -1;
}

.admin-columns .update-bar {
  margin-top: 0;
}

.admin-version {
  display: none;
  margin-top: 16px;
  text-align: center;
  color: rgba(231, 238, 252, 0.62);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.landing:has(.panel.is-wide) .admin-version {
  display: block;
}

.admin-col-scans .form {
  grid-template-columns: minmax(220px, 1fr) auto auto auto;
  align-items: center;
}

.admin-col {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  background: rgba(8, 16, 32, 0.28);
}

.admin-col .h1,
.admin-col .h2,
.admin-col .p {
  margin-top: 0;
}

.admin-col .group-row {
  position: relative;
  grid-template-columns: 1fr;
  gap: 12px;
}

.admin-col .group-row > :first-child {
  padding-right: 56px;
}

.admin-col .gicon {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
}

.admin-col .gactions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.admin-col .gactions .btn {
  min-width: 0;
  width: 100%;
}

.h1 {
  font-size: 26px;
  font-weight: 900;
}

.update-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 204, 0, 0.7);
  background: rgba(255, 204, 0, 0.12);
  color: #ffe566;
  font-weight: 800;
}

.h2 {
  margin-top: 12px;
  font-size: 18px;
  font-weight: 800;
}

.p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.form {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

/* ===== Modal (choose group kind) ===== */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
}

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  width: min(760px, 100%);
  border: 1px solid var(--border);
  background: rgba(15, 26, 46, 0.98);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.modal-title {
  font-size: 20px;
  font-weight: 900;
}

.modal-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.kind-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 860px) {
  .kind-grid {
    grid-template-columns: 1fr;
  }
}

.kind-btn {
  border: 1px solid var(--border);
  background: rgba(231, 238, 252, 0.06);
  color: var(--text);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  text-align: left;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: center;
  justify-items: start;
}

.kind-btn:hover {
  border-color: rgba(255, 204, 0, 0.35);
  background: rgba(255, 204, 0, 0.08);
}

.kind-btn img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  justify-self: start;
}

.kind-btn .kind-name,
.kind-btn .kind-desc{
  grid-column: 2;
  min-width: 0;
  justify-self: start;
}

.kind-btn .kind-desc{
  align-self: start;
}

/* ThaiTicketMajor logo is wide */
#pickTtm {
  grid-template-columns: 140px 1fr;
}

#pickTtm img {
  width: 140px;
  height: 48px;
}

.kind-name {
  font-weight: 900;
  font-size: 18px;
  text-align: left;
}

.kind-desc {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
  text-align: left;
}

.kind-desc-3lines{
  display:flex;
  flex-direction:column;
  gap:2px;
  align-items:flex-start;
  width: 100%;
}

.kind-desc-3lines .kind-desc-line{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  text-align:left;
  width: 100%;
}

.kind-desc-2lines{
  display:flex;
  flex-direction:column;
  gap:2px;
  align-items:flex-start;
  width: 100%;
}

.kind-desc-2lines .kind-desc-line{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  text-align:left;
  width: 100%;
}

.modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.label {
  font-size: 14px;
  color: var(--muted);
}

.input {
  width: 100%;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(231, 238, 252, 0.06);
  color: var(--text);
  outline: none;
  font-size: 16px;
}

.btn {
  border: 1px solid var(--border);
  background: rgba(231, 238, 252, 0.06);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  text-align: center;
  font-size: 15px;
}

.btn.primary {
  background: rgba(255, 204, 0, 0.12);
  border-color: rgba(255, 204, 0, 0.35);
}

.btn.danger {
  background: rgba(255, 77, 79, 0.12);
  border-color: rgba(255, 77, 79, 0.35);
}

.reset-wrap {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.divider {
  margin: 18px 0;
  height: 1px;
  background: rgba(231, 238, 252, 0.08);
}

.groups {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.scan-wrap {
  overflow: auto;
  margin-top: 10px;
}

.scan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.scan-table th,
.scan-table td {
  border-bottom: 1px solid rgba(231, 238, 252, 0.08);
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.scan-table a {
  color: #93c5fd;
}

.group-row {
  display: grid;
  grid-template-columns: 1fr 80px auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  background: rgba(16, 28, 51, 0.6);
  border-radius: 12px;
  padding: 14px;
}

.gactions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.gactions .btn {
  min-width: 110px;
}

.gicon {
  display: grid;
  place-items: center;
}

.gicon img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.gicon img.ttm-logo {
  width: 78px;
  height: 28px;
}

.gname {
  font-weight: 900;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.gtags {
  display: inline-flex;
  gap: 6px;
}

.tag {
  font-size: 11px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 204, 0, 0.35);
  background: rgba(255, 204, 0, 0.10);
  color: rgba(255, 204, 0, 0.95);
}

.tag.paused {
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.14);
  color: #fecaca;
}

.gid {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.gstats {
  margin-top: 6px;
  font-size: 13px;
  color: rgba(231, 238, 252, 0.82);
  font-weight: 800;
}

.recovery-code {
  margin-top: 8px;
  padding: 14px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 204, 0, 0.7);
  background: rgba(255, 204, 0, 0.08);
  color: #ffe566;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
  word-break: break-all;
}

.group-cards {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-top: 18px;
  perspective: 1100px;
}

.group-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-height: 176px;
  padding: 18px 16px 16px;
  border-radius: 18px;
  text-decoration: none;
  color: inherit;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02) 42%, rgba(8, 16, 32, 0.35));
  border: 1px solid rgba(231, 238, 252, 0.16);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  transform-style: preserve-3d;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  overflow: hidden;
}

.group-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.16), transparent 42%);
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}

.group-card.is-hot {
  z-index: 2;
  border-color: #ffcc00;
  box-shadow:
    0 28px 50px rgba(0, 0, 0, 0.5),
    0 0 0 2px rgba(255, 204, 0, 0.9),
    0 0 48px rgba(255, 204, 0, 0.55);
}

.group-card.is-hot::before {
  opacity: 1;
}

.group-card-icon img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  display: block;
}

.group-card-icon img.ttm-logo {
  width: 86px;
  height: 30px;
}

.group-card-name {
  margin-top: auto;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0.01em;
}

.group-card.is-hot .group-card-name {
  animation: group-name-flash 0.62s linear infinite;
}

.group-card-tag {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: rgba(231, 238, 252, 0.72);
}

.group-card-count {
  font-size: 13px;
  font-weight: 800;
  color: #e7eefc;
}

.group-card-pause {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  padding: 5px 10px;
  border-radius: 999px;
  background: #f59e0b;
  color: #1c1403;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.8);
}

.group-card.is-paused {
  border-color: rgba(245, 158, 11, 0.9);
}

.group-card-go {
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  color: #052e16;
  background: #22c55e;
  border-radius: 999px;
  padding: 6px 12px;
}

@keyframes group-name-flash {
  0%, 100% {
    color: #fff;
    text-shadow: 0 0 10px #ffcc00;
    opacity: 1;
  }
  25% {
    color: #ffcc00;
    text-shadow: 0 0 16px #fff, 0 0 28px #ffcc00;
    opacity: 1;
  }
  50% {
    color: #fff;
    text-shadow: none;
    opacity: 0.2;
  }
  75% {
    color: #ffe566;
    text-shadow: 0 0 22px #ffcc00;
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .group-card,
  .group-card.is-hot .group-card-name {
    animation: none;
    transition: none;
  }
}

/* ===== 手机（≤640）适配 ===== */
@media (max-width: 640px) {
  html, body { -webkit-text-size-adjust: 100%; }
  .landing { padding: 10px; }
  .panel { padding: 14px; border-radius: 14px; }
  .h1 { font-size: 20px; }
  .h2 { font-size: 16px; margin-top: 10px; }
  .p { font-size: 14px; }
  .input { font-size: 15px; padding: 12px; }
  .btn { padding: 12px 14px; font-size: 14px; min-width: 0; }
  .admin-columns { grid-template-columns: 1fr; }
  .admin-col-scans .form { grid-template-columns: 1fr; }

  /* 已有分组卡片：改单列排 + 图标缩小放右上 */
  .group-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
    position: relative;
  }
  .gicon {
    position: absolute;
    top: 12px;
    right: 12px;
  }
  .gicon img { width: 30px; height: 30px; }
  .gicon img.ttm-logo { width: 60px; height: 22px; }
  .gname { font-size: 15px; padding-right: 44px; }
  .gid, .gstats { font-size: 12px; }
  .gactions {
    justify-content: stretch;
    gap: 8px;
  }
  .gactions .btn {
    flex: 1;
    min-width: 0;
    padding: 10px 8px;
  }

  .group-cards {
    grid-template-columns: 1fr;
  }
  .group-card {
    min-height: 148px;
  }
  .group-card-name {
    font-size: 20px;
  }

  /* 弹窗 */
  .modal { padding: 10px; }
  .modal-card { padding: 14px; border-radius: 14px; }
  .modal-title { font-size: 17px; }
  .modal-sub { font-size: 13px; }
  .kind-grid { grid-template-columns: 1fr; gap: 10px; }
  .kind-btn { padding: 12px; grid-template-columns: 44px 1fr; gap: 10px; }
  .kind-btn img { width: 44px; height: 44px; }
  #pickTtm { grid-template-columns: 90px 1fr; }
  #pickTtm img { width: 90px; height: 34px; }
  .kind-name { font-size: 16px; }
  .kind-desc { font-size: 13px; }
  .modal-actions { flex-direction: column-reverse; gap: 8px; }
  .modal-actions .btn { width: 100%; }
}


