:root {
  --bg: #e8eef5;
  --bg-accent: #d4e2f2;
  --bar: #1a6fb5;
  --bar-deep: #0f4f86;
  --ink: #14324d;
  --muted: #5a738a;
  --line: rgba(15, 79, 134, 0.18);
  --active: #fff7e6;
  --active-ink: #8a4b00;
  --danger: #b42318;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: #fff;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  min-height: 100dvh;
}

.topbar {
  flex: 0 0 auto;
  display: block;
  padding: 8px 12px;
  background: linear-gradient(180deg, var(--bar) 0%, var(--bar-deep) 100%);
  color: #fff;
  box-shadow: var(--shadow), 0 2px 10px rgba(10, 40, 70, 0.22);
  z-index: 2;
}

/* Taiwan page: remove the shell nav entirely (no leftover height). */
.topbar[hidden],
html[data-tab="tw"] .topbar {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.tab {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 8px;
  min-height: 42px;
  padding: 6px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font: inherit;
  font-size: clamp(13px, 2.8vw, 16px);
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.18);
}

.tab.is-active,
.tab[aria-selected="true"] {
  background: var(--active);
  color: var(--active-ink);
  border-color: #ffd27a;
}

.tab-icon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.tab-icon--am {
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.tab-icon--tw {
  background: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}

.tab-icon--hk {
  background: #f97316;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.25);
}

.tab-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  background: #fff;
}

.embed {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  margin: 0;
  padding: 0;
  background: #fff;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 15px;
  padding: 24px;
  text-align: center;
}

.overlay[hidden] {
  display: none !important;
}

.overlay[data-error="1"] {
  color: var(--danger);
}

@media (max-width: 720px) {
  .topbar {
    padding: 8px;
  }

  .tab {
    min-height: 40px;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    padding: 6px 4px;
  }
}
