/* ============================================================
   Layered Gate Execution Protocol — Showcase styles
   黒×ティール、幾何学ミニマリズム
   ============================================================ */

:root {
  --bg: #050810;                         /* Velcore に寄せて純黒寄り */
  --panel: #0E1424;
  --card: #141C32;
  --border: #2A3A55;
  --teal: #00D4E0;                       /* Velcore のティール (ロゴ V の上端) */
  --teal-soft: rgba(0, 212, 224, 0.18);
  --teal-glow: rgba(0, 212, 224, 0.45);
  --indigo: #5A6FE8;                     /* Velcore 粒子の中域 */
  --violet: #2A2DBE;                     /* Velcore 粒子の深域 */
  --red: #FF4757;
  --red-soft: rgba(255, 71, 87, 0.2);
  --text: #E6EDF7;
  --text-dim: rgba(230, 237, 247, 0.62);
  --text-dimmer: rgba(230, 237, 247, 0.4);
  --grad-velcore: linear-gradient(135deg, #00D4E0 0%, #5A6FE8 55%, #2A2DBE 100%);
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

html {
  font-size: 14.4px;        /* 全体 90% スケール (R111 反映) */
}
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans JP', 'Yu Gothic UI', sans-serif;
  height: 100vh;
  overflow: hidden;          /* ページ全体スクロール禁止、タブ切替で完結 (R37 反映) */
}

a { color: var(--teal); text-decoration: none; }

/* ============ 背景の粒子レイヤー (Velcore 風 波) ============ */
.bg-particles {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 1;
}
.bg-particles circle.wave-dot {
  /* particle gradient 風 — fill は JS で個別設定 */
}

/* ============ ヘッダー / タブナビ ============ */
.header {
  position: fixed; top: 0; left: 0; right: 0;
  background: rgba(5, 8, 16, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  padding: 10px 32px;
  display: flex; align-items: center; justify-content: space-between;
}

.logo-block {
  display: flex; flex-direction: column;
  gap: 1px;
  line-height: 1.15;
}
.logo {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 14px;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.logo::before {
  content: '▲';
  color: var(--teal);
  font-size: 16px;
}
.logo-jp {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding-left: 26px;        /* logo の三角分インデント */
}

/* 右下 案件サイン (Velcore ロゴセンス) */
.case-sig {
  position: fixed;
  right: 22px; bottom: 16px;
  z-index: 50;
  display: flex; align-items: baseline; gap: 6px;
  padding: 10px 16px 10px 16px;
  background: linear-gradient(135deg, rgba(0,212,224,0.04), rgba(42,45,190,0.06));
  border-left: 1px solid rgba(0,212,224,0.35);
  border-bottom: 1px solid rgba(90,111,232,0.25);
  border-radius: 0 0 0 6px;
  backdrop-filter: blur(8px);
  pointer-events: none;
  box-shadow: 0 4px 24px rgba(0,212,224,0.06);
}
.case-sig-for {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.32em;
  color: var(--text-dimmer);
  text-transform: uppercase;
  margin-right: 2px;
}
.case-sig-velcore {
  font-family: 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.005em;
  background: var(--grad-velcore);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}
.case-sig-consulting {
  font-family: 'Allura', cursive;
  font-size: 22px;
  font-weight: 400;
  color: var(--teal);
  margin-left: -4px;
  letter-spacing: 0;
  line-height: 1;
  transform: translateY(4px);
  text-shadow: 0 0 12px rgba(0,212,224,0.3);
}
.case-sig-demo {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.32em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-left: 6px;
}
@media (max-width: 600px) { .case-sig { display: none; } }


.tab-nav {
  display: flex; gap: 4px;
}
.tab-link {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 84px;
  justify-content: center;
}
.tab-link:hover { color: var(--text); }
.tab-link.active {
  color: var(--teal);
  background: var(--teal-soft);
}
.tab-link.active::after {
  content: '';
  position: absolute;
  left: 16px; right: 16px; bottom: 2px;
  height: 1px;
  background: var(--teal);
  box-shadow: 0 0 8px var(--teal-glow);
}

/* タブ 英 / 日 切替 (ホバー時に日本語が同位置に重ねて切替) */
.tab-link .lbl-en,
.tab-link .lbl-jp {
  transition: opacity 0.25s ease, transform 0.25s ease;
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
  white-space: nowrap;
}
.tab-link .lbl-jp {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  font-size: 11px;
  letter-spacing: 0.05em;
  pointer-events: none;
  transform: translateY(4px);
  color: var(--teal);
}
.tab-link:hover .lbl-en { opacity: 0; transform: translateY(-4px); }
.tab-link:hover .lbl-jp { opacity: 1; transform: translateY(0); }

/* ============ メイン ============ */
main {
  position: relative;
  z-index: 1;
  padding-top: 64px;
  height: 100vh;
  overflow: hidden;                       /* R37: ページ全体スクロール禁止 */
}
.tab-pane {
  display: none;
  height: calc(100vh - 64px);             /* 1 タブ 1 viewport */
  overflow-y: auto;                        /* タブ内のみスクロール (必要なら) */
}
.tab-pane.active { display: block; }

/* タブの 1 行ガイド */
.tab-hint {
  position: sticky; top: 0; z-index: 4;
  background: rgba(10,14,26,0.92);
  backdrop-filter: blur(6px);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  padding: 8px 32px;
  border-bottom: 1px solid var(--border);
}
.tab-hint .lbl { color: var(--teal); font-weight: 700; margin-right: 10px; }

/* ============ Tab 1 Core (Hero) ============ */
#tab-core.active {
  padding: 12px 40px 24px;
  display: flex; flex-direction: column; justify-content: center;
  gap: 4px;
}
.hero-headline {
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 900;
  font-size: clamp(32px, 5.5vw, 72px);    /* R1: 縮小して viewport に納める */
  line-height: 1.08;
  letter-spacing: 0.01em;
  margin: 0 0 8px;
}
.hero-headline .strike {
  text-decoration: line-through;
  text-decoration-thickness: 5px;
  text-decoration-color: var(--text-dimmer);
  color: var(--text-dim);
}
.hero-headline .teal {
  color: var(--teal);
  text-shadow: 0 0 24px var(--teal-glow);
}
.hero-sub-en {
  font-family: 'Inter', sans-serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(13px, 1.4vw, 18px);
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 0 0 4px;
}
.hero-sub-jp {
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 500;
  font-size: clamp(11px, 1.05vw, 13px);
  letter-spacing: 0.06em;
  color: var(--text-dimmer);
  margin: 0 0 10px;
  line-height: 1.5;
}

.hero-svg-wrap {
  width: 100%;
  margin: 0;
  flex: 1;
  min-height: 0;
  display: flex; align-items: center;
}
.hero-svg-wrap svg {
  width: 100%;
  height: auto;
  max-height: 42vh;                       /* R1/R37: viewport 内に納める */
  display: block;
}

.gate-shape {
  fill: none;
  stroke: var(--teal);
  stroke-width: 2;
  opacity: 0.7;
  filter: drop-shadow(0 0 6px var(--teal-glow));
}
.gate-shape.pulse { animation: gatePulse 200ms ease-out; }
@keyframes gatePulse {
  0%   { opacity: 0.7; stroke-width: 2; }
  50%  { opacity: 1;   stroke-width: 4; filter: drop-shadow(0 0 14px var(--teal)); }
  100% { opacity: 0.7; stroke-width: 2; }
}

.token { fill: var(--teal); filter: drop-shadow(0 0 6px var(--teal)); }
.token.bad { fill: var(--red); filter: drop-shadow(0 0 6px var(--red)); }
.reject-label {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 11px;
  fill: var(--red);
  font-weight: 600;
}

.design-box {
  fill: none;
  stroke: var(--border);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}
.design-label {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  fill: var(--text-dim);
  letter-spacing: 0.08em;
}

.cta-row {
  display: flex; gap: 14px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.cta-btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  letter-spacing: 0.08em;
  font-size: 12px;
  padding: 12px 28px;
  border: 2px solid var(--teal);
  border-radius: 999px;
  background: transparent;
  color: var(--teal);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.65,0,0.35,1);
}
.cta-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(closest-side, var(--teal-soft), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s;
}
.cta-btn:hover { transform: scale(1.06); }
.cta-btn:hover::before { opacity: 1; }
.cta-btn span { position: relative; z-index: 1; }

/* ============ Tab 2 Why (4 cards 2x2) ============ */
#tab-issues.active {
  padding: 16px 40px 24px;
}
.issues-question {
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 800;
  font-size: clamp(20px, 2.8vw, 32px);    /* R170: 縮小 + R111: 全体 90% */
  text-align: center;
  margin: 8px 0 24px;
  color: var(--text);
}
.issues-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  max-width: 1200px; margin: 0 auto;
}
@media (max-width: 800px) {
  .issues-grid { grid-template-columns: 1fr; }
}

