:root {
  --bg: #0C2549;
  --panel: #0F2F5A;
  --card: #15396B;
  --card-border: #2A4C82;
  --text: #F5F8FF;
  --muted: #A9BEE0;
  --faint: #6F87B5;
  --accent: #5FA8F5;
  --accent-deep: #1E5FA8;
  --buy: #D63447;
  --sell: #2E5F9E;
  --hold: #A9BEE0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', sans-serif;
  height: 100%;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

/* ---------- Header ---------- */
.hj-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.hj-logo-wrap { display: flex; align-items: center; gap: 10px; }
.hj-logo {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
  color: #ffffff;
}
.hj-logo-bar {
  margin-top: 3px;
  height: 3px;
  width: 46px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-deep));
}
.hj-status { display: flex; align-items: center; gap: 5px; }
.hj-status-dot { width: 6px; height: 6px; border-radius: 999px; }
.hj-status-dot.on { background: var(--accent); box-shadow: 0 0 0 3px rgba(95,168,245,0.2); }
.hj-status-dot.off { background: var(--faint); }
.hj-status-text { color: var(--faint); font-size: 10.5px; font-weight: 500; }

.hj-toggle {
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 3px;
}
.hj-toggle button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.hj-toggle button.active { background: var(--bg); color: var(--accent); }

/* ---------- Sub header / flash ---------- */
.hj-subheader {
  padding: 10px 16px;
  border-bottom: 1px solid var(--card-border);
  color: var(--muted);
  font-size: 12.5px;
}
.hj-flash {
  padding: 8px 16px;
  text-align: center;
  background: rgba(95, 168, 245, 0.08);
  border-bottom: 1px solid var(--card-border);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

/* ---------- Announcement banner ---------- */
.hj-announcement {
  border-bottom: 1px solid var(--card-border);
  background: rgba(214, 52, 71, 0.06);
}
.hj-announcement-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
}
.hj-announcement-icon { font-size: 13px; flex-shrink: 0; }
.hj-announcement-preview {
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hj-announcement-chevron { color: var(--faint); font-size: 10px; flex-shrink: 0; }
.hj-announcement-list {
  padding: 0 16px 14px;
  max-height: 340px;
  overflow-y: auto;
}
.hj-announcement-item {
  padding: 12px 0;
  border-top: 1px solid var(--card-border);
}
.hj-announcement-item:first-child { border-top: none; padding-top: 4px; }
.hj-announcement-item-time {
  color: var(--faint);
  font-size: 11px;
  margin-bottom: 4px;
}
.hj-announcement-item-content {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ---------- Push banner ---------- */
.hj-push-row {
  padding: 10px 16px;
  border-bottom: 1px solid var(--card-border);
}
.hj-push-on {
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
}
.hj-push-btn {
  width: 100%;
  padding: 9px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: rgba(95, 168, 245, 0.1);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.hj-push-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.hj-push-error {
  margin-top: 6px;
  color: var(--buy);
  font-size: 12px;
  line-height: 1.5;
}

/* ---------- Feed ---------- */
.hj-feed {
  flex: 1;
  overflow-y: auto;
}
.hj-empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}

.hj-bubble {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--card-border);
}
.hj-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--card-border);
  color: var(--accent);
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hj-bubble-body { flex: 1; min-width: 0; }
.hj-bubble-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.hj-bubble-name { color: var(--text); font-weight: 600; font-size: 14px; }
.hj-bubble-time { color: var(--faint); font-size: 11px; white-space: nowrap; }

