/* 東日本住宅評価センター 社内ポータル スタイル
 * ブループリント調（明色）＋WebGL街並み背景＋白ガラスの角ばりタイル。
 * サンプル(sample/社内ポータル_standalone.html)の意匠を素の HTML/CSS へ移植。
 */
:root {
  --bg-grad: linear-gradient(172deg, #f6f9fc 0%, #ecf1f7 44%, #dde6f0 100%);
  --ink: #1e2a38;
  --accent: #33628f;
  --font-ja: 'Noto Sans JP', "Yu Gothic", "Meiryo", sans-serif;
  --font-mono: 'Chakra Petch', ui-monospace, "SFMono-Regular", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; }
body { background: var(--bg-grad); color: var(--ink); font-family: var(--font-ja);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }

/* ===== 背景（Three.js「街と空」v8＋スクリム） ===== */
/* 素材ロード完了（初回描画）で .is-ready が付き fade-in。それまでは body のグラデーションが見える */
#cityGL { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; cursor: grab;
  opacity: 0; transition: opacity 1.2s ease; }
#cityGL.is-ready { opacity: 1; }
#scrim { position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120% 98% at 50% 0%, rgba(245,248,252,0.02) 34%, rgba(242,246,250,0.6) 100%); }
/* 夜（body.is-night＝bg/city.js が付与）：白いかぶせの代わりに藍色のかぶせをクロスフェード */
#scrim::after { content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity 1.5s ease;
  background: radial-gradient(120% 98% at 50% 0%, rgba(12,20,34,0.0) 34%, rgba(12,20,34,0.5) 100%); }
