* {
      box-sizing: border-box;
      -webkit-tap-highlight-color: transparent;
    }

    html {
      scroll-behavior: smooth;
    }

    body {
      margin: 0;
      padding: 0;
      background-color: #030a14;
      color: #f0f6fc;
      font-family: 'Noto Serif JP', serif;
      overflow-x: hidden;
    }

    /* WebGL背景キャンバス */
    #glCanvas {
      position: fixed;
      inset: 0;
      width: 100vw;
      height: 100vh;
      z-index: 0;
      pointer-events: none;
    }

    /* 微細なフィルムグレイン質感 */
    .noise-overlay {
      position: fixed;
      inset: 0;
      z-index: 1;
      pointer-events: none;
      opacity: 0.032;
      background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    }

    /* ガラスモーフィズムUI */
    .glass-pill {
      background: rgba(6, 18, 34, 0.45);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid rgba(255, 255, 255, 0.14);
      transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .glass-pill:hover {
      background: rgba(14, 36, 66, 0.58);
      border-color: rgba(255, 255, 255, 0.28);
    }

    .glass-pill.active {
      background: rgba(255, 255, 255, 0.18);
      border-color: rgba(255, 255, 255, 0.48);
      box-shadow: 0 0 24px rgba(130, 200, 255, 0.24);
    }

    /* カスタムレンジスライダー（水音ミキサー用） */
    input[type="range"].water-slider {
      -webkit-appearance: none;
      appearance: none;
      width: 100%;
      height: 2px;
      background: rgba(255, 255, 255, 0.22);
      border-radius: 999px;
      outline: none;
    }

    input[type="range"].water-slider::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 14px;
      height: 14px;
      border-radius: 50%;
      background: #e0f2fe;
      cursor: pointer;
      box-shadow: 0 0 10px rgba(186, 230, 253, 0.85);
    }

    /* スクロールで浮かび上がる青の断片 */
    .fragment-card {
      opacity: 0;
      transform: translateY(32px) scale(0.98);
      filter: blur(5px);
      transition: opacity 1.1s cubic-bezier(0.16, 1, 0.3, 1),
                  transform 1.1s cubic-bezier(0.16, 1, 0.3, 1),
                  filter 1.1s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .fragment-card.is-visible {
      opacity: 1;
      transform: translateY(0) scale(1);
      filter: blur(0px);
    }

    /* 音波インジケーター */
    @keyframes waveBar {
      0%, 100% { transform: scaleY(0.28); }
      50% { transform: scaleY(1); }
    }

    .sound-playing .bar-1 { animation: waveBar 1.1s ease-in-out infinite; }
    .sound-playing .bar-2 { animation: waveBar 0.85s ease-in-out infinite 0.18s; }
    .sound-playing .bar-3 { animation: waveBar 1.3s ease-in-out infinite 0.35s; }
    .sound-playing .bar-4 { animation: waveBar 0.95s ease-in-out infinite 0.5s; }

    @keyframes floatSlow {
      0%, 100% { transform: translateY(0px); }
      50% { transform: translateY(-9px); }
    }

    .animate-float {
      animation: floatSlow 8.5s ease-in-out infinite;
    }

    /* 堅牢な2D/3Dハイブリッド反転アニメーション（backface-visibility不具合回避） */
    .oracle-card-stage {
      perspective: 1400px;
      touch-action: manipulation;
    }

    /* 待機時のゆったりとした水面浮遊（6秒周期） */
    @keyframes oracleFloatIdle {
      0%, 100% { transform: translateY(0px) rotate(0deg); }
      50% { transform: translateY(-9px) rotate(0.4deg); }
    }

    /* 深い深呼吸のリズム（8秒周期の明滅・光彩） */
    @keyframes oracleDeepBreathe {
      0%, 100% {
        box-shadow: 0 18px 50px rgba(4, 15, 32, 0.75), 0 0 22px rgba(125, 211, 252, 0.16);
        border-color: rgba(186, 230, 253, 0.28);
      }
      50% {
        box-shadow: 0 24px 64px rgba(8, 28, 56, 0.85), 0 0 46px rgba(165, 243, 252, 0.42);
        border-color: rgba(224, 242, 254, 0.65);
      }
    }

    @keyframes oracleSigilBreathe {
      0%, 100% { opacity: 0.68; transform: scale(0.985); }
      50% { opacity: 1; transform: scale(1.025); }
    }

    .oracle-idle-float {
      animation: oracleFloatIdle 6s ease-in-out infinite;
    }

    .oracle-breathe-glow {
      animation: oracleDeepBreathe 8s ease-in-out infinite;
    }

    .oracle-sigil-breathe {
      transform-origin: center;
      animation: oracleSigilBreathe 8s ease-in-out infinite;
    }

    /* 1.4秒かけたスローモーション・ヒーリングフリップ */
    .oracle-card-body {
      transition: transform 0.72s cubic-bezier(0.32, 0.04, 0.22, 1),
                  filter 0.72s cubic-bezier(0.32, 0.04, 0.22, 1),
                  box-shadow 0.8s ease;
      transform-style: flat;
      will-change: transform, filter;
    }

    .oracle-card-body.flipping-out {
      transform: translateY(-16px) rotateY(90deg) scale(1.03);
      filter: brightness(1.35) blur(2px);
    }

    .oracle-card-body.flipping-in {
      transform: translateY(0px) rotateY(0deg) scale(1);
      filter: brightness(1) blur(0px);
    }

    /* 朝の霧が晴れるようなスタッガー出現アニメーション */
    .oracle-reveal-item {
      opacity: 0;
      transform: translateY(12px);
      filter: blur(7px);
      transition: opacity 1.15s cubic-bezier(0.22, 1, 0.36, 1),
                  transform 1.15s cubic-bezier(0.22, 1, 0.36, 1),
                  filter 1.15s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .oracle-reveal-item.is-revealed {
      opacity: 1;
      transform: translateY(0);
      filter: blur(0px);
    }

    /* タップ時の3重光の波紋（リップル） */
    @keyframes healingRippleExpand {
      0% {
        width: 30px;
        height: 30px;
        opacity: 0.85;
        border-width: 2px;
      }
      100% {
        width: 540px;
        height: 540px;
        opacity: 0;
        border-width: 0.5px;
      }
    }

    .healing-ripple-ring {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      border-radius: 9999px;
      border-style: solid;
      border-color: rgba(207, 250, 254, 0.78);
      box-shadow: 0 0 24px rgba(165, 243, 252, 0.45), inset 0 0 18px rgba(224, 242, 254, 0.3);
      pointer-events: none;
      animation: healingRippleExpand 2.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    /* 水泡・夜光虫パーティクル */
    @keyframes bubbleRiseFade {
      0% {
        opacity: 0;
        transform: translate3d(0, 0, 0) scale(0.4);
      }
      22% {
        opacity: 0.9;
      }
      100% {
        opacity: 0;
        transform: translate3d(var(--drift-x, 12px), var(--rise-y, -130px), 0) scale(1.15);
      }
    }

    .healing-bubble-particle {
      position: absolute;
      border-radius: 9999px;
      background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.95), rgba(165, 243, 252, 0.35));
      box-shadow: 0 0 12px rgba(186, 230, 253, 0.8);
      pointer-events: none;
      animation: bubbleRiseFade var(--dur, 2.4s) cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }

    /* 画面全体に広がる優しい光のベール */
    @keyframes screenLightVeil {
      0% { opacity: 0; }
      28% { opacity: 0.32; }
      100% { opacity: 0; }
    }

    .oracle-light-veil {
      animation: screenLightVeil 2.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }

    @keyframes slowSpin {
      from { transform: rotate(0deg); }
      to { transform: rotate(360deg); }
    }

    .astrolabe-spin {
      transform-origin: 150px 210px;
      animation: slowSpin 48s linear infinite;
    }

    ::-webkit-scrollbar {
      width: 4px;
    }
    ::-webkit-scrollbar-track {
      background: transparent;
    }
    ::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.16);
      border-radius: 999px;
    }

