/* ==========================================================
   ITMLAB Unified Sky-Lab Design System (original / light / dark)
   ========================================================== */

:root,
html[data-theme="original"] {
  color-scheme: light;
  --bg-page: #f2f9ff;
  --bg-page-grad: linear-gradient(180deg, #f2f9ff 0%, #f7fbff 42%, #ffffff 100%);
  --bg-header: rgba(255, 255, 255, 0.92);
  --header-border: rgba(114, 189, 245, 0.28);
  --header-shadow: 0 8px 28px -12px rgba(17, 108, 190, 0.16);
  --header-slice: linear-gradient(125deg, #e7f5ff 0%, rgba(231, 245, 255, 0.15) 75%, transparent 100%);

  --hero-bg:
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.72) 0%, transparent 45%),
    radial-gradient(circle at 82% 28%, rgba(163, 224, 255, 0.55) 0%, transparent 48%),
    linear-gradient(180deg, #98d8ff 0%, #bfe8ff 46%, #e1f4ff 82%, #f2f9ff 100%);
  --hero-rays: repeating-linear-gradient(126deg, rgba(255, 255, 255, 0.16) 0 42px, transparent 42px 96px);
  --cloud-fill: #ffffff;
  --cloud-soft: rgba(255, 255, 255, 0.72);

  --subhero-blue: linear-gradient(160deg, #bde6ff 0%, #dff3ff 55%, #f2f9ff 100%);
  --subhero-lavender: linear-gradient(160deg, #d8d4ff 0%, #ebe8ff 55%, #f6f4ff 100%);
  --subhero-mint: linear-gradient(160deg, #b8f2ea 0%, #dcfaf5 55%, #f0fcfb 100%);

  --ink: #15325c;
  --ink-soft: #2e4b73;
  --muted: #58759b;

  --accent: #0284e8;
  --accent-bright: #0099ff;
  --accent-deep: #005eb8;
  --accent-soft: #e3f3ff;
  --accent-tint: #eff8ff;

  --lavender: #6d4aff;
  --lavender-deep: #4e32c9;
  --lavender-soft: #efeaff;
  --mint: #0e9e8e;
  --mint-deep: #09786b;
  --mint-soft: #dff9f4;

  --surface: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.92);
  --surface-soft: #f3f9ff;
  --surface-hover: #e7f4ff;
  --line: #d4e8fa;
  --line-strong: #94ccf8;
  --glass-border: rgba(255, 255, 255, 0.96);
  --glass-ring: rgba(120, 194, 248, 0.34);

  --cat-blue-bg: linear-gradient(135deg, #ffffff 0%, #edf7ff 52%, #d4eeff 100%);
  --cat-blue-border: #b6dfff;
  --cat-lavender-bg: linear-gradient(135deg, #ffffff 0%, #f4eeff 52%, #e6dcff 100%);
  --cat-lavender-border: #d5c4ff;
  --cat-mint-bg: linear-gradient(135deg, #ffffff 0%, #eafcf8 52%, #cef6ef 100%);
  --cat-mint-border: #afece2;

  --pill-surface: linear-gradient(180deg, #ffffff 0%, #f5fbff 100%);
  --switcher-bg: #e7f4ff;
  --switcher-active: #ffffff;
  --primary-btn-bg: linear-gradient(135deg, #1ea7ff 0%, #027ce0 100%);
  --primary-btn-shadow: 0 8px 20px -6px rgba(2, 124, 224, 0.45);
  --shadow-card: 0 12px 30px -12px rgba(20, 94, 168, 0.16), 0 2px 8px rgba(20, 94, 168, 0.05);
  --shadow-hover: 0 18px 38px -12px rgba(2, 132, 232, 0.26), 0 4px 12px rgba(20, 94, 168, 0.08);
  --error-text: #dc2626;
  --warn-bg: #fffbeb;
  --warn-border: #fde68a;
  --warn-text: #92400e;
  --grid-a: #ebf5fd;
  --grid-b: #ffffff;
  --footer-bg: #e6f4ff;
  --footer-sep: #b7d7f0;

  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "BIZ UDPGothic", "Noto Sans JP", Meiryo, system-ui, sans-serif;
  font-size: 16px;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg-page: #ffffff;
  --bg-page-grad: linear-gradient(180deg, #ffffff 0%, #ffffff 40%, #f8fbff 100%);
  --bg-header: rgba(255, 255, 255, 0.96);
  --header-border: #e2eaf4;
  --header-shadow: 0 6px 20px -10px rgba(15, 23, 42, 0.08);
  --header-slice: linear-gradient(125deg, #f1f6fd 0%, transparent 75%);

  --hero-bg: linear-gradient(180deg, #e5f0ff 0%, #f1f7ff 60%, #ffffff 100%);
  --hero-rays: repeating-linear-gradient(126deg, rgba(255, 255, 255, 0.45) 0 42px, transparent 42px 96px);
  --cloud-fill: #ffffff;
  --cloud-soft: rgba(255, 255, 255, 0.85);

  --subhero-blue: linear-gradient(160deg, #e3eeff 0%, #f3f8ff 100%);
  --subhero-lavender: linear-gradient(160deg, #ede9fe 0%, #f7f5ff 100%);
  --subhero-mint: linear-gradient(160deg, #defaf4 0%, #f2fdfb 100%);

  --ink: #0f2342;
  --ink-soft: #334155;
  --muted: #64748b;

  --accent: #2563eb;
  --accent-bright: #3b82f6;
  --accent-deep: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-tint: #f8fafc;

  --lavender: #6366f1;
  --lavender-deep: #4338ca;
  --lavender-soft: #eef2ff;
  --mint: #0d9488;
  --mint-deep: #0f766e;
  --mint-soft: #f0fdfa;

  --surface: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.97);
  --surface-soft: #f8fafc;
  --surface-hover: #f1f5f9;
  --line: #e2e8f0;
  --line-strong: #bfdbfe;
  --glass-border: #ffffff;
  --glass-ring: #cbd5e1;

  --cat-blue-bg: linear-gradient(135deg, #ffffff 0%, #f3f8ff 100%);
  --cat-blue-border: #cde0fb;
  --cat-lavender-bg: linear-gradient(135deg, #ffffff 0%, #f5f3ff 100%);
  --cat-lavender-border: #ddd6fe;
  --cat-mint-bg: linear-gradient(135deg, #ffffff 0%, #f0fdfa 100%);
  --cat-mint-border: #bdeee4;

  --pill-surface: #ffffff;
  --switcher-bg: #f1f5f9;
  --switcher-active: #ffffff;
  --primary-btn-bg: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --primary-btn-shadow: 0 8px 18px -6px rgba(37, 99, 235, 0.36);
  --shadow-card: 0 10px 26px -12px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.03);
  --shadow-hover: 0 18px 34px -12px rgba(37, 99, 235, 0.16), 0 4px 10px rgba(15, 23, 42, 0.05);
  --grid-a: #f1f5f9;
  --grid-b: #ffffff;
  --footer-bg: #f1f5f9;
  --footer-sep: #cbd5e1;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg-page: #0b1526;
  --bg-page-grad: linear-gradient(180deg, #0b1526 0%, #0b1526 50%, #091220 100%);
  --bg-header: rgba(13, 25, 45, 0.9);
  --header-border: rgba(56, 189, 248, 0.18);
  --header-shadow: 0 8px 28px -10px rgba(0, 0, 0, 0.55);
  --header-slice: linear-gradient(125deg, rgba(56, 189, 248, 0.12) 0%, transparent 75%);

  --hero-bg:
    radial-gradient(circle at 20% 25%, rgba(56, 189, 248, 0.16) 0%, transparent 45%),
    radial-gradient(circle at 80% 25%, rgba(99, 102, 241, 0.14) 0%, transparent 48%),
    linear-gradient(180deg, #0f2544 0%, #10203a 55%, #0c172b 100%);
  --hero-rays: repeating-linear-gradient(126deg, rgba(125, 211, 252, 0.04) 0 42px, transparent 42px 96px);
  --cloud-fill: #0b1526;
  --cloud-soft: rgba(21, 40, 68, 0.72);

  --subhero-blue: linear-gradient(160deg, #102847 0%, #0e1e36 100%);
  --subhero-lavender: linear-gradient(160deg, #1e1c42 0%, #141933 100%);
  --subhero-mint: linear-gradient(160deg, #0e2e36 0%, #0c1e2a 100%);

  --ink: #eef6ff;
  --ink-soft: #c7daf0;
  --muted: #8ea9c9;

  --accent: #38bdf8;
  --accent-bright: #5ce1ff;
  --accent-deep: #7dd3fc;
  --accent-soft: rgba(56, 189, 248, 0.16);
  --accent-tint: rgba(56, 189, 248, 0.08);

  --lavender: #a78bfa;
  --lavender-deep: #c4b5fd;
  --lavender-soft: rgba(167, 139, 250, 0.16);
  --mint: #2dd4bf;
  --mint-deep: #5eead4;
  --mint-soft: rgba(45, 212, 191, 0.16);

  --surface: #132238;
  --surface-glass: rgba(19, 34, 56, 0.94);
  --surface-soft: #0f1c2f;
  --surface-hover: #1a2f4d;
  --line: #233a5c;
  --line-strong: #325786;
  --glass-border: rgba(56, 189, 248, 0.22);
  --glass-ring: rgba(56, 189, 248, 0.25);

  --cat-blue-bg: linear-gradient(135deg, #162945 0%, #12243f 100%);
  --cat-blue-border: #2a4d7a;
  --cat-lavender-bg: linear-gradient(135deg, #1d2042 0%, #171a38 100%);
  --cat-lavender-border: #3c3a75;
  --cat-mint-bg: linear-gradient(135deg, #112d38 0%, #0f2630 100%);
  --cat-mint-border: #225963;

  --pill-surface: linear-gradient(180deg, #162842 0%, #122036 100%);
  --switcher-bg: #0c1729;
  --switcher-active: #1c3658;
  --primary-btn-bg: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  --primary-btn-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 12px 28px -12px rgba(0, 0, 0, 0.55), 0 1px 4px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 18px 36px -12px rgba(56, 189, 248, 0.18), 0 0 0 1px rgba(56, 189, 248, 0.28);
  --error-text: #f87171;
  --warn-bg: rgba(217, 119, 6, 0.16);
  --warn-border: rgba(251, 191, 36, 0.35);
  --warn-text: #fde68a;
  --grid-a: #182942;
  --grid-b: #101d31;
  --footer-bg: #0f1b2e;
  --footer-sep: #294366;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--bg-page-grad);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

main { flex: 1 0 auto; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--accent-bright); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button, summary, select { cursor: pointer; }
img { max-width: 100%; height: auto; display: block; }

.frame {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================
   Unified Header with Dropdowns & Theme Pill
   ========================================================== */
.site-masthead {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--bg-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--header-border);
  box-shadow: var(--header-shadow);
}

.site-masthead::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 240px;
  background: var(--header-slice);
  pointer-events: none;
}

.masthead-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font-weight: 900;
  font-size: 1.24rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  flex: none;
}

.brand-flask {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  border: 1px solid var(--line-strong);
  color: var(--accent);
}

.brand-lab {
  color: var(--accent-bright);
}

.nav-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-dropdown {
  position: relative;
}

.nav-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.nav-trigger svg.nav-ico {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex: none;
}

.nav-trigger svg.nav-caret {
  width: 13px;
  height: 13px;
  color: var(--muted);
  transition: transform 0.18s ease;
}

.nav-trigger:hover,
.nav-dropdown.is-open .nav-trigger {
  background: var(--accent-tint);
  color: var(--accent-deep);
}

.nav-trigger.is-current {
  background: var(--accent-soft);
  border-color: var(--line-strong);
  color: var(--accent-deep);
}

.nav-dropdown.is-open .nav-caret {
  transform: rotate(180deg);
}

.nav-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 224px;
  padding: 8px;
  border-radius: 18px;
  background: var(--surface-glass);
  border: 1.5px solid var(--line);
  box-shadow: 0 18px 40px -12px rgba(15, 58, 112, 0.24);
  backdrop-filter: blur(18px);
  display: none;
  flex-direction: column;
  gap: 3px;
  z-index: 80;
}

.nav-dropdown.is-open .nav-menu {
  display: flex;
  animation: dropFade 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropFade {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.nav-menu a,
.nav-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 700;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.nav-menu a:hover,
.nav-menu button:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.nav-menu-sub {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
}

/* Header pill theme switcher */
.theme-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--switcher-bg);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 2px rgba(15, 45, 80, 0.06);
}

.theme-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.theme-pill-btn svg {
  width: 15px;
  height: 15px;
}

.theme-pill-btn:hover {
  color: var(--ink);
}

.theme-pill-btn.is-active,
.theme-pill-btn[aria-pressed="true"] {
  background: var(--switcher-active);
  color: var(--accent-bright);
  box-shadow: 0 2px 8px rgba(15, 45, 80, 0.14);
}

.nav-mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

/* ==========================================================
   Home Sky Lab Hero
   ========================================================== */
.sky-hero {
  position: relative;
  overflow: hidden;
  background: var(--hero-bg);
  padding: clamp(28px, 4vw, 48px) 0 76px;
}

.sky-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--hero-rays);
  pointer-events: none;
}

.hero-clouds-backdrop {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 108px;
  pointer-events: none;
  z-index: 2;
}

.hero-clouds-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.hero-clouds-back { fill: var(--cloud-soft); }
.hero-clouds-front { fill: var(--bg-page); }

.sky-sparkle {
  position: absolute;
  color: #ffffff;
  opacity: 0.85;
  pointer-events: none;
  z-index: 1;
}

.sparkle-1 { top: 22px; left: 6%; width: 22px; height: 22px; }
.sparkle-2 { top: 44px; right: 7%; width: 26px; height: 26px; }
.sparkle-3 { top: 140px; left: 48%; width: 16px; height: 16px; opacity: 0.65; }

.sky-hero-inner {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: 24px;
}

.hero-logo-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-bottom: 10px;
}

.hero-emblem-svg {
  width: min(440px, 100%);
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 8px 18px rgba(0, 120, 212, 0.14));
}

.hero-emblem-itm { fill: var(--ink); }
.hero-emblem-lab { fill: var(--accent-bright); }
.hero-emblem-swoosh { stroke: var(--accent-bright); }
.hero-emblem-spark { fill: var(--accent-bright); }

.hero-tagline {
  margin-top: 10px;
  font-size: clamp(0.92rem, 1.4vw, 1.08rem);
  font-weight: 800;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

/* Lab Scene with Kumao & Piko + Desk + Flasks */
.hero-lab-scene {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-height: 235px;
  padding-top: 10px;
}

.lab-screens-bg {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(430px, 100%);
  height: auto;
  z-index: 1;
  pointer-events: none;
}

.lab-mascots-row {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  margin-bottom: -18px;
}

.lab-mascot-kumao {
  width: 175px;
  height: auto;
  filter: drop-shadow(0 6px 12px rgba(21, 50, 92, 0.14));
  animation: labBob 4.8s ease-in-out infinite;
}

.lab-mascot-piko {
  width: 128px;
  height: auto;
  margin-left: -14px;
  filter: drop-shadow(0 6px 12px rgba(21, 50, 92, 0.14));
  animation: labBob 4.2s ease-in-out -1.5s infinite;
}

@keyframes labBob {
  0%, 100% { transform: translateY(4px); }
  50% { transform: translateY(0); }
}

.lab-desk-fg {
  position: relative;
  z-index: 4;
  width: min(450px, 100%);
  height: auto;
  pointer-events: none;
}

/* ==========================================================
   Home Cards Grid (3 Category Cards + 3 Info Pills)
   ========================================================== */
.home-stage {
  position: relative;
  z-index: 5;
  margin-top: -46px;
  padding-bottom: 42px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.cat-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 18px;
  border-radius: 24px;
  border: 2.5px solid var(--glass-border);
  box-shadow: 0 0 0 1px var(--glass-ring), var(--shadow-card);
  text-decoration: none;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease;
  overflow: hidden;
}

.cat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 0 1.5px var(--accent-bright), var(--shadow-hover);
}

.cat-card--blue { background: var(--cat-blue-bg); border-color: var(--cat-blue-border); }
.cat-card--lavender { background: var(--cat-lavender-bg); border-color: var(--cat-lavender-border); }
.cat-card--mint { background: var(--cat-mint-bg); border-color: var(--cat-mint-border); }

.cat-icon-art {
  width: 66px;
  height: 66px;
  flex: none;
  display: grid;
  place-items: center;
  transition: transform 0.22s ease;
}

.cat-card:hover .cat-icon-art {
  transform: scale(1.06) rotate(-2deg);
}

.cat-body {
  flex: 1;
  min-width: 0;
}

.cat-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.25;
}

.cat-unofficial {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.cat-desc {
  margin-top: 4px;
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.4;
}

.cat-arrow {
  flex: none;
  color: var(--accent);
  transition: transform 0.2s ease;
}

.cat-card--lavender .cat-arrow { color: var(--lavender); }
.cat-card--mint .cat-arrow { color: var(--mint); }
.cat-card:hover .cat-arrow { transform: translateX(4px); }

/* Bottom 3 Pill Cards */
.info-pills-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.info-pill-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  border-radius: 20px;
  border: 2px solid var(--glass-border);
  outline: 1px solid var(--line);
  background: var(--pill-surface);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  text-align: left;
  transition: transform 0.2s ease, box-shadow 0.2s ease, outline-color 0.2s ease;
}

.info-pill-btn:hover {
  transform: translateY(-2px);
  outline-color: var(--line-strong);
  box-shadow: var(--shadow-hover);
}

.info-pill-ico {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.info-pill-label {
  flex: 1;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--ink);
}

.info-pill-arrow {
  color: var(--accent);
  flex: none;
  transition: transform 0.2s ease;
}

.info-pill-btn:hover .info-pill-arrow { transform: translateX(3px); }

/* ==========================================================
   Lab Dialog Modals (About / Unofficial / Theme)
   ========================================================== */
dialog.lab-dialog {
  width: min(520px, calc(100% - 32px));
  margin: auto;
  padding: 0;
  border: 2px solid var(--glass-border);
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 26px 64px -12px rgba(15, 45, 95, 0.36);
}

dialog.lab-dialog::backdrop {
  background: rgba(15, 36, 68, 0.45);
  backdrop-filter: blur(6px);
}

.lab-dialog-inner {
  padding: 24px;
}

.lab-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.lab-dialog-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.12rem;
  font-weight: 900;
  color: var(--ink);
}

.lab-dialog-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.lab-dialog-close:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.lab-dialog-body p {
  font-size: 0.88rem;
  line-height: 1.75;
  color: var(--ink-soft);
}

.lab-dialog-body p + p {
  margin-top: 10px;
}

.dialog-link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.dialog-pill-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--line-strong);
  color: var(--accent-deep);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
}

.dialog-pill-link:hover {
  background: var(--surface-hover);
}

.theme-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.theme-choice-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: var(--surface-soft);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--ink);
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.theme-choice-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.theme-choice-card[aria-pressed="true"] {
  border-color: var(--accent-bright);
  background: var(--accent-soft);
  color: var(--accent-deep);
  box-shadow: 0 4px 14px -4px rgba(2, 132, 232, 0.25);
}

.theme-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.swatch-original { background: linear-gradient(135deg, #98d8ff 0%, #0284e8 100%); }
.swatch-light { background: linear-gradient(135deg, #ffffff 0%, #dbeafe 100%); }
.swatch-dark { background: linear-gradient(135deg, #1e293b 0%, #0b1526 100%); }

/* ==========================================================
   Sub-Hero (Shared across Image Tools / Monst / Works)
   ========================================================== */
.sub-hero {
  position: relative;
  overflow: hidden;
  padding: 26px 0 38px;
  background: var(--subhero-blue);
  border-bottom: 1px solid var(--line);
}

.sub-hero--lavender { background: var(--subhero-lavender); }
.sub-hero--mint { background: var(--subhero-mint); }

.sub-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--hero-rays);
  pointer-events: none;
}

.sub-hero-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sub-hero-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sub-hero-badge {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 2px solid var(--glass-border);
  box-shadow: var(--shadow-card);
  color: var(--accent);
}

.sub-hero--lavender .sub-hero-badge { color: var(--lavender); }
.sub-hero--mint .sub-hero-badge { color: var(--mint); }

.sub-hero-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.sub-hero-title-row h1 {
  font-size: clamp(1.38rem, 2.8vw, 1.95rem);
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.sub-hero-tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
}

.sub-hero-lead {
  margin-top: 3px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-soft);
}

/* Mode switcher pills in Sub-Hero */
.mode-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px;
  border-radius: 999px;
  background: var(--surface-glass);
  border: 1.5px solid var(--glass-border);
  box-shadow: var(--shadow-card);
}

.mode-pills a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--muted);
  transition: background-color 0.16s ease, color 0.16s ease;
}

.mode-pills a:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.mode-pills a[aria-current="page"] {
  background: var(--primary-btn-bg);
  color: #ffffff;
  box-shadow: var(--primary-btn-shadow);
}

.sub-hero--lavender .mode-pills a[aria-current="page"] {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  box-shadow: 0 8px 18px -6px rgba(109, 40, 217, 0.42);
}

.sub-hero--mint .mode-pills a[aria-current="page"] {
  background: linear-gradient(135deg, #14b8a6 0%, #0f766e 100%);
  box-shadow: 0 8px 18px -6px rgba(15, 118, 110, 0.42);
}

/* ==========================================================
   Image Tools Workspace (/image-tools/)
   ========================================================== */
.tool-main {
  padding: 26px 0 48px;
}

.image-workspace {
  display: grid;
  grid-template-columns: minmax(0, 410px) minmax(0, 1fr);
  align-items: start;
  gap: 20px;
}

.lab-card {
  background: var(--surface);
  border: 2px solid var(--glass-border);
  outline: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-card);
  padding: 22px;
}

.lab-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.lab-card-head h2 {
  font-size: 1.04rem;
  font-weight: 900;
  color: var(--ink);
}

.format-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.format-chip {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}

.drop-zone {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 28px 18px;
  border: 2px dashed var(--line-strong);
  border-radius: 18px;
  background: linear-gradient(160deg, var(--surface-soft) 0%, var(--accent-soft) 100%);
  text-align: center;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.drop-zone.drag-over {
  border-color: var(--accent-bright);
  transform: scale(1.01);
}

.size-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--accent);
  box-shadow: 0 6px 14px -6px rgba(2, 132, 232, 0.25);
}

.drop-zone p,
.meta {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.file-label,
.primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--primary-btn-bg);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--primary-btn-shadow);
  transition: filter 0.16s ease, transform 0.16s ease;
}

.file-label:hover,
.primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.file-label input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}

#file-info {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--accent-tint);
  border: 1px solid var(--line);
  color: var(--accent-deep);
  font-weight: 700;
}

fieldset {
  display: grid;
  gap: 14px;
  min-inline-size: 0;
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}

fieldset:disabled { opacity: 0.55; }
button:disabled { cursor: default; opacity: 0.55; }

.dimensions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dimensions label,
.field {
  display: grid;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.dimensions input,
.tool-main select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 7px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--ink);
  font-weight: 700;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink-soft);
}

input[type="checkbox"],
input[type="range"] {
  accent-color: var(--accent);
}

input[type="range"] { width: 100%; }

#quality-value {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.78rem;
}

.error {
  margin-top: 12px;
  color: var(--error-text);
  font-size: 0.84rem;
  font-weight: 700;
}

.preview-stage {
  display: grid;
  place-items: center;
  min-height: 330px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  color: var(--muted);
  background-color: var(--surface-soft);
  background-image: conic-gradient(var(--grid-a) 25%, var(--grid-b) 0 50%, var(--grid-a) 0 75%, var(--grid-b) 0);
  background-size: 20px 20px;
  overflow: hidden;
}

.preview-stage p {
  padding: 20px;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 700;
  background: var(--surface-glass);
  border-radius: 12px;
  border: 1px solid var(--line);
}

.preview-stage img {
  display: block;
  max-width: 100%;
  max-height: 480px;
  object-fit: contain;
}

.download-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--accent-tint);
  border: 1px solid var(--line);
}

.privacy-banner {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
}

.privacy-banner svg {
  color: var(--mint);
  flex: none;
}

/* ==========================================================
   Footer
   ========================================================== */
.site-footer-band {
  margin-top: auto;
  background: var(--footer-bg);
  border-top: 1px solid var(--line);
  padding: 22px 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  font-size: 0.96rem;
  color: var(--ink);
  text-decoration: none;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.footer-links a,
.footer-links button {
  border: 0;
  background: none;
  padding: 0;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
}

.footer-links a:hover,
.footer-links button:hover {
  color: var(--accent-deep);
}

.footer-sep {
  color: var(--footer-sep);
  user-select: none;
}

.footer-copy {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 960px) {
  .category-grid {
    grid-template-columns: 1fr;
  }
  .info-pills-row {
    grid-template-columns: 1fr;
  }
  .sky-hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 16px;
  }
  .hero-logo-block {
    align-items: center;
  }
  .image-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .nav-mobile-toggle {
    display: inline-flex;
  }
  .site-nav {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 14px 20px 18px;
    background: var(--surface-glass);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 18px 36px -12px rgba(15, 45, 95, 0.2);
  }
  .site-masthead.is-nav-open .site-nav {
    display: flex;
  }
  .nav-trigger {
    width: 100%;
    justify-content: space-between;
  }
  .nav-menu {
    position: static;
    box-shadow: none;
    background: var(--surface-soft);
    margin-top: 4px;
  }
}

@media (max-width: 600px) {
  .frame { width: calc(100% - 28px); }
  .sky-hero { padding: 20px 0 64px; }
  .lab-mascot-kumao { width: 138px; }
  .lab-mascot-piko { width: 104px; }
  .home-stage { margin-top: -36px; }
  .theme-choice-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
