:root {
  color-scheme: light;

  /* Brand palette */
  --fdc-blue-50: #eff6ff;
  --fdc-blue-100: #dbeafe;
  --fdc-blue-300: #93c5fd;
  --fdc-blue-500: #3b82f6;
  --fdc-blue-600: #2563eb;
  --fdc-blue-700: #1d4ed8;

  --fdc-slate-50: #f8fafc;
  --fdc-slate-100: #f1f5f9;
  --fdc-slate-200: #e2e8f0;
  --fdc-slate-300: #cbd5e1;
  --fdc-slate-500: #64748b;
  --fdc-slate-600: #475569;
  --fdc-slate-700: #334155;
  --fdc-slate-800: #1e293b;
  --fdc-slate-900: #0f172a;

  --fdc-green-500: #16a34a;
  --fdc-red-500: #dc2626;
  --fdc-amber-500: #f59e0b;

  /* Semantic tokens (light) */
  --fdc-color-bg: #f8faff;
  --fdc-color-surface: #ffffff;
  --fdc-color-surface-soft: #f1f5f9;
  --fdc-color-border: #d6e3f2;

  --fdc-color-text-main: #1e293b;
  --fdc-color-text-sub: #64748b;
  --fdc-color-text-muted: #475569;

  --fdc-color-accent: #3b82f6;
  --fdc-color-accent-strong: #2563eb;
  --fdc-color-accent-soft: #dbeafe;

  --fdc-color-success: #16a34a;
  --fdc-color-danger: #dc2626;
  --fdc-color-warning: #f59e0b;
}

:root[data-theme='dark'] {
  color-scheme: dark;

  /* Semantic tokens (dark) */
  --fdc-color-bg: #0b1220;
  --fdc-color-surface: #111827;
  --fdc-color-surface-soft: #0f172a;
  --fdc-color-border: #2a3951;

  --fdc-color-text-main: #e5edf8;
  --fdc-color-text-sub: #9fb0c7;
  --fdc-color-text-muted: #b9c8db;

  --fdc-color-accent: #60a5fa;
  --fdc-color-accent-strong: #3b82f6;
  --fdc-color-accent-soft: #13233a;

  --fdc-color-success: #4ade80;
  --fdc-color-danger: #f87171;
  --fdc-color-warning: #fbbf24;
}

/*
 * Shared header first-paint baseline
 * Keep the initial static HTML close to the final shared-shell render
 * so the header does not visibly resize after JS mounts.
 */
[data-shared-header].fixed-brand-bar,
[data-shared-header].top-strip {
  justify-content: flex-start !important;
  align-items: center !important;
  gap: clamp(6px, 1vw, 10px) !important;
  min-height: 56px !important;
  padding: 6px 12px 7px !important;
}

[data-shared-header].fixed-brand-bar .theme-toggle,
[data-shared-header].top-strip .theme-toggle {
  width: 40px !important;
  height: 40px !important;
  border: 1px solid var(--fdc-color-border) !important;
  background: var(--fdc-color-surface) !important;
  color: var(--fdc-color-text-main) !important;
  font-size: 18px !important;
  line-height: 1 !important;
  border-radius: 999px !important;
  margin-left: 0 !important;
}

.fdc-shell-header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0 0 0 clamp(18px, 2.4vw, 34px);
  overflow: visible;
  scrollbar-width: none;
  flex-wrap: nowrap;
  width: auto;
  max-width: 100%;
}

.fdc-shell-header-actions::-webkit-scrollbar {
  display: none;
}

.fdc-shell-header-btn {
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--fdc-color-text-sub);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.1;
  min-height: 44px;
  padding: 8px 0;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.fdc-shell-header-btn:hover,
.fdc-shell-header-btn.active {
  color: var(--fdc-color-accent);
  text-decoration: none;
}

.fdc-shell-header-dropdown {
  position: relative;
  flex: 0 0 auto;
}

.fdc-shell-header-summary {
  gap: 0;
}

.fdc-shell-header-dropdown .global-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 90;
  min-width: 220px;
  padding: 8px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--fdc-color-border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(16px);
}

