/* ========== Variables ========== */
:root {
  --bg-primary: #0a0b0f;
  --bg-secondary: #12141a;
  --bg-tertiary: #1a1d25;
  --bg-hover: #22262f;

  --text-primary: #e8eaed;
  --text-secondary: #a8b2c1;
  --text-muted: #6b7685;

  --accent-primary: #FF8C00;
  --accent-secondary: #FFA500;
  --accent-glow: #FF8C00;

  --border-color: #2a2e38;
  --border-hover: #3a3f4a;

  --success: #4ade80;
  --warning: #fbbf24;
  --error: #f87171;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px var(--accent-glow);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --transition: all 0.2s ease;
  --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Reset & Base ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ========== Custom Scrollbar ========== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
  border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* ========== Header ========== */
.site-header {
  background: rgba(18, 20, 26, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.25rem;
  transition: var(--transition);
}

.logo:hover {
  transform: translateX(4px);
}

.logo-icon {
  font-size: 1.5rem;
  color: var(--accent-primary);
}

.logo-text .accent {
  color: var(--accent-secondary);
}

.main-nav {
  display: flex;
  gap: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  border: 1px solid transparent;
}

.nav-link:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.nav-link.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.nav-icon {
  font-size: 1.1rem;
}

.admin-badge {
  padding: 0.25rem 1rem;
  background: var(--error);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
}

/* ========== Hero Section ========== */
.home-hero {
  position: relative;
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-background {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  opacity: 0.3;
  animation: pulse 8s ease-in-out infinite;
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-color) 1px, transparent 1px);
  background-size: 50px 50px;
  opacity: 0.1;
}

.hero-content {
  position: relative;
  text-align: center;
  max-width: 800px;
  padding: 2rem;
}

.hero-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.hero-title {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.title-line {
  display: block;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.title-accent {
  display: block;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 3rem;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.btn-hero {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  border-radius: var(--radius-lg);
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  border: 2px solid transparent;
}

.btn-hero.primary {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.btn-hero.primary:hover {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.btn-hero.secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-hero.secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.stat-item {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-primary);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border-color);
}

/* ========== Main Content ========== */
.main-content {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
}

.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.page-subtitle {
  color: var(--text-secondary);
}

.info-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* ========== Search Bar ========== */
.search-bar {
  margin-bottom: 2rem;
}

.search-wrapper {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.25rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 1rem 3rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 1rem;
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: var(--bg-tertiary);
}

.search-clear {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
}

.search-clear:hover {
  color: var(--text-primary);
}

/* ========== Character Grid ========== */
.characters-container {
  min-height: 400px;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.character-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition-slow);
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  position: relative;
}

.character-card.show {
  opacity: 1;
  transform: translateY(0);
}

.character-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-lg);
}

.character-card:hover .character-overlay {
  opacity: 0.9;
}

.character-card:hover .character-image img {
  transform: scale(1.02);
}

/* ========== Fixed Image Display (No Cropping) ========== */
.character-image {
  position: relative;
  width: 100%;
  height: 220px;
  background: var(--bg-tertiary);
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.character-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transition: var(--transition);
  background: var(--bg-tertiary);
}

.character-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.8) 100%);
  opacity: 0;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay-btn {
  background: var(--accent-primary);
  border: none;
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  color: white;
  cursor: pointer;
  transition: var(--transition);
}

.overlay-btn:hover {
  background: var(--accent-secondary);
  transform: scale(1.1);
}

.character-body {
  padding: 1.25rem;
}

.character-name {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.character-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.meta-separator {
  color: var(--border-color);
}

.character-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 1rem;
  min-height: 2.6em;
}

.character-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.tag {
  padding: 0.25rem 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: var(--transition);
  cursor: pointer;
}

.tag:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.more-tags {
  background: var(--bg-hover);
  cursor: default;
}

.character-actions {
  display: flex;
  gap: 0.5rem;
  position: relative;
  z-index: 5;
}

.card-btn {
  flex: 1;
  padding: 0.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-align: center;
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  z-index: 10;
}

.card-btn:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

/* ========== Modal ========== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: auto;
  animation: modalSlide 0.3s ease;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal-close:hover {
  background: var(--error);
  border-color: var(--error);
  color: white;
}

#modal-body {
  padding: 2rem;
}

.modal-character {
  padding: 20px;
}

.modal-header {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
}

.modal-image {
  width: 200px;
  height: 200px;
  object-fit: contain;
  object-position: center;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
  background: var(--bg-tertiary);
}

.modal-info h2 {
  margin-bottom: 10px;
}

.modal-creator,
.modal-version,
.modal-date {
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.modal-section {
  margin-bottom: 25px;
}

.modal-section h3 {
  color: var(--accent-primary);
  margin-bottom: 10px;
  font-size: 1rem;
}

.modal-section p,
.modal-message {
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
}

.modal-section.description-full {
  background: var(--bg-tertiary);
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.modal-greetings {
  display: grid;
  gap: 12px;
}

.greeting-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  transition: var(--transition);
}

.greeting-item:hover {
  border-color: var(--accent-primary);
}

.greeting-item summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.greeting-item summary:hover {
  color: var(--accent-primary);
  background: var(--bg-hover);
}

.greeting-item[open] summary {
  color: var(--accent-primary);
  margin-bottom: 8px;
}

.greeting-item .modal-message {
  padding: 8px 12px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-primary);
  font-family: inherit;
  line-height: 1.6;
}

.modal-link {
  color: var(--accent-primary);
  text-decoration: none;
}

.modal-link:hover {
  text-decoration: underline;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 30px;
}

/* ========== Forms ========== */
.form-container {
  max-width: 900px;
  margin: 0 auto;
}

