/* 水影笺 · 界面样式
   深色砚台底 + 描金细线 + 宣纸字色；朱砂只给主 CTA，克制 */

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

:root {
  --paper: #e9e2d0;
  --paper-dim: rgba(233, 226, 208, 0.55);
  --gold: rgba(201, 169, 97, 0.55);
  --cinnabar: #a5382b;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Noto Serif SC", serif;
}

html, body { height: 100%; }

body {
  font-family: var(--serif);
  background:
    radial-gradient(120% 90% at 50% 0%, #1d2a26 0%, #121a17 55%, #0b0f0d 100%);
  color: var(--paper);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  height: 100dvh;
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: calc(10px + env(safe-area-inset-top)) 14px calc(10px + env(safe-area-inset-bottom));
  gap: 10px;
}

/* ---------- 顶栏 ---------- */
#topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 2px 4px 0;
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand-mark {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
}
.brand-sub {
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--paper-dim);
}
.theme-switch {
  display: flex;
  border: 1px solid rgba(233, 226, 208, 0.22);
  border-radius: 999px;
  overflow: hidden;
}
.theme-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--paper-dim);
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.14em;
  padding: 6px 15px;
  cursor: pointer;
  transition: all 0.25s;
}
.theme-btn.active {
  background: var(--paper);
  color: #1a211d;
}

/* ---------- 墨池 ---------- */
#poolWrap {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--gold);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 0 44px rgba(201, 169, 97, 0.07) inset;
}
#pool {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}
#hint {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  font-size: 13px;
  letter-spacing: 0.22em;
  color: rgba(240, 235, 220, 0.85);
  background: rgba(10, 14, 12, 0.35);
  border: 1px solid rgba(233, 226, 208, 0.18);
  border-radius: 999px;
  padding: 7px 20px;
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  animation: hintFloat 3.2s ease-in-out infinite;
  transition: opacity 0.6s;
}
#hint.hide { opacity: 0; }
@keyframes hintFloat {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-5px); }
}

/* ---------- 底部操作 ---------- */
#dock {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#palette {
  display: flex;
  justify-content: center;
  gap: 13px;
  padding: 3px 0 1px;
}
.swatch {
  appearance: none;
  border: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: transform 0.18s, box-shadow 0.18s;
}
.swatch.active {
  transform: scale(1.18);
  box-shadow:
    0 0 0 2px #0b0f0d,
    0 0 0 3.5px rgba(201, 169, 97, 0.85),
    0 2px 8px rgba(0, 0, 0, 0.5);
}
#tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.tool-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tool-btn {
  appearance: none;
  font-family: var(--serif);
  font-size: 13.5px;
  letter-spacing: 0.12em;
  color: var(--paper);
  background: rgba(233, 226, 208, 0.07);
  border: 1px solid rgba(233, 226, 208, 0.16);
  border-radius: 12px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}
.tool-btn:hover { background: rgba(233, 226, 208, 0.13); }
.tool-btn:active { transform: scale(0.95); }
.tool-btn.ghost { color: var(--paper-dim); }

.cta {
  appearance: none;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: #f6ead9;
  background: linear-gradient(160deg, #b5402f 0%, #93291e 100%);
  border: 1px solid rgba(246, 234, 217, 0.25);
  border-radius: 999px;
  padding: 11px 26px 11px 30px;
  cursor: pointer;
  box-shadow: 0 8px 26px rgba(165, 56, 43, 0.42);
  transition: transform 0.12s, box-shadow 0.2s;
}
.cta:hover { box-shadow: 0 10px 32px rgba(165, 56, 43, 0.55); }
.cta:active { transform: scale(0.96); }

/* ---------- 覆纸拓印 ---------- */
#printOverlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(8, 11, 10, 0.78);
  backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity 0.4s;
  overflow-y: auto;
  padding: 20px 0;
}
#printOverlay.show { opacity: 1; }
#printOverlay.hidden { display: none; }

#sheetCaption {
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--paper-dim);
}

#paperSheet {
  transform: translateY(-130%) rotate(2.5deg);
  transition: transform 1.2s cubic-bezier(0.22, 0.75, 0.25, 1);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.75);
  border-radius: 4px;
}
#printOverlay.show #paperSheet { transform: translateY(0) rotate(0.8deg); }
#paperCanvas {
  display: block;
  width: min(82vw, 42dvh * 0.692);
  aspect-ratio: 720 / 1040;
  height: auto;
  border-radius: 4px;
}

#resultBar {
  display: flex;
  align-items: center;
  gap: 14px;
  transition: opacity 0.4s;
}
#resultBar.hidden { opacity: 0; pointer-events: none; }

/* ---------- 分享文案卡 ---------- */
#shareCard {
  width: min(82vw, 420px);
  max-height: 30dvh;
  overflow-y: auto;
  background: rgba(233, 226, 208, 0.07);
  border: 1px solid rgba(233, 226, 208, 0.16);
  border-radius: 14px;
  padding: 14px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity 0.4s;
}
#shareCard.hidden { opacity: 0; pointer-events: none; }
.share-title {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f0e8d5;
}
.share-body {
  font-size: 12.5px;
  line-height: 1.75;
  color: rgba(233, 226, 208, 0.82);
  white-space: pre-line;
}
.share-tags {
  font-size: 12px;
  color: rgba(201, 169, 97, 0.9);
  letter-spacing: 0.03em;
}
.share-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 2px;
}
.tool-btn.small {
  padding: 6px 13px;
  font-size: 12px;
  border-radius: 9px;
}

/* ---------- 小屏适配 ---------- */
@media (max-width: 480px) {
  .brand-mark { font-size: 20px; }
  .brand-sub { display: none; }
  #stage { padding-left: 10px; padding-right: 10px; }
  .swatch { width: 26px; height: 26px; }
  #palette { gap: 11px; }
  .tool-btn { padding: 9px 13px; font-size: 13px; }
  .cta { padding: 10px 20px 10px 24px; font-size: 14px; }
}
