@tailwind base;
@tailwind components;
@tailwind utilities;

/* Styrene A - 只保留常用字重 */
@font-face {
  font-family: 'StyreneA';
  font-weight: 400;
  font-style: normal;
  src: url('/fonts/StyreneA/StyreneA-Regular.woff2') format('woff2'),
    url('/fonts/StyreneA/StyreneA-Regular.otf') format('opentype');
  font-display: swap;
}

@font-face {
  font-family: 'StyreneA';
  font-weight: 500;
  font-style: normal;
  src: url('/fonts/StyreneA/StyreneA-Medium.woff2') format('woff2'),
    url('/fonts/StyreneA/StyreneA-Medium.otf') format('opentype');
  font-display: swap;
}

@font-face {
  font-family: 'StyreneA';
  font-weight: 700;
  font-style: normal;
  src: url('/fonts/StyreneA/StyreneA-Bold.woff2') format('woff2'),
    url('/fonts/StyreneA/StyreneA-Bold.otf') format('opentype');
  font-display: swap;
}

/* Tiempos Text - 只保留常用字重 */
@font-face {
  font-family: 'TiemposText';
  font-weight: 400;
  font-style: normal;
  src: url('/fonts/TiemposText/TiemposText-Regular.woff2') format('woff2'),
    url('/fonts/TiemposText/TiemposText-Regular.otf') format('opentype');
  font-display: swap;
}

@font-face {
  font-family: 'TiemposText';
  font-weight: 500;
  font-style: normal;
  src: url('/fonts/TiemposText/TiemposText-Medium.woff2') format('woff2'),
    url('/fonts/TiemposText/TiemposText-Medium.otf') format('opentype');
  font-display: swap;
}

@font-face {
  font-family: 'TiemposText';
  font-weight: 600;
  font-style: normal;
  src: url('/fonts/TiemposText/TiemposText-Semibold.woff2') format('woff2'),
    url('/fonts/TiemposText/TiemposText-Semibold.otf') format('opentype');
  font-display: swap;
}

