/* 咖啡拉花模拟器：项目自己的样式。位置和大小都由 scene.js 按窗口算好写成像素；这里只管样子。 */
:root {
  --bg: #2f2621;
  --surface: #f6ecdc;
  --surface-2: #e4d3bb;
  --field: #fbf4e8;
  --bar: #8a7767;
  --disc: #efe1cd;
  --ink: #4a382d;
  --ink-2: #7a6657;
  --ink-3: #a89686;
  --line: #8a7767;
  --accent: #c98d5b;
  --on-dark: #f3e6d3;
  --radius: calc(var(--u) * 2.6);
}

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

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

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

.frame:not(.is-ready) {
  visibility: hidden;
}

/* 整页抖动：很轻，只作用在底子、标题栏和按钮层，不碰中间的画面 */
.latte-boil {
  filter: url(#latte-boil);
}

/* ---------- 标题栏（只在中间一列里） ---------- */
.titlebar {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.title-text {
  margin: 0;
  font-weight: var(--title-weight);
  line-height: 1;
  letter-spacing: 0.08em;
  color: #f3e6d3;
  white-space: nowrap;
}

/* 中 / EN：小而扁，两半共用外框；按钮本身 44 像素高保证点得到，看得见的只是中间一小条 */
.lang {
  position: absolute;
  right: 8px;
  top: 50%;
  height: 44px;
  margin-top: -22px;
  display: flex;
  align-items: center;
  padding: 0 4px;
}

.lang-pill {
  display: flex;
  border: 1px solid #f3e6d3;
  border-radius: 9px;
  overflow: hidden;
}

.lang-half {
  display: block;
  padding: 1px 6px;
  font-size: 11px;
  line-height: 16px;
  color: #f3e6d3;
}

.lang-half.is-on {
  background: #f3e6d3;
  color: #3f322b;
}

/* ---------- 画布区 ---------- */
.world {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  overflow: hidden;
}

/* 放大平移时只动这一层 */
.layer {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
}

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

.fx {
  left: 0;
  top: 0;
}

.ui {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ui > * {
  pointer-events: auto;
}

.art-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

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

.ring-focus:focus-visible {
  box-shadow: none;
  outline: 2px solid #c98d5b;
  outline-offset: 2px;
  border-radius: 50%;
}

/* ---------- 文字胶囊钮 ---------- */
.pill {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.pill-face {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  border: 3px solid #b79a72;
  border-radius: 12px;
  background: #efe1cd;
}

.pill-text {
  position: relative;
  font-size: 15px;
  line-height: 1.2;
  color: #4a382d;
  white-space: nowrap;
}

.pill-big .pill-text {
  font-size: 17px;
}

.pill:disabled,
.sbtn:disabled {
  opacity: 0.4;
}

/* ---------- 大小滑杆：槽里从底往上填色 ---------- */
.hslider {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  touch-action: none;
}

.hslider-track {
  position: relative;
  flex: 1 1 auto;
  width: 14px;
  margin: 17px 0;
  border-radius: 7px;
  background: #3f322b;
}

.hslider-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 50%;
  border-radius: 7px;
  background: #c98d5b;
}

.hslider-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  background: #efe1cd;
  border: 3px solid #b79a72;
  box-sizing: border-box;
}

/* ---------- 底部标签页：固定在窗口下沿 ---------- */
.sheet {
  position: absolute;
  bottom: 6px;
  z-index: 4;
  box-sizing: border-box;
  padding: 0 8px 6px;
  border: 2px solid #c9b394;
  border-radius: 14px;
  background: #f6ecdc;
  color: #4a382d;
}

.sheet-bar {
  display: flex;
  align-items: stretch;
  border-bottom: 2px solid #e4d3bb;
}

.tab-bar {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
}

.tab {
  flex: 1 1 0;
  min-width: 0;
  min-height: 34px;
  padding: 0 2px;
  font-size: 14px;
  line-height: 1.2;
  color: #7a6657;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}

.tab.is-on {
  color: #4a382d;
  border-bottom-color: #4a382d;
}

.sheet-body {
  padding-top: 6px;
}

.tab-stack {
  display: grid;
}

.tab-panel {
  grid-area: 1 / 1;
  min-width: 0;
}

.tab-panel.is-off {
  visibility: hidden;
}

/* ---------- 预设：一排可以左右滑动的卡片，点一下就选中 ---------- */
.strip {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior: contain;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 0;
}

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

.card {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
  margin-right: 6px;
  padding: 4px 4px 3px;
  border: 2px solid #e4d3bb;
  border-radius: 10px;
  background: #fbf4e8;
  color: #4a382d;
}

.card.is-on {
  background: #e4d3bb;
  border-color: #4a382d;
}

.card-art {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 36px;
}

.card-art img,
.card-art .desk-thumb {
  display: block;
  width: 52px;
  height: 36px;
  pointer-events: none;
}

.card-art .desk-thumb {
  border-radius: 6px;
}

.card-art .color-button {
  width: 30px;
  height: 30px;
}

.card-name {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.sel-badge {
  position: absolute;
  right: 2px;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #4a382d;
  color: #f3e6d3;
  padding: 2px;
}

.sel-badge .icon,
.sel-badge svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- 基础五钮：48 × 32 的扁钮，平涂无阴影；点击区靠伪元素上下各多 6 像素 ---------- */
.sbtn {
  position: absolute;
  padding: 0;
  touch-action: manipulation;
}

.sbtn::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -6px;
  bottom: -6px;
}

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

.sbtn-face svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.sbtn-ico {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
}

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

/* ---------- 视角钮：一个杯子加一圈转动的箭头，下面写着现在是哪种视角 ---------- */
.view-btn {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  z-index: 4;
  touch-action: manipulation;
}

.view-disc {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 2px solid #c9b394;
  border-radius: 50%;
  background: #f6ecdc;
  color: #4a382d;
}

.view-cup {
  display: block;
  height: 26px;
  pointer-events: none;
}

.view-arrows {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.view-arrows svg {
  display: block;
  width: 100%;
  height: 100%;
}

.view-cap {
  display: block;
  margin-top: 3px;
  padding: 0 6px;
  border-radius: 9px;
  background: #f3e6d3;
  color: #4a382d;
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
}

/* ---------- 倒入悬浮窗：咖啡 / 奶泡两个小圆钮，实心底、浮在主内容上 ---------- */
.pour-box {
  position: absolute;
  display: flex;
  box-sizing: border-box;
  padding: 3px;
  border: 2px solid #c9b394;
  border-radius: 12px;
  background: #f6ecdc;
  z-index: 4;
}

.pour-opt {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  padding: 3px 2px 2px;
  border-radius: 8px;
}

.pour-opt.is-on {
  background: #e4d3bb;
}

.pour-opt .color-button {
  flex: none;
  width: 28px;
  height: 28px;
}

.pour-name {
  min-height: 20px;
  padding: 0;
  font-size: 12px;
  line-height: 1.2;
  color: #4a382d;
  white-space: nowrap;
}

.color-button.is-open {
  box-shadow: none;
  outline: 3px solid #c98d5b;
  outline-offset: 1px;
}

/* ---------- 浮图：虚线框、四条可拖的边、三个角钮 ---------- */
.float-box {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
  cursor: move;
  transform-origin: 50% 50%;
}

.float-canvas-host,
.float-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.float-canvas {
  opacity: 0.78;
  pointer-events: none;
}

.float-box.is-sticker .float-canvas {
  opacity: 1;
}

.float-line-under,
.float-line {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  box-sizing: border-box;
  pointer-events: none;
}

.float-line-under {
  border: 3.6px solid rgba(35, 31, 29, 0.6);
}

.float-line {
  border: 1.6px dashed #e6d8d0;
}

.float-edge {
  position: absolute;
}

.float-edge.is-top,
.float-edge.is-bottom {
  left: -6px;
  right: -6px;
  height: 16px;
  cursor: ns-resize;
}

.float-edge.is-left,
.float-edge.is-right {
  top: -6px;
  bottom: -6px;
  width: 16px;
  cursor: ew-resize;
}

.float-edge.is-top { top: -8px; }
.float-edge.is-bottom { bottom: -8px; }
.float-edge.is-left { left: -8px; }
.float-edge.is-right { right: -8px; }

.float-handle {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid #4a382d;
  border-radius: 50%;
  background: #f6ecdc;
  color: #4a382d;
  touch-action: none;
  z-index: 5;
}

.float-handle::before {
  content: "";
  position: absolute;
  left: -8px;
  right: -8px;
  top: -8px;
  bottom: -8px;
}

.float-handle .icon,
.float-handle svg {
  display: block;
  width: 16px;
  height: 16px;
}

/* ---------- 杯内物理画布：液面，圆形（斜视是椭圆）；不裁切，斜视时奶泡凸起的部分画在液面上方 ---------- */
.surface-zone {
  overflow: visible;
}

.surface-zone.is-empty {
  visibility: hidden;
}

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

.card-art .swatch {
  display: block;
  width: 46px;
  height: 30px;
  box-sizing: border-box;
  border: 2px solid #c9b394;
  border-radius: 8px;
  pointer-events: none;
}

.modal-title {
  color: #4a382d;
}

/* 色盘悬浮层要盖在配置弹窗上面 */
.popover {
  z-index: 60;
}

.is-hidden {
  display: none !important;
}

/* 窄屏上卡片紧凑一点 */
@media (max-width: 400px) {
  .card {
    min-width: 60px;
  }

  .card-name {
    font-size: 11px;
  }

  .tab {
    font-size: 13px;
  }
}

/* 矮屏横屏：标签页更矮，把高度还给杯子 */
@media (max-height: 520px) {
  .tab {
    min-height: 30px;
    position: relative;
  }

  .tab::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -4px;
    bottom: -4px;
  }

  .sheet {
    padding-bottom: 4px;
  }

  .sheet-body {
    padding-top: 4px;
  }
}
