@import url('https://fonts.googleapis.com/css2?family=VT323&family=Kosugi+Maru&display=swap');

:root {
  --font-pixel: 'VT323', 'Courier New', monospace;
  --font-cute: 'Kosugi Maru', 'Segoe UI', sans-serif;
  --accent-cyan: #00bdd6;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-cute);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 20px 70px;
  background-image: url("assets/bg.svg");
  background-position: center;
  background-attachment: fixed;
  background-size: cover;
}

img {
  max-width: 100%;
  height: auto;
}

/* Sparkle Canvas */
#sparkle-canvas {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
}

/* === Page Layout === */
.page-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.main-window {
  width: 100%;
}

.main-window .window-body {
  padding: 16px;
}

/* === Taskbar Navigation === */
.taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9000;
  background: linear-gradient(180deg, #3168d5 0%, #2456b8 3%, #1941a5 6%, #1941a5 94%, #122e7a 100%);
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3);
  border-top: 2px solid #5c8de8;
}

.start-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(180deg, #3d9e41 0%, #3d9e41 50%, #2d8a31 100%);
  color: white;
  border: none;
  padding: 4px 10px;
  font-weight: bold;
  font-size: 13px;
  font-family: 'Trebuchet MS', sans-serif;
  font-style: italic;
  cursor: pointer;
  height: 32px;
  border-radius: 0 8px 8px 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  letter-spacing: 0.3px;
}

.start-btn:hover {
  background: linear-gradient(180deg, #4db851 0%, #4db851 50%, #3a9a3e 100%);
}

.start-btn .start-icon {
  font-size: 16px;
}

.taskbar-divider {
  width: 2px;
  height: 24px;
  background: linear-gradient(180deg, #5c8de8, #1941a5);
  margin: 0 4px;
}

.taskbar-links {
  display: flex;
  gap: 2px;
  flex: 1;
}

.taskbar-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 12px;
  font-size: 12px;
  color: white;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  height: 28px;
  transition: background 0.1s;
  font-family: 'Tahoma', 'Segoe UI', sans-serif;
  white-space: nowrap;
}

.taskbar-link:hover {
  background: rgba(255, 255, 255, 0.15);
}

.taskbar-link.active {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.15);
}

.taskbar-link .link-icon {
  font-size: 14px;
}

.taskbar-clock {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  font-size: 11px;
  color: white;
  background: rgba(0, 93, 186, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  height: 28px;
  font-family: 'Tahoma', sans-serif;
  margin-left: auto;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.2);
}

/* === Home Page === */
.home-content {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.home-mascot {
  text-align: center;
  flex-shrink: 0;
}

.home-mascot img {
  border-radius: 8px;
  border: 2px solid #87ceeb;
  width: 180px;
  height: 180px;
  object-fit: cover;
}

.mascot-label {
  font-family: var(--font-pixel);
  font-size: 14px;
  color: #666;
  margin-top: 6px;
}

.home-text h2 {
  font-size: 18px;
  margin-bottom: 8px;
  color: #003399;
}

.home-text p {
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.6;
}

.home-stats {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.stat-box {
  text-align: center;
  padding: 8px 16px;
  flex: 1;
}

.stat-box fieldset {
  padding: 8px;
}

.stat-box .stat-num {
  font-family: var(--font-pixel);
  font-size: 28px;
  color: #003399;
  display: block;
}

.stat-box .stat-label {
  font-size: 11px;
  color: #666;
}

/* === Marquee === */
.marquee-bar {
  background: #ffffcc;
  border: 1px solid #e6d98c;
  padding: 4px 8px;
  font-family: var(--font-pixel);
  font-size: 14px;
  color: #996600;
  overflow: hidden;
  white-space: nowrap;
}

.marquee-bar .marquee-text {
  display: inline-block;
  animation: marquee 20s linear infinite;
}

@keyframes marquee {
  0% {
    transform: translateX(100%);
  }

  100% {
    transform: translateX(-100%);
  }
}

/* === Skills Page === */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  padding: 8px 0;
}

.skill-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  text-align: center;
  cursor: default;
  border-radius: 4px;
  transition: background 0.15s;
}

.skill-item:hover {
  background: rgba(49, 104, 213, 0.08);
}

.skill-item img,
.skill-item svg {
  width: 48px;
  height: 48px;
}

.skill-item .skill-name {
  font-size: 11px;
  color: #333;
  word-break: break-word;
}

.skill-category-title {
  font-size: 14px;
  color: #003399;
  margin: 12px 0 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid #d2e2f9;
}

/* === Projects Page === */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.project-window {
  width: 100%;
}

.project-body {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.project-icon {
  font-size: 48px;
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f4ff;
  border: 1px solid #d2e2f9;
  border-radius: 4px;
}

.project-details {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.project-details h3 {
  font-size: 14px;
  color: #003399;
  margin-bottom: 4px;
}

.project-details p {
  font-size: 12px;
  color: #555;
  margin-bottom: 8px;
  line-height: 1.5;
}

.project-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.project-tags span {
  font-size: 10px;
  padding: 2px 6px;
  background: #e8f0fe;
  border: 1px solid #b8d4fe;
  border-radius: 2px;
  color: #1a5dab;
}

.project-links {
  display: flex;
  gap: 6px;
}

.image-scroll-container {
  max-height: 400px;
  overflow-y: auto;
  border: 1px inset #d5d5d5;
  background: #fff;
  margin-bottom: 12px;
  border-radius: 2px;
}

.image-scroll-container img {
  display: block;
  width: 100%;
  height: auto;
}

/* === Posts Page (Admin Form) === */
.post-form {
  margin-bottom: 16px;
}

.post-form label {
  font-size: 13px;
  display: block;
  margin-bottom: 4px;
}

.post-form input[type="text"],
.post-form textarea {
  width: 100%;
  margin-bottom: 8px;
}

.post-form textarea {
  min-height: 100px;
  resize: vertical;
  font-family: var(--font-cute);
}

.post-form .form-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* === Contact Page === */
.contact-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0;
}

.contact-item-badge {
  display: inline-block;
  transition: transform 0.1s ease;
}

.contact-item-badge:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.contact-item-badge img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* === Footer in window === */
.window-footer {
  padding: 8px 16px;
  background: #f0f0f0;
  border-top: 1px solid #d5d5d5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #888;
}

.footer-mascot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 4px;
}

