:root {
  --sticker-size: 120px;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans JP", sans-serif;
  background: #50476a;
  color: #fff;
}
.chat-root {
  display: flex;
  height: 100vh;
  background: #50476a;
}
.sidebar {
  width: 280px;
  background: #3f355b;
  display: flex;
  flex-direction: column;
}
.server-header {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #2b2633;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.2s;
}
.server-header:hover {
  background: rgba(61, 55, 80, 0.5);
}
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px 0;
}
.channel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  background: #50476a;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 15px;
}
.channel-icon {
  width: 24px;
  height: 24px;
  display: flex;
  padding: 0 10px;
}
.section-label {
  font-size: 12px;
  color: #bdbdbd;
  margin: 16px 0 4px 8px;
}
.voice-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}
.voice-user:hover {
  background: #50476a;
}
.voice-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
}
.bg-pink-500 {
  background: #ec4899;
}
.bg-purple-400 {
  background: #a78bfa;
}
.bg-teal-400 {
  background: #2dd4bf;
}
.bg-pink-400 {
  background: #f472b6;
}
.bg-purple-600 {
  background: #7c3aed;
}
.bg-green-600 {
  background: #22c55e;
}
.bg-red-600 {
  background: #ef4444;
}
.bg-default {
  background: #9a559b;
}
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #50476a;
}
.chat-header {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid #2b2633;
  background: rgba(78, 72, 104, 0.8);
}
.chat-header .channel-icon {
  width: 24px;
  height: 24px;
  font-size: 13px;
}
.window-buttons {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.window-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.window-btn.blue {
  background: #62c4ed;
}
.window-btn.yellow {
  background: #f5c03b;
}
.window-btn.red {
  background: #f25a64;
}
.messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  border-radius: 10px;
  scrollbar-color: rgb(53, 36, 78) rgb(70, 52, 92);
}
.message {
  display: flex;
  gap: 12px;
  padding: 8px 16px;
  transition: background 0.1s;
  position: relative;
}
.message:hover {
  background: rgba(4, 4, 5, 0.07);
}

/* Reply button */
.message-reply-btn {
  position: absolute;
  top: -12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: #3f355b; /* 调整为侧边栏深紫色 */
  border: 1px solid #2b2633; /* 调整为深色边框 */
  border-radius: 4px;
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: opacity 0.15s ease-out, transform 0.15s ease-out, background-color 0.1s;
  color: #b9bbbe;
  opacity: 0;
  transform: translateY(4px) scale(0.95);
  pointer-events: none;
  z-index: 10;
}

