/* ============================================================
   習陵祭 装飾パート - Aurora Theme
   未来的・幻想的なグラデーションデザイン
   ============================================================ */

:root {
  --aurora-1: #6366f1;
  --aurora-2: #8b5cf6;
  --aurora-3: #ec4899;
  --aurora-4: #06b6d4;
  --bg-0: #05060f;
  --bg-1: #0a0e1f;
  --bg-2: #111634;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.12);
  --text-0: #f8fafc;
  --text-1: #cbd5e1;
  --text-2: #94a3b8;
  --shadow-glow: 0 8px 40px rgba(99, 102, 241, 0.35);
}

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

html, body {
  height: 100%;
  font-family: 'Zen Kaku Gothic New', 'Noto Sans JP', sans-serif;
  background: var(--bg-0);
  color: var(--text-0);
  overflow-x: hidden;
}

/* ---- Aurora背景 ---- */
.aurora-bg {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(60% 80% at 20% 10%, rgba(99,102,241,0.28), transparent 60%),
    radial-gradient(50% 70% at 85% 20%, rgba(236,72,153,0.22), transparent 60%),
    radial-gradient(70% 90% at 50% 100%, rgba(6,182,212,0.22), transparent 60%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
}
.aurora-blob {
  position: fixed; z-index: -1; border-radius: 50%;
  filter: blur(90px); opacity: 0.5; pointer-events: none;
  animation: float 18s ease-in-out infinite;
}
.blob-1 { width: 480px; height: 480px; background: var(--aurora-1); top: -120px; left: -100px; }
.blob-2 { width: 420px; height: 420px; background: var(--aurora-3); bottom: -140px; right: -80px; animation-delay: -6s; }
.blob-3 { width: 360px; height: 360px; background: var(--aurora-4); top: 40%; left: 55%; animation-delay: -12s; }

@keyframes float {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.1); }
  66% { transform: translate(-30px, 40px) scale(0.95); }
}

/* ---- 汎用 ---- */
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-radius: 22px;
}
.gradient-text {
  background: linear-gradient(120deg, #a5b4fc, #f0abfc, #67e8f9);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
button { font-family: inherit; cursor: pointer; border: none; }
input, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* fade-in */
.reveal { opacity: 0; transform: translateY(30px); transition: all .8s cubic-bezier(.16,1,.3,1); }
.reveal.in { opacity: 1; transform: none; }

/* ============================================================
   ホームページ (HERO)
   ============================================================ */
.hero {
  min-height: 92vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  position: relative; padding: 40px 20px;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 18px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-border);
  font-size: 13px; letter-spacing: 2px; color: var(--text-1);
  margin-bottom: 28px; animation: fadeDown 1s both;
}
.hero-title {
  font-size: clamp(44px, 9vw, 110px); font-weight: 900;
  line-height: 1.02; letter-spacing: 2px;
  animation: fadeUp 1.1s .15s both;
}
.hero-sub {
  margin-top: 22px; font-size: clamp(15px, 2.4vw, 20px);
  color: var(--text-1); max-width: 620px; line-height: 1.9;
  animation: fadeUp 1.1s .3s both;
}
.hero-cta { margin-top: 40px; display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; animation: fadeUp 1.1s .45s both; }
.scroll-hint {
  position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
  color: var(--text-2); font-size: 13px; animation: bounce 2s infinite;
}
@keyframes fadeUp { from { opacity:0; transform: translateY(40px);} to {opacity:1; transform:none;} }
@keyframes fadeDown { from { opacity:0; transform: translateY(-20px);} to {opacity:1; transform:none;} }
@keyframes bounce { 0%,100%{transform:translateX(-50%) translateY(0);} 50%{transform:translateX(-50%) translateY(10px);} }

.btn {
  padding: 15px 34px; border-radius: 999px; font-weight: 700; font-size: 15px;
  transition: all .3s cubic-bezier(.16,1,.3,1); position: relative; overflow: hidden;
}
.btn-primary {
  background: linear-gradient(120deg, var(--aurora-1), var(--aurora-2), var(--aurora-3));
  background-size: 200% 200%; color: white; box-shadow: var(--shadow-glow);
  animation: gradShift 6s ease infinite;
}
.btn-primary:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 12px 50px rgba(139,92,246,.55); }
.btn-ghost { background: var(--glass); border: 1px solid var(--glass-border); color: var(--text-0); }
.btn-ghost:hover { background: rgba(255,255,255,.12); transform: translateY(-3px); }
@keyframes gradShift { 0%{background-position:0 0;} 50%{background-position:100% 100%;} 100%{background-position:0 0;} }

