@font-face {
  font-family: 'HarmonyOS Sans SC';
  src: url('fonts/HarmonyOS_Sans_SC_Medium.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}

:root {
  --bg: #14141f;
  --bg-bar: #1c1c2b;
  --line: #262636;
  --text: #e8e8f0;
  --text-dim: #7a7a8c;
  --accent: #e94560;
  --gold: #f9ca24;
  --green: #6ab04c;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'HarmonyOS Sans SC', -apple-system, 'PingFang SC', sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.view {
  display: none;
  height: 100%;
}
.view.active { display: flex; }

/* 登录 / 输入 */
#view-login, #view-input {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.brand {
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 28px;
  text-align: center;
}

.login-card, .input-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qr-wrap {
  position: relative;
  width: 240px;
  height: 240px;
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 44px rgba(0, 0, 0, .55);
}
.qr-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}
.qr-wrap img.ready { display: block; }

.qr-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 13px;
  border-radius: 14px;
  background: #fff;
}
.qr-loading.hide { display: none; }

#qr-status {
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  min-height: 18px;
}

/* 输入框 */
.input-row {
  width: 100%;
  display: flex;
  gap: 10px;
}

#link-input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-bar);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}
#link-input:focus { border-color: var(--accent); }
#link-input::placeholder { color: #55556a; }

#enter-btn {
  padding: 14px 26px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .2s;
}
#enter-btn:active { opacity: .75; }

#relogin-btn {
  margin-top: 22px;
  border: none;
  background: none;
  color: #4a4a5e;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
#relogin-btn:active { color: var(--text-dim); }

/* 看弹幕 */
#view-watching { flex-direction: column; }

.topbar {
  flex: 0 0 auto;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  background: var(--bg-bar);
  border-bottom: 1px solid var(--line);
}

#exit-btn {
  padding: 7px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
#exit-btn:active { color: var(--text); border-color: var(--text-dim); }

.stats {
  margin-left: auto;
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-dim);
}

/* 双栏：竖屏上下（礼物在上），横屏左右（礼物在左） */
.panes {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.pane {
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.pane-gift {
  flex: 0 0 50%;
  border-bottom: 1px solid var(--line);
}

.pane-chat { flex: 1; }

.list {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 6px 14px 16px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.list > :first-child { margin-top: auto; }
.list::-webkit-scrollbar { width: 3px; }
.list::-webkit-scrollbar-thumb { background: #33334a; border-radius: 2px; }

@media (orientation: landscape) {
  .panes { flex-direction: row; }
  .pane-gift {
    border-bottom: none;
    border-right: 1px solid var(--line);
  }
}

/* 消息行 */
.msg {
  font-size: 14px;
  line-height: 1.45;
  padding: 2px 0;
  word-break: break-word;
  animation: fadeIn .18s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg .name { color: var(--accent); margin-right: 6px; }
.msg .text { color: var(--text); }

.msg.sys {
  color: var(--text-dim);
  font-size: 12px;
  padding: 3px 0;
}

.msg.like {
  color: var(--green);
  font-size: 12px;
  opacity: .85;
}

.msg.gift { color: var(--gold); }
.msg.gift .name { color: var(--gold); }

.gift-name { color: var(--gold); }

.combo {
  display: inline-block;
  color: #ff6b81;
  margin-left: 4px;
  transform-origin: center;
}
.combo.pop { animation: comboPop .35s cubic-bezier(.34,1.56,.64,1); }
@keyframes comboPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.5); }
  70%  { transform: scale(.95); }
  100% { transform: scale(1); }
}

.gift-price {
  margin-left: 6px;
  font-size: 11px;
  color: #ffa502;
  background: rgba(255,165,2,.13);
  padding: 1px 6px;
  border-radius: 8px;
}
