/* 我的墨水瓶撒了：项目自己的样式。尺寸都用 --u（画面宽的百分之一，竖画面）；圆按钮边长 --btn 固定 32 像素，点按区 44 像素。 */
:root {
  --bg: #d8d0c9;
  --surface: #efe9df;
  --surface-2: #ddd3c7;
  --field: #f6f1e9;
  --bar: #37312d;
  --disc: #e9dfd6;
  --ink: #3a322e;
  --ink-2: #6d5f57;
  --ink-3: #9a8c83;
  --line: #4a3f3a;
  --accent: #c9a975;
  --on-dark: #eadfd6;
  --title: #cbbdb1;
  --title-font: 'Ma Shan Zheng', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

html,
body {
  background: var(--bg);
}

#app {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
}

.backdrop {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.frame {
  position: absolute;
}

/* 第一次排好之前先藏着，不在角落里闪一下 */
.frame:not(.is-ready) {
  visibility: hidden;
}

/* 整页抖动（整体很轻）：物件、按钮一层；桌面底子和标题栏的字更轻，标题带的边线几乎不动 */
.ink-boil {
  filter: url(#ink-boil);
}

.ink-boil-soft {
  filter: url(#ink-boil-soft);
}

/* ---------- 标题栏 ---------- */
.titlebar {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: center;
}

.title-text {
  margin: 0;
  font-family: var(--title-font);
  font-weight: 400;
  font-size: calc(var(--u) * 9.4);
  line-height: 1.2;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: var(--title);
}

:lang(en) .title-text {
  font-size: calc(var(--u) * 7.6);
}

[data-mode='land'] .title-text,
[data-mode='land']:lang(en) .title-text {
  font-size: calc(var(--u) * 7);
}

/* 中 / EN：一个整体的分段钮，小而扁，两半共用外框，选中的一半填色；点击区 44 像素，比看到的大 */
.lang {
  position: absolute;
  right: calc(var(--u) * 2 - var(--lang-shift, 0px));
  top: 50%;
  height: var(--lang-h);
  margin-top: calc(var(--lang-h) / -2);
  display: flex;
  align-items: center;
  padding: 0;
}

.lang-pill {
  display: flex;
  border: 1.5px solid var(--title);
  border-radius: calc(var(--u) * 1);
  overflow: hidden;
}

.lang-half {
  display: block;
  padding: calc(var(--u) * 0.35) calc(var(--u) * 1.3);
  font-size: var(--fs-lang);
  line-height: 1.2;
  color: var(--title);
}

.lang-half.is-on {
  background: #e6dbd0;
  color: #37312d;
}

.lang.is-tight .lang-half {
  padding: calc(var(--u) * 0.25) calc(var(--u) * 0.9);
}

/* ---------- 页面区 ---------- */
.page-body {
  position: absolute;
  left: 0;
  top: var(--header-h);
  width: 100%;
  bottom: 0;
  overflow: hidden;
}

/* 竖排的页面放不下时（矮窗口、手机横屏）：页面区自己下滚，外壳和标题栏不动 */
.page-body[data-scroll='1'] {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.page-mix {
  touch-action: pan-y;
}

.page {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.stage {
  position: absolute;
  left: 0;
  top: 0;
}

.zone {
  position: absolute;
  pointer-events: none;
}

/* ---------- 右侧竖栏（电脑宽屏）：实心浅底，兜住横放的笔墨；悬浮在桌面上，不透明 ---------- */
.tool-rail {
  position: absolute;
  background: var(--surface);
  border-left: 1px solid var(--surface-2);
  border-radius: calc(var(--u) * 2) 0 0 calc(var(--u) * 2);
  pointer-events: none;
}

/* ---------- 圆按钮 ---------- */
.rbtn {
  position: absolute;
  width: var(--btn);
  height: var(--btn);
  touch-action: manipulation;
}

.rbtn::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}

.rbtn-lg {
  width: var(--btn-lg);
  height: var(--btn-lg);
}

.btn-face {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* 选中：外面多一圈暖色的环 */
.rbtn .btn-face-on {
  display: none;
}

.rbtn.is-on .btn-face-on {
  display: block;
}

.rbtn.is-on .btn-face-off {
  display: none;
}

/* 不能点：换成浅灰褐的底，边缘依然清楚 */
.rbtn .btn-face-dis {
  display: none;
}

.rbtn.is-disabled .btn-face-off {
  display: none;
}

.rbtn.is-disabled .btn-face-dis {
  display: block;
}

.rbtn-ico {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 17px;
  height: 17px;
  transform: translate(-50%, -50%);
}

.rbtn-ico.is-art {
  width: 18px;
  height: 18px;
}

.rbtn-ico .icon,
.rbtn-ico svg,
.art-icon {
  display: block;
  width: 100%;
  height: 100%;
}

.ring-focus:focus-visible {
  box-shadow: none;
  outline: calc(var(--u) * 0.5) solid var(--accent);
  outline-offset: calc(var(--u) * 0.3);
  border-radius: 50%;
}

/* ---------- 物件（笔、瓶、砚台、墨条）：一块画布，尺寸由页面摆 ---------- */
.art-obj {
  position: absolute;
  pointer-events: none;
}

/* 图案的画布比盒子宽（笔、瓶），不接指针：点击只认盒子，邻近的笔不会互相盖住点击区 */
.art-obj-cv {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* 选中的笔往上拿起一截，笔下面垫一条平的暖色条（不是阴影） */
.art-pen.is-on::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--u) * -1.6);
  height: calc(var(--u) * 1.2);
  border-radius: calc(var(--u) * 0.6);
  background: var(--accent);
}

.art-held {
  transform-origin: 50% 50%;
}

/* ---------- 调墨页：墨条列表（只有这一列能上下滚）、效果方块、当前墨的小样卡、重置钮 ---------- */
.ink-scroll {
  position: absolute;
}

.ink-list {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  touch-action: pan-y;
  padding: 2px 0;
  box-sizing: border-box;
}

.ink-list::-webkit-scrollbar {
  display: none;
}

/* 上下边缘淡出：上面或下面还有墨条没露出来时才淡 */
.ink-scroll.has-above .ink-list {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 16px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 16px);
}

.ink-scroll.has-below .ink-list {
  -webkit-mask-image: linear-gradient(to top, transparent 0, #000 16px);
  mask-image: linear-gradient(to top, transparent 0, #000 16px);
}

.ink-scroll.has-above.has-below .ink-list {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
}

.ink-thumb {
  position: absolute;
  right: 0;
  top: 0;
  width: 3px;
  border-radius: 2px;
  background: #8c7f78;
  display: none;
  pointer-events: none;
}

.ink-scroll.can-scroll .ink-thumb {
  display: block;
}

.ink-row {
  position: relative;
  display: block;
  flex: none;
  pointer-events: auto;
  cursor: pointer;
}

.ink-name {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: normal;
  text-wrap: balance;
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.15;
  color: #f3eee6;
  pointer-events: none;
}

.ink-name.is-plus {
  color: #211b19;
}

.fx-tile {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  border-radius: calc(var(--u) * 1.2);
  background: #ddd3c7;
  color: #3a322e;
  pointer-events: none;
}

.fx-tile.is-on {
  background: #c9a975;
}

.fx-art {
  position: relative;
  flex: none;
  pointer-events: none;
}

.fx-name {
  display: block;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  text-align: center;
}

.ink-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px 5px;
  box-sizing: border-box;
  border-radius: calc(var(--u) * 1.6);
  background: #ece5da;
  pointer-events: none;
}

.ink-card-art {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  pointer-events: none;
}

.preview-label {
  flex: none;
  display: block;
  margin-top: 2px;
  text-align: center;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.25;
  color: #4a3f3a;
}

/* 调配：字在上，小砚台在下，没有底色和阴影 */
.mix-go {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #3a322e;
}

.mix-go-label {
  flex: none;
  height: 16px;
  font-size: 13px;
  font-weight: 700;
  line-height: 16px;
  white-space: nowrap;
}

.mix-go-cv {
  display: block;
  flex: none;
}

/* 文字按钮（重置）：占版面的正常按钮，和墨块同高同画法 */
.text-btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: none;
  color: #eadfd6;
  touch-action: manipulation;
  cursor: pointer;
}

.text-btn-bg {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.text-btn-ico {
  position: relative;
  flex: none;
  display: block;
  width: 18px;
  height: 18px;
}

.text-btn-ico .icon,
.text-btn-ico svg {
  display: block;
  width: 100%;
  height: 100%;
}

.text-btn-text {
  position: relative;
  display: block;
  max-width: calc(100% - 8px);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
}

/* ---------- 提示条：盖在页面上，标题栏正下方居中；深褐实心底，点一下关 ---------- */
.toast {
  top: calc(var(--header-h) + var(--u) * 2);
  background: #4a3f3a;
  border: 0;
  box-shadow: none;
  padding: calc(var(--u) * 1) calc(var(--u) * 2.5);
  border-radius: calc(var(--u) * 1.4);
  color: #eadfd6;
  font-size: var(--fs-body);
  line-height: calc(var(--fs-body) * 1.35);
  white-space: nowrap;
}

.toast-action {
  border: 0;
  background: none;
  color: #d9cbbf;
  text-decoration: underline;
}

/* ---------- 弹窗：纸色底、深褐按钮，和页面同一套 ---------- */
.modal-overlay {
  background: rgba(40, 33, 30, 0.5);
}

.modal {
  background: #efe9df;
  border-radius: calc(var(--u) * 1.6);
  box-shadow: none;
  color: #3a322e;
}

/* 弹窗的 ×：面板右上角的小 ×（框 22 像素，字 18 像素，离角 6 像素，无底色），点击区用伪元素扩到 44 像素 */
.modal-close {
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  padding: 0;
  background: none;
  color: #6d5f57;
  border-radius: 0;
  font-size: 18px;
}

.modal-close::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}

.modal-head {
  padding-right: 28px;
}

/* 没有标题的弹窗：文字整行居中，往下让开右上角的 ×（不占文字的宽度） */
.modal-untitled .modal-body > :first-child:not(.modal-stack),
.modal-untitled .modal-stack > :first-child {
  max-width: none;
  margin-top: 16px;
}

.modal-text {
  text-align: center;
}

/* 底部按钮栏：文字按钮居中，不拉满整行 */
.modal-foot {
  justify-content: center;
  border-top: 0;
}

.modal-foot .btn {
  flex: 0 1 auto;
  min-width: calc(var(--u) * 32);
}

.modal .btn,
.modal button.primary,
.modal .is-primary {
  background: #4a3f3a;
  color: #eadfd6;
  border-radius: calc(var(--u) * 1.4);
}

.fx-tile > * + * { margin-top: 2px; }
.text-btn-ico + .text-btn-text { margin-left: 6px; }

/* ---------- 画纸页：墨层画布、整页特效层、压感开关、能点能拖的笔和瓶 ---------- */
/* 纸外面的桌面：接平移和缩放，铺满整页，在所有东西下面 */
.scene {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.ink-view {
  position: absolute;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.fx-view {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  pointer-events: none;
}

.pressure-chip {
  position: absolute;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 14px;
  background: rgba(74, 63, 58, 0.45);
  color: #eadfd6;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 28px;
  touch-action: manipulation;
  cursor: pointer;
}

.pressure-chip.is-on {
  background: #4a3f3a;
  outline: 2px solid var(--accent);
}

.art-pen,
.art-bottle {
  pointer-events: auto;
  cursor: pointer;
  touch-action: none;
}

.art-bottle {
  cursor: grab;
}

.art-held {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
}

.art-held.is-lifted {
  cursor: grabbing;
}

.art-pen:focus-visible {
  outline: calc(var(--u) * 0.5) solid var(--accent);
  outline-offset: calc(var(--u) * 0.3);
}

.art-bottle:focus-visible {
  outline: calc(var(--u) * 0.5) solid var(--accent);
  outline-offset: calc(var(--u) * 0.3);
}

.art-stone:focus-visible {
  outline: calc(var(--u) * 0.5) solid var(--accent);
  outline-offset: calc(var(--u) * 0.3);
}

.ink-row:focus-visible {
  outline: calc(var(--u) * 0.5) solid var(--accent);
  outline-offset: calc(var(--u) * 0.3);
}

.fx-tile:focus-visible {
  outline: calc(var(--u) * 0.5) solid var(--accent);
  outline-offset: calc(var(--u) * 0.3);
}

.rail-pen.is-on::after {
  bottom: calc(var(--u) * -1.2);
}

/* ---------- 调墨页：托盘里的墨、砚台、效果方块、墨条上的 × ---------- */
.tray-view {
  position: absolute;
  display: block;
  touch-action: none;
  cursor: grab;
}

.art-stone {
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
}

.fx-tile {
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
}

.ink-del {
  position: absolute;
  right: 6px;
  top: 50%;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(43, 36, 33, 0.55);
  color: #f3eee6;
  cursor: pointer;
  touch-action: manipulation;
}

.ink-del::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36px;
  height: 36px;
  transform: translate(-50%, -50%);
}

.ink-del .icon,
.ink-del svg {
  display: block;
  width: 12px;
  height: 12px;
  margin: 5px;
}