body.is-night #scrim::after { opacity: 1; }
/* 夜のテキスト色（背景の上に直接乗る文字だけ。タイルは白ガラスのまま） */
.powered-aws, .brand-ja, .brand-en, .brand-dev, .clock-time, .clock-date, .hero-label, .hero-title, .hero-desc,
.systems-head h2, .systems-meta, .p-footer, #build-tag { transition: color 1s ease; }
body.is-night .powered-aws { color: #d7e0ea; }
body.is-night .brand-ja, body.is-night .clock-time, body.is-night .hero-title, body.is-night .systems-head h2 { color: #eef3f8; }
body.is-night .brand-en, body.is-night .clock-date, body.is-night .hero-label, body.is-night .systems-meta,
body.is-night .p-footer, body.is-night #build-tag { color: #a9b8c8; }
body.is-night .brand-dev, body.is-night .hero-desc { color: #c6d2de; }
/* v11 クリック拡大中の説明カード（#bg-caption・bg/city.js が生成。熊の拡大中だけ表示） */
#bg-caption { position: fixed; top: 150px; right: 24px; z-index: 8; display: flex; flex-direction: column; gap: 3px; padding: 10px 14px;
  background: rgba(255,255,255,0.72); border: 1px solid rgba(255,255,255,0.8); border-radius: 3px; box-shadow: 0 2px 10px rgba(30,42,56,0.12);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); pointer-events: none; animation: bg-caption-in .35s ease-out both; }
#bg-caption[hidden] { display: none; }
#bg-caption .bg-caption-title { font-family: var(--font-ja); font-size: 16px; font-weight: 700; letter-spacing: .06em; color: #1f2d3d; }
#bg-caption .bg-caption-text { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; color: #53637a; }
@keyframes bg-caption-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
body.is-night #bg-caption { background: rgba(20,32,48,0.62); border-color: rgba(255,255,255,0.18); }
body.is-night #bg-caption .bg-caption-title { color: #eef3f8; }
body.is-night #bg-caption .bg-caption-text { color: #a9b8c8; }
@media (max-width: 560px) { #bg-caption { top: auto; bottom: 76px; right: 14px; left: 56px; } }

/* ===== 走る車の吹き出し（イースターエッグ・portal.js が生成/追従）===== */
/* z-index:1 = 背景キャンバス(0)より上・UI(#portal=2)より下。pointer-events:none でタイル操作を阻害しない */
.car-bubble { position: fixed; left: 0; top: 0; z-index: 1; pointer-events: none; will-change: transform; }
.car-bubble.is-hidden { display: none; }
.car-bubble .cb-box { position: relative; display: inline-block;
  font-family: var(--font-ja); font-weight: 600; font-size: 11px; line-height: 1.25;
  letter-spacing: 0.02em; color: #37485f; white-space: nowrap;
  background: rgba(255,255,255,0.82); border: 1px solid rgba(86,109,134,0.5);
  border-radius: 9px; padding: 3px 9px; box-shadow: 0 2px 7px rgba(40,60,90,0.14);
  opacity: 0.72;                                  /* 控えめ＝探して楽しむイースターエッグ */
  transition: opacity 0.35s ease, box-shadow 0.35s ease; }
.car-bubble .cb-text { display: inline-block; transition: opacity 0.17s ease; }  /* 文言切替フェード */
.car-bubble.is-swapping .cb-text { opacity: 0; }
.car-bubble .cb-box::before, .car-bubble .cb-box::after { content: ""; position: absolute; left: 50%; width: 0; height: 0; }
.car-bubble .cb-box::before { bottom: -7px; transform: translateX(-50%);       /* しっぽ＝縁取り */
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 7px solid rgba(86,109,134,0.5); }
.car-bubble .cb-box::after { bottom: -5px; transform: translateX(-50%);        /* しっぽ＝塗り */
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 6px solid rgba(255,255,255,0.92); }
.car-bubble.is-reveal .cb-box { opacity: 1; box-shadow: 0 0 0 2px rgba(51,98,143,0.5), 0 4px 12px rgba(40,60,90,0.28); }

/* ロゴは「隠しコマンド」＝手がかり（カーソル指/ホバー）は出さない。押した瞬間だけ軽い手応え。 */
/* （portal.js が enabled:true のときだけ .logo-toggle を付与。切替結果は jokelogo 反転＋トーストで分かる） */
.brand-logo.logo-toggle { transition: transform 0.12s ease; }
.brand-logo.logo-toggle:active { transform: scale(0.96); }
.cb-toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(8px);
  z-index: 30; pointer-events: none; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em;
  color: #eaf1f8; background: rgba(30,42,56,0.82); border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px; padding: 7px 16px; box-shadow: 0 6px 20px rgba(20,35,55,0.28);
  opacity: 0; transition: opacity 0.25s ease, transform 0.25s ease; }
.cb-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== レイアウト ===== */
#portal { position: relative; z-index: 2; cursor: grab; }
/* 背景ドラッグ中は全面 grabbing＋選択抑止 */
body.bg-dragging, body.bg-dragging * { cursor: grabbing !important; user-select: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 44px 56px 80px;
  min-height: 100vh; display: flex; flex-direction: column; }

/* Powered by AWS（左上・ブランド上／背景透明） */
.powered-aws { align-self: flex-start; margin-bottom: 20px; font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 0.09em; color: #232f3e; }
.powered-aws b { color: #ff9900; font-weight: 700; letter-spacing: 0.04em;
  background: #232f3e; padding: 2px 7px; border-radius: 3px; }

/* ===== ヘッダー ===== */
.p-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 16px; }
.brand-logo { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex-shrink: 0; display: block; }
.brand-ja { font-size: 16px; font-weight: 700; letter-spacing: 0.06em; color: #1c2937; }
.brand-en { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.22em; color: #6b7c90; margin-top: 3px; }
.brand-dev { font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; letter-spacing: 0.05em;
  color: #47586c; margin-top: 9px; line-height: 1.7; }
.brand-dev b { color: #fff; background: #33628f; font-weight: 700; letter-spacing: 0.04em;
  padding: 2px 8px; border-radius: 3px; white-space: nowrap; }
.clock { text-align: right; }
.clock-time { font-family: var(--font-mono); font-size: 26px; font-weight: 500; letter-spacing: 0.04em; color: #20303f; line-height: 1; font-variant-numeric: tabular-nums; }
.clock-date { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; color: #6b7c90; margin-top: 6px; }

/* ===== ヒーロー ===== */
.hero { margin-top: 64px; margin-bottom: 44px; }
.hero-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.34em; color: #7286a0; }
.hero-title { margin: 14px 0 0; font-size: 52px; font-weight: 700; letter-spacing: 0.04em; line-height: 1.08; color: #182430; }
.hero-desc { margin: 16px 0 0; max-width: 520px; font-size: 14px; line-height: 1.9; color: #53637a; }

/* ===== 社内システム ===== */
.systems { margin-top: 8px; }
.systems-head { display: flex; align-items: baseline; gap: 14px; padding-bottom: 16px; }   /* 2026-09-07 下線（border-bottom）はユーザー指摘で削除 */
.systems-head h2 { font-size: 16px; font-weight: 700; letter-spacing: 0.08em; color: #26374a; }
.systems-meta { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.2em; color: #8493a6; }

.tiles { margin-top: 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }

/* ===== タイル（白ガラス角ばりカード） ===== */
/* ★2026-09-20 アプリが増えてきたため一回り小さく（ユーザー指示・4 段階を見比べて「かなり小」を採用）。
   旧値: .tiles gap 16px / margin-top 22px、.tile min-height 158px / padding 20px 22px、
         .tile-no 26px、.tile-arrow 15px、.tile-name 16.5px、.tile-en 10px(0.14em / margin-top 6px)、
         .badge-soon/.badge-beta 9px(padding 2px 6px)、.beta-tag/.uc-tag margin-top 9px / 8.5px / 0.2em。
   結果: タイル 1 枚 158px → 108px、タイル一覧の高さ 506px → 352px（1200px 幅・3 列は不変）。 */
.tile { display: flex; flex-direction: column; min-height: 108px; padding: 13px 15px; border-radius: 3px;
  background: rgba(255,255,255,0.66); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.72); color: inherit;
  box-shadow: 0 1px 0 rgba(52,72,98,0.06), 0 14px 30px -22px rgba(30,48,72,0.4);
  transition: transform .28s cubic-bezier(.2,.7,.3,1), border-color .28s, box-shadow .28s; }
.tile-top { display: flex; justify-content: space-between; align-items: flex-start; }
.tile-no { font-family: var(--font-mono); font-size: 19px; font-weight: 400; color: #c0ccda; letter-spacing: 0.02em; }
.tile-arrow { font-size: 12px; color: #9fb0c2; transition: transform .28s, color .28s; }
.tile-body { margin-top: auto; }
.tile-name { font-size: 13.5px; font-weight: 500; color: #22323f; letter-spacing: 0.03em; }
.tile-en { font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.1em; color: #8090a2; margin-top: 3px; }

/* 稼働中タイル：ホバーで浮上＋枠がアクセント色（CSS のみ・CSP 安全） */
.tile.is-active { cursor: pointer; }
.tile.is-active .tile-no { color: #8296ab; }
.tile.is-active:hover { transform: translateY(-4px); border-color: var(--accent);
  box-shadow: 0 1px 0 rgba(52,72,98,0.06), 0 22px 40px -24px rgba(30,48,72,0.5); }
.tile.is-active:hover .tile-arrow { transform: translate(2px, -2px); color: var(--accent); }
.tile.is-active:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* 準備中タイル：淡色・非活性 */
.tile.is-inactive { cursor: default; background: rgba(255,255,255,0.62); border-color: rgba(255,255,255,0.6); }
.tile.is-inactive .tile-no { color: #cdd6e0; }
.tile.is-inactive .tile-name { color: #66788a; }
.tile.is-inactive .tile-en { color: #8b98a8; }
.badge-soon { align-self: flex-start; font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.12em;
  color: #a8842a; border: 1px solid rgba(168,132,42,0.42); border-radius: 2px; padding: 1px 5px; }
/* β版（beta）：稼働タイル扱い（矢印あり）＋ブルーのバッジ／下段ラベル「β版 試験利用可能です」。
   アンバー(開発中＝まだ触れない)とブルー(β版＝使ってよいが試験段階)を色で区別する。 */
.tile-flags { display: inline-flex; align-items: center; gap: 9px; }
.badge-beta { align-self: flex-start; font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.12em;
  color: #2f6ea8; border: 1px solid rgba(47,110,168,0.45); background: rgba(47,110,168,0.07);
  border-radius: 2px; padding: 1px 5px; white-space: nowrap; }
.beta-tag { margin-top: 6px; display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono);
  font-size: 7.5px; font-weight: 500; letter-spacing: 0.16em; color: #4d7ba6; }
.beta-tag::before { content: ""; width: 7px; height: 7px; border-radius: 1px; background: #2f6ea8; }

/* 開発中（under construction）バナー：控えめな注意ストライプ＋英字 */
/* 稼働タイルの添え書き（段階開放の案内など。青い角印＝β と同じ系統の「使える」色） */
.note-tag { margin-top: 6px; display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.04em; color: #2f6ea8; }
.note-tag::before { content: ""; width: 7px; height: 7px; border-radius: 1px; background: #2f6ea8; }
.uc-tag { margin-top: 6px; display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono);
  font-size: 7.5px; font-weight: 500; letter-spacing: 0.16em; color: #a8842a; }
.uc-tag::before { content: ""; width: 7px; height: 7px; border-radius: 1px;
  background: repeating-linear-gradient(45deg, #c9a227 0 2px, #7a8794 2px 4px); }

/* 登場アニメ（軽い） */
.tiles.play .tile { animation: tileIn .6s cubic-bezier(.2,.75,.2,1) backwards; animation-delay: calc(var(--i) * 0.05s); }
@keyframes tileIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; } }

/* ===== フッター ===== */
.p-footer { margin-top: auto; padding-top: 40px; display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; color: #8695a8; }

/* ===== 運用 UI（環境バッジ／デプロイ日時／ログアウト） ===== */
.env-badge { position: fixed; top: 8px; right: 8px; z-index: 9; padding: 3px 12px;
  font-family: var(--font-mono); font-weight: 500; font-size: 12px; letter-spacing: 1px; color: #fff;
  background: #d9534f; border-radius: 3px; opacity: 0.9; pointer-events: none; user-select: none; }
.env-badge.env-local { background: #6c757d; }
#build-tag { position: fixed; bottom: 12px; left: 14px; z-index: 8; font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.08em; color: #8695a8; opacity: 0.85; pointer-events: none; }
#signout-btn { position: fixed; bottom: 14px; right: 14px; z-index: 8; padding: 7px 15px; font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 0.06em; color: #3a4c60; background: rgba(255,255,255,0.7);
  border: 1px solid rgba(52,72,98,0.2); border-radius: 3px; cursor: pointer;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: background .2s, border-color .2s, color .2s; }
#signout-btn:hover { background: #fff; border-color: var(--accent); color: var(--accent); }
/* 右下の操作をまとめる器。ログアウトの左隣に「社外ログインのスマホ認証」を並べる。
   上下に積む（リンクが上・ログアウトが下）。高さは約 51px なので bottom:14〜65px を占める。
   ※案内AIチャットの FAB／パネルは、この分を避けて bottom:96px に下げてある（chat.css・2026-09-20 ユーザー指摘）。
   #signout-btn は下でこの器の中に入れるため position を上書きする。 */
#corner-actions { position: fixed; bottom: 14px; right: 14px; z-index: 8; display: flex;
  flex-direction: column; align-items: flex-end; gap: 8px; }
#corner-actions #signout-btn { position: static; bottom: auto; right: auto; z-index: auto; }
/* 承認者だけに出るリンク（mfa-setup.html・identity 設計書 §7.8）。ボタンではなく下線付きの文字（ユーザー指示） */
#mfa-link { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; color: #3a4c60;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
  white-space: nowrap; transition: color .2s; }
#mfa-link:hover { color: var(--accent); }
#mfa-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.is-night #mfa-link { color: #d7e0ea; }
/* 背景の視点操作（左下・デプロイ日時の上。bg/city.js が生成）：拡大／縮小／初期視点。ログアウトと同じガラス調 */
#bg-controls { position: fixed; left: 14px; bottom: 34px; z-index: 8; display: flex; flex-direction: column; gap: 4px; }
#bg-controls button { width: 30px; height: 30px; padding: 0; font-family: var(--font-mono); font-size: 15px; line-height: 1;
  color: #3a4c60; background: rgba(255,255,255,0.7); border: 1px solid rgba(52,72,98,0.2); border-radius: 3px; cursor: pointer;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: background .2s, border-color .2s, color .2s; }
#bg-controls button:hover { background: #fff; border-color: var(--accent); color: var(--accent); }
#bg-controls button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#bg-controls button[data-act="ui"], #bg-controls button[data-act="pause"] { font-size: 11px; letter-spacing: 0.06em; }   /* pause: II／▶（自動回転の一時停止・2026-09-10） */
#bg-controls button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
/* v11 クリック拡大: 対象の上ではカーソルを指に（bg/city.js が body.target-hover を付与）。「↩」は拡大中だけ表示 */
body.target-hover #portal, body.target-hover #cityGL { cursor: pointer; }
#bg-controls button[hidden] { display: none; }
#bg-controls button[data-act="back"] { background: var(--accent); border-color: var(--accent); color: #fff; }
/* 「UI」ボタン: 背景以外の表示（ヘッダー・タイル・チャット・ログアウト・デプロイ日時・スクリム）をまとめて隠す
   （会社ロゴも隠す＝2026-09-08 に一度「ロゴは残す」にしたが、ユーザー指示で元に戻した） */
body.ui-hidden #portal, body.ui-hidden #scrim, body.ui-hidden #chat-root, body.ui-hidden #signout-btn, body.ui-hidden #corner-actions,
body.ui-hidden #build-tag, body.ui-hidden .env-badge { display: none !important; }

/* ===== レスポンシブ ===== */
@media (max-width: 900px) {
  .container { padding: 32px 28px 72px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .hero-title { font-size: 40px; }
  .hero { margin-top: 48px; }
}
@media (max-width: 560px) {
  .p-header { flex-direction: column; gap: 14px; }
  .clock { text-align: left; }
  .tiles { grid-template-columns: 1fr; }
  .hero-title { font-size: 32px; }
}

/* ===== モーション低減 ===== */
@media (prefers-reduced-motion: reduce) {
  .tiles.play .tile { animation: none; }
  .tile.is-active, .tile-arrow { transition: none; }
}
