.danmaku-layer {
  position: fixed; z-index: 40; inset: calc(var(--site-header-height) + 8px) 0 auto;
  height: max(0px, calc(50dvh - var(--site-header-height) - 8px)); overflow: hidden; pointer-events: none; contain: layout paint;
}
.danmaku-message {
  position: absolute; inset-inline-start: 0; white-space: nowrap; max-width: none;
  font-size: 1rem; line-height: 30px; font-weight: 600; color: var(--ink);
  text-shadow: -1px -1px 0 var(--card), 1px -1px 0 var(--card), -1px 1px 0 var(--card), 1px 1px 0 var(--card), 0 1px 5px var(--card);
  will-change: transform; padding: 6px 28px 0 7px; border-radius: 6px;
}
.danmaku-repeat {
  position: absolute; top: 0; right: 0; padding: 1px 4px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--soft); color: var(--accent);
  font-size: .65rem; line-height: 1.15; font-weight: 650; text-shadow: none;
}
.danmaku-message.is-own { background: color-mix(in srgb, var(--soft) 92%, transparent); box-shadow: inset 0 0 0 1px var(--accent); }
.danmaku-controls {
  position: fixed; z-index: 45; right: max(24px, env(safe-area-inset-right));
  bottom: calc(36px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px;
}
.danmaku-controls button { font: inherit; font-size: .9rem; cursor: pointer; min-height: 44px; border-radius: 100px; }
.danmaku-launch { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--accent); padding: 10px 18px; background: var(--accent); color: var(--card); box-shadow: 0 4px 18px #102b1b25; font-weight: 650 !important; line-height: 1.3; transition: background 160ms ease, color 160ms ease, border-radius 160ms ease; }
.danmaku-controls:not(.is-expanded) .danmaku-launch { width: 44px; height: 44px; gap: 0; padding: 10px; background: var(--soft); color: var(--accent); border-color: var(--rule); box-shadow: 0 2px 10px #102b1b15; }
.danmaku-controls:not(.is-expanded) [data-danmaku-trigger-label] { display: none; }
.danmaku-controls svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; flex: none; }
.danmaku-menu { position: absolute; right: 0; bottom: calc(100% + 10px); width: 168px; max-width: calc(100vw - 32px); padding: 5px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--card); box-shadow: 0 6px 28px #102b1b25; }
.danmaku-menu.opens-right { left: 0; right: auto; }
.danmaku-menu button { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 9px; border: 0; border-radius: 9px; color: var(--ink); background: transparent; text-align: start; font-size: .875rem; }
.danmaku-menu svg { width: 18px; height: 18px; }
.danmaku-menu button:hover { background: var(--soft); }
.danmaku-switch { width: 34px; height: 21px; border-radius: 100px; background: var(--rule); padding: 3px; flex: none; }
.danmaku-switch::after { content: ''; display: block; width: 15px; height: 15px; border-radius: 50%; background: var(--card); }
.danmaku-toggle[aria-checked="true"] .danmaku-switch { background: var(--accent); }
.danmaku-toggle[aria-checked="true"] .danmaku-switch::after { transform: translateX(13px); }
.danmaku-notice { position: fixed; z-index: 55; bottom: calc(100px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); margin: 0; max-width: calc(100vw - 32px); border-radius: 12px; color: var(--card); background: var(--ink); font-size: .9rem; text-align: center; }
.danmaku-notice:not(:empty) { padding: 9px 18px; }
:is(#danmaku-dialog, #market-feedback-dialog) { width: min(440px, calc(100vw - 32px)); max-height: calc(var(--danmaku-viewport, 100dvh) - 24px); padding: 22px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: auto; overscroll-behavior: contain; }
:is(#danmaku-dialog, #market-feedback-dialog)::backdrop { background: #07150e80; }
body:has(:is(#danmaku-dialog, #market-feedback-dialog)[open]) { overflow: hidden; }
.danmaku-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.danmaku-heading h2 { font-size: 1.3rem; margin: 0; }
:is(#danmaku-dialog, #market-feedback-dialog) :is(button, textarea) { font: inherit; }
:is(#danmaku-hint, #market-feedback-hint) { margin: 8px 0 18px; font-size: .9rem; }
:is(#danmaku-label, #market-feedback-label) { display: block; margin-bottom: 7px; font-weight: 600; }
:is(#danmaku-text, #market-feedback-text) { display: block; width: 100%; min-height: 108px; resize: vertical; padding: 12px; color: var(--ink); background: var(--bg); border: 1px solid var(--rule); border-radius: 12px; font-size: 16px; }
.danmaku-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
:is(#danmaku-count, #market-feedback-count) { font-size: .875rem; color: var(--muted); }
:is(#danmaku-count, #market-feedback-count).is-invalid, :is(#danmaku-error, #market-feedback-error) { color: light-dark(#a12d22, #ffb0a7); }
:is(#danmaku-error, #market-feedback-error) { font-size: .9rem; margin: 10px 0 0; }
:is(#danmaku-error, #market-feedback-error):empty { display: none; }
:is(#danmaku-send, #market-feedback-send) { border-radius: 100px; min-height: 44px; padding: 7px 24px; border: 1px solid var(--accent); color: var(--card); background: var(--accent); cursor: pointer; }
:is(#danmaku-send, #market-feedback-send):disabled { opacity: .5; cursor: default; }
@media (max-width: 620px) {
  .danmaku-controls { right: max(16px, env(safe-area-inset-right)); bottom: calc(88px + env(safe-area-inset-bottom)); gap: 6px; }
  .danmaku-controls:not(.is-expanded) { right: max(0px, env(safe-area-inset-right)); }
  .danmaku-controls:not(.is-expanded) .danmaku-launch { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; }
  .danmaku-controls button { font-size: .875rem; }
  .danmaku-launch { padding: 10px 15px; }
  .danmaku-notice { bottom: calc(150px + env(safe-area-inset-bottom)); }
  :is(#danmaku-dialog, #market-feedback-dialog) { position: fixed; inset: auto 0 var(--danmaku-keyboard, 0px); margin: 0; width: 100%; max-width: none; border-radius: 22px 22px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .danmaku-launch { transition: none; }
}