.form-section {
  margin-bottom: 2rem;
}

.panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.panel-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.panel-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.form-field {
  margin-bottom: 1.25rem;
}

.form-field:last-child {
  margin-bottom: 0;
}

.form-field label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.label-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: normal;
  margin-left: 0.5rem;
}

.input,
.textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: var(--transition);
}

.input:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: var(--bg-hover);
}

.textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
  line-height: 1.5;
}

.textarea[rows="2"] {
  min-height: 60px;
}

.textarea[rows="5"] {
  min-height: 120px;
}

.textarea.code {
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.875rem;
}

.input-file {
  width: 100%;
  padding: 0.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ========== Mode Switcher ========== */
.mode-switcher {
  margin-bottom: 2rem;
}

.switch-group {
  display: flex;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 0.25rem;
}

.switch-group input[type="radio"] {
  display: none;
}

.switch-option {
  flex: 1;
  padding: 0.75rem;
  text-align: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-secondary);
}

.switch-group input[type="radio"]:checked + .switch-option {
  background: var(--accent-primary);
  color: white;
}

.switch-icon {
  font-size: 1.125rem;
}

/* ========== Upload Area ========== */
.upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 3rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 1.5rem;
}

.upload-area:hover {
  border-color: var(--accent-primary);
  background: var(--bg-tertiary);
}

.upload-area.dragover {
  border-color: var(--accent-primary);
  background: var(--accent-glow);
}

.upload-icon {
  font-size: 3rem;
  color: var(--accent-primary);
  margin-bottom: 1rem;
}

.upload-text {
  color: var(--text-primary);
  font-weight: 500;
}

.upload-hint {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.upload-hint::after {
  content: " (PNG, JPG, WebP)";
  color: var(--accent-primary);
  font-size: 0.75rem;
}

.upload-preview {
  display: flex;
  align-items: center;
  gap: 20px;
}

.upload-preview img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  object-position: center;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  background: var(--bg-tertiary);
}

.upload-info {
  text-align: left;
}

