:root {
  --bg: #0d1020; --bg2: #161a33; --card: #1d2247;
  --text: #eef0ff; --muted: #9aa0c7; --accent: #7c83ff; --accent2: #ff7eb6; --ok: #5ee0a0;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Segoe UI", system-ui, "Noto Sans Myanmar", sans-serif; background: linear-gradient(160deg, #0d1020, #1a1f44); color: var(--text); min-height: 100vh; }
.app { max-width: 1000px; margin: 0 auto; padding: 14px; height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: rgba(22,26,51,.85); border-radius: 14px; backdrop-filter: blur(8px); margin-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; box-shadow: 0 0 16px rgba(124,131,255,.55); }
.topbar h1 { font-size: 18px; font-weight: 800; letter-spacing: .5px; }
.sub { font-size: 12px; color: var(--muted); }
.status { font-size: 12px; color: var(--muted); }

.nav { display: flex; gap: 8px; margin-bottom: 10px; }
.nav-btn { padding: 10px 18px; border-radius: 10px; cursor: pointer; font-size: 14px; background: var(--bg2); color: var(--muted); border: 1px solid rgba(255,255,255,.08); }
.nav-btn.active { background: linear-gradient(90deg, var(--accent), var(--accent2)); color: #fff; font-weight: 700; border: none; }

.view { display: none; flex: 1; min-height: 0; }
.view.active { display: flex; flex-direction: column; }

/* coach chat */
.chat { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 82%; padding: 11px 14px; border-radius: 16px; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; }
.msg.bot { background: var(--card); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.user { background: var(--accent); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.typing { color: var(--muted); font-style: italic; }
.composer { display: flex; gap: 8px; padding: 10px 0; }
#coachInput { flex: 1; resize: none; background: var(--bg2); color: var(--text); border: 1px solid rgba(255,255,255,.12); border-radius: 14px; padding: 12px 14px; font-size: 15px; font-family: inherit; max-height: 140px; }
.send { height: 46px; padding: 0 18px; border: none; border-radius: 12px; cursor: pointer; background: var(--accent); color: #fff; font-weight: 700; }
.send:hover { filter: brightness(1.08); }

/* content layout */
.layout { display: grid; grid-template-columns: 340px 1fr; gap: 14px; flex: 1; min-height: 0; }
@media (max-width: 760px) { .layout { grid-template-columns: 1fr; } }
.controls, .output { background: var(--bg2); border: 1px solid rgba(255,255,255,.06); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.tabs { display: flex; gap: 6px; }
.tab { flex: 1; padding: 9px; border-radius: 9px; cursor: pointer; background: var(--card); color: var(--muted); border: 1px solid rgba(255,255,255,.1); font-size: 13px; }
.tab.active { background: var(--accent); color: #fff; font-weight: 700; }
.tabpane { display: none; flex-direction: column; gap: 8px; }
.tabpane.active { display: flex; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.5; }
.lbl { font-size: 12px; color: var(--muted); margin-top: 6px; }
select, textarea, input { width: 100%; background: var(--card); color: var(--text); border: 1px solid rgba(255,255,255,.12); border-radius: 10px; padding: 10px 12px; font-size: 14px; font-family: inherit; resize: vertical; }
.seg { display: flex; gap: 6px; }
.seg-btn { flex: 1; padding: 9px; border-radius: 9px; cursor: pointer; background: var(--card); color: var(--text); border: 1px solid rgba(255,255,255,.12); font-size: 13px; }
.seg-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.adv { margin-top: 8px; font-size: 13px; color: var(--muted); }
.adv summary { cursor: pointer; }
.adv input { margin-top: 8px; }
.gen { margin-top: 12px; padding: 13px; border: none; border-radius: 12px; cursor: pointer; background: linear-gradient(90deg, var(--accent), var(--accent2)); color: #fff; font-size: 15px; font-weight: 700; }
.gen:hover { filter: brightness(1.08); }
.output { min-height: 420px; }
.out-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.out-meta { font-size: 12px; color: var(--muted); }
.out-actions { display: flex; gap: 6px; }
.mini { padding: 7px 12px; border-radius: 9px; cursor: pointer; font-size: 13px; background: var(--card); color: var(--text); border: 1px solid rgba(255,255,255,.12); }
.mini:hover { border-color: var(--accent); }
.result { background: var(--card); border-radius: 12px; padding: 16px; white-space: pre-wrap; line-height: 1.65; font-size: 15px; overflow-y: auto; max-height: 340px; }
.result.placeholder { color: var(--muted); display: grid; place-items: center; text-align: center; }
.result.thinking::after { content: "▍"; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0; } }
.history { margin-top: 14px; border-top: 1px solid rgba(255,255,255,.08); padding-top: 12px; }
.hist-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.hist-list { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; }
.hist-item { background: var(--card); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 9px 11px; font-size: 13px; cursor: pointer; }
.hist-item:hover { border-color: var(--accent); }
.hist-item .t { color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hist-item .m { color: var(--muted); font-size: 11px; margin-top: 3px; }