@layer base {
  :root {
    /* Claude theme palette */
    --slate-dark: #3d3929;
    --slate-medium: #6c695c;
    --slate-light: #cbc9c2;

    /* Neutral tones */
    --cloud-dark: #3d3d3a;
    --cloud-medium: #e9e6dc;
    --cloud-light: #f5f4ee;

    /* Ivory accents */
    --ivory-dark: #ede9de;
    --ivory-medium: #e9e6dc;
    --ivory-light: #faf9f5;

    /* Warm accents */
    --book-cloth: #c96442;
    --kraft: #e4b2a0;
    --manilla: #f4e0d9;

    /* Functional colors */
    --black: #1a1815;
    --white: #ffffff;
    --focus: rgba(201, 100, 66, 0.35);
    --link: #75a9f2;
    --error: #ef4444;

    /* Typography */
    --sans-serif: 'StyreneA', 'Helvetica', 'HarmonyOS Sans', 'SF Pro Display', 'Segoe UI', system-ui,
      -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Noto Sans SC', sans-serif;
    --serif: 'TiemposText', 'STZhongsong', 'Fang Song', serif;
    --monospace: 'Cascadia Code', 'Cascadia mono', 'Fira Code', 'MonoLisa Trial', 'MonaLisa',
      'JetBrains Mono', sans-serif;
    --font-sans: var(--sans-serif);
    --font-serif: var(--serif);
    --font-mono: var(--monospace);
    --list-item-border-radius: 0.5rem;

    /* Letter spacing */
    --tracking-normal: 0em;
    --tracking-tighter: calc(var(--tracking-normal) - 0.05em);
    --tracking-tight: calc(var(--tracking-normal) - 0.025em);
    --tracking-wide: calc(var(--tracking-normal) + 0.025em);
    --tracking-wider: calc(var(--tracking-normal) + 0.05em);
    --tracking-widest: calc(var(--tracking-normal) + 0.1em);

    /* Custom aliases */
    --color-black-soft: var(--slate-dark);
    --color-primary: var(--book-cloth);
    --color-primary-soft: var(--kraft);
    --color-primary-mute: var(--manilla);
    --color-text: var(--slate-dark);
    --color-background: var(--ivory-light);
    --color-background-soft: var(--ivory-medium);
    --color-background-mute: var(--ivory-dark);
    --navbar-background: var(--ivory-medium);
    --navbar-background-mac: rgba(250, 249, 245, 0.55);
    --chat-background: var(--ivory-light);
    --chat-background-user: var(--ivory-medium);
    --chat-background-assistant: var(--ivory-light);
    --color-icon: var(--slate-dark);
    --color-icon-white: var(--cloud-medium);
    --color-border: rgba(61, 57, 41, 0.15);
    --color-border-soft: rgba(61, 57, 41, 0.1);
    --color-border-mute: rgba(61, 57, 41, 0.05);
    --color-code-background: #e9e6dc;
    --color-code-text: var(--slate-dark);
    --command-panel-background: rgba(255, 252, 247, 0.95);
    --command-panel-border-color: rgba(204, 120, 92, 0.32);
    --command-panel-shadow-color: rgba(201, 100, 66, 0.2);
    --config-panel-background: #fdf9f4;
    --config-panel-border-color: rgba(61, 57, 41, 0.12);
    --config-panel-shadow-color: rgba(61, 57, 41, 0.08);
    --config-panel-header-background: rgba(252, 249, 243, 0.85);
    --color-hover: var(--ivory-medium);
    --color-active: var(--kraft);
    --color-frame-border: var(--cloud-medium);
    --color-group-background: var(--ivory-medium);
    --color-reference: var(--cloud-medium);
    --color-reference-text: var(--slate-dark);
    --color-reference-background: var(--ivory-light);
    --color-error: var(--error);
    --color-link: var(--link);
    --color-white: var(--white);
    --input-container-background: var(--color-white);
    --input-background: var(--color-background);
    --input-shadow: rgba(61, 57, 41, 0.08);

    /* Claude theme tokens */
    color-scheme: light;
    --background: oklch(0.9818 0.0054 95.0986);
    --foreground: oklch(0.3438 0.0269 95.7226);
    --card: oklch(0.9818 0.0054 95.0986);
    --card-foreground: oklch(0.1908 0.002 106.5859);
    --popover: oklch(1 0 0);
    --popover-foreground: oklch(0.2671 0.0196 98.939);
    --primary: oklch(0.6171 0.1375 39.0427);
    --primary-foreground: oklch(1 0 0);
    --secondary: oklch(0.9245 0.0138 92.9892);
    --secondary-foreground: oklch(0.4334 0.0177 98.6048);
    --muted: oklch(0.9341 0.0153 90.239);
    --muted-foreground: oklch(0.6059 0.0075 97.4233);
    --accent: oklch(0.9245 0.0138 92.9892);
    --accent-foreground: oklch(0.2671 0.0196 98.939);
    --destructive: oklch(0.1908 0.002 106.5859);
    --destructive-foreground: oklch(1 0 0);
    --border: oklch(0.8847 0.0069 97.3627);
    --input: oklch(0.7621 0.0156 98.3528);
    --ring: oklch(0.6171 0.1375 39.0427);
    --radius: 0.5rem;

    --chart-1: oklch(0.5583 0.1276 42.9956);
    --chart-2: oklch(0.6898 0.1581 290.4107);
    --chart-3: oklch(0.8816 0.0276 93.128);
    --chart-4: oklch(0.8822 0.0403 298.1792);
    --chart-5: oklch(0.5608 0.1348 42.0584);

    --sidebar: oklch(0.9663 0.008 98.8792);
    --sidebar-foreground: oklch(0.359 0.0051 106.6524);
    --sidebar-primary: oklch(0.6171 0.1375 39.0427);
    --sidebar-primary-foreground: oklch(0.9881 0 0);
    --sidebar-accent: oklch(0.9245 0.0138 92.9892);
    --sidebar-accent-foreground: oklch(0.325 0 0);
    --sidebar-border: oklch(0.9401 0 0);
    --sidebar-ring: oklch(0.7731 0 0);

    --shadow-color: oklch(0 0 0);
    --shadow-opacity: 0.1;
    --shadow-blur: 3px;
    --shadow-spread: 0px;
    --shadow-offset-x: 0;
    --shadow-offset-y: 1px;

    --shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
    --shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
    --shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
    --shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
    --shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 2px 4px -1px hsl(0 0% 0% / 0.1);
    --shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 4px 6px -1px hsl(0 0% 0% / 0.1);
    --shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 8px 10px -1px hsl(0 0% 0% / 0.1);
    --shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);

    --shell-glass: rgba(250, 249, 245, 0.8);
    --shell-border: rgba(61, 57, 41, 0.16);
    --shell-shadow: 0 25px 65px rgba(201, 100, 66, 0.18);
    --shell-sidebar-shadow: 0 45px 95px rgba(61, 57, 41, 0.12);
  }

  body[theme-mode='light'] {
    --color-primary-rgb: 201, 100, 66;
    --color-primary: var(--book-cloth);
    --color-primary-soft: var(--kraft);
    --color-primary-mute: var(--manilla);
    --color-text: var(--slate-dark);
    --input-container-background: var(--color-white);
    --input-background: var(--color-background);
    --input-shadow: rgba(61, 57, 41, 0.08);
  }

  body[theme-mode='light']::selection {
    background-color: var(--book-cloth);
    color: var(--ivory-light);
  }

  body[theme-mode='dark'],
  .dark {
    color-scheme: dark;
    --color-primary-rgb: 217, 119, 87;
    --slate-dark: #262624;
    --slate-medium: #30302e;
    --slate-light: #3e3e38;
    --cloud-dark: #b7b5a9;
    --cloud-medium: #c3c0b6;
    --cloud-light: #e5e5e2;
    --ivory-dark: #b7b5a9;
    --ivory-medium: #e5e5e2;
    --ivory-light: #faf9f5;
    --book-cloth: #d97757;
    --kraft: #ecbbab;
    --manilla: #f7e4dd;
    --color-text: var(--ivory-light);
    --color-background: var(--slate-dark);
    --color-background-soft: var(--slate-medium);
    --color-background-mute: var(--slate-light);
    --navbar-background: var(--slate-medium);
    --navbar-background-mac: rgba(38, 38, 36, 0.6);
    --chat-background: var(--slate-dark);
    --chat-background-user: var(--book-cloth);
    --chat-background-assistant: var(--slate-medium);
    --color-primary: var(--book-cloth);
    --color-primary-soft: var(--kraft);
    --color-primary-mute: var(--manilla);
    --color-icon: var(--cloud-light);
    --color-icon-white: var(--cloud-medium);
    --color-border: rgba(227, 224, 211, 0.16);
    --color-border-soft: rgba(227, 224, 211, 0.12);
    --color-border-mute: rgba(227, 224, 211, 0.08);
    --color-code-background: var(--slate-medium);
    --color-code-text: var(--ivory-light);
    --command-panel-background: rgba(43, 40, 37, 0.95);
    --command-panel-border-color: rgba(235, 219, 188, 0.24);
    --command-panel-shadow-color: rgba(0, 0, 0, 0.55);
    --config-panel-background: rgba(30, 28, 25, 0.92);
    --config-panel-border-color: rgba(235, 219, 188, 0.18);
    --config-panel-shadow-color: rgba(0, 0, 0, 0.45);
    --config-panel-header-background: rgba(42, 39, 35, 0.75);
    --color-hover: var(--slate-medium);
    --color-active: var(--slate-light);
    --color-frame-border: var(--slate-light);
    --color-group-background: var(--slate-medium);
    --color-reference: var(--slate-light);
    --color-reference-text: var(--ivory-light);
    --color-reference-background: var(--slate-dark);
    --color-white: var(--ivory-light);
    --input-container-background: var(--slate-medium);
    --input-background: var(--slate-dark);
    --input-shadow: rgba(0, 0, 0, 0.32);

    --background: oklch(0.2679 0.0036 106.6427);
    --foreground: oklch(0.8074 0.0142 93.0137);
    --card: oklch(0.2679 0.0036 106.6427);
    --card-foreground: oklch(0.9818 0.0054 95.0986);
    --popover: oklch(0.3085 0.0035 106.6039);
    --popover-foreground: oklch(0.9211 0.004 106.4781);
    --primary: oklch(0.6724 0.1308 38.7559);
    --primary-foreground: oklch(1 0 0);
    --secondary: oklch(0.9818 0.0054 95.0986);
    --secondary-foreground: oklch(0.3085 0.0035 106.6039);
    --muted: oklch(0.2213 0.0038 106.707);
    --muted-foreground: oklch(0.7713 0.0169 99.0657);
    --accent: oklch(0.213 0.0078 95.4245);
    --accent-foreground: oklch(0.9663 0.008 98.8792);
    --destructive: oklch(0.6368 0.2078 25.3313);
    --destructive-foreground: oklch(1 0 0);
    --border: oklch(0.3618 0.0101 106.8928);
    --input: oklch(0.4336 0.0113 100.2195);
    --ring: oklch(0.6724 0.1308 38.7559);
    --chart-1: oklch(0.5583 0.1276 42.9956);
    --chart-2: oklch(0.6898 0.1581 290.4107);
    --chart-3: oklch(0.213 0.0078 95.4245);
    --chart-4: oklch(0.3074 0.0516 289.323);
    --chart-5: oklch(0.5608 0.1348 42.0584);
    --sidebar: oklch(0.2357 0.0024 67.7077);
    --sidebar-foreground: oklch(0.8074 0.0142 93.0137);
    --sidebar-primary: oklch(0.325 0 0);
    --sidebar-primary-foreground: oklch(0.9881 0 0);
    --sidebar-accent: oklch(0.168 0.002 106.6177);
    --sidebar-accent-foreground: oklch(0.8074 0.0142 93.0137);
    --sidebar-border: oklch(0.9401 0 0);
    --sidebar-ring: oklch(0.7731 0 0);

    --shell-glass: rgba(38, 38, 36, 0.68);
    --shell-border: rgba(195, 192, 182, 0.18);
    --shell-shadow: 0 25px 65px rgba(0, 0, 0, 0.5);
    --shell-sidebar-shadow: 0 45px 95px rgba(0, 0, 0, 0.55);
  }

  body[theme-mode='dark']::selection,
  .dark::selection {
    background-color: var(--book-cloth);
    color: var(--ivory-light);
  }

  body[theme-mode='light'] #content-container {
    background-color: var(--ivory-light) !important;
  }

  body[theme-mode='dark'] #content-container,
  .dark #content-container {
    background-color: var(--slate-medium) !important;
  }

  body {
    @apply bg-background text-foreground antialiased;
    min-height: 100vh;
    background-color: var(--background);
    font-family: var(--font-sans);
    color: var(--color-text);
    letter-spacing: var(--tracking-normal);
    transition:
      background-color 0.35s ease,
      color 0.35s ease;
  }

  * {
    @apply border-border;
  }
}