.issue-card {
  perspective: 1400px;
  height: 200px;                          /* R73: 縮小 */
  cursor: pointer;
}
.issue-card-inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 500ms cubic-bezier(0.65,0,0.35,1);
}
.issue-card.flipped .issue-card-inner { transform: rotateY(180deg); }

.issue-face {
  position: absolute; inset: 0;
  border-radius: 12px;
  padding: 28px;
  backface-visibility: hidden;
  border: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: space-between;
}
.issue-face.front { background: var(--card); }
.issue-face.back  {
  background: linear-gradient(135deg, rgba(0,212,224,0.06), var(--panel) 70%);
  border-color: var(--teal);
  transform: rotateY(180deg);
}
.issue-num {
  font-family: 'Inter', sans-serif;
  font-weight: 700; font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--text-dimmer);
}
.issue-face.back .issue-num { color: var(--teal); }
.issue-title {
  font-size: 22px;
  font-weight: 800;
  margin: 8px 0 12px;
  line-height: 1.3;
}
.issue-face.back .issue-title { color: var(--teal); }
.issue-body {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.7;
}

.issues-cta {
  text-align: center;
  margin-top: 40px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--teal);
  opacity: 0;
  letter-spacing: 0.06em;
  transition: opacity 0.6s;
  cursor: pointer;
}
.issues-cta.visible { opacity: 0.95; }
.issues-cta:hover { text-decoration: underline; }

