/* ============================================================
   BARUSU — style.css
   カオス・チャット広場
   ============================================================ */

/* ── 1. CSS Variables (Design Tokens) ─────────────────────── */
:root {
  --bg-base: #0a0a12;
  --bg-panel: #11111e;
  --bg-sidebar: #0d0d1a;
  --bg-input: #1a1a2e;
  --bg-card: #16162a;
  --bg-hover: #1e1e38;

  --accent-red: #ff2d55;
  --accent-orange: #ff6b35;
  --accent-gold: #ffd700;
  --accent-purple: #9b59b6;
  --accent-cyan: #00d4ff;

  --gradient-barusu: linear-gradient(135deg, #ff2d55 0%, #ff6b35 50%, #ffd700 100%);
  --gradient-dark: linear-gradient(180deg, #0a0a12 0%, #11111e 100%);

  --text-primary: #f0f0ff;
  --text-secondary: #8888aa;
  --text-muted: #55556e;

  --border-subtle: rgba(255,255,255,0.06);
  --border-accent: rgba(255, 45, 85, 0.4);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-glow-red: 0 0 20px rgba(255,45,85,0.4);
  --shadow-glow-gold: 0 0 30px rgba(255,215,0,0.3);

  --sidebar-w: 300px;
  --font-ja: 'Zen Maru Gothic', sans-serif;
  --font-en: 'Inter', sans-serif;

  --transition: 0.18s ease;
}

/* ── 2. Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 15px;
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ja);
  background: var(--bg-base);
  color: var(--text-primary);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── 3. Layout ─────────────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

#sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient-barusu);
}

/* Chat area */
#chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ── 4. Sidebar Header / Logo ─────────────────────────────── */
#sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

#logo-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

#logo-text {
  font-family: var(--font-en);
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gradient-barusu);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.1em;
}

#logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 0.05em;
}

/* ── 5. Icon Buttons ───────────────────────────────────────── */
.icon-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.9rem;
}

.icon-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-red);
  color: var(--accent-red);
  box-shadow: var(--shadow-glow-red);
}

.icon-btn.small {
  width: 26px;
  height: 26px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 6px;
}

/* ── 6. Barusu Meter ──────────────────────────────────────── */
#barusu-meter {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

#barusu-meter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

#barusu-meter-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#barusu-conditions {
  font-family: var(--font-en);
  font-size: 0.75rem;
  color: var(--accent-orange);
  font-weight: 600;
}

#msg-count-display {
  font-size: 1rem;
  font-weight: 900;
  color: var(--accent-red);
}

#meter-bar-wrap {
  position: relative;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  overflow: visible;
  margin-bottom: 8px;
}

#meter-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--gradient-barusu);
  width: 0%;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

#meter-bar::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  background: var(--accent-red);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-red);
  transition: opacity var(--transition);
}

#meter-glow {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--gradient-barusu);
  opacity: 0.2;
  filter: blur(4px);
  width: 0%;
  transition: width 0.5s ease;
  pointer-events: none;
}

#timer-display {
  font-family: var(--font-en);
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: right;
}

#timer-text {
  font-weight: 700;
  color: var(--text-primary);
}

/* Meter danger pulsing */
.meter-danger #meter-bar {
  animation: meter-pulse 0.8s ease-in-out infinite alternate;
}

@keyframes meter-pulse {
  from { filter: brightness(1); }
  to   { filter: brightness(1.5) saturate(1.4); }
}

/* ── 7. Online section ─────────────────────────────────────── */
#online-section {
  padding: 10px 16px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#online-count {
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 0.9rem;
  color: #4ade80;
}

/* ── 8. Music Section ──────────────────────────────────────── */
#music-section {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}

#music-section::-webkit-scrollbar { width: 4px; }
#music-section::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 4px; }

#music-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#youtube-player-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

#youtube-player-wrap iframe {
  width: 100% !important;
  height: 100% !important;
}

#now-playing-title {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Skip pips */
#skip-section {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
}

#skip-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

#skip-pips {
  display: flex;
  gap: 5px;
  margin-bottom: 4px;
}

.pip {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--bg-hover);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.pip.active {
  background: var(--accent-red);
  box-shadow: 0 0 6px var(--accent-red);
}

.pip.flash {
  animation: pip-flash 0.4s ease;
}

@keyframes pip-flash {
  0%, 100% { background: var(--accent-red); }
  50% { background: var(--accent-gold); box-shadow: 0 0 12px var(--accent-gold); }
}

#skip-count-text {
  font-family: var(--font-en);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: right;
}

/* Queue */
#queue-section { margin-top: 2px; }

#queue-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  animation: slide-in-left 0.3s ease;
}

