/* ============================================================
   简纸 Konshi — 主题系统 | Refined Warm Minimalist
   ============================================================ */

:root {
  /* ---- Brand ---- */
  --color-primary: #c17b3c;
  --color-primary-dark: #8a5626;
  --color-primary-light: #f0dfcd;

  /* ---- Paper Backgrounds ---- */
  --color-bg-app: #f5f0ea;
  --color-bg-paper: #faf5ef;
  --color-bg-surface: #ffffff;
  --color-bg-soft: #ece6de;
  --color-bg-muted: #e2dad0;

  /* ---- Text ---- */
  --color-text-primary: #1c1814;
  --color-text-secondary: #7a6b5e;
  --color-text-tertiary: #afa194;

  /* ---- Borders ---- */
  --color-border: #e3dbd2;
  --color-border-strong: #d0c5b9;
  --color-divider: #ece6de;
  --color-white: #ffffff;

  /* ---- Functional ---- */
  --color-success: #5f8a45;
  --color-warning: #c17b3c;
  --color-error: #b94a3e;
  --color-info: #6d9eba;

  /* ---- Craft / Illustration ---- */
  --color-tape: #d9a46f;
  --color-folder: #bc8f5a;
  --color-card-blue: #d6e2df;
  --color-card-yellow: #f1d7a5;

  /* ---- Typography ---- */
  --font-family-display: "LXGW WenKai", "Ma Shan Zheng", "STKaiti", "KaiTi", serif;
  --font-family-body: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-family-ui: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;

  --font-size-xs: 12px;
  --font-size-sm: 13px;
  --font-size-base: 15px;
  --font-size-md: 17px;
  --font-size-lg: 20px;
  --font-size-xl: 24px;
  --font-size-2xl: 28px;
  --font-size-h1: 26px;
  --font-size-h2: 21px;
  --font-size-h3: 18px;
  --font-size-body: 15px;
  --font-size-caption: 12px;
  --font-size-tab: 13px;

  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-loose: 1.7;

  /* ---- Spacing (4px base) ---- */
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 20px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 40px;
  --space-4xl: 48px;
  --space-5xl: 64px;
  --space-6xl: 80px;

  /* ---- Layout ---- */
  --page-padding-x: 20px;
  --section-gap: 24px;
  --card-gap: 14px;
  --search-height: 48px;
  --quick-action-size: 60px;
  --tool-card-height: 124px;
  --tabbar-height: 72px;
  --status-bar-height: 44px;

  /* ---- Radius ---- */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-2xl: 30px;
  --radius-pill: 999px;
  --radius-card: 16px;
  --radius-paper-card: 14px;
  --radius-search: 999px;
  --radius-btn: 999px;

  /* ---- Shadows (warm, layered) ---- */
  --shadow-xs: 0 1px 2px rgba(40, 30, 20, 0.05);
  --shadow-sm: 0 2px 6px rgba(40, 30, 20, 0.07), 0 1px 2px rgba(40, 30, 20, 0.04);
  --shadow-md: 0 6px 16px rgba(40, 30, 20, 0.08), 0 2px 6px rgba(40, 30, 20, 0.05);
  --shadow-paper: 0 4px 12px rgba(50, 38, 25, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  --shadow-inner: inset 0 1px 3px rgba(50, 38, 25, 0.06);

  /* ---- Borders ---- */
  --border-paper: 1px solid var(--color-border);
  --border-paper-strong: 1px solid var(--color-border-strong);
  --border-dashed: 1px dashed var(--color-border-strong);

  /* ---- Opacity ---- */
  --opacity-disabled: 0.40;
  --opacity-muted: 0.60;

  /* ---- Paper Texture ---- */
  --paper-noise-opacity: 0.035;
  --paper-fold-opacity: 0.08;
  --paper-edge-opacity: 0.12;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-family: var(--font-family-body);
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  background: var(--color-bg-app);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg-app);
}

button { font: inherit; border: 0; cursor: pointer; background: transparent; transition: opacity 0.15s, transform 0.15s; }
button:active { transform: scale(0.97); }
a { color: inherit; text-decoration: none; transition: color 0.15s; }
input, textarea { font: inherit; border: 0; outline: none; }
ul, ol { list-style: none; margin: 0; padding: 0; }

