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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Georgia', 'Times New Roman', serif;
  background: #000;
  color: #333;
}

/* === Canvas Container (Three.js + CSS3D) === */
#canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#canvas-container canvas {
  display: block;
}

/* === Article Overlay (managed by CSS3DRenderer in 3D space) === */
#article-overlay {
  background: #fafaf8;
  overflow-y: auto;
}

/* === Blog Article === */
#blog-article {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  line-height: 1.75;
  user-select: text;
  -webkit-user-select: text;
}

/* === Site Header (stays outside scrolling content) === */
#site-header {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
  border-bottom: 1px solid #e0e0e0;
}

.site-name {
  font-weight: bold;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

.site-nav nav a {
  margin-left: 1.5rem;
  color: #666;
  text-decoration: none;
  font-size: 0.9rem;
}

.site-nav nav a:hover {
  color: #333;
}

.site-nav nav a.active {
  color: #1a1a1a;
  font-weight: 600;
}

.article-meta {
  color: #999;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.article-meta .reading-time {
  margin-left: 1rem;
}

h1 {
  font-size: 2.4rem;
  line-height: 1.2;
  margin-bottom: 1.5rem;
  color: #1a1a1a;
  font-weight: 700;
}

h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: #2a2a2a;
}

p {
  margin-bottom: 1.25rem;
  font-size: 1.1rem;
  color: #444;
}

.lede {
  font-size: 1.25rem;
  color: #333;
  font-style: italic;
  border-left: 3px solid #ccc;
  padding-left: 1rem;
  margin-bottom: 2rem;
}

.cta {
  font-style: italic;
  color: #888;
  text-align: center;
  margin-top: 2rem;
  font-size: 1.15rem;
}

blockquote {
  margin: 2rem 0;
  padding: 1.5rem 2rem;
  background: #f5f5f0;
  border-left: 4px solid #b0a090;
  font-style: italic;
}

blockquote cite {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: #888;
  font-style: normal;
}

.article-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e0e0e0;
}

.tags a {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  margin: 0.25rem;
  background: #eee;
  border-radius: 3px;
  font-size: 0.8rem;
  color: #666;
  text-decoration: none;
}

/* === Essay Cards === */
.essay-list {
  margin-top: 2rem;
}

.essay-card {
  display: block;
  padding: 1.5rem;
  margin-bottom: 1rem;
  background: #f5f5f0;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}

.essay-card:hover {
  border-color: #ccc;
  background: #fff;
}

.essay-card h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.3rem;
}

.essay-card p {
  margin-bottom: 0;
  font-size: 1rem;
}

.essay-meta {
  color: #999;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.essay-card.coming-soon {
  opacity: 0.6;
  cursor: default;
}

/* === Hint Overlay === */
#hint-overlay {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  opacity: 0;
  transition: opacity 1s ease-in;
  pointer-events: none;
  color: #999;
  font-size: 0.9rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#hint-overlay.visible {
  opacity: 1;
}

/* === Explore Hint (post-reveal) === */
#explore-hint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  color: #fff;
  font-size: 1.2rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
  opacity: 1;
  transition: opacity 2s ease-out;
  pointer-events: none;
}

#explore-hint.hidden {
  opacity: 0;
}

/* === Test Pages (work / nowork) === */
.test-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.25rem;
}