.queue-item img {
  width: 36px;
  height: 27px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.queue-item .q-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item.now-playing {
  border-color: var(--accent-red);
  background: rgba(255,45,85,0.08);
}

.queue-item.now-playing::before {
  content: '▶';
  color: var(--accent-red);
  font-size: 0.6rem;
  flex-shrink: 0;
}

@keyframes slide-in-left {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── 9. Chat Topbar ────────────────────────────────────────── */
#chat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-muted);
}

#session-label { font-family: var(--font-en); font-weight: 600; }
#session-num { color: var(--accent-orange); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  transition: all var(--transition);
}
.status-dot.connected { background: #4ade80; box-shadow: 0 0 6px #4ade80; }
.status-dot.disconnected { background: var(--text-muted); }
.status-dot.connecting { background: var(--accent-gold); animation: blink 1s ease infinite; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── 10. Messages ──────────────────────────────────────────── */
#messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
  padding: 16px 0 8px;
}

#messages-container::-webkit-scrollbar { width: 4px; }
#messages-container::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 4px; }

#messages-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 100%;
}

/* Message row */
.msg-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 20px;
  border-radius: 0;
  position: relative;
  transition: background var(--transition);
  animation: msg-appear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.msg-row:hover { background: var(--bg-hover); }

@keyframes msg-appear {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Avatar */
.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-hover);
  border: 2px solid var(--border-subtle);
  transition: border-color var(--transition);
}

.msg-row:hover .msg-avatar { border-color: var(--accent-red); }

/* Message content */
.msg-content { flex: 1; min-width: 0; }

.msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.msg-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  position: relative;
}

.msg-name:hover { color: var(--accent-cyan); }

/* Tooltip for X link */
.msg-name .tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.7rem;
  color: var(--accent-cyan);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 100;
  box-shadow: var(--shadow-glow-red);
}

.msg-name:hover .tooltip { opacity: 1; }

.msg-time {
  font-family: var(--font-en);
  font-size: 0.65rem;
  color: var(--text-muted);
}

.msg-text {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.55;
  word-break: break-word;
}

/* Barusu keyword highlight */
.msg-text .kw-barusu {
  color: var(--accent-red);
  font-weight: 900;
  text-shadow: 0 0 10px rgba(255,45,85,0.5);
  animation: kw-pulse 2s ease infinite;
}

@keyframes kw-pulse {
  0%, 100% { text-shadow: 0 0 10px rgba(255,45,85,0.5); }
  50%       { text-shadow: 0 0 20px rgba(255,45,85,0.9); }
}

/* Report button */
.msg-report-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  opacity: 0;
  transition: all var(--transition);
  align-self: flex-start;
  margin-top: 4px;
}

.msg-row:hover .msg-report-btn { opacity: 1; }
.msg-report-btn:hover { color: var(--accent-red); background: rgba(255,45,85,0.1); }

/* System messages */
.msg-system {
  text-align: center;
  padding: 6px 20px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

.msg-system.barusu-warn {
  color: var(--accent-orange);
  font-weight: 700;
  font-style: normal;
  font-size: 0.78rem;
  animation: kw-pulse 1.5s ease infinite;
}

/* Domino fall animation (Barusu event) */
.msg-row.domino-fall {
  animation: domino-fall 0.6s ease forwards;
  transform-origin: bottom center;
}

@keyframes domino-fall {
  0%   { transform: rotate(0deg) translateY(0); opacity: 1; }
  20%  { transform: rotate(var(--fall-dir, 5deg)) translateY(-4px); }
  100% { transform: rotate(var(--fall-dir, 45deg)) translateY(80px); opacity: 0; }
}

/* ── 11. Input Area ────────────────────────────────────────── */
#input-area {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 20px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-subtle);
}

#my-avatar-wrap {
  flex-shrink: 0;
  margin-bottom: 2px;
}

#my-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-accent);
}

#input-wrap {
  flex: 1;
  position: relative;
}

#message-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ja);
  font-size: 0.9rem;
  padding: 10px 50px 10px 14px;
  resize: none;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 44px;
  max-height: 120px;
  line-height: 1.5;
}

#message-input:focus {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 3px rgba(255,45,85,0.15);
}

#message-input::placeholder { color: var(--text-muted); }

#char-count {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-family: var(--font-en);
  font-size: 0.65rem;
  color: var(--text-muted);
  pointer-events: none;
}

#char-num.near-limit { color: var(--accent-orange); }
#char-num.at-limit   { color: var(--accent-red); }

#send-btn {
  background: var(--gradient-barusu);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  box-shadow: 0 2px 12px rgba(255,45,85,0.4);
}

#send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 20px rgba(255,45,85,0.6);
}

#send-btn:active { transform: scale(0.95); }