/* Layout and accessibility refinements for the published experience. */
:root { color-scheme: dark; }
body { font-size: 1rem; }
button, input { touch-action: manipulation; }
button { min-height: 44px; }
button:disabled { cursor: default; }
button:focus-visible, [role="button"]:focus-visible, input:focus-visible {
  outline: 2px solid #c7f2ff;
  outline-offset: 5px;
}
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 26px 32px;
  background: linear-gradient(to bottom, rgba(3,10,20,.58), transparent);
  pointer-events: none;
}
.site-header > * { pointer-events: auto; }
.brand { flex: 0 0 auto; }
.brand h1 { font-size: 1rem; letter-spacing: .25em; font-weight: 500; white-space: nowrap; }
.brand p { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: .875rem; letter-spacing: .13em; color: rgba(240,246,252,.65); margin-top: 4px; }
.blue-settings, .header-actions { display:flex; align-items:center; gap:12px; }
.setting-block { display:flex; align-items:center; }
.setting-label { display:none; }
.blue-settings [aria-label="気分・周波数"] > span { display:none; }
.time-btn, .mood-btn { font-size: .875rem; min-width: 42px; min-height: 36px; }
.time-btn { letter-spacing: .05em; padding-inline: 9px; }
.motion-toggle { font-size: .875rem; border-radius: 999px; padding: 8px 14px; white-space: nowrap; }
.settings-toggle { display:none; }
#sound-toggle { min-height:44px; font-size:.875rem; white-space:nowrap; padding-inline:14px; }
#mixer-toggle-btn { width:44px; height:44px; flex-shrink:0; }
#sound-mixer-panel { top:54px; width:288px; padding:20px; background:rgba(6,18,34,.95); }
#sound-mixer-panel span, #test-droplet-btn { font-size:.875rem; }
#sound-mixer-panel .water-slider { height:24px; background:linear-gradient(to bottom, transparent 11px, rgba(255,255,255,.3) 11px, rgba(255,255,255,.3) 13px, transparent 13px); }
#sound-mixer-panel .water-slider::-moz-range-thumb { width:16px; height:16px; border:0; border-radius:50%; background:#e0f2fe; }
.bubble-option { display:flex; align-items:center; justify-content:space-between; min-height:44px; gap:12px; border-top:1px solid rgba(255,255,255,.15); color:rgba(255,255,255,.9); cursor:pointer; }
.bubble-option input { width:18px; height:18px; margin:0; accent-color:#bae6fd; cursor:pointer; }
#blue-journey > section { min-height:100svh; padding-top:150px; padding-bottom:150px; }
#surface h2 { font-size:clamp(1.75rem, 2.8vw, 2.6rem); line-height:1.9; letter-spacing:.12em; white-space:nowrap; }
.hero-mobile-break { display:none; }
#surface > div:first-child { max-width:52rem; }
#surface p:not(:first-child), .fragment-card > p { font-size:1rem; line-height:2.25; letter-spacing:.12em; }
#surface p:first-child { font-size:.875rem; letter-spacing:.25em; }
#hero-sound-cta { margin-top:12px; font-size:.875rem; padding:13px 24px; }
#surface > div:last-child { bottom:115px; }
#surface > div:last-child > span { font-size:.75rem; }
.fragment-card { max-width:560px; }
.fragment-card > div:first-child span { font-size:.75rem; letter-spacing:.12em; }
.fragment-card h3 span { font-size:.875rem; }
#depth-gauge > div:first-child, #depth-zone-name { font-size:.75rem; letter-spacing:.12em; }
#depth-value { font-size:.875rem; }
#color-readout { bottom:28px; left:32px; }
#live-color-name { font-size:1rem; }
#color-readout .font-mono { font-size:.75rem; }
#blue-actions { bottom:28px; right:32px; }
#blue-actions button, #deep-oracle-btn, #back-to-surface-btn { font-size:.875rem; }
#blue-actions button { padding:12px 20px; }
#oracle-modal, #specimen-modal { overscroll-behavior:contain; overflow-y:auto; padding:24px; }
#oracle-modal > div:last-child { padding-block:8px; }
#oracle-card-stage { width:min(350px,100%); height:520px; flex-shrink:0; }
#oracle-front-view > div { padding:20px; }
#oracle-trad-color, #oracle-title-en { font-size:.75rem; }
#oracle-message { font-size:1rem; line-height:1.9; letter-spacing:.04em; }
#oracle-ritual { font-size:.875rem; line-height:1.7; letter-spacing:.04em; }
#oracle-title-ja { font-size:1.3rem; }
#oracle-front-view [id="oracle-emblem-container"] { width:64px; height:64px; }
#oracle-draw-action-btn, #save-oracle-btn, #download-specimen-btn { font-size:.875rem; }
#close-oracle-modal-btn, #close-specimen-btn { width:44px; height:44px; flex-shrink:0; }
#specimen-modal > div { margin:auto; }
#specimen-modal p { font-size:.875rem; line-height:1.8; }
#specimen-canvas { max-width:min(260px, 32vh); height:auto; }
#toast { font-size:.875rem; top:auto; bottom:110px; max-width:calc(100% - 32px); border-radius:18px; text-align:center; background:rgba(6,18,34,.95); }
.noscript-note { position:fixed; z-index:60; inset:auto 20px 20px; padding:20px; background:#071929; }
html.motion-paused { scroll-behavior:auto; }
html.motion-paused *, html.motion-paused *::before, html.motion-paused *::after { animation:none!important; transition:none!important; }
@media (max-width:1250px) {
  .site-header { flex-wrap:wrap; padding:20px 24px; gap:14px; }
  .blue-settings { order:3; width:100%; justify-content:center; }
}
@media (max-width:700px) {
  .site-header { padding:18px 18px 24px; gap:10px; align-items:center; flex-wrap:nowrap; }
  .brand h1 { font-size:.875rem; letter-spacing:.16em; }
  .brand p { font-size:.75rem; letter-spacing:.08em; }
  .header-actions { gap:7px; }
  .settings-toggle { display:block; font-size:.875rem; border-radius:999px; padding:8px 12px; white-space:nowrap; }
  #sound-toggle { width:44px; padding:0; justify-content:center; }
  #sound-label { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
  #mixer-toggle-btn { width:36px; min-width:36px; }
  #sound-mixer-panel { right:0; max-width:calc(100vw - 36px); }
  .blue-settings { display:none; position:absolute; top:86px; left:18px; right:18px; width:auto; padding:20px 16px; border:1px solid rgba(255,255,255,.2); border-radius:22px; background:rgba(4,18,33,.96); backdrop-filter:blur(20px); flex-direction:column; align-items:stretch; gap:16px; box-shadow:0 16px 48px rgba(0,0,0,.25); }
  .settings-open .blue-settings { display:flex; }
  .setting-block { flex-direction:column; align-items:stretch; gap:9px; }
  .setting-label { display:block; font-size:.875rem; color:#c7dbe8; letter-spacing:.12em; }
  .setting-block > [role="group"] { justify-content:space-between; }
  .time-btn, .mood-btn { min-height:40px; flex:1; }
  .motion-toggle { align-self:flex-start; }
  #blue-journey > section { padding:130px 28px 170px 52px; }
  #surface { padding-inline:24px!important; }
  #surface h2 { font-size:clamp(1.5rem, 7vw, 1.8rem); letter-spacing:.15em; }
  .hero-mobile-break { display:initial; }
  #surface p:not(:first-child) { font-size:1rem; line-height:2; letter-spacing:.05em; }
  #surface p:first-child { font-size:.75rem; letter-spacing:.18em; }
  #surface > div:first-child { transform:none; }
  #surface > div:last-child { bottom:152px; }
  #depth-gauge { left:12px; }
  #depth-gauge > div:first-child { writing-mode:vertical-rl; font-size:.75rem; }
  #depth-gauge > div:nth-child(2) { height:110px; }
  #depth-zone-name { writing-mode:vertical-rl; font-size:.75rem; }
  #depth-gauge > div:nth-child(3) { font-size:.75rem; writing-mode:vertical-rl; }
  #depth-value { font-size:.75rem; }
  .fragment-card { padding:26px 22px; border-radius:24px; }
  .fragment-card > div:first-child { flex-wrap:wrap; gap:8px; }
  .fragment-card > div:first-child span { font-size:.75rem; }
  .fragment-card h3 { line-height:1.7; }
  .fragment-card h3 span { display:block; margin-left:0; }
  .fragment-card > p { letter-spacing:.05em; line-height:2; }
  #color-readout { left:20px; bottom:calc(88px + env(safe-area-inset-bottom)); gap:8px; }
  #live-swatch { width:22px; height:22px; }
  #live-color-name { font-size:.875rem; }
  #color-readout .font-mono { font-size:.75rem; }
  #blue-actions { bottom:calc(18px + env(safe-area-inset-bottom)); left:18px; right:18px; flex-direction:row; justify-content:space-between; gap:8px; }
  #blue-actions::before { content:""; position:fixed; inset:auto 0 0; height:150px; background:linear-gradient(transparent,rgba(3,10,20,.7)); pointer-events:none; z-index:-1; }
  #blue-actions button { flex:1; justify-content:center; padding:12px 8px; font-size:.875rem; letter-spacing:.04em; background:rgba(6,18,34,.65); }
  #blue-actions svg { width:14px; height:14px; }
  #oracle-modal, #specimen-modal { padding:16px; }
  #oracle-card-stage { width:min(328px,100%); height:510px; }
  #oracle-modal > div:last-child { gap:12px; }
  #oracle-modal h3 { font-size:1rem; letter-spacing:.13em; }
  #oracle-front-view > div { padding:16px; }
  #oracle-title-ja { letter-spacing:.14em; }
  #oracle-message { font-size:1rem; line-height:1.8; }
  #oracle-ritual { font-size:.875rem; }
  #toast { bottom:155px; width:max-content; }
}
@media (max-width:360px) {
  .site-header { padding-inline:12px; gap:5px; }
  .brand h1 { font-size:.8rem; }
  .settings-toggle { padding-inline:9px; }
  .header-actions { gap:4px; }
  #blue-actions { left:12px; right:12px; }
  #blue-actions button { font-size:.8rem; gap:5px; }
  #surface > div:last-child { display:none; }
  #oracle-card-stage { height:550px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior:auto; }
  *, *::before, *::after { animation:none!important; transition:none!important; }
}
