@import url(https://fonts.googleapis.com/css?family=Righteous);

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

body {
    font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background:
        radial-gradient(at 50% 0, transparent, #080808),
        repeating-conic-gradient(
            hsla(0, 0%, 0%, .235) 0% 25%,
            transparent 0% 50%
        ) 0 0 / 0.375em 0.375em,
        #3b3b3b;
    min-height: 100vh;
    padding: 20px;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 移除网格线背景 wrapper，不再需要 */
#background-wrapper {
    display: none;
}

.page-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 2;
    flex: 1;
}

.back-btn {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: hsl(0 0% 85%);
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 1rem;
}

.back-btn:hover {
    color: hsl(0 0% 100%);
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

.header h1 {
    display: inline-block;
    color: hsl(0 0% 90%);
    font-family: 'Righteous', 'Microsoft YaHei', serif;
    font-size: 3.5em;
    text-shadow: .03em .03em 0 hsla(230,40%,50%,1);
    position: relative;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.header h1::after {
    content: attr(data-shadow);
    position: absolute;
    top: .06em;
    left: .06em;
    width: 100%;
    height: 100%;
    z-index: -1;
    text-shadow: none;
    background-image: linear-gradient(
        45deg,
        transparent 45%,
        hsla(48,20%,90%,1) 45%,
        hsla(48,20%,90%,1) 55%,
        transparent 0
    );
    background-size: .05em .05em;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
    animation: shad-anim 60s linear infinite;
}

@keyframes shad-anim {
    0% { background-position: 0 0; }
    100% { background-position: 100% -100%; }
}

.subtitle {
    font-size: 1rem;
    color: hsl(0 0% 75%);
    margin-top: 0.5rem;
}

.section {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px) saturate(1.2);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.section h2 {
    color: hsl(0 0% 95%);
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.upload-area {
    margin: 20px 0;
}

.file-upload {
    text-align: center;
    margin-bottom: 20px;
}

.file-upload-area {
    border: 3px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.03);
}

.file-upload-area:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

.file-upload-area.drag-over {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.upload-text {
    font-size: 1.1rem;
    color: hsl(0 0% 90%);
    margin-bottom: 8px;
    font-weight: 600;
}

.upload-hint {
    font-size: 0.9rem;
    color: hsl(0 0% 70%);
}

.file-name {
    display: block;
    margin-top: 15px;
    color: hsl(122 40% 70%);
    font-weight: 600;
    font-size: 0.95rem;
    min-height: 24px;
}

.btn {
    -webkit-tap-highlight-color: #0000;
    cursor: pointer;
    border-radius: 12px;
    padding: 12px 30px;
    font-size: 1rem;
    background: #0000;
    border: 1px solid #0000;
    position: relative;
    color: white;
    transition-property: translate, scale;
    transition-duration: 0.1s;
    transition-timing-function: ease-out;
    font-weight: 500;
    display: block;
    width: 100%;
    margin-top: 20px;
}

.btn:active:not(:disabled) {
    scale: 0.98;
    translate: 0 1px;
}

.btn::before,
.btn::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    pointer-events: none;
}

.btn::before {
    z-index: -1;
    background: linear-gradient(
        hsl(0 0% 100% / 0.18),
        hsl(0 0% 4% / 0.7)
    );
    backdrop-filter: saturate(2) contrast(1) blur(10px);
}

.btn::after {
    box-shadow: 0 0 1px 0.8px hsl(0 0% 100% / 0.8) inset;
    mask: linear-gradient(-35deg, #ffffff80, #ffffff30 30% 60%, #fff);
}

.btn:hover:not(:disabled) {
    scale: 1.02;
}

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

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 5px;
    color: hsl(0 0% 95%);
}

.stat-label {
    font-size: 0.9em;
    color: hsl(0 0% 80%);
}

.resource-list {
    margin: 25px 0;
}

.resource-list h3 {
    color: hsl(0 0% 90%);
    margin-bottom: 15px;
    font-size: 1.2em;
}

#resourceList {
    max-height: 400px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 8px;
}

.resource-item {
    padding: 12px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border-left: 4px solid hsl(0 0% 70%);
    display: flex;
    align-items: center;
    gap: 10px;
    word-break: break-all;
    color: hsl(0 0% 85%);
}

.resource-type {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

.resource-type.css {
    background: rgba(66, 165, 245, 0.2);
    color: hsl(207 90% 70%);
}

.resource-type.js {
    background: rgba(255, 193, 7, 0.2);
    color: hsl(45 100% 70%);
}

.progress-container {
    margin: 25px 0;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, hsl(0 0% 60%) 0%, hsl(0 0% 80%) 100%);
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: white;
    font-weight: bold;
}

.progress-text {
    margin-top: 15px;
    text-align: center;
    color: hsl(0 0% 85%);
    font-weight: 500;
    font-size: 1.1em;
}

.log-output {
    max-height: 300px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.4);
    color: hsl(0 0% 85%);
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.6;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.log-entry {
    margin-bottom: 8px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry.success {
    color: hsl(122 40% 70%);
}

.log-entry.error {
    color: hsl(4 80% 70%);
}

.log-entry.info {
    color: hsl(207 90% 70%);
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .header h1 {
        font-size: 2em;
    }

    .section {
        padding: 20px;
    }

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

    .file-label {
        padding: 15px 25px;
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .section {
        padding: 15px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== 日间模式样式 ===== */
/* 页面初始加载时的日间模式支持 - 只为关键元素添加以避免CSS冗余 */
html.day-init body,
body.day-mode {
    background: #f0f4f8;
    background-image: url(../../../../assets/image/day-background.png);
    background-size: auto;
    background-repeat: repeat;
    font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html.day-init #background-wrapper,
body.day-mode #background-wrapper {
    background-color: transparent;
}

html.day-init .section,
body.day-mode .section {
    background: hsla(0, 0%, 100%, 0.4);
    border: none;
    box-shadow: 5px 3px 30px rgba(0, 0, 0, 0.1);
}

html.day-init .header h1,
body.day-mode .header h1 {
    color: #2d3748;
    text-shadow: .03em .03em 0 hsla(200, 60%, 60%, 1);
}

/* 以下样式只使用 body.day-mode，由 JS 在加载后应用 */

body.day-mode .back-btn {
    color: #4a5568;
}

body.day-mode .back-btn:hover {
    color: #1a202c;
}


body.day-mode .subtitle {
    color: #4a5568;
}

body.day-mode .section h2,
body.day-mode .section h3 {
    color: #1a202c;
    font-weight: 600;
}

body.day-mode .file-upload-area {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(0, 0, 0, 0.15);
}

body.day-mode .file-upload-area:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.25);
}

body.day-mode .upload-text {
    color: #2d3748;
}

body.day-mode .upload-hint {
    color: #718096;
}

body.day-mode .file-name {
    color: #2d3748;
}

/* 1. 修改基础按钮样式 */
body.day-mode .btn {
    background: #ffffff;
    color: #1a202c;
    border: 2px solid #cbd5e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

body.day-mode .btn::before {
    background: none;
    backdrop-filter: none;
}

body.day-mode .btn-primary,
body.day-mode .btn-success,
body.day-mode .btn-secondary {
    background: #ffffff;
    color: #1a202c;
}

body.day-mode .btn:hover:not(:disabled),
body.day-mode .btn-primary:hover:not(:disabled),
body.day-mode .btn-success:hover:not(:disabled),
body.day-mode .btn-secondary:hover:not(:disabled) {
    background: #f7fafc;
    border-color: #a0aec0;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body.day-mode .stat-card {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(0, 0, 0, 0.1);
}

body.day-mode .stat-number {
    color: #1a202c;
}

body.day-mode .stat-label {
    color: #4a5568;
}

body.day-mode .resource-list {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(0, 0, 0, 0.1);
}

body.day-mode .resource-item {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(0, 0, 0, 0.1);
    color: #2d3748;
}

body.day-mode .resource-type {
    background: rgba(59, 130, 246, 0.2);
    color: #1e40af;
}

body.day-mode .progress-container {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(0, 0, 0, 0.1);
}

body.day-mode .progress-bar {
    background: rgba(0, 0, 0, 0.1);
}

body.day-mode .progress-text {
    color: #2d3748;
}

body.day-mode .log-output {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(0, 0, 0, 0.15);
    color: #1a202c;
}

body.day-mode ::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

body.day-mode ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

body.day-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* ===== 日夜切换器样式 ===== */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  user-select: none;
  transform: scale(0.64);
  transform-origin: top right;
}

.theme-toggle__checkbox {
  display: none;
}

.theme-toggle__btn {
  display: block;
  position: relative;
  width: 125px;
  height: 70px;
  border-radius: 70px;
  border: 5px solid #1c1c1c;
  background-color: #3c4145;
  cursor: pointer;
  transition: all 350ms ease-in;
}

/* 禁用初始加载时的动画 */
.theme-toggle__btn.no-transition,
.theme-toggle__btn.no-transition::before,
.theme-toggle__btn.no-transition::after,
.theme-toggle__btn.no-transition .theme-toggle__feature,
.theme-toggle__btn.no-transition .theme-toggle__feature::before {
  transition: none !important;
  animation: none !important;
}

.theme-toggle__btn::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background-color: #fff;
  border: 5px solid #e3e3c7;
  transition: all 250ms ease-in;
}

.theme-toggle__btn::after {
  content: '';
  position: absolute;
  top: 62%;
  left: 39px;
  z-index: 10;
  width: 9.2px;
  height: 9.2px;
  opacity: 0;
  background-color: #fff;
  border-radius: 50%;
  box-shadow:
    #fff 0 0,
    #fff 2.5px 0,
    #fff 5px 0,
    #fff 7.5px 0,
    #fff 9px 0,
    #fff 11.5px 0,
    #fff 13px 0,
    #fff 17px -1px 0 1px,
    #fff 13px -6px 0 -2px,
    #fff 6px -6px 0 1px,
    #d3d3d3 0 0 0 3.5px,
    #d3d3d3 5px 0 0 3.5px,
    #d3d3d3 9px 0 0 3.5px,
    #d3d3d3 13px 0 0 3.5px,
    #d3d3d3 17px -1px 0 4.5px,
    #d3d3d3 13px -6px 0 1px,
    #d3d3d3 6px -6px 0 4.5px;
  transition: opacity 100ms ease-in;
}

.theme-toggle__feature {
  display: block;
  position: absolute;
  top: 9px;
  left: 52.5%;
  z-index: 20;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: #fff;
  box-shadow:
    rgba(255,255,255,0.1) 30px -3px 0 0,
    rgba(255,255,255,0.1) 12px 10px 0 -1px,
    #fff 38px 18px 0 1px,
    rgba(255,255,255,0.1) 32px 34px 0 0,
    #fff 20px 24px 0 -1.5px,
    rgba(255,255,255,0.1) 5px 38px 0 1px;
  animation: starry_star 5s ease-in-out infinite;
}

.theme-toggle__feature::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -25px;
  width: 15px;
  height: 15px;
  background-color: #fff;
  border-radius: 50%;
  border: 4px solid #e3e3c7;
  box-shadow:
    #e3e3c7 -28px 0 0 -3px,
    #e3e3c7 -8px 24px 0 -2px;
  transform-origin: -6px 130%;
  transition: all 250ms ease-in;
}

@keyframes starry_star {
  50% {
    background-color: rgba(255,255,255,0.1);
    box-shadow:
      #fff 30px -3px 0 0,
      #fff 12px 10px 0 -1px,
      rgba(255,255,255,0.1) 38px 18px 0 1px,
      #fff 32px 34px 0 0,
      rgba(255,255,255,0.1) 20px 24px 0 -1.5px,
      #fff 5px 38px 0 1px;
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
  55% {
    transform: scale(1.1);
  }
  75% {
    transform: scale(.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.theme-toggle__checkbox:checked + .theme-toggle__btn {
  background-color: #9ee3fb;
  border: 5px solid #86c3d7;
}

.theme-toggle__checkbox:checked + .theme-toggle__btn::before {
  left: 57px;
  background-color: #ffdf6d;
  border: 5px solid #e1c348;
}

.theme-toggle__checkbox:checked + .theme-toggle__btn::after {
  opacity: 1;
  animation-name: bounceIn;
  animation-duration: 0.60s;
  animation-delay: 0.10s;
  animation-fill-mode: backwards;
  animation-timing-function: ease-in-out;
}

.theme-toggle__checkbox:checked + .theme-toggle__btn .theme-toggle__feature {
  opacity: 0;
  box-shadow:
    rgba(255,255,255,0.1) 30px -3px 0 -4px,
    rgba(255,255,255,0.1) 12px 10px 0 -5px,
    #fff 38px 18px 0 -3px,
    rgba(255,255,255,0.1) 32px 34px 0 -4px,
    #fff 20px 24px 0 -5.5px,
    rgba(255,255,255,0.1) 5px 38px 0 -3px;
  animation: none;
}

.theme-toggle__checkbox:checked + .theme-toggle__btn .theme-toggle__feature::before {
  left: 25px;
  transform: rotate(70deg);
}

@media (max-width: 768px) {
  .theme-toggle {
    top: 10px;
    right: 10px;
    transform: scale(0.58);
  }
}

/* ===== 页脚样式 ===== */
.footer {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 2rem 1rem;
    text-align: center;
    margin-top: auto;
}

.footer p {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
    transition: color 300ms ease-out;
}

/* 日间模式页脚样式 */
body.day-mode .footer p {
    color: rgba(0, 0, 0, 0.5);
}

/* 页脚响应式 */
@media (max-width: 768px) {
    .footer {
        padding: 1.5rem 1rem;
    }

    .footer p {
        font-size: 0.75rem;
    }
}
