@layer theme, base, components, responsive;

@layer theme {
  @font-face {
    font-family: "Cormorant Love";
    src: url("./fonts/cormorant-garamond-italic-600.ttf") format("truetype");
    font-style: italic;
    font-weight: 600;
    font-display: swap;
  }
  :root {
    color-scheme: light;
    --paper: #f6e9e9;
    --ink: #4b303c;
    --muted: #896976;
    --rose: #b85875;
    --glass: rgba(255, 252, 252, .43);
    --edge: rgba(255, 255, 255, .82);
    --shadow: 0 20px 65px -24px rgba(123, 53, 78, .2), inset 0 1px 1px rgba(255, 255, 255, .85), inset 0 -1px 1px rgba(255, 255, 255, .35);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-synthesis: none;
  }
}
@layer base {
  * { box-sizing: border-box; }
  body { margin: 0; background: var(--paper); color: var(--ink); min-width: 320px; overflow-x: clip; -webkit-font-smoothing: antialiased; }
  button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
  button { font: inherit; color: inherit; cursor: pointer; }
  a { color: inherit; text-decoration: none; }
  button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid #a84168; outline-offset: 5px; }
  button { border: 0; }
  ::selection { background: #e5b3c3; color: #442734; }
  p, h1, h2 { margin: 0; }
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
}
@layer components {
  .ambient-light { position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse at 83% 38%, #f7c6d29e, transparent 48%), radial-gradient(ellipse at 16% 82%, #e1d9ee8c, transparent 44%), radial-gradient(ellipse at 8% 0%, #fff8ef, transparent 58%); }
  #stardust { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; }
  .page { width: min(1440px, calc(100% - 112px)); margin: auto; padding: max(28px, env(safe-area-inset-top)) 0 max(22px, env(safe-area-inset-bottom)); }
  .glass { border: 1px solid var(--edge); background: var(--glass); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(26px) saturate(125%); backdrop-filter: blur(26px) saturate(125%); }
  .masthead { display: flex; align-items: center; justify-content: space-between; min-height: 57px; margin-bottom: 38px; gap: 24px; }
  .brand { display: flex; align-items: center; gap: 13px; flex-shrink: 0; }
  .brand-mark { font-family: Georgia, "Times New Roman", serif; font-size: 36px; font-style: italic; letter-spacing: -6px; width: 57px; margin-right: 4px; padding-bottom: 5px; }
  .brand-mark > span { font-size: 24px; color: var(--rose); display: inline-block; transform: translateY(3px); padding: 0 4px; }
  .brand-name { font-size: 14px; font-weight: 600; letter-spacing: 3px; }
  .brand-name > i { font-family: Georgia, serif; font-size: 17px; font-weight: 400; }
  .brand-caption { display: block; color: var(--muted); font-size: 12px; letter-spacing: .2px; font-weight: 400; margin-top: 7px; }
  .header-note { font-size: 13px; letter-spacing: 2px; color: #8c6978; margin-left: -80px; }
  .archive-link { display: flex; align-items: center; gap: 9px; padding: 13px 19px; border-radius: 100px; font-size: 13px; min-height: 46px; transition: background .25s, transform .25s; flex-shrink: 0; background: #ffffff26; }
  .archive-link > span { font-size: 20px; line-height: 1; color: #a35e78; }
  .archive-link:hover { background: #fff7; transform: translateY(-2px); }
  .story-grid { display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(0, 1fr); gap: 34px; align-items: stretch; }
  .letter-panel { border-radius: 23px; overflow: hidden; position: relative; z-index: 1; background: linear-gradient(135deg, #fff9, #fffcfc45 70%); }
  .editor-bar { min-height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 17px 0 23px; gap: 12px; border-bottom: 1px solid #9f658417; background: #ffffff1f; }
  .window-dots { display: flex; gap: 7px; }
  .window-dots i { width: 9px; height: 9px; border-radius: 50%; background: #d99ba7; border: 1px solid #c8839326; }
  .window-dots i:nth-child(2) { background: #e7c5ac; }
  .window-dots i:nth-child(3) { background: #bbc8b6; }
  .editor-bar h2 { font-size: 12px; font-family: "SFMono-Regular", Consolas, monospace; letter-spacing: .3px; font-weight: 400; color: #826873; }
  .editor-bar h2 > span { margin-right: 5px; opacity: .8; }
  .icon-button { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: transparent; color: #967482; transition: background .2s, color .2s; }
  .icon-button:hover { background: #fff9; color: #88425e; }
  .icon-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
  .code-scroll { height: 585px; overflow-x: hidden; overflow-y: scroll; padding: 24px 26px 28px; scrollbar-width: thin; scrollbar-color: #c991a35c transparent; overscroll-behavior: contain; overflow-anchor: none; scrollbar-gutter: stable; scroll-behavior: auto; }
  #code { font-family: "SFMono-Regular", Consolas, "Monaco", "Courier New", monospace; font-size: 14px; line-height: 1.65; letter-spacing: -.36px; color: #514354; overflow-wrap: anywhere; }
  #code .comments { color: #816174; }
  #code .keyword { color: #ad3f6a; font-weight: 600; }
  #code .string { color: #75629e; }
  #code .placeholder { margin-left: 15px; }
  #code .space { margin-left: 7px; float: left; }
  #code .typing-cursor { position: relative; display: inline; pointer-events: none; }
  #code .typing-cursor::after { content: "_"; position: absolute; left: 0; top: 0; font: inherit; line-height: inherit; }
  .editor-footer { border-top: 1px solid #9f658414; padding: 0 24px; min-height: 42px; display: flex; justify-content: space-between; align-items: center; color: #816174; font-size: 12px; gap: 14px; }
  .editor-footer > span:first-child { display: flex; align-items: center; gap: 8px; }
  .status-dot { width: 5px; height: 5px; border-radius: 50%; background: #b68397; }
  .is-writing .status-dot { animation: pulse 2s ease-in-out infinite; }
  .hero { position: relative; min-width: 0; isolation: isolate; text-align: center; display: flex; flex-direction: column; align-items: center; }
  .hero-copy { position: relative; z-index: 2; padding-top: 24px; }
  .eyebrow { display: flex; align-items: center; justify-content: center; gap: 13px; font-size: 12px; letter-spacing: 2.6px; color: #916476; font-weight: 500; }
  .eyebrow > span { height: 1px; width: 23px; background: #a678895c; }
  h1 { font-family: "Baskerville", "Times New Roman", "Songti SC", serif; font-size: clamp(64px, 6.3vw, 95px); font-weight: 400; letter-spacing: -5px; line-height: 1.15; padding-top: 19px; }
  h1 > em { font-weight: 400; color: #b96883; font-size: .87em; margin: 0 1px; }
  h1 > span { display: block; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; font-size: 17px; letter-spacing: 5px; line-height: 1.8; padding-top: 10px; color: #8d6173; }
  .tree-stage { position: relative; width: calc(100% + 34px); flex: 1; min-height: 402px; margin: -2px -17px -8px; isolation: isolate; }
  .tree-stage::before { content: ""; position: absolute; inset: 8% 3% 3%; z-index: -1; background: radial-gradient(ellipse at 50% 55%, #fff7ea91, #f9ccdc33 45%, transparent 70%); }
  #love-tree { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
  .glass-letter { color: #9b627a; font-family: "Cormorant Love", "Baskerville", Georgia, serif; font-weight: 600; font-style: italic; }
  @supports (background-clip: text) or (-webkit-background-clip: text) {
    .glass-letter { background: linear-gradient(165deg, #fffdfdf5 2%, #dab4c296 24%, #966378b8 43%, #fffafbfa 48%, #ac7089bf 58%, #d3acbf73 80%, #fffafdde 100%); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-stroke: .4px #985d787d; filter: drop-shadow(0 1px 0 #ffffffbf) drop-shadow(0 3px 3px #98617f29); }
  }
  .floating-note { position: absolute; display: flex; align-items: center; gap: 14px; padding: 8px 19px 11px; border-radius: 17px; color: #885069; border-color: #ffffff8c; box-shadow: 0 9px 28px #98557113, inset 0 1px 1px #fffffff0, inset 0 -1px 1px #c393a429, inset 1px 0 1px #ffffff8c; background: linear-gradient(135deg, #ffffff24, #ffffff05 52%, #ffffff17); -webkit-backdrop-filter: blur(7px) saturate(115%); backdrop-filter: blur(7px) saturate(115%); z-index: 2; }
  .floating-note .monogram { font-size: 40px; line-height: 1.12; letter-spacing: -1.5px; padding-right: 3px; }
  .floating-note .note-heart { color: #bd84969c; font-size: 21px; font-family: sans-serif; }
  .note-cx { top: 265px; left: 0; transform: rotate(-9deg); animation: float-left 7s ease-in-out infinite; }
  .note-by { top: 407px; right: -3px; transform: rotate(9deg); animation: float-right 8s ease-in-out infinite; }
  .hero-bottom { margin-top: 0; padding-bottom: 17px; position: relative; z-index: 2; }
  .hero-bottom > p { color: #936a7a; font-size: 14px; letter-spacing: 2px; margin-bottom: 21px; }
  .heart-button { display: inline-flex; align-items: center; gap: 11px; border-radius: 100px; padding: 14px 22px; font-size: 14px; letter-spacing: 1px; color: #89576d; transition: background .25s, transform .25s, box-shadow .25s; min-height: 49px; background: #fff6; }
  .heart-button:hover { background: #fff9; box-shadow: 0 8px 32px #ad60882b, inset 0 1px 1px #fff; transform: translateY(-3px); }
  .heart-button:active { transform: scale(.97); }
  .heart-button svg { width: 17px; height: 17px; fill: #c8849a15; stroke: #b16683; stroke-width: 1.4; stroke-linejoin: round; }
  .button-arrow { color: #b590a0; margin-left: 10px; font-size: 17px; }
  .time-panel { display: flex; align-items: center; justify-content: space-between; padding: 28px 34px; border-radius: 23px; margin-top: 28px; gap: 22px; position: relative; background: linear-gradient(110deg, #ffffff38, #ffffff10); -webkit-backdrop-filter: blur(14px) saturate(125%); backdrop-filter: blur(14px) saturate(125%); }
  .time-intro { display: flex; gap: 17px; align-items: center; }
  .time-symbol { display: grid; place-items: center; font-family: Georgia, serif; font-size: 34px; width: 54px; height: 54px; color: #ad7791; background: #ffffff5c; border: 1px solid #fff9; border-radius: 50%; }
  .time-intro h2 { font-family: "Cormorant Love", "Baskerville", Georgia, serif; font-style: italic; font-size: 33px; line-height: 1.15; font-weight: 600; letter-spacing: -.5px; padding: 3px 4px 3px 0; }
  .time-intro p { margin-top: 9px; color: #93717f; font-size: 12px; letter-spacing: 1.5px; }
  .clock { display: flex; align-items: center; justify-content: center; gap: 16px; flex-shrink: 0; }
  .time-unit { display: flex; flex-direction: column; align-items: center; min-width: 60px; }
  .digit { font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; font-weight: 200; font-size: 47px; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -2px; color: #694451; }
  .days-unit .digit { color: #a65775; }
  .unit { font-size: 12px; color: #816174; margin-top: 8px; letter-spacing: 2px; }
  .clock-divider { font-family: Georgia, serif; font-size: 25px; font-weight: 400; color: #b496a458; align-self: flex-start; padding-top: 7px; }
  .time-aside { font-size: 12px; line-height: 1.9; color: #a28593; letter-spacing: 3px; text-align: right; border-left: 1px solid #b38b9f26; padding-left: 30px; }
  .page-footer { display: flex; align-items: center; justify-content: space-between; padding: 27px 2px 0; color: #9e7d8a; font-size: 12px; letter-spacing: 1.4px; }
  .page-footer > span:first-child { letter-spacing: 2px; font-size: 12px; }
  .footer-heart { margin: 0 7px; color: #b87894; }
  .page-footer p { letter-spacing: 2px; font-size: 12px; }
  .forever { font-family: Georgia, serif; font-style: italic; font-size: 13px; }
  .noscript { position: fixed; bottom: 10px; background: white; padding: 16px; }
  @keyframes float-left { 0%,100% { transform: translateY(0) rotate(-9deg); } 50% { transform: translateY(-9px) rotate(-6deg); } }
  @keyframes float-right { 0%,100% { transform: translateY(0) rotate(9deg); } 50% { transform: translateY(7px) rotate(6deg); } }
  @keyframes pulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }
}
@layer responsive {
  @media (min-width: 1700px) { .page { padding-top: 42px; } .masthead { margin-bottom: 52px; } .code-scroll { height: 605px; } .tree-stage { min-height: 425px; } }
  @media (max-width: 1250px) {
    .page { width: calc(100% - 64px); }
    .header-note { margin-left: 0; font-size: 12px; letter-spacing: 1px; }
    .story-grid { gap: 24px; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
    .code-scroll { padding: 22px; }
    .time-panel { padding: 26px; }
    .time-aside { display: none; }
    .clock { gap: 13px; }
    .time-intro h2 { font-size: 30px; }
    .tree-stage { width: calc(100% + 28px); margin-left: -14px; margin-right: -14px; }
    .note-cx { left: -4px; }
    .note-by { right: -5px; }
  }
  @media (max-width: 1000px) {
    .page { width: calc(100% - 56px); max-width: 740px; padding-top: 23px; }
    .header-note { display: none; }
    .masthead { margin-bottom: 18px; }
    .story-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .hero { grid-row: 1; min-height: 650px; }
    .hero-copy { padding-top: 12px; }
    h1 { font-size: 85px; padding-top: 12px; }
    h1 > span { padding-top: 2px; font-size: 15px; }
    .tree-stage { min-height: 420px; width: 100%; margin: 2px 0 -8px; }
    .note-cx { top: 230px; left: 9%; }
    .note-by { top: 345px; right: 7%; }
    .hero-bottom { padding-bottom: 0; }
    .hero-bottom > p { margin-bottom: 17px; }
    .letter-panel { grid-row: 2; }
    .code-scroll { height: 580px; padding: 24px 30px; }
    .time-panel { flex-direction: column; padding: 25px; gap: 25px; margin-top: 22px; }
    .time-intro { gap: 13px; }
    .time-symbol { width: 44px; height: 44px; font-size: 28px; }
    .time-intro h2 { font-size: 33px; }
    .time-intro p { margin-top: 6px; }
    .clock { gap: 23px; width: 100%; }
    .digit { font-size: 49px; }
    .page-footer { padding-top: 23px; }
  }
  @media (max-width: 600px) {
    .page { width: calc(100% - 36px); padding-top: max(19px, env(safe-area-inset-top)); padding-bottom: max(21px, env(safe-area-inset-bottom)); }
    .masthead { min-height: 44px; gap: 10px; margin-bottom: 24px; }
    .brand { gap: 8px; }
    .brand-mark { font-size: 30px; width: 44px; letter-spacing: -5px; }
    .brand-mark > span { font-size: 19px; padding: 0 3px; }
    .brand-name { font-size: 12px; letter-spacing: 2px; }
    .brand-caption { display: none; }
    .archive-link { padding: 11px 12px; font-size: 12px; gap: 6px; min-height: 44px; }
    .hero { min-height: 555px; }
    .hero-copy { padding-top: 3px; }
    .eyebrow { font-size: 12px; letter-spacing: 2px; gap: 9px; }
    .eyebrow > span { width: 17px; }
    h1 { font-size: clamp(60px, 16vw, 82px); letter-spacing: -3px; padding-top: 15px; }
    h1 > span { font-size: 14px; letter-spacing: 3px; padding-top: 9px; }
    .tree-stage { min-height: 332px; width: calc(100% + 22px); margin: 8px -11px -9px; }
    .floating-note { padding: 7px 13px 9px; gap: 9px; border-radius: 14px; }
    .floating-note .monogram { font-size: 33px; }
    .floating-note .note-heart { font-size: 18px; }
    .note-cx { top: 214px; left: 0; }
    .note-by { top: 321px; right: 1px; }
    .hero-bottom { padding-bottom: 2px; }
    .hero-bottom > p { font-size: 12px; letter-spacing: 2px; margin-bottom: 17px; }
    .heart-button { padding: 12px 19px; font-size: 13px; }
    .story-grid { gap: 27px; }
    .letter-panel { border-radius: 19px; }
    .editor-bar { min-height: 53px; padding: 0 12px 0 19px; }
    .editor-bar h2 { font-size: 12px; }
    .window-dots { gap: 5px; }
    .window-dots i { width: 8px; height: 8px; }
    .code-scroll { height: 505px; padding: 20px 19px; }
    #code { font-size: 14px; line-height: 1.75; letter-spacing: -.3px; }
    .editor-footer { padding: 0 18px; min-height: 41px; font-size: 12px; }
    .time-panel { border-radius: 19px; padding: 24px 18px; margin-top: 18px; gap: 23px; }
    .time-intro { gap: 9px; }
    .time-symbol { width: 35px; height: 35px; font-size: 27px; flex-shrink: 0; }
    .time-intro h2 { font-size: clamp(25px, 6.7vw, 31px); }
    .time-intro p { font-size: 12px; letter-spacing: 1.2px; }
    .clock { gap: clamp(4px, 1.4vw, 10px); justify-content: space-between; }
    .time-unit { min-width: 38px; }
    .digit { font-size: clamp(31px, 8.5vw, 43px); letter-spacing: -1.5px; }
    .clock-divider { font-size: 18px; padding-top: 5px; }
    .unit { font-size: 12px; letter-spacing: 1px; }
    .page-footer { flex-wrap: wrap; row-gap: 13px; padding: 22px 3px 0; }
    .page-footer p { order: 3; width: 100%; text-align: center; font-size: 12px; padding-top: 2px; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .tree-stage { transform: none !important; }
  }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .glass { background: #fff3f5ed; } }
  @supports not (overflow-x: clip) { body { overflow-x: hidden; } }
}
