/* 행밥 포털 화면 스타일. 색을 바꾸려면 :root 값만 고치면 됩니다. */
:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-2: #f8faf7;
  --line: #e2e7e0;
  --line-strong: #cbd3c8;
  --text: #151b17;
  --text-2: #444d47;
  --text-3: #6a736d;
  --accent: #16a34a;
  --accent-strong: #15803d;
  --accent-weak: #ecf8ef;
  --accent-line: #b7e4c4;
  --warn-bg: #fff8e6;
  --warn-line: #f3d68a;
  --warn-text: #7a5300;
  --err: #c2321f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 20, 0.05), 0 4px 16px rgba(20, 30, 20, 0.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2 { margin: 0; letter-spacing: -0.02em; }
.muted { color: var(--text-3); }
.pad { padding: 16px 4px; }
.spacer { flex: 1; }

.boot { display: flex; gap: 10px; align-items: center; justify-content: center; height: 100vh; color: var(--text-3); }
.spin { width: 16px; height: 16px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin 0.8s linear infinite; vertical-align: -3px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 로그인 ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #e3f4e7, transparent 50%), var(--bg); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 40px 36px; width: min(400px, 100%); text-align: center; box-shadow: var(--shadow); }
.login-sub { color: var(--text-2); margin: 16px 0 28px; }
.ms-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 13px; border: 1px solid var(--line-strong); border-radius: 10px; font-weight: 600; background: #fff; transition: background 0.15s; }
.ms-btn:hover { background: var(--surface-2); }
.login-alt { display: inline-block; margin-top: 14px; font-size: 13px; color: var(--text-3); }
.login-alt:hover { color: var(--text); }

/* ---------- 상단 ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.brand.big { font-size: 24px; justify-content: center; }
.logo { display: inline-grid; place-items: center; border-radius: 30%; background: var(--accent); color: #fff; flex: none; }
.top { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1180px; margin: 0 auto; height: 60px; padding: 0 20px; display: flex; align-items: center; gap: 10px; }
.user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-weak); color: var(--accent-strong); display: grid; place-items: center; font-weight: 700; font-size: 13px; border: 1px solid var(--accent-line); }
.nm { font-weight: 500; }
.logout { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-size: 13px; padding: 6px 8px; border-radius: 8px; }
.logout:hover { background: var(--surface-2); color: var(--text); }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-line); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); }
.link-btn { background: none; border: none; padding: 4px 6px; color: var(--accent-strong); font-weight: 600; font-size: 14px; border-radius: 6px; }
.link-btn:hover { background: var(--accent-weak); }

.main { max-width: 1180px; margin: 0 auto; padding: 28px 20px 40px; }

/* ---------- 첫 화면 ---------- */
.hero { padding: 20px 4px 28px; }
.hero h1 { font-size: 28px; }
.hero p { color: var(--text-2); margin: 6px 0 0; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.app-card { display: flex; gap: 16px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s; }
a.app-card:hover { transform: translateY(-2px); border-color: var(--accent-line); box-shadow: 0 2px 4px rgba(20, 30, 20, 0.05), 0 10px 28px rgba(22, 163, 74, 0.1); }
.app-card.disabled { opacity: 0.7; cursor: not-allowed; }
.app-icon { flex: none; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-weak); color: var(--accent-strong); }
.app-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.app-name { font-weight: 700; font-size: 16.5px; display: flex; align-items: center; gap: 6px; }
.ext { color: var(--text-3); display: inline-flex; }
.app-desc { color: var(--text-2); font-size: 14px; }
.tag { align-self: flex-start; margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--accent-weak); color: var(--accent-strong); }
.tag.warn { background: var(--warn-bg); color: var(--warn-text); }