.fdc-shell-header-dropdown:hover .global-dropdown-menu,
.fdc-shell-header-dropdown:focus-within .global-dropdown-menu,
.fdc-shell-header-dropdown.is-open .global-dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.fdc-shell-header-dropdown .global-dropdown-menu .fdc-shell-header-btn {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  justify-content: flex-start;
  gap: 8px;
}

.fdc-shell-menu-icon {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  flex: 0 0 auto;
  object-fit: contain;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.18);
  padding: 1px;
}

.fdc-shell-header-dropdown .global-dropdown-menu .fdc-shell-header-btn:hover,
.fdc-shell-header-dropdown .global-dropdown-menu .fdc-shell-header-btn.active {
  background: rgba(59, 130, 246, 0.1);
}

.fdc-shell-auth-btn {
  flex: 0 0 auto;
  margin-left: auto;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  min-width: 148px;
}

.fdc-shell-auth-btn.fdc-google-signin-btn {
  width: min(184px, 26vw);
  justify-content: center;
}

.fdc-shell-auth-btn.is-signed-in {
  min-height: 38px;
  height: 38px;
  width: min(184px, 26vw);
  max-width: min(184px, 26vw);
  padding: 0 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  gap: 8px;
  border: 1px solid var(--fdc-color-border);
  background: rgba(255, 255, 255, 0.94);
  color: var(--fdc-color-text-main);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.fdc-shell-auth-avatar {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: var(--fdc-color-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  object-fit: cover;
}

.fdc-shell-auth-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

:root[data-theme='dark'] .fdc-shell-header-btn {
  color: var(--fdc-color-text-sub);
}

:root[data-theme='dark'] .fdc-shell-header-btn:hover,
:root[data-theme='dark'] .fdc-shell-header-btn.active {
  color: var(--fdc-color-accent);
}

:root[data-theme='dark'] .fdc-shell-header-dropdown .global-dropdown-menu {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(12, 20, 32, 0.96);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.34);
}

:root[data-theme='dark'] .fdc-shell-header-dropdown .global-dropdown-menu .fdc-shell-header-btn:hover,
:root[data-theme='dark'] .fdc-shell-header-dropdown .global-dropdown-menu .fdc-shell-header-btn.active {
  background: rgba(59, 130, 246, 0.16);
}

:root[data-theme='dark'] .fdc-shell-auth-btn.is-signed-in {
  background: #111827;
  border-color: var(--fdc-color-border);
  color: var(--fdc-color-text-main);
  box-shadow: none;
}

@media (max-width: 640px) {
  .fdc-shell-auth-btn {
    min-width: 0;
  }

  .fdc-shell-auth-btn.fdc-google-signin-btn {
    width: auto;
  }

  .fdc-shell-auth-btn.is-signed-in {
    width: auto;
    max-width: min(164px, 34vw);
  }
}

/*
 * Shared shell footer pre-reserve (CLS guard)
 * Keep this in global CSS so height is reserved before module scripts run.
 */
footer.site-footer[data-shared-footer] {
  display: block;
  min-height: 156px;
  margin-top: 0;
  border-top: 1px solid var(--fdc-color-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 251, 255, 0.96)),
    var(--fdc-color-surface);
}

footer.site-footer[data-shared-footer][data-footer-variant='compact'] {
  min-height: 86px;
}

footer.site-footer[data-shared-footer] .site-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 20px 20px;
  display: grid;
  gap: 12px;
}

footer.site-footer[data-shared-footer] .footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 28px;
}

footer.site-footer[data-shared-footer] .footer-section-title {
  margin: 0 0 7px;
  color: var(--fdc-color-accent);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-weight: 850;
}

footer.site-footer[data-shared-footer] .footer-links {
  display: grid;
  gap: 6px;
}

footer.site-footer[data-shared-footer] .footer-links a,
footer.site-footer[data-shared-footer] .footer-links span {
  font-size: 0.8rem;
  color: var(--fdc-color-text-sub);
  text-decoration: none;
  word-break: break-all;
  line-height: 1.35;
}

footer.site-footer[data-shared-footer] .footer-links a:hover {
  color: var(--fdc-color-accent);
  text-decoration: none;
}

footer.site-footer[data-shared-footer] .footer-divider {
  border: 0;
  border-top: 1px solid var(--fdc-color-border);
  margin: 0;
}

