/* 涂鸦板 · 样式（.g-doodle 前缀） */

.g-doodle {
  gap: 8px;
  padding-bottom: calc(12px + var(--safe-b));
}

/* ---------------- 顶部 ---------------- */

.g-doodle .dd-head { min-height: 40px; align-items: center; gap: 8px; }
.g-doodle .dd-head-left { display: flex; align-items: center; min-width: 0; }

.g-doodle .dd-gallery-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--dim);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  touch-action: manipulation;
}

.g-doodle .dd-gallery-btn:active { background: var(--surface-2); }

.g-doodle .dd-head-right { gap: 6px; }

.g-doodle .dd-hbtn {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 11px;
  font-size: 12px;
}

/* ---------------- 画布 ---------------- */

.g-doodle .dd-stage {
  position: relative;
  flex: 1;
  min-height: 300px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  background:
    radial-gradient(90% 70% at 22% 8%, rgba(255, 255, 255, 0.06), transparent 62%),
    radial-gradient(85% 70% at 86% 96%, rgba(255, 122, 184, 0.06), transparent 62%),
    radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 7px 7px,
    #121821;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.g-doodle .dd-canvas-host {
  position: absolute;
  inset: 0;
}

.g-doodle .dd-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 1;
}

.g-doodle .dd-empty {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 0;
  text-align: center;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: rgba(238, 242, 250, 0.24);
  pointer-events: none;
}

/* ---------------- 底部工具栏 ---------------- */

.g-doodle .dd-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.g-doodle .dd-palette {
  display: grid;
  grid-template-columns: repeat(5, 40px);
  justify-content: space-between;
  gap: 6px 0;
  padding: 2px 2px 0;
}

.g-doodle .dd-swatch {
  position: relative;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: var(--c);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.35), 0 3px 8px -5px rgba(0, 0, 0, 0.9);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
  touch-action: manipulation;
}

.g-doodle .dd-swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 4px 12px -5px rgba(0, 0, 0, 0.9);
  transform: scale(1.06);
}

.g-doodle .dd-swatch:active { transform: scale(0.92); }

.g-doodle .dd-tools-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.g-doodle .dd-sizes {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.g-doodle .dd-size {
  min-width: 56px;
  min-height: 40px;
  padding: 0 8px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--dim);
  font-size: 12px;
  font-weight: 600;
  touch-action: manipulation;
  transition: color 0.16s ease, background 0.16s ease;
}

.g-doodle .dd-size i {
  display: block;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.g-doodle .dd-size.active {
  color: #fff;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  box-shadow: 0 4px 12px -6px var(--accent);
}

.g-doodle .dd-tools-right { display: flex; align-items: center; gap: 8px; }

.g-doodle .dd-tool {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--dim);
  font-size: 12.5px;
  font-weight: 600;
  touch-action: manipulation;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.g-doodle .dd-tool.on {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

/* ---------------- 我的画作 ---------------- */

.g-doodle .dd-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(4, 6, 11, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.g-doodle .dd-mask.show { display: flex; animation: fadeIn 0.18s ease both; }

.g-doodle .dd-sheet {
  width: 100%;
  max-width: 430px;
  padding: 16px 16px calc(16px + var(--safe-b));
  border-radius: 20px 20px 0 0;
  border: 1px solid var(--line-2);
  border-bottom: 0;
  background: linear-gradient(180deg, #161c2b, #111623);
  box-shadow: 0 -22px 60px -18px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: ddSheetIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

@keyframes ddSheetIn {
  from { transform: translateY(26px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}

.g-doodle .dd-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 12px;
}

.g-doodle .dd-x {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--dim);
  font-size: 19px;
  line-height: 1;
  touch-action: manipulation;
}

.g-doodle .dd-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.g-doodle .dd-gallery-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  touch-action: manipulation;
}

.g-doodle .dd-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.g-doodle .dd-gallery-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3px 5px;
  font-size: 9.5px;
  line-height: 1.3;
  color: #fff;
  text-align: left;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.66));
}

.g-doodle .dd-gallery-empty {
  padding: 26px 8px;
  text-align: center;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.6;
}

.g-doodle .dd-gallery-empty.hidden { display: none; }

.g-doodle .dd-sheet-tip { margin-top: 12px; text-align: center; }

.g-doodle .dd-img-wrap {
  max-height: 50vh;
  overflow: auto;
  border-radius: 12px;
  background: #0b0f18;
}

.g-doodle .dd-img {
  display: block;
  width: 100%;
  border-radius: 12px;
}

/* ---------------- 窄屏 ---------------- */

@media (max-width: 359px) {
  .g-doodle .dd-hbtn { padding: 0 9px; font-size: 11.5px; }
  .g-doodle .dd-gallery-btn { padding: 0 11px; font-size: 11.5px; }
  .g-doodle .dd-size { min-width: 50px; font-size: 11.5px; }
  .g-doodle .dd-tool { padding: 0 11px; font-size: 12px; }
  .g-doodle .dd-empty { font-size: 11.5px; }
}