.hj-card {
  margin-top: 6px;
  display: inline-block;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--card);
  overflow: hidden;
  max-width: 100%;
}
.hj-card-inner { padding: 12px 14px; min-width: 240px; }
.hj-card-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.hj-delete-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--faint);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
}
.hj-delete-btn:hover { color: var(--buy); }
.hj-ticker { color: var(--text); font-weight: 700; font-size: 15px; }
.hj-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.hj-price-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.hj-price-label { color: var(--muted); font-size: 13px; }
.hj-price-value { color: var(--text); font-size: 13px; font-weight: 600; }
.hj-arrow { color: var(--faint); font-size: 13px; }
.hj-target-value { color: var(--accent); font-size: 13px; font-weight: 600; }
.hj-comment { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

@keyframes hjFadeSlide {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.hj-enter { animation: hjFadeSlide 0.35s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .hj-enter { animation: none; }
}

/* ---------- Composer (admin) ---------- */
.hj-composer {
  padding: 14px 16px;
  background: var(--panel);
  border-top: 1px solid var(--card-border);
}
.hj-visitor-stat {
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(95, 168, 245, 0.08);
  border: 1px solid var(--card-border);
  color: var(--muted);
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hj-visitor-stat strong { color: var(--accent); font-size: 13.5px; }
.hj-visitor-error { color: var(--buy); }

.hj-dir-row { display: flex; gap: 8px; margin-bottom: 10px; }
.hj-dir-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.hj-field-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.hj-input {
  width: 100%;
  min-width: 0;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}
.hj-input::placeholder { color: var(--faint); }
.hj-input-ticker { flex: 1 1 140px; min-width: 0; }
.hj-input-num { flex: 1 1 90px; min-width: 0; max-width: 130px; }
.hj-send-btn {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--faint);
  cursor: not-allowed;
}
.hj-send-btn.ready {
  background: var(--accent);
  border-color: var(--accent);
  color: #0C2549;
  cursor: pointer;
}
.hj-logout {
  margin-left: 8px;
  color: var(--faint);
  font-size: 11.5px;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}

.hj-announcement-admin {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--card-border);
}
.hj-announcement-admin-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}
.hj-textarea {
  width: 100%;
  resize: vertical;
  min-height: 72px;
  font-family: inherit;
  line-height: 1.5;
}
.hj-announcement-submit-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 10px;
}
.hj-ann-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}
.hj-ann-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--card-border);
}
.hj-ann-item-text {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hj-ann-item-editing {
  border-color: var(--accent);
  background: rgba(95, 168, 245, 0.1);
}
.hj-ann-cancel-btn {
  padding: 0 16px;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Admin login ---------- */
.hj-login {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 24px;
}
.hj-login-title { color: var(--text); font-weight: 700; font-size: 16px; }
.hj-login-sub { color: var(--muted); font-size: 13px; text-align: center; }
.hj-login-form { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 10px; }
.hj-login-error { color: var(--buy); font-size: 12.5px; text-align: center; }
.hj-login-btn {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #0C2549;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
}
.hj-login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---------- 닉네임 등록 카드 ---------- */
.hj-nick-card {
  padding: 14px 16px;
  border-bottom: 1px solid var(--card-border);
  background: rgba(95, 168, 245, 0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hj-nick-title { color: var(--text); font-size: 14px; font-weight: 700; }
.hj-nick-hint { color: var(--faint); font-size: 11.5px; line-height: 1.5; }

/* ---------- 관리자: 닉네임 회원 목록 ---------- */
.hj-mini-btn {
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
}
.hj-member-list {
  max-height: 180px;
  overflow-y: auto;
  border-top: 1px solid var(--card-border);
  margin-top: 4px;
  padding-top: 6px;
}
.hj-member-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  font-size: 12.5px;
  color: var(--text);
}
.hj-member-time { color: var(--faint); font-size: 11px; white-space: nowrap; }
.hj-member-empty { color: var(--faint); font-size: 12px; padding: 4px 0; }

/* ---------- 퇴출된 기기 안내 / 관리자 퇴출 버튼 ---------- */
.hj-banned {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 72px 28px;
}
.hj-banned-icon { font-size: 40px; }
.hj-banned-title { color: var(--text); font-size: 17px; font-weight: 800; }
.hj-banned-text { color: var(--muted); font-size: 13px; line-height: 1.7; max-width: 320px; }

.hj-member-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.hj-member-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.hj-member-row.banned .hj-member-name { opacity: 0.5; text-decoration: line-through; }
.hj-banned-tag {
  display: inline-block;
  color: var(--buy);
  font-size: 10.5px;
  border: 1px solid rgba(214, 52, 71, 0.5);
  border-radius: 999px;
  padding: 1px 6px;
  text-decoration: none;
}
.hj-ban-btn {
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(214, 52, 71, 0.6);
  background: transparent;
  color: var(--buy);
  font-size: 11.5px;
  cursor: pointer;
}
.hj-ban-btn.restore { border-color: var(--accent); color: var(--accent); }

/* 퇴출 안내 화면의 운영자 연락처 */
.hj-banned-contact {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
  user-select: text;
}
.hj-banned-contact a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  word-break: break-all;
}

/* ---------- 가장 최신 추천 표시 (노란색 NEW) ---------- */
.hj-new-badge {
  display: inline-flex;
  align-items: center;
  color: #FFD43B;
  background: rgba(255, 212, 59, 0.14);
  border: 1px solid rgba(255, 212, 59, 0.5);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: none;
  line-height: 1.2;
  padding: 2px 8px;
  border-radius: 999px;
}
