/* --- 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 {
  color: inherit;
  text-decoration: none;
  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: rgb(var(--sekai-fg-subtle) / 0.55);
  margin-top: 2px;
  font-family: var(--sekai-font-mono);
}

.sekai-file-action {
  color: rgb(var(--sekai-fg-subtle) / 0.55);
  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: rgb(var(--sekai-surface-card) / 0.9);
  border-radius: var(--sekai-radius-control);
  margin: 6px 0;
  text-decoration: none;
  overflow: hidden;
  transition: background 0.2s;
  max-width: 480px;
  align-items: stretch;
}

.sekai-link-card:hover {
  background: rgb(var(--sekai-surface-hover) / 0.85);
}

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

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

.sekai-link-site {
  font-size: 0.75em;
  color: rgb(var(--sekai-fg-subtle) / 0.55);
  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: #b8b8bd;
  cursor: pointer;
  border-left: 3px solid #7c6fac;
  transition: background-color 0.2s ease, color 0.2s ease, border-left-color 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;
}

:is(.sekai-reply-chip, .sekai-image-container, .sekai-file-details):focus-visible {
  outline: 2px solid #d1c1f2;
  outline-offset: 3px;
}

.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%); }
}

/* --- 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;
}

/* --- Mention chips (SEKAI v2) --- */
.sekai-mention {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  margin: 0 1px;
  border-radius: 4px;
  background: rgb(var(--sekai-accent) / 0.28);
  color: #eee8ff;
  font-weight: 600;
  font-size: 0.95em;
  vertical-align: baseline;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.sekai-mention[role="button"] {
  cursor: pointer;
}
.sekai-mention:hover,
.sekai-mention:focus {
  background: rgb(var(--sekai-accent) / 0.45);
  color: #fff;
}
.sekai-mention:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.sekai-mention-ai {
  background: rgba(255, 85, 0, 0.22);
  color: #ffb48a;
}
.sekai-mention-ai:hover,
.sekai-mention-ai:focus {
  background: rgba(255, 85, 0, 0.4);
  color: #fff;
}
.sekai-mention-all {
  background: rgba(239, 68, 68, 0.25);
  color: #fecaca;
  font-weight: 700;
}
.sekai-mention-all:hover,
.sekai-mention-all:focus {
  background: rgba(239, 68, 68, 0.4);
  color: #fff;
}
.sekai-mention-role {
  background: rgba(56, 189, 248, 0.22);
  color: #bae6fd;
}

/* Image spoiler blur (SEKAI v2 Image:spoiler=true) */
.sekai-image-spoiler:not(.loading):not(.revealed) .sekai-image-content {
  filter: blur(18px);
  transform: scale(1.05);
  cursor: pointer;
}
.sekai-image-spoiler-cover {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: rgba(0, 0, 0, 0.18);
  pointer-events: none;
  border-radius: inherit;
  transition: opacity 0.18s ease, visibility 0s linear 0s;
}
.sekai-image-spoiler-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--sekai-radius-control, 8px);
  background: rgb(var(--sekai-surface-sunken, 17 17 20) / 0.9);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.sekai-image-spoiler-label svg {
  flex-shrink: 0;
}
.sekai-image-spoiler:is(:hover, :focus-visible) .sekai-image-spoiler-label {
  background: rgb(var(--sekai-surface-sunken, 17 17 20));
  border-color: rgba(255, 255, 255, 0.35);
}
.sekai-image-spoiler.revealed .sekai-image-spoiler-cover {
  opacity: 0;
  visibility: hidden;
  transition-delay: 0s, 0.18s;
}
.sekai-image-spoiler:not(.revealed) .sekai-image-caption {
  visibility: hidden;
}
.sekai-image-spoiler {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.sekai-image-spoiler.loading {
  cursor: default;
}
.sekai-image-spoiler.loading .sekai-image-content,
.sekai-image-spoiler.loading .sekai-image-spoiler-cover {
  visibility: hidden;
}
.sekai-image-spoiler .sekai-image-content {
  transition: opacity 0.3s;
}
.sekai-image-spoiler.revealed .sekai-image-content {
  filter: none;
  transform: none;
  transition: opacity 0.3s, filter 0.3s var(--sekai-ease-out, ease), transform 0.3s var(--sekai-ease-out, ease);
}
@media (prefers-reduced-motion: reduce) {
  .sekai-image-spoiler.loading::after {
    animation: none;
  }
  .sekai-image-spoiler-cover,
  .sekai-image-spoiler-label,
  .sekai-image-spoiler .sekai-image-content,
  .sekai-image-spoiler.revealed .sekai-image-content {
    transition: none;
  }
}

/* Code wrapper (SEKAI v2 Code) */
.sekai-code-wrapper {
  display: block;
  margin: 6px 0;
  border-radius: var(--sekai-radius-control);
  background: rgba(20, 16, 30, 0.65);
  overflow: hidden;
  max-width: 100%;
}
.sekai-code-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  font-size: 12px;
  color: rgb(var(--sekai-fg-subtle) / 0.55);
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sekai-code-name {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}
.sekai-code-lang {
  opacity: 0.7;
  font-family: var(--sekai-font-mono);
  text-transform: lowercase;
}
.sekai-code-toggle {
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: inherit;
  border-radius: 4px;
  padding: 1px 8px;
  font-size: 11px;
  cursor: pointer;
}
.sekai-code-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}
.sekai-code-wrapper.collapsed .sekai-code-block {
  max-height: 4.5em;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, #000 40%, transparent);
}
.sekai-code-wrapper .sekai-code-block {
  display: block;
  margin: 0;
  border-radius: 0;
}

/* 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;
}
