:root {
    --red: #e60012;
    --navy: #002374;
  }
  * { box-sizing: border-box; }
  body {
    margin: 0;
    background: #fff;
  }

  .kv-wrapper {
    position: relative;
    width: 100%;
    margin: 0 auto;
    background: #fff;
  }

  /* ===== 背景画像スライドショー（キービジュアル全体） ===== */
  .hero {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh; /* モバイルブラウザのアドレスバー分を考慮した実際の表示高さ */
    min-height: 480px;
    overflow: hidden;
    background: #000;
    border-bottom: 5px solid #e60012;
  }

  .hero .slide-fade {
    position: absolute;
    inset: 0;
    opacity: 0;
    animation-duration: 20s; /* 2.5s × 8枚分 */
    animation-iteration-count: infinite;
  }
  .hero .slide-fade img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .hero .slide-fade:nth-child(1) { animation-delay: 0s;    animation-name: fadeSlideFromLeft; }
  .hero .slide-fade:nth-child(2) { animation-delay: 2.5s;  animation-name: fadeSlideFromTopRight; }
  .hero .slide-fade:nth-child(3) { animation-delay: 5s;    animation-name: fadeSlideFromBottom; }
  .hero .slide-fade:nth-child(4) { animation-delay: 7.5s;  animation-name: fadeSlideFromRight; }
  .hero .slide-fade:nth-child(5) { animation-delay: 10s;   animation-name: fadeSlideFromBottomLeft; }
  .hero .slide-fade:nth-child(6) { animation-delay: 12.5s; animation-name: fadeSlideFromTop; }
  .hero .slide-fade:nth-child(7) { animation-delay: 15s;   animation-name: fadeSlideFromLeft; }
  .hero .slide-fade:nth-child(8) { animation-delay: 17.5s; animation-name: fadeSlideFromTopRight; }

  /* 左からスライド */
  @keyframes fadeSlideFromLeft {
    0%     { opacity: 0; transform: translate(-3%, 0%); }
    4%     { opacity: 1; transform: translate(0%, 0%); }
    16.6%  { opacity: 1; transform: translate(0%, 0%); }
    20.6%  { opacity: 0; transform: translate(3%, 0%); }
    100%   { opacity: 0; transform: translate(-3%, 0%); }
  }
  /* 右上から斜めにスライド */
  @keyframes fadeSlideFromTopRight {
    0%     { opacity: 0; transform: translate(3%, -2.5%); }
    4%     { opacity: 1; transform: translate(0%, 0%); }
    16.6%  { opacity: 1; transform: translate(0%, 0%); }
    20.6%  { opacity: 0; transform: translate(-3%, 2.5%); }
    100%   { opacity: 0; transform: translate(3%, -2.5%); }
  }
  /* 下からスライド */
  @keyframes fadeSlideFromBottom {
    0%     { opacity: 0; transform: translate(0%, 3%); }
    4%     { opacity: 1; transform: translate(0%, 0%); }
    16.6%  { opacity: 1; transform: translate(0%, 0%); }
    20.6%  { opacity: 0; transform: translate(0%, -3%); }
    100%   { opacity: 0; transform: translate(0%, 3%); }
  }
  /* 右からスライド */
  @keyframes fadeSlideFromRight {
    0%     { opacity: 0; transform: translate(3%, 0%); }
    4%     { opacity: 1; transform: translate(0%, 0%); }
    16.6%  { opacity: 1; transform: translate(0%, 0%); }
    20.6%  { opacity: 0; transform: translate(-3%, 0%); }
    100%   { opacity: 0; transform: translate(3%, 0%); }
  }
  /* 左下から斜めにスライド */
  @keyframes fadeSlideFromBottomLeft {
    0%     { opacity: 0; transform: translate(-3%, 2.5%); }
    4%     { opacity: 1; transform: translate(0%, 0%); }
    16.6%  { opacity: 1; transform: translate(0%, 0%); }
    20.6%  { opacity: 0; transform: translate(3%, -2.5%); }
    100%   { opacity: 0; transform: translate(-3%, 2.5%); }
  }
  /* 上からスライド */
  @keyframes fadeSlideFromTop {
    0%     { opacity: 0; transform: translate(0%, -3%); }
    4%     { opacity: 1; transform: translate(0%, 0%); }
    16.6%  { opacity: 1; transform: translate(0%, 0%); }
    20.6%  { opacity: 0; transform: translate(0%, 3%); }
    100%   { opacity: 0; transform: translate(0%, -3%); }
  }

  /* 暗めの半透明オーバーレイ（画像の一つ前に重ねてロゴ・キャッチコピーを見やすく） */
  .hero-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.50);
    z-index: 2;
  }

  /* ===== ヘッダー ===== */
  .header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 40;
    padding: 17px 24px 0 30px;
  }
  .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .logo img {
    height: 32px;
    display: block;
  }
  .nav {
    display: flex;
    align-items: center;
    gap: 32px;
  }
  .nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0;
    white-space: nowrap;
  }
  .nav-links a {
    font-size: 15px;
    font-weight: 500;
    color: #fff;
    text-decoration: none;
    transition: color 0.2s ease;
  }
  .nav-links a:hover {
    color: var(--red);
  }
  .nav-item {
    position: relative;
  }

  /* ===== メガメニュー（サービス案内） ===== */
  .mega-menu {
    position: absolute;
    top: calc(100% + 34px);
    left: 50%;
    transform: translateX(-50%);
    width: 760px;
    max-width: 90vw;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 45px rgba(0,0,0,0.18);
    padding: 28px 40px;
    display: flex;
    align-items: stretch;
    gap: 28px;
    opacity: 0;
    visibility: hidden;
    transform-origin: top center;
    transition: opacity 0.18s ease, visibility 0.18s ease;
    z-index: 30;
  }
  .mega-menu::before {
    content: "";
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 18px;
    height: 18px;
    background: #fff;
  }
  .nav-item.has-mega:hover .mega-menu,
  .mega-menu:hover {
    opacity: 1;
    visibility: visible;
  }
  .mega-menu-heading {
    font-size: 20px;
    font-weight: 500;
    color: #000;
    white-space: nowrap;
    display: flex;
    align-items: center;
    padding-right: 24px;
    flex-shrink: 0;
  }
  .mega-menu-divider {
    width: 1px;
    background: #000;
    flex-shrink: 0;
  }
  .mega-menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 22px 32px;
    min-width: 0;
    letter-spacing: 0;
  }
  .mega-menu-narrow {
    width: max-content;
  }
  .mega-menu-grid-2col {
    grid-template-columns: repeat(2, max-content);
    gap: 22px 32px;
  }
  .mega-menu-grid-1col {
    grid-template-columns: max-content;
    gap: 18px 0;
  }

  .mega-item {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    min-width: 0;
  }
  .mega-item:hover span {
    color: var(--red);
  }
  .mega-item img {
    width: 56px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
  }
  .mega-item span {
    font-size: 13px;
    font-weight: 500;
    color: #000;
    line-height: 1.4;
    white-space: nowrap;
  }

  .nav-buttons {
    display: flex;
    gap: 12px;
    order: 2;
  }
  .kbbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    width: 115px;
    border-radius: 10px;
    font-size: 16px;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    border: none;
    transition: background-color 0.25s ease, color 0.25s ease;
  }
  .btn-contact {
    background: var(--red);
    color: #fff;
  }
  .btn-contact:hover {
    background: #fff;
    color: var(--red);
  }
  .btn-recruit {
    background: var(--navy);
    color: #fff;
  }
  .btn-recruit:hover {
    background: #fff;
    color: var(--navy);
  }

  /* ===== ハンバーガーボタン（PCでは非表示） ===== */
  .kb-hamburger {
    display: none;
    order: 3;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }
  .kb-hamburger span {
    display: block;
    width: 26px;
    height: 2px;
    background: #fff;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  .kb-hamburger.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .kb-hamburger.active span:nth-child(2) { opacity: 0; }
  .kb-hamburger.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

  /* ===== モバイルメニューパネル ===== */
  .mobile-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.85);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    z-index: 25;
  }
  .mobile-menu a {
    display: block;
    padding: 16px 24px;
    color: #fff;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,0.15);
  }
  .mobile-menu.open {
    max-height: 700px;
  }

  /* ===== モバイル用アコーディオン（サービス案内） ===== */
  .mobile-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    padding: 16px 24px;
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
  }
  .mobile-nav-toggle .arrow {
    display: inline-block;
    font-size: 11px;
    transition: transform 0.2s ease;
  }
  .mobile-nav-toggle.open .arrow {
    transform: rotate(180deg);
  }
  .mobile-accordion {
    max-height: 0;
    overflow: hidden;
    background: rgba(255,255,255,0.06);
    transition: max-height 0.25s ease;
  }
  .mobile-accordion.open {
    max-height: 260px;
  }
  .mobile-accordion-grid {
    display: flex;
    flex-direction: column;
  }
  .mobile-accordion-grid .mega-item {
    padding: 12px 24px 12px 40px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  .mobile-accordion-grid .mega-item img {
    display: none;
  }
  .mobile-accordion-grid .mega-item span {
    color: #fff;
    font-size: 14px;
    white-space: normal;
  }

  .header-line {
    margin-top: 15px;
    height: 1px;
    background: rgba(255,255,255,0.6);
    width: 100%;
  }

  /* ===== キャッチコピー（中央） ===== */
  .catchcopy {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    width: 55%;
    max-width: 831px;
  }
  .catchcopy img {
    width: 100%;
    display: block;
  }

  /* ===== Topics バー ===== */
  .topics {
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: 10;
    height: 106px;
    width: 57.7%;
    max-width: 1108px;
    background: #fff;
    border-top-right-radius: 30px;
    display: flex;
    align-items: center;
    padding: 0 40px 0 51px;
    gap: 24px;
  }
  .topics-label {
    font-weight: 900;
    font-size: 18px;
    color: #000;
    white-space: nowrap;
  }
  .topics-divider {
    width: 1px;
    height: 46px;
    background: #000;
    flex-shrink: 0;
  }
  .topics-text {
    font-size: 14px;
    color: #000;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.2s ease;
  }
  .topics-text:hover {
    color: var(--red);
  }

  /* ===== レスポンシブ ===== */
  @media (max-width: 1100px) {
    .header { 
      padding: 16px 16px 0;
    }
    .header-inner { 
      flex-wrap: nowrap;
      gap: 10px;
    }
    .nav { 
      gap: 10px;
    }
    .nav-links {
      display: none;
    }
    .kbbtn { 
      width: 84px;
      height: 44px;
      font-size: 13px;
      border-radius: 10px;
      font-weight: 600;
    }
    .kb-hamburger { 
      display: flex;
     }
    .header-line { margin-top: 16px; }
    .catchcopy { width: 95%; }
    .topics {
      width: 100%;
      max-width: none;
      height: auto;
      min-height: 72px;
      padding: 20px;
      border-top-right-radius: 20px;
      flex-wrap: wrap;
    }
    .topics-divider { display: none; }
    .topics-text { white-space: normal; }
  }
  @media (max-width: 990px) {
    .header {
        padding: 16px 1% 0;
    }
    .nav {
        gap: 5px;
    }
    .nav-buttons {
      gap: 7px;
    }
    .topics {
      gap: 10px;
    }
  }