:root {
  --bg: #101317;
  --topbar: #14181d;
  --line: #232831;
  --panel: #161a20;
  --panel-on: #1d2531;
  --line-on: #3f5f99;
  --term-bg: #0a0c0f;
  --term-fg: #d6dbe1;
  --text: #e6e8eb;
  --text-2: #a9b1bd;
  --hp: #5ccf8a;
  --mp: #6ca0ff;
  --mv: #f0a04b;
  --bar-bg: #252c36;
  --accent: #9cc0ff;
  --warn: #f0a04b;
  --radius: 10px;
  --radius-s: 8px;
  --ui: "IBM Plex Sans KR", system-ui, sans-serif;
  --mono: "Nanum Gothic Coding", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--ui); }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 24px; min-height: 56px; padding: 0 16px;
  background: var(--topbar); border-bottom: 1px solid var(--line);
}
.logo { color: var(--text); font-weight: 600; font-size: 18px; letter-spacing: .02em; text-decoration: none; }
.menu { display: flex; gap: 4px; }
.menu-item {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: var(--radius-s);
  color: var(--text-2); text-decoration: none;
}
.menu-item.is-active { color: var(--text); background: var(--panel-on); }
.menu-item.is-off { opacity: .45; cursor: default; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.conn { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 14px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-2); }
.dot.is-up { background: var(--hp); box-shadow: 0 0 0 3px rgba(92, 207, 138, .15); }
.dot.is-down { background: var(--warn); }
.avatar-form { margin: 0; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-on);
  color: var(--text); font: 600 16px var(--ui); cursor: pointer;
}

/* layout: the party drops below on a narrow screen */
.layout { display: flex; flex-wrap: wrap; gap: 16px; padding: 16px; align-items: stretch; }
.view { flex: 1 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.party { flex: 0 1 340px; min-width: 280px; }

.view-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.view-title h1 { margin: 0; font-size: 20px; font-weight: 600; }
.view-sub { margin: 2px 0 0; color: var(--text-2); font-size: 14px; }
.segment { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 3px; }
.seg {
  min-height: 44px; min-width: 72px; padding: 0 14px; border: 0; border-radius: var(--radius-s);
  background: transparent; color: var(--text-2); font: 500 14px var(--ui); cursor: pointer;
}
.seg.is-on { background: var(--panel-on); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-on); }
.seg:focus-visible, .card:focus-visible, .avatar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.term-wrap {
  flex: 1; min-height: 60vh; background: var(--term-bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px; overflow: hidden;
}
#term { height: 100%; min-height: calc(60vh - 20px); }

/* party */
.party h2 { margin: 0 0 12px; font-size: 16px; font-weight: 600; color: var(--text-2); }
.cards { display: flex; flex-direction: column; gap: 10px; }
.card {
  display: block; width: 100%; text-align: left; padding: 12px 14px; min-height: 44px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); font: inherit; cursor: pointer;
}
.card.is-on { background: var(--panel-on); border-color: var(--line-on); }
.card.is-off { opacity: .55; }
.card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card-name { font-weight: 600; }
.card-class { color: var(--text-2); font-size: 13px; }
.bars { display: grid; grid-template-columns: 22px 1fr 64px; gap: 4px 8px; align-items: center; margin: 8px 0; font-size: 12px; color: var(--text-2); }
.bar { height: 4px; background: var(--bar-bg); border-radius: 2px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 2px; }
.bar.hp > i { background: var(--hp); }
.bar.mp > i { background: var(--mp); }
.bar.mv > i { background: var(--mv); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.card-doing { color: var(--text); font-size: 13px; }
.card-where { color: var(--text-2); font-size: 13px; }

/* login */
.login-page { display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(360px, 100%); display: flex; flex-direction: column; gap: 8px; padding: 28px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
}
.login-card .logo { margin-bottom: 12px; }
.login-card label { color: var(--text-2); font-size: 14px; margin-top: 6px; }
.login-card input {
  min-height: 44px; padding: 0 12px; border-radius: var(--radius-s); border: 1px solid var(--line);
  background: var(--term-bg); color: var(--text); font: 15px var(--ui);
}
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.primary {
  margin-top: 14px; min-height: 44px; border: 0; border-radius: var(--radius-s);
  background: var(--line-on); color: var(--text); font: 600 15px var(--ui); cursor: pointer;
}
.login-error { margin: 0 0 4px; color: var(--warn); font-size: 14px; }

@media (max-width: 720px) {
  .topbar { gap: 10px; flex-wrap: wrap; padding: 6px 16px; }
  .menu-item { padding: 0 10px; }
  .conn #conn-text { display: none; }
  .layout { padding: 12px 16px; }
  .party { flex-basis: 100%; }
  .term-wrap { min-height: 55vh; }
}

/* language switch */
.langs { display: inline-flex; gap: 2px; }
.lang {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: var(--radius-s);
  color: var(--text-2); text-decoration: none; font-size: 13px;
}
.lang.is-on { color: var(--text); background: var(--panel-on); }
.lang:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.login-langs { justify-content: center; margin: 8px 0 0; }
