:root {
  color-scheme: dark;

  /* --- FanSee Core Colors --- */
  --pink: #FF2D7A;
  --pink-light: #FFD6E7;
  --black: #000000;
  --gray-dark: #1F1F1F;
  --gray-light: #F8F8F8;

  /* --- 역할 토큰 --- */
  --bg: var(--black);
  --surface: #141414;
  --surface-2: var(--gray-dark);
  --line: #2C2C2C;
  --text: var(--gray-light);
  --muted: #8A8A8A;
  --accent: var(--pink);
  --accent-soft: rgba(255, 45, 122, .14);
  --on-accent: #FFFFFF;
  --danger: #FF5470;
  --ok: #37D399;
  --warn: var(--pink-light);

  --radius: 14px;
  --shell: 480px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--black);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
    "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior: none;
}

body {
  display: flex;
  justify-content: center;
}

.shell {
  width: 100%;
  max-width: var(--shell);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
@media (min-width: 520px) {
  .shell { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar h1 {
  font-size: 16px;
  margin: 0;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .sub { font-size: 12px; color: var(--muted); }
.topbar .spacer { flex: 1; }

.scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card h2 { font-size: 14px; margin: 0 0 10px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }

label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 6px; }

input, select, textarea, button { font: inherit; font-family: inherit; }

input[type="text"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  padding: 11px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder { color: #6B6B6B; }

button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 11px 14px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 650;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; }
button.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
button.ghost:active { border-color: var(--accent); }
button.danger { background: transparent; color: var(--danger); border: 1px solid #4A1F2A; }
button.tiny { padding: 7px 10px; font-size: 12px; border-radius: 8px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.block { width: 100%; }

.notice {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin: 10px 0 0;
  display: none;
}
.notice.show { display: block; }
.notice.error { background: rgba(255, 84, 112, .12); color: #FFB3C0; }
.notice.ok { background: rgba(55, 211, 153, .12); color: #9DF0CD; }

.empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 13px; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.pill.live { color: var(--ok); border-color: rgba(55, 211, 153, .35); }
.pill.warn { color: var(--pink-light); border-color: rgba(255, 214, 231, .28); }
.pill.brand { color: var(--pink); border-color: rgba(255, 45, 122, .4); background: var(--accent-soft); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(24px + env(safe-area-inset-bottom));
  background: var(--gray-light); color: var(--black); font-size: 13px; font-weight: 650;
  padding: 10px 16px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
  z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