/* ---- セクション ---- */
.section { padding: 80px 0; }
.section-title { font-size: clamp(28px, 5vw, 46px); font-weight: 900; text-align: center; margin-bottom: 12px; }
.section-desc { text-align: center; color: var(--text-2); margin-bottom: 50px; font-size: 15px; }

/* ---- 特徴カード ---- */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px,1fr)); gap: 22px; }
.feature-card { padding: 34px 28px; transition: all .4s cubic-bezier(.16,1,.3,1); }
.feature-card:hover { transform: translateY(-8px); border-color: rgba(139,92,246,.5); box-shadow: var(--shadow-glow); }
.feature-icon { font-size: 32px; margin-bottom: 18px; display: inline-block;
  background: linear-gradient(120deg,var(--aurora-2),var(--aurora-3)); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
.feature-card h3 { font-size: 19px; margin-bottom: 10px; }
.feature-card p { color: var(--text-2); font-size: 14px; line-height: 1.8; }

/* ============================================================
   掲示板
   ============================================================ */
.board-list { display: flex; flex-direction: column; gap: 16px; }
.board-post { padding: 26px 28px; transition: all .3s; position: relative; overflow: hidden; }
.board-post::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg,var(--aurora-1),var(--aurora-3));
}
.board-post:hover { transform: translateX(6px); border-color: rgba(139,92,246,.4); }
.board-post.pinned { border-color: rgba(245,158,11,.4); }
.board-post.pinned::before { background: linear-gradient(180deg,#f59e0b,#ec4899); }
.board-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.board-cat { font-size: 11px; padding: 4px 12px; border-radius: 999px; background: rgba(99,102,241,.2); color: #a5b4fc; font-weight: 700; }
.board-pin { font-size: 11px; color: #fbbf24; }
.board-title { font-size: 19px; font-weight: 700; flex: 1; }
.board-date { font-size: 12px; color: var(--text-2); }
.board-content { color: var(--text-1); font-size: 14px; line-height: 1.9; white-space: pre-wrap; }
.board-actions { margin-top: 14px; display: flex; gap: 10px; }
.mini-btn { padding: 6px 14px; font-size: 12px; border-radius: 8px; background: var(--glass); border: 1px solid var(--glass-border); color: var(--text-1); transition: all .2s; }
.mini-btn:hover { background: rgba(255,255,255,.12); }
.mini-btn.danger:hover { background: rgba(244,63,94,.25); color: #fda4af; }

/* ============================================================
   隠しゲート (登録/ログイン)
   ============================================================ */
.gate {
  margin: 60px auto 20px; max-width: 460px; padding: 40px 34px; text-align: center;
}
.gate-emblem {
  width: 64px; height: 64px; margin: 0 auto 20px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center; font-size: 28px;
  background: linear-gradient(135deg,var(--aurora-1),var(--aurora-3));
  box-shadow: var(--shadow-glow); animation: pulse 3s ease infinite;
}
@keyframes pulse { 0%,100%{transform:scale(1);} 50%{transform:scale(1.06);} }
.gate h3 { font-size: 22px; margin-bottom: 6px; }
.gate p { color: var(--text-2); font-size: 13px; margin-bottom: 26px; }
.gate-tabs { display: flex; gap: 8px; margin-bottom: 24px; background: rgba(0,0,0,.25); padding: 5px; border-radius: 14px; }
.gate-tab { flex: 1; padding: 11px; border-radius: 10px; font-size: 14px; font-weight: 700; color: var(--text-2); background: transparent; transition: all .3s; }
.gate-tab.active { background: linear-gradient(120deg,var(--aurora-1),var(--aurora-2)); color: white; box-shadow: 0 4px 16px rgba(99,102,241,.4); }

/* フォーム */
.field { margin-bottom: 16px; text-align: left; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 7px; font-weight: 500; }
.field input[type=text], .field input[type=password], .field textarea, .field select {
  width: 100%; padding: 14px 16px; border-radius: 12px; font-size: 15px;
  background: rgba(0,0,0,.3); border: 1px solid var(--glass-border); color: var(--text-0);
  transition: all .25s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--aurora-2); box-shadow: 0 0 0 3px rgba(139,92,246,.25);
}
.field input::placeholder, .field textarea::placeholder { color: #64748b; }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; text-align: left; margin-bottom: 20px; }
.checkbox-row input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--aurora-2); }
.checkbox-row label { font-size: 13px; color: var(--text-1); line-height: 1.6; }
.checkbox-row a { color: #a5b4fc; text-decoration: underline; }
.full-btn { width: 100%; padding: 15px; margin-top: 6px; }
.form-error { color: #fda4af; font-size: 13px; margin-bottom: 14px; min-height: 18px; text-align: center; }

/* ============================================================
   フッター
   ============================================================ */
.footer { padding: 50px 0 40px; text-align: center; color: var(--text-2); font-size: 13px; border-top: 1px solid var(--glass-border); margin-top: 40px; }

/* ============================================================
   チャット画面
   ============================================================ */
.chat-app { height: 100dvh; display: flex; flex-direction: column; background: var(--bg-1); }
.chat-shell { flex: 1; display: flex; overflow: hidden; }

/* サイドバー */
.chat-sidebar {
  width: 340px; flex-shrink: 0; display: flex; flex-direction: column;
  border-right: 1px solid var(--glass-border); background: rgba(10,14,31,.6); backdrop-filter: blur(20px);
}
.side-header { padding: 20px; border-bottom: 1px solid var(--glass-border); }
.my-profile { display: flex; align-items: center; gap: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 18px; color: white; flex-shrink: 0; }
.my-info { flex: 1; min-width: 0; }
.my-name { font-weight: 700; font-size: 15px; }
.my-id { font-size: 12px; color: var(--text-2); }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; background: var(--glass); border: 1px solid var(--glass-border); color: var(--text-1); display: flex; align-items: center; justify-content: center; transition: all .2s; }
.icon-btn:hover { background: rgba(255,255,255,.12); color: white; }

.add-friend-box { padding: 14px 20px; display: flex; gap: 8px; border-bottom: 1px solid var(--glass-border); }
.add-friend-box input { flex: 1; padding: 11px 14px; border-radius: 10px; background: rgba(0,0,0,.3); border: 1px solid var(--glass-border); color: var(--text-0); font-size: 14px; }
.add-friend-box input:focus { outline: none; border-color: var(--aurora-2); }
.add-friend-box button { width: 44px; border-radius: 10px; background: linear-gradient(120deg,var(--aurora-1),var(--aurora-2)); color: white; font-size: 16px; }

.friend-list { flex: 1; overflow-y: auto; padding: 8px; }
.friend-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; cursor: pointer; transition: all .2s; margin-bottom: 2px; }
.friend-item:hover { background: rgba(255,255,255,.06); }
.friend-item.active { background: linear-gradient(120deg, rgba(99,102,241,.25), rgba(139,92,246,.15)); }
.friend-meta { flex: 1; min-width: 0; }
.friend-name-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.friend-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.friend-time { font-size: 11px; color: var(--text-2); flex-shrink: 0; }
.friend-preview { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.badge { background: linear-gradient(120deg,var(--aurora-3),#f43f5e); color: white; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 6px; }

/* メイン会話 */
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-2); gap: 16px; }
.chat-empty i { font-size: 56px; opacity: .3; }
.chat-header { padding: 16px 22px; border-bottom: 1px solid var(--glass-border); display: flex; align-items: center; gap: 14px; background: rgba(10,14,31,.5); }
.chat-header .back-btn { display: none; }
.chat-header-info { flex: 1; }
.chat-header-name { font-weight: 700; font-size: 16px; }
.chat-header-status { font-size: 12px; color: var(--text-2); }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; display: inline-block; margin-right: 5px; box-shadow: 0 0 8px #10b981; }

.messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 4px; }
.msg-row { display: flex; margin-bottom: 2px; animation: msgIn .35s cubic-bezier(.16,1,.3,1); }
.msg-row.mine { justify-content: flex-end; }
@keyframes msgIn { from { opacity:0; transform: translateY(12px) scale(.96);} to {opacity:1; transform:none;} }
.bubble {
  max-width: 68%; padding: 11px 16px; border-radius: 20px; font-size: 15px; line-height: 1.6;
  word-break: break-word; position: relative;
}
.msg-row:not(.mine) .bubble { background: var(--glass); border: 1px solid var(--glass-border); border-bottom-left-radius: 6px; }
.msg-row.mine .bubble { background: linear-gradient(120deg,var(--aurora-1),var(--aurora-2)); color: white; border-bottom-right-radius: 6px; box-shadow: 0 4px 16px rgba(99,102,241,.3); }
.bubble img { max-width: 240px; border-radius: 14px; display: block; cursor: pointer; }
.msg-time { font-size: 10px; color: var(--text-2); align-self: flex-end; margin: 0 6px 4px; }
.msg-row.mine .msg-time { order: -1; }

/* 入力中 */
.typing-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px; }
.typing-bubble { background: var(--glass); border: 1px solid var(--glass-border); padding: 12px 18px; border-radius: 20px; border-bottom-left-radius: 6px; display: flex; gap: 5px; }
.typing-bubble span { width: 8px; height: 8px; border-radius: 50%; background: var(--text-2); animation: typing 1.4s infinite; }
.typing-bubble span:nth-child(2){ animation-delay: .2s; }
.typing-bubble span:nth-child(3){ animation-delay: .4s; }
@keyframes typing { 0%,60%,100%{transform:translateY(0);opacity:.4;} 30%{transform:translateY(-8px);opacity:1;} }

/* 入力欄 */
.composer { padding: 14px 18px; border-top: 1px solid var(--glass-border); display: flex; align-items: flex-end; gap: 10px; background: rgba(10,14,31,.5); }
.composer textarea { flex: 1; resize: none; max-height: 120px; padding: 13px 18px; border-radius: 22px; background: rgba(0,0,0,.3); border: 1px solid var(--glass-border); color: var(--text-0); font-size: 15px; line-height: 1.5; }
.composer textarea:focus { outline: none; border-color: var(--aurora-2); }
.send-btn { width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(120deg,var(--aurora-1),var(--aurora-2)); color: white; font-size: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .2s; }
.send-btn:hover { transform: scale(1.08); box-shadow: var(--shadow-glow); }
.send-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.img-btn { width: 46px; height: 46px; border-radius: 50%; background: var(--glass); border: 1px solid var(--glass-border); color: var(--text-1); font-size: 18px; display:flex; align-items:center; justify-content:center; flex-shrink:0; transition: all .2s; }
.img-btn:hover { background: rgba(255,255,255,.12); color: white; }

/* ============================================================
   モーダル / トースト
   ============================================================ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; animation: fadeIn .25s; }
@keyframes fadeIn { from {opacity:0;} to {opacity:1;} }
.modal { max-width: 520px; width: 100%; padding: 32px; animation: modalIn .35s cubic-bezier(.16,1,.3,1); max-height: 88vh; overflow-y: auto; }
@keyframes modalIn { from { opacity:0; transform: translateY(30px) scale(.96);} to {opacity:1; transform:none;} }
.modal-title { font-size: 22px; font-weight: 900; margin-bottom: 20px; }
.modal-close { position: absolute; }
.modal-row { display: flex; gap: 10px; margin-top: 20px; }

.toast-wrap { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 14px 24px; border-radius: 14px; font-size: 14px; font-weight: 600; box-shadow: 0 8px 30px rgba(0,0,0,.4); animation: toastIn .4s cubic-bezier(.16,1,.3,1); backdrop-filter: blur(20px); }
.toast.success { background: rgba(16,185,129,.9); color: white; }
.toast.error { background: rgba(244,63,94,.9); color: white; }
.toast.info { background: rgba(99,102,241,.9); color: white; }
@keyframes toastIn { from {opacity:0; transform: translateY(-20px);} to {opacity:1; transform:none;} }

/* 画像プレビュー */
.img-preview-bar { padding: 10px 18px; display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--glass-border); background: rgba(0,0,0,.2); }
.img-preview-bar img { width: 60px; height: 60px; object-fit: cover; border-radius: 10px; }
.img-viewer { position: fixed; inset: 0; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; z-index: 300; cursor: zoom-out; animation: fadeIn .25s; }
.img-viewer img { max-width: 92%; max-height: 92%; border-radius: 12px; }

/* スクロールバー */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

/* ローディング */
.loader { width: 40px; height: 40px; border: 3px solid rgba(255,255,255,.1); border-top-color: var(--aurora-2); border-radius: 50%; animation: spin 1s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   レスポンシブ
   ============================================================ */
@media (max-width: 768px) {
  .chat-sidebar { width: 100%; }
  .chat-shell.viewing .chat-sidebar { display: none; }
  .chat-shell:not(.viewing) .chat-main { display: none; }
  .chat-header .back-btn { display: flex; }
  .bubble { max-width: 78%; }
  .section { padding: 56px 0; }
  .hero-cta { flex-direction: column; width: 100%; max-width: 300px; }
  .hero-cta .btn { width: 100%; }
}

.terms-text { text-align: left; font-size: 13px; line-height: 1.9; color: var(--text-1); max-height: 50vh; overflow-y: auto; padding-right: 10px; }
.terms-text h4 { margin: 16px 0 6px; color: var(--text-0); }