/* ============ Tab 3 Structure (15層×6ゲート) ============ */
#tab-flow.active {
  padding: 12px 24px 24px;
  display: grid;
  grid-template-columns: minmax(420px, 1.7fr) minmax(260px, 1fr);
  gap: 18px;
  height: calc(100vh - 64px);
}
@media (max-width: 760px) {
  #tab-flow.active { grid-template-columns: 1fr; height: auto; }
}

.structure-svg-wrap {
  background: rgba(17, 23, 38, 0.4);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  position: relative;
  overflow-y: auto;                       /* R73: 内部スクロール */
  max-height: calc(100vh - 130px);
}
.structure-svg-wrap svg { width: 100%; height: auto; }

.layer-rect {
  fill: var(--card);
  stroke: var(--border);
  stroke-width: 1;
  cursor: pointer;
  transition: fill 0.2s, stroke 0.2s;
}
.layer-rect:hover, .layer-rect.selected {
  fill: rgba(0, 212, 224, 0.12);
  stroke: var(--teal);
  filter: drop-shadow(0 0 6px var(--teal-glow));
}
.layer-text {
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 600;
  font-size: 12px;
  fill: var(--text);
  pointer-events: none;
}
.layer-id {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  fill: var(--text-dimmer);
  letter-spacing: 0.08em;
  pointer-events: none;
}

.gate-hex {
  fill: var(--panel);
  stroke: var(--teal);
  stroke-width: 1.5;
  cursor: pointer;
  transition: fill 0.2s, filter 0.2s;
}
.gate-hex:hover, .gate-hex.selected {
  fill: var(--teal-soft);
  filter: drop-shadow(0 0 8px var(--teal));
}
.gate-text {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 11px;
  fill: var(--teal);
  pointer-events: none;
  text-anchor: middle;
}

.structure-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  overflow-y: auto;
  max-height: 80vh;
}
.structure-panel h3 {
  font-family: 'Inter', sans-serif;
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 13px;
  letter-spacing: 0.1em;
}
.structure-panel h2 {
  margin: 0 0 16px;
  font-size: 22px;
  font-weight: 800;
}
.structure-panel dl {
  display: grid; grid-template-columns: 80px 1fr;
  gap: 8px 16px;
  font-size: 13px;
  margin: 8px 0;
}
.structure-panel dt { color: var(--text-dim); }
.structure-panel dd { margin: 0; color: var(--text); }

.flow-play-hint {
  display: block;
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--teal);
  margin: 12px 0 8px;
  animation: blink 2s ease-in-out infinite;
  cursor: pointer;
}
.flow-play-hint:hover { text-decoration: underline; }
@keyframes blink {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ============ Tab 4 Live ============ */
#tab-live.active {
  padding: 12px 20px 16px;
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) minmax(260px, 340px);
  gap: 14px;
  height: calc(100vh - 64px);
}
@media (max-width: 760px) {
  #tab-live.active { grid-template-columns: 1fr; height: auto; }
}
.live-pane {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  overflow-y: auto;
  position: relative;
}
.live-pane h3 {
  font-family: 'Inter', sans-serif;
  margin: 0 0 14px;
  color: var(--teal);
  font-size: 12px;
  letter-spacing: 0.1em;
}

.scenario-card {
  padding: 12px 12px 12px 16px;
  border-radius: 8px;
  background: var(--card);
  margin-bottom: 10px;
  cursor: pointer;
  position: relative;
  border-left: 4px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}
