:root {
  --bg-primary: linear-gradient(135deg, #ffeef8 0%, #e8f4ff 50%, #ffeef8 100%);
  --bg-card: #ffffff;
  --bg-modal: #ffffff;
  --text-primary: #ff6bb3;
  --text-secondary: #999999;
  --text-title: #ff6bb3;
  --text-body: #666666;
  --border-color: #ff9ed2;
  --accent-pink: #ff9ed2;
  --accent-blue: #9ed2ff;
  --accent-gradient: linear-gradient(135deg, #ff9ed2 0%, #9ed2ff 100%);
  --shadow-color: rgba(255, 158, 210, 0.3);
  --shadow-hover: rgba(255, 158, 210, 0.4);
  --card-bg: linear-gradient(135deg, #ffeef8 0%, #e8f4ff 100%);
  --input-bg: #fafafa;
  --input-border: #ffeef8;
  --spinner-border: #ffeef8;
  --card-footer-bg: linear-gradient(135deg, #ffeef8 0%, #e8f4ff 100%);
}

[data-theme="dark"] {
  --bg-primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
  --bg-card: #242438;
  --bg-modal: #242438;
  --text-primary: #ff9ed2;
  --text-secondary: #888899;
  --text-title: #ff9ed2;
  --text-body: #aaaabc;
  --border-color: #ff9ed2;
  --accent-pink: #ff9ed2;
  --accent-blue: #6bb3ff;
  --accent-gradient: linear-gradient(135deg, #ff9ed2 0%, #6bb3ff 100%);
  --shadow-color: rgba(255, 158, 210, 0.15);
  --shadow-hover: rgba(255, 158, 210, 0.25);
  --card-bg: linear-gradient(135deg, #2d2d4a 0%, #1e2a4a 100%);
  --input-bg: #1a1a2e;
  --input-border: #3d3d5c;
  --spinner-border: #2d2d4a;
  --card-footer-bg: linear-gradient(135deg, #2d2d4a 0%, #1e2a4a 100%);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", "Microsoft YaHei", Tahoma, Geneva, Verdana,
    sans-serif;
  background: var(--bg-primary);
  min-height: 100vh;
  padding: 20px;
  position: relative;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
}

.sidebar-toggle {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1001;
  background: var(--accent-gradient);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  box-shadow: 0 5px 20px var(--shadow-color);
  transition: transform 0.2s ease;
}

.sidebar-toggle:hover {
  transform: scale(1.1);
}

.sidebar-icon {
  display: inline-block;
}

.sidebar {
  position: fixed;
  top: 0;
  left: -300px;
  width: 280px;
  height: 100vh;
  background: var(--bg-card);
  box-shadow: 5px 0 30px var(--shadow-color);
  z-index: 1000;
  transition: left 0.3s ease;
  display: flex;
  flex-direction: column;
}

.sidebar.open {
  left: 0;
}

.sidebar-header {
  padding: 30px 20px;
  background: var(--accent-gradient);
  position: relative;
}

.sidebar-title {
  font-size: 1.5em;
  color: #fff;
  text-shadow: 2px 2px 0 #ff6bb3;
  margin-bottom: 0;
  font-weight: bold;
  text-align: center;
}

.sidebar-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  transition: background 0.2s ease;
}

.sidebar-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.sidebar-nav {
  flex: 1;
  padding: 20px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 15px 25px;
  color: var(--text-body);
  text-decoration: none;
  transition: all 0.2s ease;
  margin: 5px 15px;
  border-radius: 15px;
}

.nav-item:hover {
  background: var(--card-bg);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-gradient);
  color: #fff;
}

.nav-icon {
  font-size: 1.5em;
  margin-right: 15px;
}

.nav-text {
  font-size: 1.1em;
  font-weight: 500;
}

.sidebar-footer {
  padding: 20px;
  border-top: 2px solid var(--border-color);
  display: flex;
  justify-content: center;
}

.main-content {
  margin-left: 0;
  transition: margin-left 0.3s ease;
}

.sidebar.open ~ .main-content {
  margin-left: 280px;
}

.search-container {
  margin-bottom: 30px;
  padding: 0 20px;
}

.search-box {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-card);
  border-radius: 30px;
  box-shadow: 0 5px 20px var(--shadow-color);
  display: flex;
  align-items: center;
  padding: 5px 10px;
  transition: box-shadow 0.2s ease;
}

.search-box:focus-within {
  box-shadow: 0 8px 30px var(--shadow-hover);
}

.search-icon {
  font-size: 1.3em;
  margin-left: 10px;
  margin-right: 10px;
  color: var(--accent-pink);
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 15px 10px;
  font-size: 1em;
  color: var(--text-body);
  outline: none;
  font-family: inherit;
}

.search-input::placeholder {
  color: var(--text-secondary);
}

.search-clear {
  background: var(--accent-pink);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  transition: transform 0.2s ease;
  margin-right: 5px;
}

.search-clear:hover {
  transform: scale(1.1);
}

.header {
  text-align: center;
  padding: 40px 20px;
  background: var(--accent-gradient);
  border-radius: 30px;
  margin-bottom: 40px;
  box-shadow: 0 10px 30px var(--shadow-color);
  position: relative;
  overflow: hidden;
}

.header::before {
  content: "✨";
  position: absolute;
  top: 10px;
  left: 20px;
  font-size: 30px;
}

.header::after {
  content: "✨";
  position: absolute;
  bottom: 10px;
  right: 20px;
  font-size: 30px;
}

.header-top {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.title {
  font-size: 3em;
  color: #fff;
  text-shadow: 3px 3px 0 #ff6bb3, 6px 6px 0 rgba(0, 0, 0, 0.1);
  margin-bottom: 0;
  font-weight: bold;
  letter-spacing: 2px;
}

.fox {
  display: inline-block;
}

.theme-toggle {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: transform 0.2s ease, background 0.2s ease;
  backdrop-filter: blur(5px);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.subtitle {
  font-size: 1.3em;
  color: #fff;
  text-shadow: 1px 1px 0 #ff6bb3;
}

.waterfall {
  column-count: 4;
  column-gap: 25px;
}

@media (min-aspect-ratio: 16/9) and (min-width: 1200px) {
  .waterfall {
    column-count: 5;
    column-gap: 20px;
  }

  .container {
    max-width: 1600px;
  }

  .header {
    padding: 50px 30px;
  }

  .title {
    font-size: 3.5em;
  }

  .card {
    margin-bottom: 20px;
  }

  .modal-content {
    max-width: 900px;
  }
}

@media (min-aspect-ratio: 16/9) and (min-width: 1600px) {
  .waterfall {
    column-count: 6;
    column-gap: 18px;
  }

  .container {
    max-width: 1800px;
  }

  .card-title {
    font-size: 1.4em;
  }
}

@media (max-aspect-ratio: 9/16) {
  body {
    padding: 10px;
  }

  .sidebar-toggle {
    top: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .sidebar {
    width: 100%;
    left: -100%;
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar.open ~ .main-content {
    margin-left: 0;
  }

  .sidebar-header {
    padding: 20px 15px;
  }

  .sidebar-title {
    font-size: 1.2em;
  }

  .sidebar-close {
    width: 30px;
    height: 30px;
    font-size: 20px;
  }

  .nav-item {
    padding: 12px 20px;
    margin: 3px 10px;
  }

  .nav-icon {
    font-size: 1.3em;
    margin-right: 10px;
  }

  .nav-text {
    font-size: 1em;
  }

  .sidebar-footer {
    padding: 15px;
  }

  .header {
    padding: 25px 15px;
    margin-bottom: 20px;
    border-radius: 20px;
  }

  .title {
    font-size: 1.8em;
  }

  .subtitle {
    font-size: 1em;
  }

  .header::before,
  .header::after {
    font-size: 20px;
  }

  .search-container {
    padding: 0 10px;
    margin-bottom: 20px;
  }

  .search-box {
    padding: 3px 8px;
  }

  .search-icon {
    font-size: 1.1em;
    margin-left: 8px;
    margin-right: 8px;
  }

  .search-input {
    padding: 12px 8px;
    font-size: 0.9em;
  }

  .search-clear {
    width: 25px;
    height: 25px;
    font-size: 18px;
  }

  .waterfall {
    column-count: 2;
    column-gap: 12px;
  }

  .card {
    margin-bottom: 12px;
    border-radius: 12px;
  }

  .card-content {
    padding: 15px;
  }

  .card-title {
    font-size: 1.1em;
  }

  .card-footer {
    padding: 12px 15px;
  }

  .card-download {
    padding: 6px 15px;
    font-size: 0.85em;
  }

  .modal-content {
    width: 95%;
    max-height: 85vh;
    border-radius: 20px;
  }

  .modal-body {
    padding: 20px;
  }

  .modal-title {
    font-size: 1.5em;
  }

  .modal-image {
    max-height: 300px;
  }

  .modal-actions {
    flex-direction: column;
    align-items: center;
  }

  .modal-btn {
    width: 100%;
    max-width: 300px;
    text-align: center;
  }
}

@media (max-width: 900px) {
  .sidebar {
    width: 100%;
    left: -100%;
  }

  .sidebar.open ~ .main-content {
    margin-left: 0;
  }

  .waterfall {
    column-count: 2;
  }
}

@media (max-width: 600px) {
  .waterfall {
    column-count: 2;
  }
  .title {
    font-size: 2em;
  }
  .header-top {
    flex-direction: column;
  }
  .theme-toggle {
    position: absolute;
    top: 15px;
    right: 15px;
  }
}

@media (max-width: 480px) {
  .waterfall {
    column-count: 2;
    column-gap: 15px;
  }
  
  .card {
    margin-bottom: 0;
    border-radius: 12px;
  }
  
  .card-image-placeholder {
    font-size: 40px;
  }
  
  .card-content {
    padding: 10px;
  }
  
  .card-title {
    font-size: 0.9em;
  }
  
  .card-notes {
    font-size: 0.8em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  
  .card-footer {
    padding: 8px 10px;
  }
  
  .card-download {
    padding: 5px 10px;
    font-size: 0.75em;
  }
  
  .card-share {
    padding: 5px 10px;
    font-size: 0.75em;
  }
}

.card {
  break-inside: avoid;
  margin-bottom: 25px;
  background: var(--bg-card);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 5px 20px var(--shadow-color);
  cursor: pointer;
  position: relative;
  will-change: transform, box-shadow;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 40px var(--shadow-hover);
}

.card-image {
  aspect-ratio: 9/16;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-image img.landscape-fit {
  object-fit: contain;
}

.card-image-placeholder {
  font-size: 60px;
  color: #fff;
  text-shadow: 2px 2px 0 #ff6bb3;
}

.card-content {
  padding: 20px;
}

.card-title {
  font-size: 1.2em;
  color: var(--text-title);
  margin-bottom: 8px;
  word-break: break-word;
}

.card-notes {
  font-size: 0.9em;
  color: var(--text-body);
  margin-bottom: 10px;
  line-height: 1.5;
}

.card-pdf-badge {
  display: inline-block;
  background: var(--accent-gradient);
  color: #fff;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8em;
  margin-top: 8px;
}

.card-footer {
  padding: 15px 20px;
  background: var(--card-footer-bg);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.card-actions {
  display: flex;
  gap: 8px;
}

.card-download, .card-share {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  background: var(--accent-gradient);
  color: #fff;
  text-decoration: none;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 500;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.card-download:hover, .card-share:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px var(--shadow-color);
}

.card-share {
  background: linear-gradient(135deg, #9ed2ff 0%, #ff9ed2 100%);
}

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-modal);
  color: var(--text-body);
  padding: 12px 24px;
  border-radius: 25px;
  box-shadow: 0 5px 20px var(--shadow-color);
  font-size: 0.95em;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

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

.modal-content {
  background: var(--bg-modal);
  border-radius: 25px;
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 32px;
  font-weight: bold;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.close:hover {
  color: var(--text-primary);
  transform: rotate(90deg);
}

.modal-body {
  padding: 30px;
}

.modal-header {
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--border-color);
}

.modal-title {
  font-size: 1.8em;
  color: var(--text-title);
  margin-bottom: 8px;
}

.modal-id {
  font-size: 0.9em;
  color: var(--text-secondary);
}

.modal-image {
  width: 100%;
  max-height: 400px;
  background: var(--accent-gradient);
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 25px;
  overflow: hidden;
}

.modal-image img {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
}

.modal-image-placeholder {
  font-size: 100px;
  color: #fff;
  text-shadow: 2px 2px 0 #ff6bb3;
}

.modal-info {
  margin-bottom: 25px;
  padding: 20px;
  background: var(--card-bg);
  border-radius: 15px;
}

.modal-info-label {
  font-size: 1.1em;
  color: var(--text-primary);
  margin-bottom: 12px;
  font-weight: 500;
}

.modal-info-value {
  color: var(--text-body);
  line-height: 1.8;
}

.modal-actions {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 25px;
}

.modal-btn {
  flex: 1;
  min-width: 150px;
  padding: 15px 25px;
  border-radius: 25px;
  text-decoration: none;
  text-align: center;
  font-weight: 500;
  transition: transform 0.2s ease;
}

.modal-btn:hover {
  transform: scale(1.02);
}

.modal-btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 5px 20px var(--shadow-color);
}

.modal-btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.modal-btn-share {
  background: linear-gradient(135deg, #9ed2ff 0%, #ff9ed2 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1em;
}

.modal-btn-share:hover {
  transform: scale(1.02);
  box-shadow: 0 5px 20px var(--shadow-color);
}

.modal-qr {
  text-align: center;
}

.modal-qr img {
  max-width: 250px;
  border-radius: 15px;
  box-shadow: 0 5px 20px var(--shadow-color);
}

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

.empty-icon {
  font-size: 80px;
  display: block;
  margin-bottom: 20px;
}

.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--spinner-border);
  border-top-color: var(--accent-pink);
  border-radius: 50%;
  margin: 0 auto 15px;
  animation: spin 0.8s linear infinite;
}

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

@media (max-width: 600px) {
  .modal-content {
    width: 95%;
    border-radius: 20px;
  }

  .modal-body {
    padding: 20px;
  }

  .modal-title {
    font-size: 1.5em;
    padding-right: 30px;
  }

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

  .modal-btn {
    width: 100%;
  }

  .modal-qr img {
    max-width: 200px;
  }
}