/* ---------- 규칙 Q&A ---------- */
.rules { display: grid; grid-template-columns: 280px 1fr; gap: 20px; height: calc(100vh - 60px - 56px); min-height: 480px; }
.side, .chat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-height: 0; }
.side { display: flex; flex-direction: column; padding: 16px; }
.side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.side-head h2 { font-size: 15px; }
.search { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--text-3); margin-bottom: 10px; }
.search:focus-within { border-color: var(--accent); }
.search input { border: none; outline: none; font: inherit; flex: 1; min-width: 0; background: transparent; color: var(--text); }
.games { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -6px; padding: 0 6px; }
.game { text-align: left; background: none; border: 1px solid transparent; border-radius: 10px; padding: 9px 12px; display: flex; flex-direction: column; }
.game:hover { background: var(--surface-2); }
.game.on { background: var(--accent-weak); border-color: var(--accent-line); }
.game-name { font-weight: 600; }
.game-files { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat { display: flex; flex-direction: column; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); min-height: 54px; }
.chat-log { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.intro { padding: 12px 0 8px; }
.intro h2 { font-size: 22px; }
.intro p { margin: 4px 0 14px; font-size: 13.5px; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface-2); padding: 7px 12px; border-radius: 99px; font-size: 14px; }
.chip:hover { border-color: var(--accent-line); background: var(--accent-weak); }
.msg { display: flex; flex-direction: column; max-width: 82%; }
.msg.me { align-self: flex-end; }
.msg.bot { align-self: flex-start; }
.bubble { padding: 11px 15px; border-radius: 16px; overflow-wrap: anywhere; }
.msg.me .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 5px; white-space: pre-wrap; }
.msg.bot .bubble { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.bubble p { margin: 0 0 8px; }
.bubble p:last-child, .bubble ul:last-child { margin-bottom: 0; }
.bubble ul { margin: 0 0 8px; padding-left: 20px; }
.err { color: var(--err); }
.cite { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; margin: 0 1px; border-radius: 5px; border: none; background: var(--accent-weak); color: var(--accent-strong); font-size: 11px; font-weight: 700; vertical-align: 2px; }
.cite:hover { background: var(--accent); color: #fff; }
.cites { margin-top: 6px; font-size: 13.5px; }
.cites summary { cursor: pointer; color: var(--text-3); padding: 2px 4px; width: max-content; }
.cites ol { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cites li { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--surface); transition: background 0.3s, border-color 0.3s; }
.cites li.flash { background: var(--accent-weak); border-color: var(--accent-line); }
.cite-meta { color: var(--text-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.num { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; background: var(--accent-weak); color: var(--accent-strong); font-size: 11px; font-weight: 700; }
.cites blockquote { margin: 4px 0 0; color: var(--text-3); border-left: 3px solid var(--line-strong); padding-left: 10px; white-space: pre-wrap; }
.skipped { font-size: 12.5px; color: var(--warn-text); margin: 6px 4px 0; }
.typing { display: inline-flex; gap: 3px; vertical-align: middle; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); 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; } }

.composer { display: flex; gap: 8px; align-items: flex-end; margin: 0 16px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 14px; background: #fff; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12); }
.composer textarea { flex: 1; border: none; outline: none; resize: none; font: inherit; padding: 6px 8px; max-height: 180px; background: transparent; color: var(--text); }
.send { width: 38px; height: 38px; border-radius: 10px; border: none; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.send:hover { background: var(--accent-strong); }
.foot { font-size: 12px; text-align: center; margin: 8px 16px 12px; }

.empty { margin: auto; text-align: center; padding: 40px 24px; max-width: 440px; }
.empty-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: var(--accent-weak); color: var(--accent-strong); margin-bottom: 14px; }
.empty h2 { font-size: 20px; }
.empty p { color: var(--text-2); }
.callout { padding: 12px 14px; border-radius: 10px; font-size: 14px; text-align: left; }
.callout.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-text); }
.only-mobile { display: none; }

@media (max-width: 760px) {
  .main { padding: 16px 12px 24px; }
  .nm { display: none; }
  .hero h1 { font-size: 23px; }
  .apps { grid-template-columns: 1fr; }
  .rules { grid-template-columns: 1fr; height: calc(100vh - 60px - 32px); }
  .rules.has-game .side { display: none; }
  .rules:not(.has-game) .chat { display: none; }
  .only-mobile { display: inline-grid; }
  .msg { max-width: 92%; }
  .chat-log { padding: 16px 14px; }
}