* {
  font-variant-ligatures: normal;
}

/* Literary Tech 全局字体规则 */
/* 标题层级使用衬线体 */
h1,
h2,
h3,
h4,
h5,
h6,
.literary-heading {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.015em;
}

/* 大标题特殊处理 */
h1 {
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* 正文内容使用衬线体 */
.literary-body,
article p,
.prose p {
  font-family: var(--serif);
  line-height: 1.7;
  letter-spacing: 0.005em;
}

/* UI 元素保持无衬线体 */
.literary-ui,
button,
input,
select,
label,
nav,
.btn,
[class*="button"] {
  font-family: var(--sans-serif);
}

#app {
  min-height: 100vh;
}

::selection {
  background-color: var(--color-primary-soft);
  color: var(--color-text);
}

.assistant-tab {
  font-family: var(--serif) !important;
  font-size: small !important;
}

.assistant-tab * {
  transition: all 0.3s ease-in-out !important;
}

.ant-avatar {
  box-shadow: 0 0 0 1px var(--color-border-soft) !important;
  border-radius: 999rem !important;
}

#content-container {
  font-family: var(--sans-serif);
}

.markdown {
  font-family: var(--serif);
}

.markdown p {
  line-height: 1.65em;
  font-weight: 200;
}

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4 {
  font-family: var(--serif);
  font-weight: 500;
  padding: 0.5rem 0;
  text-align: center;
}