.scenario-card:hover { background: rgba(24, 34, 56, 0.7); }
.scenario-card.selected {
  border-left-color: var(--teal);
  background: rgba(0, 212, 224, 0.06);
}
.scenario-card .kind {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-dimmer);
}
.scenario-card.ng .kind { color: var(--red); }
.scenario-card.ok .kind { color: var(--teal); }
.scenario-card .lbl {
  font-size: 14px;
  font-weight: 700;
  margin: 4px 0 2px;
}
.scenario-card .desc {
  font-size: 12px;
  color: var(--text-dim);
}
.scenario-card.locked { opacity: 0.4; pointer-events: none; }

.live-controls {
  display: flex; gap: 8px; align-items: center;
  margin: -14px -14px 14px;             /* pane padding 相殺 */
  padding: 12px 14px;
  flex-wrap: wrap;
  position: sticky; top: 0; z-index: 5;  /* R150: スクロールで消えない */
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.live-controls button {
  font-family: 'Inter', sans-serif;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.live-controls button:hover { border-color: var(--teal); color: var(--teal); }
.live-controls button.primary {
  background: var(--teal);
  color: var(--bg);
  border-color: var(--teal);
  font-weight: 700;
}
.live-controls button.primary:disabled,
.live-controls button:disabled {
  opacity: 0.4; cursor: not-allowed;
}
.live-controls .speed-group { display: inline-flex; gap: 4px; margin-left: 6px; }
.live-controls .speed-group button { padding: 6px 10px; font-size: 11px; }
.live-controls .speed-group button.active { background: var(--teal-soft); color: var(--teal); border-color: var(--teal); }

.live-flow-svg-wrap svg { width: 100%; height: auto; }
.scan-circle {
  fill: none;
  stroke: var(--teal);
  stroke-width: 2;
  opacity: 0;
}
.layer-rect.fail {
  fill: var(--red-soft);
  stroke: var(--red);
}
.improve-box {
  fill: rgba(0,212,224,0.08);
  stroke: var(--teal);
  stroke-dasharray: 4 4;
  stroke-width: 1.5;
}

.log-pane {
  background: #050810;
}
.log-pane h3 { color: var(--teal); }
.log-line {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.6;
  padding: 1px 0;
  color: var(--text);
  white-space: pre-wrap;
}
.log-line.pass { color: var(--teal); }
.log-line.fail { color: var(--red); }
.log-line.fail::before { content: '● '; }
.log-line.warn { color: #FFC857; }
.log-line.info { color: var(--text-dim); }
.log-pane .caret {
  display: inline-block;
  width: 8px; background: var(--teal);
  height: 1em; vertical-align: middle;
  animation: caret 1s steps(2) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* ============ Tab 5 Improve ============ */
#tab-loop.active {
  padding: 16px 24px 24px;
  display: grid;
  grid-template-columns: minmax(360px, 1.4fr) minmax(280px, 1fr);
  gap: 22px;
  align-items: start;
  height: calc(100vh - 64px);
}
@media (max-width: 760px) { #tab-loop.active { grid-template-columns: 1fr; height: auto; } }
.improve-svg-wrap { max-height: calc(100vh - 110px); overflow: hidden; }
.improve-panel { max-height: calc(100vh - 110px); overflow-y: auto; }

.improve-svg-wrap {
  background: rgba(17,23,38,0.4);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.improve-svg-wrap svg { width: 100%; height: auto; }

.improve-core {
  fill: var(--teal-soft);
  stroke: var(--teal);
  stroke-width: 2;
  filter: drop-shadow(0 0 18px var(--teal-glow));
  animation: corePulse 2.4s ease-in-out infinite;
}
@keyframes corePulse {
  0%, 100% { r: 56; filter: drop-shadow(0 0 18px var(--teal-glow)); }
  50%      { r: 60; filter: drop-shadow(0 0 32px var(--teal)); }
}
.ooda-node circle {
  fill: var(--card);
  stroke: var(--teal);
  stroke-width: 1.5;
}
.ooda-node text {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  fill: var(--text);
  text-anchor: middle;
  letter-spacing: 0.08em;
}

.improve-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.improve-panel h2 {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 800;
}
.improve-panel ul {
  list-style: none;
  padding: 0; margin: 0;
}
.improve-panel li {
  padding: 10px 12px;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
  display: flex; justify-content: space-between;
  gap: 12px;
}
.improve-panel li:last-child { border-bottom: none; }
.improve-panel li .target { color: var(--text); font-weight: 600; }
.improve-panel li .note { color: var(--text-dim); font-size: 12px; }
.improve-panel li.new {
  background: var(--teal-soft);
  border-left: 3px solid var(--teal);
  padding-left: 9px;
  animation: newRow 600ms ease-out;
}
@keyframes newRow {
  0% { background: var(--teal); padding-left: 18px; }
  100% { background: var(--teal-soft); padding-left: 9px; }
}