/* ── 12. Modals ────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modal-in 0.2s ease;
}

.modal.hidden { display: none; }

@keyframes modal-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-inner {
  background: var(--bg-panel);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: min(90vw, 400px);
  position: relative;
  animation: modal-slide 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), var(--shadow-glow-red);
}

@keyframes modal-slide {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  transition: color var(--transition);
  line-height: 1;
}

.modal-close:hover { color: var(--text-primary); }

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
  background: var(--gradient-barusu);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-ja);
  font-size: 0.9rem;
  padding: 10px 12px;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 2px rgba(255,45,85,0.15);
}

.form-group select { cursor: pointer; }
.form-hint { font-size: 0.68rem; color: var(--text-muted); }

.twitter-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition);
}

.twitter-input-wrap:focus-within {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 2px rgba(255,45,85,0.15);
}

.twitter-at {
  padding: 10px 8px 10px 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.twitter-input-wrap input {
  border: none !important;
  box-shadow: none !important;
  padding: 10px 12px 10px 0;
  background: transparent;
}

#avatar-preview-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

#avatar-preview-wrap.hidden { display: none; }

#avatar-preview {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

#avatar-preview-name {
  font-size: 0.85rem;
  font-weight: 600;
}

#youtube-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

#youtube-preview.hidden { display: none; }

#youtube-preview-thumb img {
  width: 60px;
  height: 45px;
  object-fit: cover;
  border-radius: 4px;
}

#youtube-preview-title {
  font-size: 0.78rem;
  color: var(--text-secondary);
  flex: 1;
  word-break: break-word;
}

/* Buttons */
.btn-primary {
  width: 100%;
  background: var(--gradient-barusu);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-ja);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 12px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(255,45,85,0.4);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255,45,85,0.5);
}

.btn-danger {
  width: 100%;
  background: transparent;
  border: 1px solid var(--accent-red);
  border-radius: var(--radius-md);
  color: var(--accent-red);
  font-family: var(--font-ja);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 12px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-danger:hover {
  background: var(--accent-red);
  color: #fff;
  box-shadow: var(--shadow-glow-red);
}

/* ── 13. Barusu Event Overlays ─────────────────────────────── */
#flash-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 900;
  pointer-events: none;
  opacity: 0;
}

#flash-overlay.active {
  animation: white-flash 0.6s ease-out forwards;
}

@keyframes white-flash {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

#barusu-text {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ja);
  font-size: clamp(4rem, 14vw, 10rem);
  font-weight: 900;
  background: var(--gradient-barusu);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  z-index: 901;
  pointer-events: none;
  text-shadow: none;
  filter: drop-shadow(0 0 40px rgba(255,45,85,0.8));
}

#barusu-text.hidden { display: none; }

#barusu-text.show {
  animation: barusu-appear 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes barusu-appear {
  0%   { opacity: 0; transform: scale(0.3) rotate(-10deg); }
  50%  { opacity: 1; transform: scale(1.15) rotate(2deg); }
  80%  { transform: scale(0.95) rotate(-1deg); }
  100% { opacity: 0; transform: scale(1.5); }
}

/* Last Words Screen */
#last-words-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, #1a0a0a 0%, #0a0a12 60%, #000 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 800;
}

#last-words-screen.hidden { display: none; }

#last-words-inner {
  text-align: center;
  padding: 40px;
  animation: lw-appear 0.8s ease;
}

@keyframes lw-appear {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

#last-words-title {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 900;
  background: var(--gradient-barusu);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 30px;
  letter-spacing: 0.15em;
}

#last-words-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 30px;
  min-width: min(80vw, 480px);
}

.lw-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  border: 1px solid;
  animation: lw-item-in var(--delay, 0.3s) ease both;
}

.lw-item:nth-child(1) { border-color: var(--accent-gold); --delay: 0.2s; }
.lw-item:nth-child(2) { border-color: #c0c0c0; --delay: 0.4s; }
.lw-item:nth-child(3) { border-color: #cd7f32; --delay: 0.6s; }

@keyframes lw-item-in {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.lw-medal {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.lw-content { flex: 1; text-align: left; }
.lw-name { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; }
.lw-text { font-size: 0.9rem; font-weight: 600; word-break: break-word; }

#last-words-countdown {
  font-size: 0.8rem;
  color: var(--text-muted);
  animation: fade-blink 1s ease infinite;
}

@keyframes fade-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

#lw-countdown {
  font-family: var(--font-en);
  font-weight: 700;
  color: var(--accent-orange);
}

/* ── 14. Utility ───────────────────────────────────────────── */
.hidden { display: none !important; }

/* Scrollbar for all */
* { scrollbar-width: thin; scrollbar-color: var(--border-subtle) transparent; }

/* ── 15. Responsive ────────────────────────────────────────── */
@media (max-width: 640px) {
  :root { --sidebar-w: 100vw; }

  #app { flex-direction: column; }

  #sidebar {
    width: 100%;
    min-width: 100%;
    max-height: 280px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  #music-section { display: none; }

  #chat-topbar { display: none; }
}

/* ── 16. Skip all animation if prefers-reduced-motion ─────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