.markdown blockquote,
.markdown th {
  font-family: var(--sans-serif);
}

.markdown a {
  text-underline-offset: 0.1em;
  text-decoration-color: var(--color-primary-soft);
  text-decoration-thickness: 0.1em;
  text-decoration-style: dashed;
}

.markdown a:hover {
  text-decoration-style: solid;
}

.markdown table,
.markdown th,
.markdown td,
.markdown blockquote {
  font-size: small;
  font-family: var(--sans-serif);
}

code,
pre {
  font-family: var(--monospace) !important;
}

:not(pre)>code {
  background-color: transparent !important;
  color: var(--color-code-text) !important;
  padding: 0 !important;
  border-radius: 0 !important;
  white-space: nowrap !important;
  font-weight: 500 !important;
  margin: 0 !important;
}

.inputbar {
  background-color: var(--color-background) !important;
}

.inputbar textarea {
  font-size: 1rem;
  font-family: var(--sans-serif);
}

.inputbar-container {
  background-color: var(--color-background-soft) !important;
  filter: drop-shadow(0 0 1.25rem hsl(0 0% 0% / 3.5%));
  transition: all 0.3s ease-in-out;
}

.inputbar-container.focus {
  filter: drop-shadow(0 0 1.25rem hsl(0 0% 0% / 7.5%));
}