.profile-photo {
  border-image: outset;
  box-shadow: 2px 2px 0 #000;
}

/* === Responsive === */
@media (max-width: 640px) {
  body {
    padding: 10px 10px 50px;
  }

  .home-content {
    flex-direction: column;
    align-items: center;
  }

  .home-mascot img {
    width: 140px;
    height: 140px;
  }

  .home-stats {
    flex-direction: column;
  }

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

  .project-body {
    flex-direction: column;
  }

  /* Taskbar: hide Start button and clock, show only icons */
  .start-btn {
    display: none;
  }

  .taskbar-divider {
    display: none;
  }

  .taskbar-link span:not(.link-icon) {
    display: none;
  }

  .taskbar-clock {
    display: none;
  }

  .taskbar-links {
    justify-content: center;
    gap: 4px;
  }

  .taskbar-link {
    padding: 3px 10px;
  }

  /* Explorer: stack vertically on mobile */
  .explorer-container {
    flex-direction: column;
    height: auto;
    max-height: none;
  }

  .explorer-sidebar {
    width: 100%;
    max-height: 180px;
    border-right: none;
    border-bottom: 2px solid #d5d5d5;
  }

  .explorer-sidebar .tree-container {
    max-height: 120px;
  }

  .explorer-content {
    padding: 16px;
    min-height: 300px;
  }

  /* Bigger touch targets for tree items */
  ul.tree-view li {
    padding: 6px 8px;
    font-size: 13px;
  }

  /* Post header adjustments */
  .explorer-post-header h2 {
    font-size: 18px;
  }

  .explorer-index h2 {
    font-size: 16px;
  }

  /* Pagination buttons full width */
  .content-pagination {
    flex-direction: column;
    gap: 8px;
  }

  .content-pagination button {
    width: 100%;
  }
}

/* === Explorer Layout (GitBook Style) === */
.explorer-container {
  display: flex;
  height: 600px;
  max-height: 80vh;
  background: #fff;
  border: 1px inset #d5d5d5;
}

.explorer-sidebar {
  width: 200px;
  flex-shrink: 0;
  border-right: 1px solid #d5d5d5;
  background: #f0f0f0;
  display: flex;
  flex-direction: column;
}

.explorer-sidebar .search-container {
  padding: 8px;
  border-bottom: 1px solid #d5d5d5;
}

.explorer-sidebar .search-container input {
  width: 100%;
  font-size: 11px;
}

.explorer-sidebar .tree-container {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
}

.explorer-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: #fff;
  position: relative;
}

/* Tree View */
ul.tree-view {
  margin: 0;
  padding: 0;
  list-style: none;
}

ul.tree-view li {
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

ul.tree-view li:hover {
  background: #3168d2;
  color: #fff;
}

ul.tree-view li.active {
  background: #000080;
  color: #fff;
}

ul.tree-view li.folder {
  font-weight: bold;
  pointer-events: none;
  background: #ddd;
  margin-top: 8px;
  padding: 4px;
  border-bottom: 1px solid #ccc;
}

/* Post Header in Explorer */
.explorer-post-header {
  border-bottom: 1px solid #eee;
  margin-bottom: 20px;
  padding-bottom: 10px;
}

.explorer-post-header h2 {
  margin: 0;
  color: #000;
  font-size: 24px;
  font-family: 'MS Sans Serif', 'Tahoma', sans-serif;
}

.explorer-post-meta {
  font-size: 11px;
  color: #666;
  margin-top: 4px;
}

/* Index / Summary View */
.explorer-index h2 {
  font-size: 20px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 8px;
}

.explorer-index-item {
  margin-bottom: 16px;
  padding: 8px;
  border: 1px solid transparent;
  cursor: pointer;
}

.explorer-index-item:hover {
  background: #f8fbff;
  border-color: #d2e2f9;
}

.explorer-index-item .title {
  font-weight: bold;
  color: #003399;
}

.explorer-index-item .snippet {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

/* Pagination in Content */
.content-pagination {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: space-between;
}

.content-pagination button {
  min-width: 100px;
}

/* Markdown rendering in post body */
.post-body h1,
.post-body h2,
.post-body h3 {
  color: #003399;
  margin-top: 15px;
  margin-bottom: 5px;
}

.post-body blockquote {
  border-left: 4px solid #ccc;
  padding-left: 10px;
  margin: 10px 0;
  color: #666;
  font-style: italic;
}

.post-body code {
  background: #f0f0f0;
  padding: 2px 4px;
  border-radius: 3px;
}

.post-body ul,
.post-body ol {
  padding-left: 20px;
  margin: 8px 0;
}

.post-body p {
  margin-bottom: 8px;
  line-height: 1.6;
}

/* === JSON Output (Admin) === */
#json-output {
  width: 100%;
  background: #eee;
  border: 1px inset #888;
  padding: 5px;
  margin-bottom: 5px;
}

/* === Admin Login Modal === */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  backdrop-filter: blur(2px);
}

.login-overlay.hidden {
  display: none !important;
}

/* === Utilities === */
.hidden,
[hidden] {
  display: none !important;
}