.message:hover .message-reply-btn {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.message-reply-btn:hover {
  background: #50476a; /* 悬停时变亮，呼应主体背景色 */
  color: #fff;
  border-color: #6d638a; /* 悬停时边框也稍微提亮 */
  box-shadow: 0 4px 8px rgba(0,0,0,0.4);
  transform: translateY(0) scale(1.05);
}

.message-reply-btn:active {
  transform: translateY(0) scale(0.95);
  background: #3f355b;
}

.message-reply-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Reply jump highlight animation */
.message-highlighted {
  background: rgba(124, 111, 172, 0.2) !important;
  animation: message-highlight-pulse 2s ease-out;
}

@keyframes message-highlight-pulse {
  0% {
    background: rgba(124, 111, 172, 0.4);
  }
  100% {
    background: rgba(124, 111, 172, 0.2);
  }
}

.message .avatar {
  width: 40px;
  height: 40px;
  font-size: 18px;
}
.message-content {
  flex: 1;
  min-width: 0;
}
.message-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.message-user {
  font-weight: 600;
  font-size: 15px;
}
.message-time {
  font-size: 12px;
  color: #bdbdbd;
}
.message-text {
  font-size: 15px;
  margin: 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Nako 流式消息动画 */
.message.streaming .message-text::after {
  content: '▋';
  animation: blink 1s infinite;
  margin-left: 2px;
}

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

.message-file {
  margin-top: 6px;
  background: #2b2633;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 320px;
}
.file-icon {
  width: 48px;
  height: 48px;
  background: #3d3750;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #bdbdbd;
}
.file-info {
  flex: 1;
  min-width: 0;
}
.file-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-size {
  font-size: 12px;
  color: #bdbdbd;
}
.file-download {
  background: none;
  border: none;
  color: #bdbdbd;
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
  border-radius: 50%;
  transition: background 0.2s;
}
.file-download:hover {
  background: #3d3750;
}
.input-area {
  padding: 16px;
  background: none;
}
.input-box {
  position: relative;
  background: #3f355b;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 15px;
  font-family: inherit;

  /* textarea 专属属性 */
  resize: none;
  overflow-y: hidden;
  line-height: 1.5;
  min-height: 22px;
  max-height: 140px;
  padding: 0;
  vertical-align: top;

  /* 滚动条样式 */
  scrollbar-width: thin;
  scrollbar-color: rgba(167, 139, 250, 0.3) transparent;
}

.input::-webkit-scrollbar {
  width: 6px;
}

.input::-webkit-scrollbar-thumb {
  background: rgba(167, 139, 250, 0.3);
  border-radius: 3px;
}

.input::-webkit-scrollbar-thumb:hover {
  background: rgba(167, 139, 250, 0.5);
}
.input::placeholder {
  color: #888;
}
.input-btns {
  display: flex;
  gap: 8px;
  align-self: flex-start;
  margin-top: 5px;
}
.input-btn {
  background: none;
  border: none;
  color: #bdbdbd;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.input-btn:hover {
  background: #3d3750;
  color: #fff;
}

.sticker {
  vertical-align: middle;
  display: inline-block;
  max-width: 100%; /* 防止超出容器 */
}
.sticker-fixed {
  height: var(--sticker-size);
  width: auto;
}

.sticker-narrow {
  width: var(--sticker-size);
  height: auto;
}

.sticker-inline {
  height: 60px;
  width: auto;
}

/* 加载占位：在图片加载前显示正方形占位，尺寸与将要显示的贴纸大小匹配 */
.sticker-loading {
  background: #3d3750; /* 占位背景色 */
  display: inline-block;
  vertical-align: middle;
  width: var(--sticker-size);
  height: var(--sticker-size);
}

/* 对于 inline 情况，使用更小的正方形占位 */
.sticker-inline.sticker-loading {
  width: 60px;
  height: 60px;
}

/* 加载失败时显示的替代文本样式 */
.sticker-broken {
  color: #bdbdbd;
  font-style: italic;
  display: inline-block;
  padding: 0 6px;
}

/* Mention List */
.mention-list {
  position: absolute;
  bottom: 100%;
  left: 0;
  width: 240px;
  background: #2f3136;
  border: 1px solid #202225;
  border-radius: 4px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
  margin-bottom: 8px;
}

.mention-list.hidden {
  display: none;
}

.mention-item {
  padding: 8px 12px;
  cursor: pointer;
  color: #dcddde;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.mention-item:hover,
.mention-item.active {
  background-color: #40444b;
  color: #fff;
}

.mention-item .avatar {
  width: 24px;
  height: 24px;
  font-size: 12px;
  line-height: 24px;
}

.mention-item .status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: auto;
}

.mention-item.online .status-indicator {
  background-color: #43b581;
}

.mention-item.offline {
  opacity: 0.6;
}

.mention-item.offline .status-indicator {
  background-color: #747f8d;
}

/* Sticker Autocomplete Item */
.mention-item.sticker-autocomplete-item {
  height: auto;
  min-height: 48px;
}
.sticker-preview {
  width: 48px;
  height: 48px;
  object-fit: contain;
  margin-right: 12px;
  background: rgba(0,0,0,0.1);
  border-radius: 4px;
}
.sticker-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sticker-label {
  font-weight: 600;
  color: #fff;
  font-size: 14px;
}
.sticker-desc {
  font-size: 12px;
  color: #b9bbbe;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message.mentioned {
  background: rgba(250, 166, 26, 0.1);
  border-left: 2px solid #faa61a;
  padding-left: 14px; /* Compensate for border */
}

.message.mentioned:hover {
  background: rgba(250, 166, 26, 0.15);
}

/* Name Chooser Overlay - Redesigned */
.name-chooser {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(20, 20, 25, 0.92);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.4s ease-out;
}

.name-chooser.hidden {
  display: none;
}

.name-chooser-content {
  position: relative; /* For absolute positioning of close button */
  background: #2b2633;
  border-radius: 24px;
  padding: 48px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transform: translateY(0);
  animation: slideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.logo-area {
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
}

.logo-area svg {
  filter: drop-shadow(0 0 10px rgba(138, 123, 206, 0.4));
  animation: float 6s ease-in-out infinite;
}

.name-chooser-content h2 {
  margin: 0 0 8px;
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.subtitle {
  margin: 0 0 32px;
  color: #b9bbbe;
  font-size: 14px;
}

.input-wrapper {
  position: relative;
  margin-bottom: 24px;
  text-align: left;
}

.name-input {
  width: 100%;
  padding: 16px 20px;
  background-color: #1e1b24;
  border: 2px solid transparent;
  border-radius: 12px;
  color: #fff;
  font-size: 16px;
  outline: none;
  box-sizing: border-box;
  transition: all 0.2s ease;
  font-family: inherit;
}

.name-input::placeholder {
  color: #6a6f7a;
}

.name-input:focus {
  background-color: #1e1b24;
  border-color: #7289da;
  box-shadow: 0 0 0 3px rgba(114, 137, 218, 0.15);
}

.name-submit {
  width: 100%;
  padding: 16px;
  background: #5865f2;
  border: none;
  border-radius: 12px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  outline: none;
}

.name-submit:hover {
  background: #4752c4;
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(88, 101, 242, 0.3);
}

.name-submit:active {
  transform: translateY(0);
  background: #3c45a5;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
  width: 100%;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.auth-divider span {
  padding: 0 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sekai-pass-login {
  position: relative;
  width: 100%;
  padding: 14px;
  background: rgba(35, 39, 42, 0.6);
  border: 1px solid rgba(88, 101, 242, 0.3);
  border-radius: 12px;
  color: #e0e0e0;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  outline: none;
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.sekai-pass-login:hover {
  background: rgba(88, 101, 242, 0.15);
  border-color: #5865f2;
  color: #fff;
  box-shadow: 0 4px 25px rgba(88, 101, 242, 0.35);
}

.sekai-pass-login svg {
  transition: transform 0.3s ease, color 0.3s ease, filter 0.3s ease;
  color: #5865f2;
  will-change: transform;
}

.sekai-pass-login:hover svg {
  transform: scale(1.1);
  color: #fff;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
}

.sekai-pass-login:active {
  transform: scale(0.98);
  background: rgba(88, 101, 242, 0.1);
}

/* Optional: Add a subtle shine effect on hover */
.sekai-pass-login::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transform: skewX(-20deg);
  transition: 0.5s;
}

.sekai-pass-login:hover::after {
  left: 150%;
  transition: 0.7s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0px); }
}

.input-error {
  color: #ed4245;
  font-size: 13px;
  margin-top: 8px;
  min-height: 20px;
  opacity: 0;
  transition: opacity 0.2s;
  text-align: left;
  font-weight: 500;
}

.input-error.visible {
  opacity: 1;
}

.name-input.error {
  border-color: #ed4245;
  box-shadow: 0 0 0 3px rgba(237, 66, 69, 0.15); /* matching default focus style but red */
}
.name-input.error:focus {
  border-color: #ed4245;
}

.chooser-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: #b9bbbe;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  outline: none;
}

.chooser-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.chooser-close.hidden {
  display: none;
}

/* ==================== Mobile Responsive Styles ==================== */

/* 移动端适配 - 针对平板和小屏设备 */
@media screen and (max-width: 768px) {
  /* 侧边栏响应式 */
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    height: 100vh;
    height: 100dvh; /* 修复移动端浏览器工具栏遮挡问题 */
    z-index: 999;
    transition: left 0.3s ease;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
  }
  
  .sidebar.show {
    left: 0;
  }
  
  /* 主聊天区域需要正确处理视口高度 */
  .chat-root {
    height: 100vh;
    height: 100dvh;
  }
  
  /* 主聊天区域占满屏幕 */
  .main {
    width: 100%;
  }
  
  /* 添加汉堡菜单按钮 */
  .chat-header {
    position: relative;
  }
  
  .chat-header::before {
    content: '☰';
    position: absolute;
    left: 16px;
    font-size: 24px;
    cursor: pointer;
    z-index: 1;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
  }
  
  .chat-header::before:hover {
    background: rgba(255, 255, 255, 0.1);
  }
  
  .chat-header .channel-icon {
    margin-left: 48px;
  }
  
  /* 窗口按钮在移动端隐藏 */
  .window-buttons {
    display: none;
  }
  
  /* 消息区域优化 */
  .messages {
    padding: 12px 0;
  }
  
  .message {
    padding: 8px 12px;
  }
  
  .message .avatar {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  /* 输入区域优化 */
  .input-area {
    padding: 12px;
  }
  
  .input-box {
    padding: 10px 12px;
  }
  
  /* 输入按钮优化为触摸友好 */
  .input-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  /* 名称选择器优化 */
  .name-chooser-content {
    padding: 36px 24px;
    max-width: 90%;
    margin: 0 16px;
  }
}

/* 移动端适配 - 针对小屏手机 */
@media screen and (max-width: 480px) {
  /* 减小字体大小 */
  .message-user {
    font-size: 14px;
  }
  
  .message-text {
    font-size: 14px;
  }
  
  .input {
    font-size: 14px;
  }
  
  /* 消息头部优化 */
  .message-header {
    gap: 6px;
  }
  
  .message-time {
    font-size: 11px;
  }
  
  /* 减小头像大小 */
  .message .avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  /* 贴纸大小调整 */
  :root {
    --sticker-size: 80px;
  }
  
  .sticker-inline {
    height: 48px;
  }
  
  /* 文件附件优化 */
  .message-file {
    max-width: 100%;
  }
  
  .file-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  
  .file-name {
    font-size: 13px;
  }
  
  .file-size {
    font-size: 11px;
  }
  
  /* 输入按钮进一步优化 -- 更加紧凑且视觉上更舒适 */
  .input-area {
    padding: 8px; /* 极简的外部填充 */
    background: #50476a; /* 确保背景色不透明，遮挡底部可能的内容 */
    padding-bottom: max(8px, env(safe-area-inset-bottom)); /* 适配 iPhone X+ 底部安全区域 */
  }

  .input-box {
    padding: 6px 10px; /* 更加紧凑的内部填充 */
    gap: 8px;
    min-height: 44px; /* 保证最小触控高度 */
  }

  .input-btns {
    gap: 2px; /* 缩小按钮间距 */
  }
  
  .input-btn {
    width: 32px; /* 较小的视觉尺寸 */
    height: 32px;
    min-height: 32px; /* 覆盖全局触摸优化 */
    font-size: 16px;
    padding: 0; /* 移除可能的内边距 */
    position: relative;
  }
  
  /* 增加实际点击热区但不增加视觉尺寸 */
  .input-btn::after {
    content: '';
    position: absolute;
    top: -6px; right: -6px; bottom: -6px; left: -6px;
  }

  /* 提及列表优化 */
  .mention-list {
    width: calc(100vw - 48px);
    max-width: 280px;
  }
  
  /* 侧边栏内容优化 */
  .voice-user-info .avatar {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
  
  .section-label {
    font-size: 11px;
  }
  
  /* 名称选择器进一步优化 */
  .name-chooser-content {
    padding: 24px 20px;
  }
  
  .name-chooser-content h2 {
    font-size: 20px;
  }
  
  .subtitle {
    font-size: 13px;
    margin-bottom: 24px;
  }
  
  .name-input {
    padding: 14px 16px;
    font-size: 15px;
  }
  
  .name-submit {
    padding: 14px;
    font-size: 15px;
  }
  
  .logo-area svg {
    width: 48px;
    height: 48px;
  }
}

/* 横屏模式优化 */
@media screen and (max-width: 768px) and (orientation: landscape) {
  .chat-root {
    height: 100vh;
    height: 100dvh;
  }
  
  .name-chooser-content {
    max-height: 90vh;
    overflow-y: auto;
  }
  
  /* 减小头部高度 */
  .chat-header,
  .server-header {
    height: 40px;
  }
  
  /* 减小输入区域 */
  .input-area {
    padding: 8px 12px;
  }
  
  .input-box {
    padding: 8px 12px;
  }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  /* 增加点击区域 */
  .input-btn,
  .file-download,
  .channel,
  .voice-user {
    min-height: 44px;
  }
  
  /* 移除悬停效果，使用点击效果 */
  .input-btn:active {
    background: #3d3750;
    transform: scale(0.95);
  }
  
  .message:active {
    background: rgba(4, 4, 5, 0.1);
  }
  
  .name-submit:active {
    transform: scale(0.98);
  }
}

/* 最终修正：针对移动端强制覆盖触摸设备的大尺寸设置，使用伪元素扩大点击区域代替 */
@media screen and (max-width: 480px) {
  .input-btn {
    min-height: 32px !important;
    height: 32px !important;
    width: 32px !important;
  }
}

/* Nako 思考图标样式 */
.nako-thinking-icon {
  display: inline-block;
  margin-left: 6px;
  font-size: 14px;
  cursor: help;
  opacity: 0.5;
  transition: opacity 0.2s, transform 0.2s;
  vertical-align: middle;
}

.nako-thinking-icon:hover {
  opacity: 0.9;
  transform: scale(1.15);
}

/* 移动端隐藏思考图标 */
@media screen and (max-width: 768px) {
  .nako-thinking-icon {
    display: none;
  }
}

/* ============================================
   SEKAI Rich Text & Media (Minimalist Geometric Redesign)
   ============================================ */

:root {
  --sekai-accent: #7c6fac;
  --sekai-bg-card: #2b2633;
  --sekai-bg-hover: #352d42;
  --sekai-text-dim: #bdbdbd;
  --sekai-radius: 6px;
  --sekai-font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

/* --- Typography & Inline Elements --- */

.sekai-text-node {
  line-height: 1.6;
}

/* Bold text styling */
.sekai-text-node strong {
  font-weight: 700;
  color: #fff;
}

/* Italic text styling */
.sekai-text-node em {
  font-style: italic;
  color: #e0d4f7;
}

/* Strikethrough text styling */
.sekai-text-node del {
  text-decoration: line-through;
  opacity: 0.7;
}

/* Inline code styling */
.sekai-code-inline {
  font-family: var(--sekai-font-mono);
  background: #2b2633;
  color: #f8c555;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
  border: 1px solid rgba(255,255,255,0.05);
}

/* --- Code Block (IDE Style Integration) --- */
.sekai-code-block {
  font-family: var(--sekai-font-mono);
  display: block;
  /* Upgrade to gradient glass background to match file-card */
  background: linear-gradient(145deg, rgba(43, 38, 51, 0.9), rgba(30, 25, 40, 0.95));
  color: #e0d4f7; /* Keep the soft purple text */
  padding: 12px 16px;
  border-radius: 8px; /* Slightly smoother radius */
  margin: 10px 0;
  white-space: pre; /* Use pre to strictly respect formatting */
  overflow-x: auto; /* Scroll for long lines */
  
  /* Geometric Accent: Left border strip */
  border-left: 3px solid rgba(124, 111, 172, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08); /* Unified border style */
  border-left-width: 3px; /* Ensure left border takes precedence */
  
  line-height: 1.6;
  font-size: 0.9em; /* Slightly smaller for density */
  tab-size: 2;
  
  /* UX: Subtle shadow to lift it from chat background */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: border-color 0.2s;
}

.sekai-code-block:hover {
  border-color: rgba(167, 139, 250, 0.3); /* Integrated hover state */
  border-left-color: #a78bfa; /* Highlight accent on hover */
}

/* Scrollbar styling for code block */
.sekai-code-block::-webkit-scrollbar {
  height: 6px;
}
.sekai-code-block::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
.sekai-code-block::-webkit-scrollbar-track {
  background: transparent;
}

/* Spoiler / 黑幕 - Optical Blur Redesign */
/* Spoiler / 黑幕 - Digital Interference Tape */
.sekai-spoiler {
  /* "Stuck on" feel: Solid noise texture masking the text */
  background: #2a2635;
  color: transparent;
  text-shadow: none; /* Removed text hint to ensure total spoiler safety */
  padding: 0 4px; /* Tighter padding like a tape */
  margin: 0 2px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  font-weight: 500;
  border: 1px solid rgba(124, 111, 172, 0.2); /* Subtle purple border */
  
  /* Texture: Digital Noise Stripe */
  background-image: repeating-linear-gradient(
    135deg,
    #2a2635,
    #2a2635 6px,
    #332e42 6px,
    #332e42 12px
  );
  /* Soft shadow to lift it up (Layering) */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sekai-spoiler:hover {
  /* Interactive feedback: Brighter, slightly unstable feel */
  border-color: rgba(167, 139, 250, 0.6); /* Purple accent highlight */
  background-image: repeating-linear-gradient(
    135deg,
    #322d40,
    #322d40 6px,
    #3e3750 6px,
    #3e3750 12px
  );
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255,255,255,0.05);
}

.sekai-spoiler.revealed {
  /* "Dug out" / Contextual feel: Texture vanishes, text remains */
  background: rgba(124, 111, 172, 0.1); 
  background-image: none;
  color: inherit;
  cursor: text;
  user-select: text;
  border-color: transparent;
  box-shadow: none;
  padding: 0 2px; /* Slight shrink to fit text naturally */
}

.sekai-spoiler.revealed {
  background: rgba(124, 111, 172, 0.15); /* Highlighted background when revealed */
  color: inherit;
  text-shadow: none; /* Clear blur */
  cursor: text;
  user-select: text;
  animation: sekai-spoiler-reveal 0.3s ease-out;
}

@keyframes sekai-spoiler-reveal {
  0% { filter: blur(4px); opacity: 0.5; }
  100% { filter: blur(0); opacity: 1; }
}

/* Auto-linked URLs */
.sekai-link-inline {
  color: #88b3f5;
  text-decoration: none; /* No underline by default to keep clean */
  border-bottom: 1px solid rgba(136, 179, 245, 0.3); /* Subtle hint instead */
  transition: all 0.2s;
  padding-bottom: 0px;
}

.sekai-link-inline:hover {
  color: #a8c9ff;
  border-bottom-color: #a8c9ff; /* Fully underline on hover */
  border-bottom-width: 1.5px;
}

/* --- Stickers --- */

.sekai-sticker {
  vertical-align: middle;
  transition: transform 0.2s;
}

.sekai-sticker-inline {
  height: 60px; /* Restored to original size */
  width: auto;
  margin: 0 4px;
}

@media screen and (max-width: 600px) {
  .sekai-sticker-inline {
    height: 48px;
  }
} 


.sekai-sticker-single {
  max-width: var(--sticker-size);
  max-height: var(--sticker-size);
  display: block;
  margin: 4px 0;
  border-radius: var(--sekai-radius);
}

.sekai-sticker-single:hover {
  transform: scale(1.02);
}

/* --- Images --- */

.sekai-image-container {
  display: inline-block;
  margin: 6px 0;
  position: relative;
  overflow: hidden;
  border-radius: var(--sekai-radius);
  background: rgba(0,0,0,0.1);
  max-width: 100%;
}

/* Loading 状态默认使用 large 尺寸 */
.sekai-image-container.loading {
  max-width: 400px;
}

.sekai-image-container.loading::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, #2b2633 25%, #352d42 50%, #2b2633 75%);
  background-size: 200% 100%;
  animation: sekai-shimmer 1.5s infinite;
}

.sekai-image-content {
  display: block;
  max-width: 100%;
  max-height: 400px;
  transition: opacity 0.3s;
}

.sekai-image-caption {
  padding: 4px 8px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 0.85em;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  transform: translateY(100%);
  transition: transform 0.2s;
}

.sekai-image-container:hover .sekai-image-caption {
  transform: translateY(0);
}

/* Image size classes - based on naturalWidth */
.sekai-image-container.sekai-image-large {
  max-width: 400px;
}

.sekai-image-container.sekai-image-small {
  max-width: 200px;
}

.sekai-error-placeholder {
  padding: 20px;
  text-align: center;
  color: #ff6b6b;
}

.sekai-error-icon {
  font-size: 24px;
  display: block;
  margin-bottom: 8px;
}

.sekai-error-text {
  font-size: 13px;
  font-style: italic;
}

/* --- Audio Player (Custom Geometric) --- */

.sekai-audio-player {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)); /* Gradient for depth without greyness */
  padding: 12px 16px;
  border-radius: 12px;
  margin: 6px 0;
  width: fit-content;
  min-width: 320px;
  max-width: 480px;
  border: 1px solid rgba(255,255,255,0.1);
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.sekai-audio-player:hover {
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  border-color: rgba(124, 111, 172, 0.6);
}

.sekai-audio-control {
  background: #ec4899; /* Pink as per design */
  border: none;
  min-width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(236, 72, 153, 0.3);
}

.sekai-audio-control:hover {
  transform: scale(1.05);
  background: #f472b6;
}

.sekai-audio-control:active {
  transform: scale(0.95);
}

.sekai-audio-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 32px;
  flex: 1;
}

.sekai-audio-wave .bar {
  flex: 1;
  background: #50476a;
  border-radius: 4px;
  min-height: 4px;
  transition: height 0.2s, background-color 0.2s;
}

.sekai-audio-player.playing .sekai-audio-wave .bar {
  animation: sekai-wave 0.6s ease-in-out infinite alternate;
  background: #a78bfa;
}

.sekai-audio-time {
  font-family: var(--sekai-font-mono);
  font-size: 0.85em;
  color: var(--sekai-text-dim);
  min-width: 45px;
  text-align: right;
  font-weight: 500;
}

/* --- File Card --- */

.sekai-file-card {
  display: flex;
  align-items: center;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border-radius: 8px; /* Slightly less rounded than audio for distinct feel */
  padding: 12px;
  margin: 6px 0;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
  border: 1px solid rgba(255,255,255,0.1);
  width: fit-content;
  min-width: 300px;
  max-width: 450px;
  backdrop-filter: blur(4px);
}

.sekai-file-card:hover {
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  border-color: rgba(255,255,255,0.2);
  transform: translateY(-1px);
}

.sekai-file-icon {
  width: 48px;
  height: 48px;
  background: rgba(167, 139, 250, 0.15); /* Purple tint instead of grey-white */
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a78bfa; /* Purple icon */
}

.sekai-file-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  overflow: hidden;
}

.sekai-file-name {
  font-size: 0.95em;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #eee;
}

.sekai-file-meta {
  font-size: 0.75em;
  color: var(--sekai-text-dim);
  margin-top: 2px;
  font-family: var(--sekai-font-mono);
}

.sekai-file-action {
  color: var(--sekai-text-dim);
  opacity: 0.6;
  transition: opacity 0.2s;
  padding: 4px;
  display: flex;
}

.sekai-file-action:hover {
  opacity: 1;
  color: #fff;
}

/* --- Link Card --- */

.sekai-link-card {
  display: flex;
  background: var(--sekai-bg-card);
  border-radius: var(--sekai-radius);
  margin: 6px 0;
  text-decoration: none;
  overflow: hidden;
  transition: background 0.2s;
  max-width: 480px;
  align-items: stretch;
}

.sekai-link-card:hover {
  background: var(--sekai-bg-hover);
}

.sekai-link-accent {
  width: 4px;
  background: var(--sekai-accent);
}

.sekai-link-content {
  padding: 10px 12px;
  flex: 1;
  overflow: hidden;
}

.sekai-link-site {
  font-size: 0.75em;
  color: var(--sekai-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.sekai-link-title {
  color: #cbbde2;
  font-weight: 600;
  font-size: 0.95em;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sekai-link-desc {
  font-size: 0.85em;
  color: #888;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sekai-link-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  color: rgba(255,255,255,0.2);
  font-size: 1.2em;
  font-weight: 300;
}

/* --- Reply Chip --- */

.sekai-reply-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(40, 35, 50, 0.4);
  padding: 3px 8px 3px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: #a0a0a0;
  cursor: pointer;
  border-left: 3px solid #7c6fac;
  transition: all 0.2s ease;
  margin-right: 4px;
  margin-bottom: 2px;
  user-select: none;
  max-width: 100%;
}

.sekai-reply-chip:hover {
  background: rgba(65, 55, 90, 0.5);
  color: #eee;
  border-left-color: #9d8ec4;
}

.sekai-reply-accent {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7c6fac;
  flex-shrink: 0;
  opacity: 0.8;
}

.sekai-reply-chip:hover .sekai-reply-accent {
  opacity: 1;
  color: #9d8ec4;
}

.sekai-reply-content {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  font-weight: 500;
}

/* --- Animations --- */

@keyframes sekai-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes sekai-wave {
  0% { transform: scaleY(1); }
  100% { transform: scaleY(1.5); }
}

/* --- Colored Text --- */

.sekai-colored-text {
  font-weight: 500;
  transition: text-shadow 0.2s;
}

.sekai-colored-text:hover {
  filter: brightness(1.1);
}

/* Truecolor mode: Original colors without adjustment */
.sekai-truecolor {
  /* Distinct styling to indicate "raw" mode */
  font-weight: 600;
  position: relative;
}

/* Optional: Add a subtle indicator that this is unmodified color */
.sekai-truecolor::before {
  content: '◆';
  font-size: 0.7em;
  opacity: 0.3;
  margin-right: 2px;
  vertical-align: super;
}

/* Mobile Adjustments */
@media screen and (max-width: 600px) {
  .sekai-link-card, .sekai-file-card, .sekai-audio-player {
    min-width: 100%;
    max-width: 100%;
  }
}

/* Additional SEKAI Fixes */

/* Show full URL in link card */
.sekai-link-url {
  font-size: 0.75em;
  color: #666; /* Even dimmer */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  font-family: var(--sekai-font-mono);
}

/* Blockquote */
.sekai-text-node blockquote {
  border-left: 4px solid var(--sekai-accent);
  margin: 10px 0;
  padding: 8px 16px;
  background: rgba(124, 111, 172, 0.08); /* Subtle tint matching accent */
  color: #eeeff1;
  border-radius: 0 8px 8px 0;
  font-style: normal; /* Modern UI prefers normal style */
}

/* Mobile spoiler adjustment - click to reveal instead of hover */
@media screen and (max-width: 768px) {
  .sekai-spoiler:hover {
    background: #000;
  }
}

/* --- Update Toast (Version Checker) --- */

.sekai-update-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(30, 25, 40, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  color: #fff;
  font-family: inherit;
  animation: sekai-toast-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 280px;
}

@keyframes sekai-toast-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.sekai-update-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #eee;
  flex: 1;
}

.sekai-update-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sekai-update-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sekai-update-btn {
  background: var(--sekai-accent, #7c6fac);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s;
  white-space: nowrap;
}

.sekai-update-btn:hover {
  filter: brightness(1.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 111, 172, 0.3);
}

.sekai-update-btn:active {
  transform: translateY(0);
}

/* Old dismiss button styles removed in favor of the new ones below */

/* Mobile responsive */
@media screen and (max-width: 600px) {
  .sekai-update-toast {
    bottom: 12px;
    right: 12px;
    left: 12px;
    min-width: unset;
    max-width: 100%;
    padding: 12px 16px;
    gap: 12px;
  }

  .sekai-update-content {
    font-size: 13px;
  }

  .sekai-update-icon {
    width: 16px;
    height: 16px;
  }

  .sekai-update-btn {
    font-size: 12px;
    padding: 6px 12px;
  }

  .sekai-update-btn-dismiss {
    padding: 4px 8px;
    font-size: 14px;
  }
}

/* --- Added Action Container & Refined Dismiss Button --- */

.sekai-update-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sekai-update-btn-dismiss {
  /* Reset & Layout */
  appearance: none;
  background: transparent;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  
  /* Visual */
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sekai-update-btn-dismiss:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: rotate(90deg); /* Playful interaction */
}

.sekai-update-btn-dismiss:active {
  background: rgba(255, 255, 255, 0.15);
  transform: rotate(90deg) scale(0.9);
}

/* ============================================
   SEKAI Image Viewer (Lightbox)
   ============================================ */

.sekai-image-viewer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
}

.sekai-image-viewer.active {
  display: flex;
}

/* Backdrop */
.sekai-viewer-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(2.5px);
  -webkit-backdrop-filter: blur(2.5px);
  animation: sekai-viewer-fade-in 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Image Container */
.sekai-viewer-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.sekai-viewer-image {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  transition: transform 0.1s linear, opacity 0.3s ease; /* Removed transform 0.3s for smooth wheel zoom */
  user-select: none;
  -webkit-user-drag: none;
  animation: sekai-viewer-zoom-in 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  will-change: transform;
}

/* Loading Spinner */
.sekai-viewer-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
}

.sekai-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: #a78bfa;
  border-radius: 50%;
  animation: sekai-spin 0.8s linear infinite;
}