.bubble .message-content-container {
  border-radius: 1rem;
  border: 0.7pt solid var(--color-border-soft);
}

.bubble .message-user .message-action-button:hover {
  background-color: var(--color-background-mute);
}

.ant-btn,
.ant-input-outlined {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.ant-btn:focus,
.ant-btn:focus-visible,
.ant-input-outlined:focus,
.ant-input-outlined:focus-visible {
  box-shadow: 0 0 0 2pt var(--focus);
  border-color: var(--color-border-mute) !important;
}

.ant-btn:hover,
.ant-input-outlined:hover {
  border-color: var(--color-border-soft) !important;
}

.footnotes {
  background-color: var(--color-background-soft);
}

.ant-dropdown-menu {
  border-style: solid;
  border-width: 1px;
  border-color: var(--color-border);
}

.ant-segmented-group * {
  border-radius: 0.5rem !important;
}

.ant-dropdown-trigger {
  --color-border: transparent !important;
  transition: all 0.3s ease-in-out !important;
}

* {
  --ant-color-primary-hover: var(--color-primary) !important;
  --ant-color-primary: var(--color-primary) !important;
}

.ant-switch {
  scale: 0.95;
  background: var(--color-primary-mute) !important;
  transition: all 0.3s ease-in-out;
}

.ant-switch.ant-switch-checked {
  background: var(--book-cloth) !important;
}

.ant-switch:hover:not(.ant-switch-disabled) {
  scale: 1;
}

.ant-select-selector {
  border-color: var(--color-border-soft) !important;
  transition: all 0.3s ease-in-out;
}

.ant-select-selector:hover {
  border-color: var(--color-border) !important;
}

.ant-select-focused .ant-select-selector {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 2pt var(--focus) !important;
}

.ant-select-item-option {
  margin-top: 2pt;
}

.ant-select-item-option-selected {
  background-color: transparent !important;
}

.ant-select-item-option-active {
  background-color: var(--color-active) !important;
  border-color: var(--color-border-soft) !important;
}

.ant-slider {
  margin: 5pt 0 !important;
  padding-block: 0 !important;
  height: 15pt !important;
}

.ant-slider .ant-slider-handle {
  opacity: 0 !important;
}

.ant-slider .ant-slider-rail {
  border-radius: 999rem !important;
  height: 10pt !important;
  background-color: var(--color-border-soft) !important;
}

.ant-slider .ant-slider-track {
  border-radius: 999rem !important;
  height: 10pt !important;
  background-color: var(--color-primary) !important;
}

.ant-slider-step {
  height: 10pt !important;
  border-radius: 999rem !important;
  overflow: hidden !important;
  top: 0 !important;
}

.ant-slider-step span {
  inset-block-start: 0 !important;
  border-radius: 0 !important;
  border-color: transparent !important;
  background: var(--color-border-soft) !important;
  width: 1em !important;
  height: 10pt !important;
}

.ant-btn>div>span:nth-child(2) {
  font-family: var(--serif) !important;
  margin-top: 0.1em !important;
}

.ant-btn-variant-outlined:hover {
  color: var(--color-primary) !important;
}

.ant-btn-variant-solid:not(:disabled) {
  background-color: var(--color-black-soft) !important;
}

#app-sidebar div {
  transition: all 0.1s ease-in-out !important;
}

#app-sidebar div.active {
  background-color: var(--color-active) !important;
  border: 0;
}

#app-sidebar div.active i,
#app-sidebar div.active span {
  color: var(--color-primary);
}

/* ==========================================
   Literary Tech / Wenren Geek Style
   "Da Vinci manuscript meets modern IDE"
   ========================================== */

/* Paper texture overlay - 宣纸/磨砂玻璃质感 */
.literary-paper {
  position: relative;
}

.literary-paper::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.025;
  pointer-events: none;
  mix-blend-mode: overlay;
  z-index: 1;
}

.dark .literary-paper::before,
body[theme-mode='dark'] .literary-paper::before {
  opacity: 0.04;
  mix-blend-mode: soft-light;
}

