header {
  background: linear-gradient(135deg, #FF8F4D 0%, #FF6B1A 50%, #FF8F4D 100%);
  position: relative;
  overflow: hidden;
}
header::before, header::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}
header::before { width: 180px; height: 180px; top: -60px; right: -40px; }
header::after { width: 100px; height: 100px; bottom: -30px; left: 12%; background: rgba(255, 201, 60, 0.18); }

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 28px;
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.header-logo {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 rgba(58, 31, 10, 0.18);
  padding: 4px;
}
.header-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.header-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 200px;
}

.header-title h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.02em;
  line-height: 1.25;
  text-shadow: 0 2px 0 rgba(58, 31, 10, 0.18);
}

.header-title .subtitle {
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.04em;
}

.header-meta {
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.18);
  padding: 6px 14px;
  border-radius: 999px;
}

@media (max-width: 600px) {
  .header-inner { padding: 16px 18px; gap: var(--gap-sm); }
  .header-title h1 { font-size: 1.15rem; }
  .header-title .subtitle { font-size: 0.7rem; }
  .header-meta { display: none; }
  .header-logo { width: 48px; height: 48px; border-radius: 12px; }
}

.header-tools {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lang-switch {
  position: relative;
  display: inline-block;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  padding: 7px 12px 7px 11px;
  box-shadow: 0 2px 0 rgba(58, 31, 10, 0.18);
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--ink);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s, transform 0.08s, box-shadow 0.12s;
  min-height: 32px;
  white-space: nowrap;
}

.lang-toggle:hover {
  background: #fff;
  box-shadow: 0 3px 0 rgba(58, 31, 10, 0.22);
}

.lang-toggle:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(58, 31, 10, 0.2);
}

.lang-icon {
  flex-shrink: 0;
  color: var(--orange);
  transition: transform 0.4s ease;
}

.lang-switch.is-open .lang-icon {
  transform: rotate(60deg);
}

.lang-current {
  display: inline-block;
  min-width: 1em;
}

.lang-caret {
  flex-shrink: 0;
  color: var(--ink-3);
  transition: transform 0.2s;
}

.lang-switch.is-open .lang-caret {
  transform: rotate(180deg);
}

.lang-menu {
  position: fixed;

  min-width: 180px;
  background-color: #ffffff !important;
  background-image: none !important;
  border-radius: var(--radius-md);
  border: 1px solid rgba(58, 31, 10, 0.08);
  box-shadow:
    0 4px 0 rgba(58, 31, 10, 0.10),
    0 12px 32px -8px rgba(58, 31, 10, 0.30);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px) scale(0.96);
  transform-origin: top right;
  transition: opacity 0.16s, transform 0.16s;
  z-index: 99999;

  isolation: isolate;
  will-change: transform, opacity;
  -webkit-transform: translateY(-4px) scale(0.96);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.lang-switch.is-open .lang-menu,
.lang-menu.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  -webkit-transform: translateY(0) scale(1);
}

.lang-menu button {
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--ink);
  background: transparent;
  border: none;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  letter-spacing: 0.01em;
  transition: background 0.12s, color 0.12s;
  position: relative;
  white-space: nowrap;
}

.lang-menu button[lang="ko"] { font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', var(--font-jp); }
.lang-menu button[lang="zh-TW"] { font-family: 'PingFang TC', 'Microsoft JhengHei', var(--font-jp); }
.lang-menu button[lang="en"],
.lang-menu button[lang="fr"],
.lang-menu button[lang="es"],
.lang-menu button[lang="de"],
.lang-menu button[lang="it"],
.lang-menu button[lang="nl"],
.lang-menu button[lang="pt-BR"] {
  font-family: var(--font-jp);
}

.lang-menu button:hover {
  background: var(--orange-pale);
  color: var(--orange-d);
}

.lang-menu button.is-active {
  background: var(--orange);
  color: #fff;
  font-weight: 800;
}

.lang-menu button.is-active::after {
  content: '✓';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 700;
}

.lang-menu button.is-active:hover {
  background: var(--orange-d);
  color: #fff;
}

@media (max-width: 600px) {
  .header-tools { width: 100%; justify-content: flex-end; gap: var(--gap-sm); }
  .lang-switch .lang-toggle {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 0 rgba(58, 31, 10, 0.18);
    padding: 6px 10px 6px 9px;
    font-size: 0.74rem;
    min-height: 30px;
  }

  .lang-menu {

    position: fixed !important;
    top: auto !important;
    right: 0 !important;
    left: 0 !important;
    bottom: 0 !important;

    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    max-height: 75vh;

    border-radius: 20px 20px 0 0 !important;
    border: none !important;

    padding: 8px 12px calc(20px + env(safe-area-inset-bottom)) !important;

    padding-top: 28px !important;

    overflow-y: auto;
    -webkit-overflow-scrolling: touch;

    box-shadow: 0 -8px 32px -4px rgba(58, 31, 10, 0.25) !important;

    transform: translateY(100%) !important;
    -webkit-transform: translateY(100%) !important;
    transform-origin: bottom center !important;
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.2s !important;
    opacity: 1;

    z-index: 99999;
  }

  .lang-menu::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: rgba(58, 31, 10, 0.18);
  }

  .lang-switch.is-open .lang-menu,
  .lang-menu.is-open {
    transform: translateY(0) !important;
    -webkit-transform: translateY(0) !important;
    pointer-events: auto;
  }

  .lang-menu button {
    padding: 14px 18px !important;
    font-size: 1rem !important;
    border-radius: var(--radius-md) !important;
    min-height: var(--tap-min, 42px);
  }
  .lang-menu button.is-active::after {
    right: 18px !important;
    font-size: 1.1rem !important;
  }

  .lang-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(58, 31, 10, 0.45);
    z-index: 99998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease-out;
  }
  .lang-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  body.lang-sheet-open {
    overflow: hidden;
  }
}

@media (max-width: 380px) {
  .lang-current { display: none; }
  .lang-switch .lang-toggle {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 0 rgba(58, 31, 10, 0.18);
    padding: 7px 11px;
    min-width: 42px;
    min-height: 36px;
  }
  .lang-icon { width: 18px; height: 18px; }
}