/* ============================================================
   Screen Container
   ============================================================ */
.screen {
  position: relative;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-paper);
}

.screen::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: var(--paper-noise-opacity);
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.5), transparent);
}

.screen > * { position: relative; z-index: 1; }

/* ============================================================
   Status Bar
   ============================================================ */
.status-bar {
  height: var(--status-bar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-2xl) 0;
  font-family: var(--font-family-ui);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  flex-shrink: 0;
}

.status-left {
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-md);
  letter-spacing: 0.5px;
}

.status-icons {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-text-secondary);
}

.signal-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.signal-bars .bar { width: 3px; background: currentColor; border-radius: 1px; }
.wifi-icon { font-size: var(--font-size-md); line-height: 1; }

.battery-icon {
  position: relative; display: inline-flex; align-items: center;
  width: 22px; height: 11px; padding: 1.5px;
  border: 1.5px solid currentColor; border-radius: 2px; box-sizing: content-box;
}
.battery-icon::after {
  content: ''; position: absolute; right: -4px; top: 50%;
  transform: translateY(-50%); width: 3px; height: 5px;
  background: currentColor; border-radius: 0 1px 1px 0;
}
.battery-fill { width: 72%; height: 100%; background: currentColor; border-radius: 1px; }

/* ============================================================
   Page Header
   ============================================================ */
.page-header {
  padding: var(--space-2xl) var(--page-padding-x) var(--space-xl);
  text-align: center;
}

.page-title {
  margin: 0;
  font-family: var(--font-family-display);
  font-size: var(--font-size-h1);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: 0.5px;
  color: var(--color-text-primary);
}

/* ============================================================
   Page Content
   ============================================================ */
.page-main {
  flex: 1;
  padding: 0 var(--page-padding-x) var(--tabbar-height);
}

/* ============================================================
   Paper Note / 纸面便签
   ============================================================ */
.paper-note {
  position: relative;
  padding: var(--space-xl) var(--space-2xl);
  margin-bottom: var(--section-gap);
  background: var(--color-bg-surface);
  border: var(--border-paper);
  border-radius: var(--radius-paper-card);
  box-shadow: var(--shadow-paper);
  overflow: hidden;
}

.paper-note::before {
  content: "";
  position: absolute;
  inset: var(--space-sm);
  border: var(--border-dashed);
  border-radius: var(--radius-sm);
  opacity: 0.08;
  pointer-events: none;
}

.note-text {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: var(--font-family-display);
  font-size: var(--font-size-h3);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-loose);
  text-align: center;
  color: var(--color-text-primary);
}

/* ============================================================
   Section Title
   ============================================================ */
.section-title {
  margin: 0 0 var(--space-md);
  font-family: var(--font-family-display);
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-text-primary);
}

/* ============================================================
   Tool Grid & Cards
   ============================================================ */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--card-gap);
}

.tool-card {
  min-height: var(--tool-card-height);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xs);
  background: var(--color-bg-surface);
  border: var(--border-paper);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.tool-card:hover { border-color: var(--color-border-strong); box-shadow: var(--shadow-md); }
.tool-card:active { transform: scale(0.96); box-shadow: var(--shadow-xs); }

.tool-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  font-size: var(--font-size-xl);
  color: var(--color-primary-dark);
  background: var(--color-bg-paper);
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s;
}

.tool-card-title {
  margin: 0;
  font-family: var(--font-family-display);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  text-align: center;
  color: var(--color-text-primary);
}

/* ============================================================
   Bottom Navigation
   ============================================================ */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--tabbar-height);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  padding: var(--space-sm) var(--space-md) var(--space-xs);
  background: var(--color-bg-surface);
  border-top: var(--border-paper);
  box-shadow: 0 -1px 4px rgba(40, 30, 20, 0.04);
  z-index: 10;
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  font-family: var(--font-family-display);
  font-size: var(--font-size-tab);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-tight);
  color: var(--color-text-secondary);
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
}

.bottom-nav a[aria-current="page"] {
  color: var(--color-primary);
  font-weight: var(--font-weight-bold);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: var(--space-2xl);
  height: var(--space-2xl);
  font-size: var(--font-size-xl);
  color: currentColor;
}
