:root {
  --bg-sky: #7ec8e3;
  --bg-field: #a8d36f;
  --bg-panel: #fff8df;
  --bg-card: #fffdf2;
  --bg-accent: #ffd36f;
  --bg-accent-2: #e6f09b;
  --bg-dark: #294653;
  --line: #5b3b26;
  --line-soft: #b98d4f;
  --text: #33261d;
  --text-soft: #6b4a31;
  --danger: #e87c5b;
  --shadow: rgba(68, 47, 28, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Courier New", "Microsoft YaHei", monospace;
  background:
    radial-gradient(circle at 12% 14%, rgba(255, 245, 171, 0.95) 0 18px, transparent 19px),
    radial-gradient(circle at 88% 24%, rgba(255, 245, 171, 0.9) 0 22px, transparent 23px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 100%) 0 0 / 100% 28px,
    linear-gradient(180deg, var(--bg-sky) 0 62%, var(--bg-field) 62% 86%, #648b31 86% 100%);
}

body::before {
  content: "";
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 80px;
  background: repeating-linear-gradient(90deg, #6b8c42 0px, #6b8c42 20px, #7d9f54 20px, #7d9f54 40px);
  box-shadow: 0 -4px 0 #3e5a1f;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "🌿🌱🌿";
  position: fixed;
  bottom: 20px;
  left: 20px;
  font-size: 28px;
  color: #4a6b2f;
  text-shadow: 2px 2px 0 #2c4518;
  pointer-events: none;
  z-index: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

a,
button,
.clickable,
.project-card,
.chip-link,
.pixel-button,
.note-list-item {
  cursor: pointer;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-wrap {
  width: min(1000px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 110px;
  position: relative;
  z-index: 2;
}

.site-shell,
.notes-shell {
  background: rgba(255, 255, 245, 0.88);
  border: 6px solid var(--line);
  border-radius: 24px;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.2);
  min-height: calc(100vh - 28px);
  padding: 30px 34px 70px;
  backdrop-filter: blur(1px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 3px solid var(--line);
  background: var(--bg-accent);
  box-shadow: 4px 4px 0 rgba(91, 59, 38, 0.2);
  font-weight: 900;
  letter-spacing: 0.04em;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pixel-button {
  border: 3px solid var(--line);
  background: var(--bg-accent);
  color: var(--text);
  padding: 8px 12px;
  font-weight: 900;
  box-shadow: 3px 3px 0 rgba(91, 59, 38, 0.22);
}

.pixel-button.secondary {
  background: #e8ddb0;
}

.pixel-button.dark {
  background: var(--bg-dark);
  color: #fff5bc;
  border-color: #162d36;
}

.pixel-button.danger {
  background: var(--danger);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border: 2px solid var(--line-soft);
  background: rgba(255,255,255,0.7);
  min-height: 40px;
  color: var(--text-soft);
  font-weight: 700;
}

.hero-title {
  font-size: clamp(42px, 7vw, 72px);
  line-height: 1.02;
  margin: 0;
  text-shadow: 4px 4px 0 rgba(233, 198, 121, 0.55);
  overflow-wrap: anywhere;
}

.hero-subtitle {
  margin: 18px 0 34px;
  font-size: clamp(18px, 2.6vw, 25px);
  font-weight: 800;
  color: var(--text-soft);
}

.panel-card {
  background: #fff3c8;
  border: 4px solid var(--line-soft);
  border-radius: 28px;
  box-shadow: 6px 6px 0 rgba(91, 59, 38, 0.18);
}

.profile-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
  border-radius: 32px;
}

.avatar-box {
  min-height: 180px;
  background: #facb67;
  border: 4px solid var(--line);
  box-shadow: 6px 6px 0 rgba(91, 59, 38, 0.18);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}

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

.avatar-fallback {
  font-size: clamp(30px, 4vw, 56px);
  font-weight: 900;
  text-align: center;
  padding: 12px;
}

.profile-name {
  margin: 0 0 12px;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.15;
}

.profile-lines {
  display: grid;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
}

.chip-row,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip-link,
.tag-chip {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  border: 3px solid var(--line-soft);
  background: #f5e5b7;
  box-shadow: 3px 3px 0 rgba(91, 59, 38, 0.16);
  font-weight: 800;
}

.chip-link:hover,
.project-link:hover,
.note-card:hover {
  transform: translate(-2px, -2px);
}

.project-section-title,
.section-title {
  margin: 34px 0 16px;
  font-size: clamp(26px, 3.4vw, 40px);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.project-card {
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--bg-card);
  border: 4px solid var(--line);
  border-radius: 28px;
  box-shadow: 6px 6px 0 rgba(91, 59, 38, 0.18);
  overflow: hidden;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s cubic-bezier(0.34, 1.2, 0.64, 1), box-shadow 0.18s ease, background 0.18s ease;
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 0 0 #c09a6b;
  background: #fffff0;
}

.project-card:hover .project-link {
  background: #ffc857;
  transform: translateY(1px);
}

.project-media {
  aspect-ratio: 16 / 9;
  border-bottom: 4px solid var(--line);
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.18) 0 8px, rgba(255,255,255,0) 8px 16px),
    linear-gradient(135deg, #f7d06d, #b4df86);
  display: grid;
  place-items: center;
  color: #6f4b21;
  font-weight: 900;
  font-size: 28px;
}

.project-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-body {
  display: grid;
  gap: 14px;
  padding: 18px 20px 20px;
}

.project-title {
  margin: 0;
  color: #c95a31;
  font-size: clamp(22px, 2.5vw, 34px);
  line-height: 1.15;
}

.project-desc {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.7;
}

.project-link {
  justify-self: start;
}

.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.mini-panel {
  padding: 18px;
}

.mini-panel h3 {
  margin: 0 0 12px;
  font-size: 24px;
}

.mini-panel ul,
.mini-panel .contact-stack {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.contact-stack {
  padding-left: 0;
}

.footer,
.footer-note {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 3px dotted var(--line-soft);
  color: var(--text-soft);
  font-weight: 700;
  text-align: center;
}

.footer a {
  color: var(--text-soft);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.editor-pane {
  margin-top: 26px;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
}

.editor-pane[hidden],
.note-editor-card[hidden] {
  display: none !important;
}

.editor-pane:not([hidden]) {
  display: flex;
}

.editor-pane h3 {
  margin: 0;
  font-size: 24px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.field-block {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.field-block.full {
  grid-column: 1 / -1;
}

.field-block input,
.field-block textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 3px solid var(--line);
  background: #fffdf1;
  color: var(--text);
}

.field-block textarea {
  min-height: 110px;
  resize: vertical;
}

.row-editor-list,
.project-editor-list,
.note-list {
  display: grid;
  gap: 12px;
}

.row-editor,
.project-editor,
.note-card,
.note-editor-card,
.preview-card {
  background: #fffdf1;
  border: 3px solid var(--line-soft);
  box-shadow: 4px 4px 0 rgba(91, 59, 38, 0.14);
}

.row-editor,
.note-card {
  padding: 12px;
}

.row-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.project-editor {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
}

.project-editor-media {
  display: grid;
  gap: 10px;
}

.project-thumb {
  aspect-ratio: 16 / 10;
  border: 3px solid var(--line);
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.16) 0 8px, rgba(255,255,255,0) 8px 16px),
    linear-gradient(135deg, #f7d06d, #b4df86);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-weight: 900;
}

.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.notes-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.note-toolbar {
  display: grid;
  gap: 12px;
}

.filter-card,
.note-list-card {
  padding: 16px;
}

.search-box,
.tag-filter {
  width: 100%;
  padding: 10px 12px;
  border: 3px solid var(--line);
  background: #fffdf1;
}

.note-card {
  display: grid;
  gap: 10px;
}

.note-card.active {
  border-color: var(--line);
  background: #fff4cf;
}

.note-card h3 {
  margin: 0;
  font-size: 22px;
}

.note-card p {
  margin: 0;
  color: var(--text-soft);
  font-weight: 700;
}

.notes-main {
  display: grid;
  gap: 18px;
}

.note-editor-card,
.preview-card {
  padding: 18px;
}

.editor-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.note-markdown {
  min-height: 360px;
}

.markdown-body {
  line-height: 1.8;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin: 1.2em 0 0.5em;
  line-height: 1.2;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote,
.markdown-body pre {
  margin: 0 0 1em;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 22px;
}

.markdown-body code {
  padding: 1px 5px;
  background: #f3e6ba;
  border: 1px solid #dab672;
}

.markdown-body pre {
  padding: 12px;
  background: #243d49;
  color: #fff3bb;
  overflow: auto;
}

.markdown-body pre code {
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0;
}

.markdown-body blockquote {
  padding-left: 12px;
  border-left: 4px solid var(--line-soft);
  color: var(--text-soft);
}

.screen-reader {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .page-wrap {
    width: min(100%, calc(100% - 20px));
    padding-top: 18px;
    padding-bottom: 72px;
  }

  body::after {
    font-size: 20px;
    bottom: 10px;
  }

  .site-shell,
  .notes-shell {
    padding: 18px 16px 54px;
    border-width: 4px;
    border-radius: 18px;
  }

  .profile-card,
  .projects-grid,
  .split-grid,
  .field-grid,
  .notes-layout,
  .editor-two-col,
  .project-editor {
    grid-template-columns: 1fr;
  }

  .row-editor {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: clamp(36px, 12vw, 58px);
  }
}