.upload-size {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ========== Checkbox ========== */
.checkbox-group {
  margin: 1rem 0;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.checkbox input[type="checkbox"] {
  display: none;
}

.checkbox-box {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.checkbox input[type="checkbox"]:checked + .checkbox-box {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.checkbox-tick {
  color: white;
  font-size: 0.75rem;
  opacity: 0;
  transition: var(--transition);
}

.checkbox input[type="checkbox"]:checked + .checkbox-box .checkbox-tick {
  opacity: 1;
}

.checkbox-label {
  color: var(--text-primary);
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn.primary {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.btn.primary:hover {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
}

.btn.secondary {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.btn.secondary:hover {
  background: var(--bg-tertiary);
}

.btn.danger {
  background: var(--error);
  border-color: var(--error);
  color: white;
}

.btn.danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.btn.full {
  width: 100%;
  justify-content: center;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-icon {
  font-size: 1.125rem;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.form-actions .btn {
  min-width: 160px;
}

/* ========== Collapsible Panel ========== */
.collapsible .panel-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

.collapsible .toggle-icon {
  transition: var(--transition);
}

.collapsible .panel-toggle.active .toggle-icon {
  transform: rotate(180deg);
}

.panel-content {
  margin-top: 1rem;
}

/* ========== Character Note Field ========== */
.form-field:has(#v2_character_note),
.form-field:has(#ev2_character_note) {
  background: var(--bg-primary);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* ========== Better Alternative Greetings Input ========== */
.form-field:has(#v2_alt_greetings),
.form-field:has(#ev2_alt_greetings) {
  background: var(--bg-primary);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.form-field:has(#v2_alt_greetings) label,
.form-field:has(#ev2_alt_greetings) label {
  color: var(--accent-primary);
  font-weight: 600;
}

.form-field:has(#v2_alt_greetings)::after,
.form-field:has(#ev2_alt_greetings)::after {
  content: "Пример: Привет!↵↵Как дела?↵может быть многострочным↵↵Третье приветствие";
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.5rem;
  background: var(--bg-tertiary);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-family: monospace;
}

.form-field:has(#v2_short_description),
.form-field:has(#ev2_short_description) {
  background: var(--bg-tertiary);
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

/* ========== Status Message ========== */
.status-message {
  padding: 1rem;
  border-radius: var(--radius-md);
  text-align: center;
  margin-top: 1rem;
}

.status-message.success {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid var(--success);
  color: var(--success);
}

.status-message.error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid var(--error);
  color: var(--error);
}

/* ========== Code Block ========== */
.code-block {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.875rem;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
}

.code-block::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

/* ========== Pagination ========== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin: 2rem 0;
}

.pagination-info {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-right: 1rem;
}

.pagination-buttons {
  display: flex;
  gap: 0.5rem;
}

.page-btn {
  padding: 0.5rem 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.page-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.page-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-dots {
  padding: 0.5rem;
  color: var(--text-muted);
}

/* ========== Admin ========== */
.admin-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
}

.login-title {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 1.5rem;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  font-size: 2rem;
  color: var(--accent-primary);
}

.stat-info {
  flex: 1;
}

.admin-toolbar {
  margin-bottom: 2rem;
  display: flex;
  justify-content: flex-end;
}

.filter-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.filter-tab {
  padding: 0.5rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.filter-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.filter-tab.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.submissions-list {
  display: grid;
  gap: 1rem;
}

.submission-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.submission-header {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.submission-type {
  padding: 0.25rem 0.75rem;
  background: var(--accent-primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.submission-id,
.submission-target {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.submission-content {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.submission-field {
  display: flex;
  gap: 0.5rem;
}

.submission-label {
  font-weight: 500;
  color: var(--text-secondary);
}

.submission-value {
  color: var(--text-primary);
  word-break: break-all;
}

.submission-short-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  margin: 0.5rem 0;
}

.submission-link {
  color: var(--accent-primary);
  text-decoration: none;
}

.submission-link:hover {
  text-decoration: underline;
}

.submission-image {
  width: 150px;
  height: 150px;
  object-fit: contain;
  object-position: center;
  border-radius: var(--radius-md);
  margin: 1rem 0;
  background: var(--bg-tertiary);
}

.submission-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.admin-char-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.admin-char-image {
  width: 100%;
  height: 160px;
  object-fit: contain;
  object-position: center;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  background: var(--bg-tertiary);
}

.admin-char-name {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.admin-char-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.admin-char-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.admin-char-actions {
  display: flex;
  gap: 0.5rem;
}

.ban-form {
  margin-bottom: 1rem;
}

.ban-list {
  display: grid;
  gap: 1rem;
}

.ban-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.ban-info {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.ban-field {
  display: flex;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.ban-label {
  font-weight: 500;
  color: var(--text-secondary);
}

.ban-value {
  color: var(--text-primary);
  word-break: break-all;
}

.ban-status {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--error);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.current-image-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 250px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.current-image-wrapper img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

/* ========== Loading States ========== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.admin-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--text-muted);
}

.admin-loading::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 0.5rem;
}

.skeleton {
  animation: skeleton-loading 1.5s infinite ease-in-out;
}

.skeleton-image {
  width: 100%;
  height: 200px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

@keyframes skeleton-loading {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

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

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  opacity: 0.5;
  display: block;
  margin-bottom: 1rem;
}

.empty-hint {
  margin-top: 1rem;
  font-size: 0.875rem;
}

.error-message {
  text-align: center;
  padding: 40px 20px;
  color: var(--error);
}

.error-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 1rem;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 2000;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  border-color: var(--success);
  background: rgba(74, 222, 128, 0.1);
}

.toast-error {
  border-color: var(--error);
  background: rgba(248, 113, 113, 0.1);
}

.toast-icon {
  font-size: 1.25rem;
}

.toast-success .toast-icon {
  color: var(--success);
}

.toast-error .toast-icon {
  color: var(--error);
}

.toast-message {
  color: var(--text-primary);
}

/* ========== Footer ========== */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 1.5rem 2rem;
  margin-top: auto;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-text {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}

.footer-link:hover {
  color: var(--accent-primary);
}

.footer-sep {
  color: var(--text-muted);
}

/* ========== Animations ========== */
@keyframes pulse {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.5;
  }
}

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

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .header-content {
    padding: 1rem;
  }

  .main-nav {
    gap: 0.25rem;
  }

  .nav-link {
    padding: 0.5rem 0.75rem;
  }

  .nav-icon {
    display: none;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
  }

  .btn-hero {
    width: 100%;
  }

  .character-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .character-image {
    height: 200px;
  }

  .modal-image {
    width: 150px;
    height: 150px;
  }

  .footer-content {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .admin-stats {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
    min-width: unset;
  }

  .greeting-item summary {
    font-size: 0.875rem;
  }

  .character-card {
    cursor: default;
  }

  .modal-content {
    width: 95%;
    margin: 1rem;
  }

  .modal-header {
    flex-direction: column;
    text-align: center;
  }

  .modal-image {
    margin: 0 auto;
  }
}

