/* チャラオAI マッチング プロトタイプ 共通スタイル（LINE風） */

:root {
  --green: #06c755;
  --green-dark: #05a648;
  --bubble-me: #8de049;
  --chat-bg: #7494c0;
  --bg: #f2f4f8;
  --card: #ffffff;
  --text: #222428;
  --sub: #7a8087;
  --line: #e4e7ec;
  --accent: #5b6ef5;
  --danger: #e5484d;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* --- topbar --- */
.topbar {
  background: #1f2733;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar .brand { font-weight: 700; font-size: 15px; letter-spacing: 0.02em; }
.topbar .brand span { color: var(--green); }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  color: #b8c0cc;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
}
.topbar nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.topbar nav a.active { background: rgba(6, 199, 85, 0.18); color: #6ee7a0; font-weight: 600; }
.topbar .user { font-size: 12px; color: #b8c0cc; }
.topbar .logout {
  background: none; border: 1px solid #3a4657; color: #b8c0cc;
  border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 12px;
}
.topbar .logout:hover { border-color: #6a7688; color: #fff; }

.container { max-width: 1100px; margin: 20px auto; padding: 0 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

/* --- card --- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 4px; font-size: 15px; }
.card .desc { color: var(--sub); font-size: 12px; margin: 0 0 14px; }

/* --- buttons / inputs --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--green); color: #fff; border: none;
  border-radius: 10px; padding: 9px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 0.15s, opacity 0.15s;
}
.btn:hover { background: var(--green-dark); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.secondary:hover { background: #f6f7f9; }
.btn.accent { background: var(--accent); }
.btn.accent:hover { background: #4a5ce4; }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid #f3c4c6; }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 8px; }

input[type="text"], input[type="password"], textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
input:focus, textarea:focus { border-color: var(--green); }

/* --- chat --- */
.chat-wrap {
  background: var(--chat-bg);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  height: 620px;
  overflow: hidden;
}
.chat-header {
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; gap: 10px;
}
.chat-area { flex: 1; overflow-y: auto; padding: 14px 14px 8px; }
.msg-row { display: flex; margin-bottom: 10px; align-items: flex-end; gap: 8px; }
.msg-row.me { flex-direction: row-reverse; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px; flex-shrink: 0;
  position: relative;
}
.avatar.twin::after {
  content: "AI";
  position: absolute; bottom: -4px; right: -6px;
  background: #1f2733; color: #6ee7a0;
  font-size: 8px; font-weight: 700; padding: 1px 4px; border-radius: 6px;
  border: 1px solid #6ee7a0;
}
.msg-body { max-width: 68%; }
.msg-name { font-size: 11px; color: rgba(255, 255, 255, 0.9); margin: 0 0 3px 4px; }
.bubble {
  background: #fff;
  border-radius: 16px;
  padding: 9px 13px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}
.msg-row.me .bubble { background: var(--bubble-me); }
.msg-time { font-size: 10px; color: rgba(255, 255, 255, 0.75); margin: 0 6px; flex-shrink: 0; }
.msg-system {
  text-align: center; margin: 12px 0;
}
.msg-system span {
  background: rgba(0, 0, 0, 0.25); color: #fff;
  font-size: 11px; padding: 4px 12px; border-radius: 12px;
}
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i {
  width: 6px; height: 6px; background: #b9bec7; border-radius: 50%;
  animation: blink 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.chat-input {
  display: flex; gap: 8px; padding: 10px;
  background: #fff; border-top: 1px solid var(--line);
}
.chat-input textarea {
  flex: 1; resize: none; height: 42px; padding: 10px 12px; border-radius: 21px;
}
.chat-input .btn { border-radius: 21px; }

/* --- profile panel --- */
.panel-section { margin-bottom: 16px; }
.panel-section h3 { font-size: 12px; color: var(--sub); margin: 0 0 8px; letter-spacing: 0.04em; }
.coverage-bar {
  height: 8px; background: #edf0f4; border-radius: 4px; overflow: hidden;
}
.coverage-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #4ad98a); border-radius: 4px; transition: width 0.6s; }
.target-dim {
  background: #eef1ff; color: var(--accent);
  border-radius: 10px; padding: 8px 12px; font-size: 12px;
}
.slot-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.slot-item {
  background: #f7f8fa; border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 10px; font-size: 12px;
  animation: slotIn 0.4s ease;
}
@keyframes slotIn { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
.slot-item .quote { color: var(--sub); font-size: 11px; margin-top: 2px; }
.kind-badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  border-radius: 6px; padding: 1px 6px; margin-right: 6px; vertical-align: 1px;
}
.kind-belief { background: #e8ebff; color: #4a5ce4; }
.kind-desire { background: #ffe9ec; color: #d6455c; }
.kind-preference { background: #e2f6ea; color: #0f9d58; }
.kind-episode { background: #fff3dc; color: #b26a00; }
.kind-style { background: #f0e6fa; color: #8b3fd1; }
.kind-value { background: #e0f2fe; color: #0369a1; }

/* --- candidates / lists --- */
.person-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px; border-bottom: 1px solid var(--line);
}
.person-row:last-child { border-bottom: none; }
.person-row .info { flex: 1; min-width: 0; }
.person-row .name { font-weight: 700; font-size: 14px; }
.person-row .tagline { color: var(--sub); font-size: 12px; margin-top: 2px; }
.badge-seed {
  background: #eef1ff; color: var(--accent); font-size: 10px; font-weight: 700;
  border-radius: 6px; padding: 2px 6px; margin-left: 6px; vertical-align: 1px;
}
.score-pill {
  font-weight: 800; font-size: 15px; color: var(--green-dark);
  min-width: 52px; text-align: center;
}
.score-pill small { display: block; font-size: 9px; color: var(--sub); font-weight: 600; }

/* --- meters --- */
.axis-row { margin-bottom: 12px; }
.axis-row .axis-head { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.axis-row .axis-head b { font-size: 13px; }
.axis-bar { height: 10px; background: #edf0f4; border-radius: 5px; overflow: hidden; }
.axis-bar i { display: block; height: 100%; background: linear-gradient(90deg, #5b6ef5, #8b9cff); border-radius: 5px; transition: width 0.9s ease; }
.axis-note { font-size: 11px; color: var(--sub); margin-top: 4px; }
.axis-note .q { color: #4a5ce4; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: #e2f6ea; color: #0f7a46; font-size: 12px; font-weight: 600;
  border-radius: 20px; padding: 5px 12px;
}
.chip.diff { background: #fff0f0; color: #c04747; }

/* --- gauge --- */
.gauge-wrap { display: flex; flex-direction: column; align-items: center; }
.gauge-score { font-size: 40px; font-weight: 800; fill: var(--text); }
.gauge-label { font-size: 11px; fill: var(--sub); }

/* --- group support meter --- */
.support-meter { display: flex; align-items: center; gap: 10px; }
.support-meter .bar { flex: 1; height: 10px; background: rgba(255,255,255,0.25); border-radius: 5px; overflow: hidden; }
.support-meter .bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffd76b, #ff9f43); transition: width 0.8s; }
.phase-label {
  font-size: 11px; font-weight: 700; color: #fff;
  background: rgba(0,0,0,0.25); border-radius: 10px; padding: 3px 10px;
}
.member-avatars { display: flex; gap: 6px; }
.member-avatars .avatar { width: 30px; height: 30px; font-size: 12px; border: 2px solid rgba(255,255,255,0.7); transition: opacity 0.8s; }

/* --- modal --- */
.modal-back {
  position: fixed; inset: 0; background: rgba(15, 20, 30, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: #fff; border-radius: 16px; padding: 24px;
  width: min(560px, 92vw); max-height: 86vh; overflow-y: auto;
}
.modal h2 { margin: 0 0 6px; font-size: 17px; }
.hidden { display: none !important; }

/* --- slider (GT) --- */
.gt-row { margin-bottom: 14px; }
.gt-row .gt-head { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 2px; }
.gt-row input[type="range"] { width: 100%; accent-color: var(--green); }

/* --- stars --- */
.stars { display: inline-flex; gap: 3px; font-size: 22px; cursor: pointer; user-select: none; }
.stars span { color: #d5dae2; transition: color 0.1s; }
.stars span.on { color: #ffb400; }

/* --- toast --- */
#toast-box { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1f2733; color: #fff; font-size: 12.5px;
  border-radius: 10px; padding: 10px 14px; max-width: 320px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  animation: toastIn 0.3s ease;
}
.toast b { color: #6ee7a0; }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- overlay (judge演出) --- */
.judge-overlay {
  position: fixed; inset: 0; background: rgba(15, 20, 30, 0.82);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 150; color: #fff; gap: 18px;
}
.judge-overlay .big { font-size: 19px; font-weight: 700; }
.judge-overlay .count { font-size: 13px; color: #9fb0c8; font-variant-numeric: tabular-nums; }
.judge-overlay .spin {
  width: 46px; height: 46px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.15); border-top-color: var(--green);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- login --- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #1f2733 0%, #2c3e50 60%, #0f7a46 130%);
}
.login-card {
  background: #fff; border-radius: 20px; padding: 34px; width: min(400px, 92vw);
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}
.login-card h1 { font-size: 20px; margin: 0 0 2px; }
.login-card h1 span { color: var(--green); }
.login-card .sub { color: var(--sub); font-size: 12px; margin-bottom: 22px; }
.login-card label { display: block; font-size: 12px; font-weight: 600; margin: 14px 0 6px; }
.error-text { color: var(--danger); font-size: 12px; margin-top: 10px; min-height: 16px; }

.section-title { font-size: 16px; font-weight: 700; margin: 26px 0 12px; }
.muted { color: var(--sub); font-size: 12px; }
.vs-head { display: flex; align-items: center; justify-content: center; gap: 26px; padding: 10px 0 16px; }
.vs-head .p { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; }
.vs-head .p .avatar { width: 54px; height: 54px; font-size: 22px; }
.vs-head .vs { font-size: 13px; font-weight: 800; color: var(--sub); }