/* Blueprint-style precision borders - 工程蓝图细线条 */
.literary-border {
  border-width: 1px;
  border-style: solid;
  border-color: rgba(61, 57, 41, 0.12);
  box-shadow: none;
}

.dark .literary-border,
body[theme-mode='dark'] .literary-border {
  border-color: rgba(250, 249, 245, 0.1);
}

.literary-border-accent {
  border-width: 1px;
  border-style: solid;
  border-color: rgba(201, 100, 66, 0.25);
}

.dark .literary-border-accent,
body[theme-mode='dark'] .literary-border-accent {
  border-color: rgba(217, 119, 87, 0.3);
}

/* Enhanced typography for literary style */
.literary-title {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--slate-dark);
}

.dark .literary-title,
body[theme-mode='dark'] .literary-title {
  color: var(--ivory-light);
}

.literary-subtitle {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.01em;
  color: var(--slate-medium);
}

.dark .literary-subtitle,
body[theme-mode='dark'] .literary-subtitle {
  color: var(--cloud-medium);
}

/* Monospace data zones - 等宽数据区 */
.literary-data {
  font-family: var(--monospace);
  font-size: 0.875rem;
  letter-spacing: -0.01em;
  background: rgba(61, 57, 41, 0.03);
  border: 1px solid rgba(61, 57, 41, 0.08);
  padding: 1rem;
}

.dark .literary-data,
body[theme-mode='dark'] .literary-data {
  background: rgba(250, 249, 245, 0.03);
  border-color: rgba(250, 249, 245, 0.08);
}