/* Toolbar */
.sekai-viewer-toolbar {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: rgba(30, 25, 40, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 50px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: sekai-viewer-slide-up 0.3s ease 0.1s both;
}

.sekai-viewer-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
}

.sekai-viewer-btn:hover {
  background: rgba(167, 139, 250, 0.3);
  transform: scale(1.1);
}

.sekai-viewer-btn:active {
  transform: scale(0.95);
}

.sekai-viewer-scale {
  font-family: var(--sekai-font-mono, monospace);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  min-width: 50px;
  text-align: center;
  padding: 0 8px;
}

/* Info Bar */
.sekai-viewer-info {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 80%;
  padding: 10px 20px;
  background: rgba(30, 25, 40, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  animation: sekai-viewer-slide-down 0.3s ease 0.1s both;
  z-index: 100001;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Standalone Close Button (Top Right) */
.sekai-viewer-close-fixed {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(30, 25, 40, 0.6);
  color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 100002;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.sekai-viewer-close-fixed:hover {
  background: rgba(255, 255, 255, 0.15); /* More subtle hover */
  color: white;
  transform: rotate(90deg) scale(1.1);
}

/* Hide UI on Idle */
.sekai-image-viewer.ui-hidden .sekai-viewer-toolbar {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
}

.sekai-image-viewer.ui-hidden .sekai-viewer-info {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -20px);
}

.sekai-image-viewer.ui-hidden .sekai-viewer-close-fixed {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

.sekai-image-viewer .sekai-viewer-toolbar {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sekai-viewer-filename {
  font-size: 14px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 500px;
  display: inline-block;
}

/* Animations */
@keyframes sekai-viewer-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sekai-viewer-zoom-in {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes sekai-viewer-slide-up {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes sekai-viewer-slide-down {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes sekai-spin {
  to { transform: rotate(360deg); }
}

/* Mobile Adjustments */
@media screen and (max-width: 600px) {
  .sekai-viewer-toolbar {
    bottom: 20px;
    padding: 10px 16px;
    gap: 6px;
  }

  .sekai-viewer-btn {
    width: 36px;
    height: 36px;
  }

  .sekai-viewer-btn svg {
    width: 18px;
    height: 18px;
  }

  .sekai-viewer-scale {
    font-size: 12px;
    min-width: 45px;
  }

  .sekai-viewer-info {
    top: 15px;
    max-width: 90%;
    padding: 8px 16px;
  }

  .sekai-viewer-filename {
    font-size: 12px;
    max-width: 300px;
  }

  .sekai-viewer-image {
    max-width: 95vw;
    max-height: 85vh;
  }
}
