:root {
    --bg: #f3eee5;
    --panel: #fffef9;
    --indigo: #1f4f7f;
    --rakugo: #8b2a24;
    --gold: #f2d28f;
    --text: #2c2a28;
    --muted: #756f6b;
    --radius: 14px;
  }
  
  /* ===== 舞台背景（上下幕＋中央ステージ） ===== */
  /* ===== 舞台背景：上下は縦三色ストライプ、中央はステージ ===== */
  /* ===== 舞台背景：上は三色幕、中央はステージ空間 ===== */
body {
    margin: 0;
    font-family: "system-ui", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    position: relative;
    overflow-x: hidden;
  
    /* 上：縦三色ストライプ幕
       中央：ベージュ〜ブラウンのステージ空間
       下：実際の床は .stage-floor で描画する */
    background-image:
      /* 中央ステージ用のグラデーション（上下は透明） */
      linear-gradient(
        to bottom,
        transparent 0%,
        transparent 14%,
        #fefaf3 14%,
        #e9decf 50%,
        #d4c6b4 86%,
        transparent 86%,
        transparent 100%
      ),
      /* 上に乗る三色幕（縦ストライプ） */
      repeating-linear-gradient(
        90deg,
        #D7681A 0,      #D7681A 80px,   /* 赤 */
        #000000 80px,   #000000 160px,  /* 黒 */
        #1b4028 160px,  #1b4028 240px   /* 緑 */
      );
  
    background-size:
      100% 100%,
      100% 14%;    /* 幕の高さ（14%ぶん） */
  
    background-position:
      top,
      top;
  
    background-repeat: no-repeat;
    background-attachment: fixed;
  }

  body:not(.is-authenticated) [data-auth-only] {
    display: none !important;
  }

  body.modal-open {
    overflow: hidden;
  }
  
  /* カーテンアニメーション（ページロード時に上幕・下幕が開く） */
  body::before,
  body::after {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    z-index: 999;
    pointer-events: none;
  }
  
  /* 上のカーテン */
  body::before {
    top: 0;
    height: 50vh;
    background: repeating-linear-gradient(
      90deg,
      #D7681A 0,     /* 赤 */
      #D7681A 120px,
      #000000 120px, /* 黒 */
      #000000 240px,
      #1b4028 240px, /* 緑 */
      #1b4028 360px
    );
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
    animation: curtainTop 1.1s ease-out forwards;
    background-size: 100% auto;
  }
  
  /* 下のカーテン（三色幕） */
  body::after {
    bottom: 0;
    height: 50vh;
    background: repeating-linear-gradient(
      90deg,
      #D7681A 0,     /* 赤 */
      #D7681A 120px,
      #000000 120px, /* 黒 */
      #000000 240px,
      #1b4028 240px, /* 緑 */
      #1b4028 360px
    );
    box-shadow: 0 -8px 16px rgba(0,0,0,0.4);
    animation: curtainBottom 1.1s ease-out forwards;
    background-size: 100% auto;
  }
  
  /* 上幕が上に開く */
  @keyframes curtainTop {
    0%   { transform: translateY(0); }
    100% { transform: translateY(-100%); }
  }
  
  /* 下幕が下に開く */
  @keyframes curtainBottom {
    0%   { transform: translateY(0); }
    100% { transform: translateY(100%); }
  }
  
  /* ===== ページ全体：中央ステージに乗っているイメージ ===== */
  .page {
    max-width: 900px;
    margin: 1.2rem auto 3.5rem;
    padding: 1.4rem 1rem 3.5rem;
    background: rgba(255, 254, 249, 0.90);
    backdrop-filter: blur(4px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.28);
    min-height: 80vh;
    border-radius: 18px;
    position: relative;
    z-index: 5;    /* 松(3)・ステージ(2)より前に出す */
  }
  
  /* ===== ヘッダ（舞台上の看板） ===== */
  header {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    background: rgba(255,255,255,0.96);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 14px;
    padding: 0.8rem 1rem;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  }
  .site-logo {
    height: 60px;
    object-fit: contain;
  }
  .head-text { line-height: 1.2; }
  .title-en {
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #374a5b;
  }
  .title-jp {
    font-size: 1.35rem;
    font-weight: 700;
    margin-top: 0.1rem;
  }
  .subtext {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.4rem;
  }
  
  /* ===== コンテンツボックス ===== */
  .box {
    background: rgba(255,254,249,0.96);
    border-radius: var(--radius);
    border: 1px solid rgba(160, 142, 110, 0.35);
    box-shadow: 0 6px 15px rgba(193, 166, 122, 0.08);
    margin-bottom: 1rem;
    padding: 1.05rem 1.1rem 1.3rem;
    position: relative;
    overflow: hidden;
  }

  .login-section form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
  }

  .login-description {
    font-size: 0.95rem;
    color: var(--muted);
    margin-bottom: 0.8rem;
  }

  .login-support {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.5rem;
  }

  .login-button {
    align-self: flex-start;
    background: linear-gradient(90deg, #f2d28f, #f4b860);
    color: #432510;
    border: none;
    border-radius: 999px;
    padding: 0.55rem 1.4rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: pointer;
    box-shadow: 0 10px 18px rgba(180, 120, 40, 0.15);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .video-modal[hidden] {
    display: none !important;
  }

  .login-button:hover,
  .logout-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(180, 120, 40, 0.22);
  }

  .login-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
  }

  .viewer-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: rgba(255,255,255,0.9);
  }

  .viewer-text {
    font-size: 0.95rem;
    color: #3c3125;
  }

  .viewer-text strong {
    font-size: 1.05rem;
  }

  .logout-button {
    background: linear-gradient(90deg, #d4a373, #c56e33);
    color: #fffaf0;
    border: none;
    border-radius: 999px;
    padding: 0.45rem 1.3rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }
  
  /* ===== 入力フォーム ===== */
  .label {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #382a16;
  }
  .input-row {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 0.6rem;
  }
  .input-col { width: 100%; }
  
  input[type="text"], input[type="password"] {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid rgba(57,46,37,0.3);
    border-radius: 9px;
    font-size: 1rem;
    background: rgba(255,255,255,.45);
    outline: none;
    transition: .15s;
  }
  input:focus {
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(31,79,127,0.18);
    background: #fff;
  }
  
  button {
    background: linear-gradient(130deg, var(--indigo) 0%, #173a5e 100%);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.45rem 1.25rem 0.55rem;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: .02em;
    box-shadow: 0 4px 12px rgba(23,58,94,0.3);
  }
  button:disabled {
    opacity: .6;
    cursor: not-allowed;
    box-shadow: none;
  }
  
  .help {
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 0.25rem;
  }
  
  /* ===== ステータス表示 ===== */
  .status {
    font-size: 0.8rem;
    margin-top: 0.6rem;
  }
  .status.ok {
    background: #ecfdf3;
    border: 1px solid #abefc6;
    color: #0f5132;
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    display: inline-block;
  }
  .status.ng {
    background: #fef3f2;
    border: 1px solid #fecdcd;
    color: #842029;
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    display: inline-block;
  }
  
  /* ===== 動画エリア（ステージ中央） ===== */
  .video-wrap {
    display: block;
    background: radial-gradient(circle at 20% 0%, #ffffff 0%, #f6f1e7 55%, #e0d3c1 100%);
    box-shadow: 0 20px 40px rgba(0,0,0,0.28);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 16px;
    padding: 1.35rem 1.3rem 1.6rem;
    position: relative;
  }
  
  /* ステージの床の影（前に張り出している感じ） */
  .video-wrap::before {
    content: "";
    position: absolute;
    bottom: -22px;
    left: 10%;
    width: 80%;
    height: 32px;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.35) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
  }
  
  .video-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.7rem;
  }
  .video-title-block {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
  }
  .rakugo-tag {
    background: linear-gradient(180deg, #fff 0%, #f2d28f 100%);
    border: 1px solid rgba(139,42,36,0.4);
    border-radius: 4px;
    padding: 0.2rem 0.4rem 0.3rem;
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-size: 0.7rem;
    letter-spacing: 0.25em;
    color: #5b1814;
    min-height: 4.2rem;
  }
  .video-title-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }
  .video-title {
    font-weight: 700;
    font-size: 2.0rem;
  }
  .video-sub {
    font-size: 0.7rem;
    color: var(--muted);
  }
  .limit-label {
    background: #fef3f2;
    border: 1px solid #fecdcd;
    color: #a1261c;
    padding: 0.3rem 0.6rem 0.35rem;
    border-radius: 999px;
    font-size: 0.7rem;
    white-space: nowrap;
  }
  
  /* スクリーン部分（動画） */
  .video-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.12);
  }
  .video-frame > .video-highlight,
  .video-frame > video,
  .video-frame > iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
  }

  .video-highlight {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    color: #fff;
    padding: 0;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: inherit;
  }

  .video-highlight:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 4px;
  }

  .video-highlight__thumb,
  .video-highlight__placeholder,
  .video-highlight__overlay {
    position: absolute;
    inset: 0;
  }

  .video-highlight__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .video-highlight__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.2rem;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.95rem;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, rgba(36, 34, 31, 0.9), rgba(80, 70, 58, 0.75));
  }

  .video-highlight__overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    pointer-events: none;
    transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease;
    background: rgba(0, 0, 0, 0.45);
    transform: scale(1);
  }

  .video-highlight__icon {
    font-size: 2.4rem;
    line-height: 1;
    text-shadow: 0 6px 12px rgba(0, 0, 0, 0.35);
  }

  .video-highlight__label {
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .video-highlight:not(.video-highlight--disabled):hover .video-highlight__overlay,
  .video-highlight:not(.video-highlight--disabled):focus-visible .video-highlight__overlay {
    background: rgba(0, 0, 0, 0.65);
    transform: scale(1.04);
  }

  .video-highlight--disabled {
    cursor: default;
    pointer-events: none;
  }

  .video-highlight--disabled .video-highlight__overlay {
    opacity: 0.75;
  }
  
  /* ===== 有効期限切れ ===== */
  .expired {
    display: none;
    margin-top: 1rem;
    background: #fef3f2;
    border: 1px solid #fecdcd;
    border-radius: 10px;
    padding: 1rem 0.8rem;
    color: #b42318;
    font-size: 0.9rem;
  }
  
  /* ===== フッタ ===== */
  footer {
    text-align: center;
    font-size: 0.7rem;
    color: #85766c;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    margin-top: 2.4rem;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
  }
  
  /* ===== レスポンシブ ===== */
  @media (max-width: 640px) {
    .page {
      margin: 0.7rem auto 2.5rem;
      padding: 1rem 0.7rem 2.4rem;
      border-radius: 14px;
    }
    header {
      flex-wrap: wrap;
    }
    .video-header {
      flex-direction: column;
      align-items: flex-start;
    }
    .video-title-block {
      gap: .4rem;
    }
    .video-wrap {
      padding: 1.0rem 0.9rem 1.4rem;
    }
  }
  
  /* ===== 舞台左右の松（ステージ上に立っている配置） ===== */
  
  .matsu {
    position: fixed;
    bottom: calc(7vh + 1vh);   /* 客席(7vh)＋ステージ高さ(12vh) → ステージ上端に根本が来る */
    height: 70vh;               /* 画面高さの約7割 → 中央エリアの8割くらいを占めるイメージ */
    width: 40vw;                /* 横幅は画面の40%程度 */
    background-image: url("../img/matsu.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: bottom center;
    z-index: 3;                 /* ステージより前、page より後ろ */
    pointer-events: none;
    opacity: 0.98;
  }
  
  /* 左側の松 */
  .matsu-left {
    left: -10vw;                /* 少し画面外へはみ出させる */
    transform-origin: bottom left;
  }
  
  /* 右側の松（左右反転） */
  .matsu-right {
    right: -10vw;
    transform-origin: bottom right;
  }
  
  /* 狭い画面では非表示 */
  @media (max-width: 1100px) {
    .matsu {
      display: none;
    }
  }
  
  /* ===== ステージの床（土台・単色） ===== */
  .stage-floor {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 7vh;                 /* 客席(7vh)の上に乗る */
    height: 12vh;               /* ステージの高さ */
    z-index: 2;                  /* 背景より前、松より後ろ */
  
    background-color: #8b5a2b;   /* 木っぽい茶色の単色 */
    box-shadow: 0 -6px 18px rgba(0,0,0,0.35);
  }
  
  /* ===== 客席（ステージの下に見えるシート） ===== */
  .audience {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 7vh;                  /* 客席の高さ */
    z-index: 1;                   /* ステージより後ろ */
  
    /* 半円を上向きに変更（中心を下に設定） */
    background:
      radial-gradient(circle at 30px 100%,
        #b31224 0,
        #b31224 60%,
        transparent 61%) repeat-x;
    background-size: 60px 60px;
    background-position: bottom left;
    background-color: #5a0c12;    /* 客席全体のベース色（暗い赤） */
  }
  
  
  /* ===== 動画ページ専用の追記スタイル ===== */
  .video-description {
    margin-top: 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #4a3d33;
  }

  .video-list {
    background: rgba(255, 254, 249, 0.95);
  }

  .section-title {
    margin: 0 0 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #403329;
  }

  .video-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
  }

  .video-card {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(160, 142, 110, 0.28);
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
  }

  .video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  }

  .video-card--featured {
    border-color: rgba(201, 129, 20, 0.5);
    box-shadow: 0 10px 22px rgba(201, 129, 20, 0.18);
  }

  .video-thumb {
    margin: 0;
    position: relative;
    aspect-ratio: 16 / 9;
    background: #1f1c1a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  .video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .video-card-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.7rem;
    background: rgba(201, 129, 20, 0.9);
    color: #fff7ec;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    border-radius: 999px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
  }

  .video-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-align: center;
    padding: 0.5rem;
    background: linear-gradient(135deg, rgba(43, 42, 37, 0.85), rgba(94, 79, 59, 0.65));
  }

  .video-card-body {
    padding: 0.9rem 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
  }

  .video-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #392b20;
  }

  .video-card-desc {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.45;
  }

  .video-meta {
    margin-top: auto;
    font-size: 0.75rem;
    color: #6a5a4c;
  }

  .empty-message {
    margin: 1rem 0 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
  }

  /* ===== 動画モーダル ===== */
  .video-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
  }

  .video-modal.is-active {
    display: flex;
  }

  .video-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
  }

  .video-modal__dialog {
    position: relative;
    width: min(900px, 92vw);
    background: rgba(18, 18, 18, 0.95);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    padding: 1.2rem 1.2rem 1.5rem;
  }

  .video-modal__body {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    color: #f6f1e7;
  }

  #modalVideo {
    width: 100%;
    border-radius: 12px;
    background: #000;
  }

  .video-modal__close {
    position: absolute;
    top: 0.5rem;
    right: 0.6rem;
    background: transparent;
    color: #f6f1e7;
    font-size: 1.8rem;
    border: none;
    box-shadow: none;
    cursor: pointer;
    line-height: 1;
  }

  .video-modal__close:hover {
    color: #f2d28f;
  }

  #modalTitle {
    margin: 0;
    font-size: 1.2rem;
  }

  #modalDescription {
    margin: 0 0 0.2rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.75);
  }

  @media (max-width: 640px) {
    .video-gallery {
      grid-template-columns: 1fr;
    }

    .video-card {
      flex-direction: column;
    }

    .open-modal-button {
      align-self: center;
      width: 100%;
      justify-content: center;
    }

    .video-modal__dialog {
      width: 94vw;
      padding: 1rem 0.9rem 1.2rem;
    }
  }