/* Manuscript card style */
.literary-card {
  position: relative;
  background: rgba(250, 249, 245, 0.7);
  border: 1px solid rgba(61, 57, 41, 0.1);
  border-radius: 0.375rem;
  padding: 1.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.literary-card:hover {
  border-color: rgba(201, 100, 66, 0.35);
}

.dark .literary-card,
body[theme-mode='dark'] .literary-card {
  background: rgba(38, 38, 36, 0.6);
  border-color: rgba(250, 249, 245, 0.08);
}

.dark .literary-card:hover,
body[theme-mode='dark'] .literary-card:hover {
  border-color: rgba(217, 119, 87, 0.4);
}

/* Blueprint grid pattern for backgrounds */
.literary-grid {
  background-image:
    linear-gradient(rgba(61, 57, 41, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(61, 57, 41, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
}

.dark .literary-grid,
body[theme-mode='dark'] .literary-grid {
  background-image:
    linear-gradient(rgba(250, 249, 245, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(250, 249, 245, 0.03) 1px, transparent 1px);
}

/* Accent line decorations - like technical drawings */
.literary-accent-line {
  position: relative;
}

.literary-accent-line::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 3rem;
  height: 2px;
  background: var(--book-cloth);
}

/* Section divider */
.literary-divider {
  height: 1px;
  background: linear-gradient(to right,
      transparent,
      rgba(61, 57, 41, 0.15) 20%,
      rgba(61, 57, 41, 0.15) 80%,
      transparent);
  margin: 2rem 0;
}

.dark .literary-divider,
body[theme-mode='dark'] .literary-divider {
  background: linear-gradient(to right,
      transparent,
      rgba(250, 249, 245, 0.12) 20%,
      rgba(250, 249, 245, 0.12) 80%,
      transparent);
}

/* Manuscript badge/chip */
.literary-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  font-family: var(--monospace);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border: 1px solid rgba(201, 100, 66, 0.3);
  color: var(--book-cloth);
  background: transparent;
}

.dark .literary-badge,
body[theme-mode='dark'] .literary-badge {
  border-color: rgba(217, 119, 87, 0.35);
  color: var(--book-cloth);
}

/* Enhanced contrast surfaces */
.literary-surface-elevated {
  background: var(--ivory-light);
  border: 1px solid rgba(61, 57, 41, 0.08);
}

.dark .literary-surface-elevated,
body[theme-mode='dark'] .literary-surface-elevated {
  background: var(--slate-medium);
  border-color: rgba(250, 249, 245, 0.06);
}

.literary-surface-inset {
  background: rgba(61, 57, 41, 0.025);
  border: 1px solid rgba(61, 57, 41, 0.06);
}

.dark .literary-surface-inset,
body[theme-mode='dark'] .literary-surface-inset {
  background: rgba(0, 0, 0, 0.15);
  border-color: rgba(250, 249, 245, 0.04);
}

/* Technical annotation style */
.literary-annotation {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--monospace);
  font-size: 0.6875rem;
  color: var(--slate-medium);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.literary-annotation::before {
  content: '//';
  color: var(--book-cloth);
  opacity: 0.6;
}

.dark .literary-annotation,
body[theme-mode='dark'] .literary-annotation {
  color: var(--cloud-medium);
}

/* Ruler/measurement style decoration */
.literary-ruler {
  position: relative;
  padding-left: 2rem;
}

.literary-ruler::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: repeating-linear-gradient(to bottom,
      var(--book-cloth) 0,
      var(--book-cloth) 4px,
      transparent 4px,
      transparent 8px);
  opacity: 0.5;
}

@layer components {
  .app-shell {
    @apply relative h-screen overflow-hidden;
  }

  /* Literary Tech: Paper texture overlay for app-shell */
  .app-shell::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
      url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.02;
    pointer-events: none;
    mix-blend-mode: overlay;
    z-index: 0;
  }

  .dark .app-shell::before,
  body[theme-mode='dark'] .app-shell::before {
    opacity: 0.03;
    mix-blend-mode: soft-light;
  }

  .app-shell__backdrop {
    @apply absolute inset-0 -z-10 opacity-80;
  }

  .app-shell__body {
    @apply relative flex h-screen;
  }

  .app-shell__sidebar {
    /* Base styles - extended by component sidebarClass */
    @apply flex-shrink-0;
  }

  /* 侧边栏导航滚动区域 */
  .sidebar-nav-scroll {
    @apply overflow-y-auto;
    /* 隐藏滚动条但保留滚动功能 */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .sidebar-nav-scroll::-webkit-scrollbar {
    display: none;
  }

  .app-shell__sidebar-card {
    @apply rounded-2xl border p-3 flex-shrink-0;
    background: rgba(250, 250, 247, 0.75);
    border-color: rgba(145, 145, 141, 0.2);
    /* Literary Tech: Remove inner shadow */
  }

  .dark .app-shell__sidebar-card,
  body[theme-mode='dark'] .app-shell__sidebar-card {
    background: rgba(38, 38, 37, 0.72);
    border-color: rgba(250, 250, 247, 0.12);
  }

  .app-shell__content {
    /* Fill remaining space, scroll independently */
    @apply flex-1 min-w-0 h-screen overflow-y-auto flex flex-col;
  }

  .app-shell__main {
    /* Main content area with padding */
    @apply flex-1 px-4 py-6 sm:px-6 lg:px-8 lg:py-8;
  }

  .surface-glass {
    @apply border rounded-3xl backdrop-blur-2xl;
    background: rgba(250, 250, 247, 0.82);
    border-color: rgba(145, 145, 141, 0.2);
    /* Literary Tech: Remove glow shadow, use subtle border only */
    box-shadow: none;
  }

  .dark .surface-glass,
  body[theme-mode='dark'] .surface-glass {
    background: rgba(38, 38, 37, 0.78);
    border-color: rgba(250, 250, 247, 0.14);
  }

  .surface-glass.soft {
    background: rgba(240, 238, 231, 0.68);
  }

  .shell-panel {
    @apply px-5 py-6 transition-all duration-300;
  }

  .shell-chip {
    @apply inline-flex items-center rounded-full border px-3 py-1 text-[10px] sm:text-[11px] font-semibold uppercase tracking-[0.3em] sm:tracking-[0.45em];
    border-color: rgba(204, 120, 92, 0.35);
    background: rgba(204, 120, 92, 0.12);
    color: var(--color-primary);
    /* Literary Tech: Remove inner shadow */
  }

  .dark .shell-chip,
  body[theme-mode='dark'] .shell-chip {
    border-color: rgba(250, 250, 247, 0.18);
    background: rgba(36, 36, 36, 0.6);
    color: var(--color-reference-text);
  }

  .shell-toolbar {
    @apply flex flex-col gap-3;
  }

  .shell-toolbar__field {
    @apply flex w-full items-center gap-2 rounded-2xl border px-3 py-2 text-sm;
    background: rgba(250, 250, 247, 0.85);
    border-color: rgba(145, 145, 141, 0.25);
  }

  .dark .shell-toolbar__field,
  body[theme-mode='dark'] .shell-toolbar__field {
    background: rgba(38, 38, 37, 0.65);
    border-color: rgba(250, 250, 247, 0.14);
  }

  .sidebar-nav__link {
    @apply flex items-center gap-3 rounded-2xl border px-4 py-3 text-sm font-semibold transition-all duration-200;
    border-color: transparent;
  }

  .sidebar-nav__link--idle {
    color: var(--slate-medium);
    background: transparent;
  }

  .dark .sidebar-nav__link--idle,
  body[theme-mode='dark'] .sidebar-nav__link--idle {
    color: rgba(250, 250, 247, 0.75);
  }

  .sidebar-nav__link--idle:hover {
    border-color: rgba(204, 120, 92, 0.3);
    background: rgba(204, 120, 92, 0.15);
    color: var(--color-primary);
  }

  .dark .sidebar-nav__link--idle:hover,
  body[theme-mode='dark'] .sidebar-nav__link--idle:hover {
    border-color: rgba(250, 250, 247, 0.18);
    background: rgba(204, 120, 92, 0.22);
    color: var(--color-reference-text);
  }

  .sidebar-nav__link--active {
    border-color: rgba(204, 120, 92, 0.35);
    background-color: rgba(204, 120, 92, 0.18);
    color: var(--color-primary);
    /* Literary Tech: Remove glow shadow */
  }

  .dark .sidebar-nav__link--active,
  body[theme-mode='dark'] .sidebar-nav__link--active {
    border-color: rgba(250, 250, 247, 0.18);
    color: var(--color-reference-text);
    background-color: rgba(204, 120, 92, 0.25);
  }

  .sidebar-nav__icon {
    @apply flex h-10 w-10 items-center justify-center rounded-2xl transition-all;
    background: rgba(250, 250, 247, 0.9);
    color: var(--slate-medium);
  }

  .sidebar-nav__link:hover .sidebar-nav__icon {
    background: rgba(204, 120, 92, 0.22);
    color: var(--color-primary);
  }

  .dark .sidebar-nav__icon,
  body[theme-mode='dark'] .sidebar-nav__icon {
    background: rgba(38, 38, 37, 0.6);
    color: rgba(250, 250, 247, 0.75);
  }

  .sidebar-nav__icon--active {
    background-color: var(--color-primary);
    color: var(--color-white);
    /* Literary Tech: Remove glow shadow */
  }

  .dark .sidebar-nav__icon--active,
  body[theme-mode='dark'] .sidebar-nav__icon--active {
    background-color: var(--color-primary);
  }

  .sidebar-nav-enter-active,
  .sidebar-nav-leave-active {
    transition: all 0.18s ease;
  }

  .sidebar-nav-enter-from,
  .sidebar-nav-leave-to {
    opacity: 0;
    transform: translateY(4px);
  }

  .sidebar-nav-move {
    transition: transform 0.18s ease;
  }

  .sidebar-nav__label {
    @apply leading-tight;
  }

  .sidebar-nav__description {
    @apply text-[11px] font-normal;
    color: var(--slate-medium);
  }

  .dark .sidebar-nav__description,
  body[theme-mode='dark'] .sidebar-nav__description {
    color: rgba(250, 250, 247, 0.7);
  }

  .app-shell__gradient {
    @apply pointer-events-none absolute inset-0;
  }

  .app-shell__gradient--primary {
    display: none;
  }

  .app-shell__gradient--accent {
    display: none;
  }

  .sidebar-profile-card {
    @apply mt-auto rounded-3xl p-5 text-white;
    background-color: var(--book-cloth);
    /* Literary Tech: Remove glow shadow */
  }

  .dark .sidebar-profile-card,
  body[theme-mode='dark'] .sidebar-profile-card {
    background-color: var(--book-cloth);
  }

  .scrollbar-hide {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .scrollbar-hide::-webkit-scrollbar {
    display: none;
  }

  .scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--border)) transparent;
  }

  .scrollbar-thin::-webkit-scrollbar {
    width: 6px;
  }

  .scrollbar-thin::-webkit-scrollbar-track {
    background: transparent;
  }

  .scrollbar-thin::-webkit-scrollbar-thumb {
    background-color: hsl(var(--border));
    border-radius: 3px;
  }

  .scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background-color: hsl(var(--muted-foreground) / 0.5);
  }

  /* Password masking without type="password" to prevent browser autofill */
  .-webkit-text-security-disc {
    -webkit-text-security: disc;
    -moz-text-security: disc;
    text-security: disc;
  }
}