footer.site-footer[data-shared-footer] .foot {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 0;
  color: var(--fdc-color-text-sub);
  font-size: 12px;
  font-weight: 700;
}

footer.site-footer[data-shared-footer] .foot-meta {
  margin: 0;
  color: var(--fdc-color-text-sub);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

footer.site-footer[data-shared-footer] .foot-links-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}

footer.site-footer[data-shared-footer] .foot-links-inline a {
  color: var(--fdc-color-text-sub);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

footer.site-footer[data-shared-footer] .foot-links-inline a:hover {
  color: var(--fdc-color-accent);
  text-decoration: none;
}

footer.site-footer[data-shared-footer][data-footer-scope='onepiece'] {
  min-height: 220px;
}

footer.site-footer[data-shared-footer][data-footer-scope='onepiece'][data-footer-variant='compact'] {
  min-height: 110px;
}

footer.site-footer[data-shared-footer].is-compact .site-footer-inner {
  padding: 12px 20px 14px;
  gap: 8px;
}

footer.site-footer[data-shared-footer].is-compact .footer-grid,
footer.site-footer[data-shared-footer].is-compact .footer-divider {
  display: none;
}

:root[data-theme='dark'] footer.site-footer[data-shared-footer] {
  border-top-color: rgba(148, 163, 184, 0.22);
  background:
    linear-gradient(180deg, rgba(17, 24, 39, 0.94), rgba(11, 18, 32, 0.98)),
    var(--fdc-color-surface);
}

:root[data-theme='dark'] footer.site-footer[data-shared-footer] .footer-links a,
:root[data-theme='dark'] footer.site-footer[data-shared-footer] .footer-links span,
:root[data-theme='dark'] footer.site-footer[data-shared-footer] .foot,
:root[data-theme='dark'] footer.site-footer[data-shared-footer] .foot-meta {
  color: var(--fdc-color-text-sub);
}

:root[data-theme='dark'] footer.site-footer[data-shared-footer] .footer-links a:hover {
  color: var(--fdc-color-accent);
}

:root[data-theme='dark'] footer.site-footer[data-shared-footer] .footer-divider {
  border-top-color: rgba(148, 163, 184, 0.22);
}

@media (max-width: 640px) {
  footer.site-footer[data-shared-footer] {
    min-height: 220px;
  }

  footer.site-footer[data-shared-footer][data-footer-variant='compact'] {
    min-height: 104px;
  }

  footer.site-footer[data-shared-footer] .site-footer-inner {
    padding: 18px 16px 20px;
  }

  footer.site-footer[data-shared-footer].is-compact .site-footer-inner {
    padding: 12px 16px 14px;
  }

  footer.site-footer[data-shared-footer] .footer-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  footer.site-footer[data-shared-footer][data-footer-scope='onepiece'] {
    min-height: 300px;
  }

  footer.site-footer[data-shared-footer][data-footer-scope='onepiece'][data-footer-variant='compact'] {
    min-height: 136px;
  }
}

/*
 * Shared Google sign-in button (website/app shell parity)
 */
.fdc-google-signin-btn {
  min-height: 44px;
  border: 1px solid #747775;
  border-radius: 4px;
  background: #ffffff;
  color: #1f1f1f;
  font-family: 'Roboto', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  letter-spacing: 0.25px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.fdc-google-signin-btn:hover {
  background: #f8f9fa;
  border-color: #747775;
}

.fdc-google-signin-btn:active {
  background: #f1f3f4;
}

.fdc-google-signin-btn:disabled,
.fdc-google-signin-btn[aria-busy='true'] {
  opacity: 0.62;
  cursor: not-allowed;
}

.fdc-google-signin-btn--full {
  width: 100%;
}

.fdc-google-signin-icon {
  width: 20px;
  height: 20px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%234285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"/><path fill="%2334A853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"/><path fill="%23FBBC05" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"/><path fill="%23EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  flex: 0 0 auto;
}

:root[data-theme='dark'] .fdc-google-signin-btn {
  background: #131314;
  border-color: #8e918f;
  color: #e3e3e3;
}

:root[data-theme='dark'] .fdc-google-signin-btn:hover {
  background: #1b1c1d;
  border-color: #8e918f;
}

:root[data-theme='dark'] .fdc-google-signin-btn:active {
  background: #232526;
}