.test-btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.test-btn:hover { background: #555; }
.test-btn.toggled { background: #2a7d4f; }

.test-note {
  font-size: 0.85rem;
  color: #888;
  font-style: italic;
  margin-bottom: 0.75rem;
}

/* Hover boxes */
.hover-box {
  width: 80px;
  height: 80px;
  background: #e0ddd5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  border-radius: 4px;
  transition: all 0.3s;
  cursor: default;
}

.hover-box:hover { background: #c8c4b8; }
.hover-scale:hover { transform: scale(1.15); }
.hover-color:hover { background: #4a90d9; color: #fff; }

/* Animation boxes */
.spin-box, .pulse-box, .bounce-box {
  width: 40px;
  height: 40px;
  border-radius: 4px;
}

.spin-box {
  background: #d94a4a;
  animation: spin 2s linear infinite;
}

.pulse-box {
  background: #4a90d9;
  animation: pulse 1.5s ease-in-out infinite;
}

.bounce-box {
  background: #4ad97a;
  animation: bounce 1s ease-in-out infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.3); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

/* Details / accordion */
.test-details {
  margin-bottom: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
}

.test-details summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  background: #f5f5f0;
  font-size: 1rem;
}

.test-details p {
  padding: 0.75rem 1rem;
  margin: 0;
  font-size: 0.95rem;
}

/* Table */
.test-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.test-table th, .test-table td {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  text-align: left;
}

.test-table th { background: #f5f5f0; }

/* Gradient boxes */
.gradient-box {
  width: 80px;
  height: 80px;
  border-radius: 4px;
}

.grad-1 { background: linear-gradient(135deg, #667eea, #764ba2); }
.grad-2 { background: radial-gradient(circle, #f093fb, #f5576c); }
.grad-3 { background: conic-gradient(#fd4556, #d0021b, #f5a623, #7ed321, #4a90d9, #9013fe, #fd4556); }

/* --- nowork page --- */
.selectable-text {
  background: #fffde7;
  padding: 0.75rem;
  border: 1px dashed #ccc;
  border-radius: 4px;
  user-select: text;
}

.test-input, .test-textarea, .test-select {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  width: 100%;
  max-width: 320px;
}

.test-textarea { resize: vertical; }

.test-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.test-form label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  cursor: pointer;
}

.test-range {
  width: 200px;
  cursor: pointer;
}

.range-value {
  font-size: 0.9rem;
  color: #666;
  min-width: 2rem;
}

.nested-scroll {
  height: 120px;
  overflow-y: auto;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  background: #fafaf8;
  margin-bottom: 1.25rem;
}

.nested-scroll p {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.test-editable {
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0.75rem;
  min-height: 60px;
  background: #fff;
  margin-bottom: 1.25rem;
  font-size: 1rem;
  line-height: 1.6;
}

.test-editable:focus {
  outline: 2px solid #4a90d9;
  outline-offset: -1px;
}

.drag-zone {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.drag-item {
  padding: 0.75rem 1.25rem;
  background: #4a90d9;
  color: #fff;
  border-radius: 4px;
  cursor: grab;
  font-size: 0.9rem;
}

.drop-target {
  flex: 1;
  padding: 0.75rem;
  border: 2px dashed #ccc;
  border-radius: 4px;
  text-align: center;
  color: #aaa;
  font-size: 0.9rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.test-iframe {
  width: 100%;
  height: 100px;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 1.25rem;
}

.backdrop-test {
  position: relative;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: #f5f5f0;
  border-radius: 4px;
}

.backdrop-bg-text {
  font-size: 1.1rem;
  color: #333;
  margin: 0;
}

.backdrop-box {
  position: relative;
  z-index: 1;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  background: rgba(255, 255, 255, 0.3);
  padding: 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.fixed-test-wrapper {
  position: relative;
  height: 60px;
  margin-bottom: 1.25rem;
}

.fixed-test-el {
  position: fixed;
  bottom: 10px;
  right: 10px;
  background: #d94a4a;
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  z-index: 10;
}

.tooltip-trigger {
  text-decoration: underline dotted;
  cursor: help;
  position: relative;
}

.tooltip-trigger:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  font-size: 0.8rem;
  white-space: nowrap;
  pointer-events: none;
}

code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.85em;
  background: #eee;
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

/* === Mobile === */
@media (max-width: 768px) {
  h1 { font-size: 1.8rem; }
  p { font-size: 1rem; }
  .lede { font-size: 1.1rem; }
  #blog-article { padding: 1rem; }
}
