/* ===== わりピンワールド プラグイン CSS ===== */
/* すべてのセレクタに waripin- プレフィックス */

#waripin-wrap * { box-sizing: border-box; }
#waripin-wrap {
  font-family: 'BIZ UDGothic', 'Meiryo', sans-serif;
  background: #faf7f2;
  touch-action: none;
  user-select: none;
}

/* ===== メインキャンバス ===== */
#waripin-canvas { display: block; width: 100%; height: 100%; background: #faf7f2; }

/* ===== ツールバー（右下）===== */
#waripin-toolbar {
  position: absolute; bottom: 16px; right: 16px;
  display: flex; flex-direction: column; gap: 8px; z-index: 10;
}
.waripin-tb-row { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }

.waripin-tb-btn {
  width: 58px; height: 58px; border-radius: 14px;
  cursor: pointer; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s, border-color .12s, transform .1s;
  background: #9aa5b4; border: 2.5px solid #7a8799; color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.waripin-tb-btn:hover { background: #7a8fa8; border-color: #5a7090; }
.waripin-tb-btn:active { transform: scale(0.93); }
.waripin-tb-btn.waripin-active {
  background: #f0c000 !important; border: 3px solid #fff !important; color: #1a2d50 !important;
  box-shadow: 0 0 0 3px rgba(240,192,0,0.5), 0 2px 10px rgba(0,0,0,0.25) !important;
}
.waripin-tb-btn.waripin-danger { background: #b04040; border-color: #883030; color: #ffe0e0; }
.waripin-tb-btn.waripin-danger:hover { background: #c03030; }
.waripin-tb-icon { font-size: 22px; line-height: 1; }
.waripin-tb-label { font-size: 10px; font-weight: bold; line-height: 1; }
.waripin-tb-sep { width: 1px; height: 44px; background: rgba(0,0,0,0.15); margin: 0 1px; }

/* うごくボタン */
/* #waripin-btn-animate → .waripin-btn-play に移行 */

/* 速度スライダー */
#waripin-speed-row {
  display: flex; align-items: center; gap: 6px;
  background: rgba(20,40,80,0.7); border: 1.5px solid rgba(100,180,255,0.3);
  border-radius: 12px; padding: 6px 10px;
}
#waripin-speed-row label { font-size: 10px; color: #88ccff; font-weight: bold; white-space: nowrap; }
#waripin-speed-slider { width: 80px; accent-color: #f0c000; }

/* ===== ピンポップアップ ===== */
.waripin-pin-popup { display: none !important; }
.waripin-pin-row { display: flex; gap: 6px; }
.waripin-pin-btn {
  width: 58px; height: 58px; border-radius: 14px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s, border-color .12s, transform .1s;
  background: #9aa5b4; border: 2.5px solid #7a8799; color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.waripin-pin-btn:active { transform: scale(0.93); }
.waripin-pin-btn.waripin-active { border: 3px solid #fff; box-shadow: 0 0 0 3px rgba(255,255,255,0.6), 0 2px 10px rgba(0,0,0,0.3); }
.waripin-pin-btn[data-pin="360"].waripin-active { background: #1a5fa0; }
.waripin-pin-btn[data-pin="180"].waripin-active { background: #a07800; }
.waripin-pin-btn[data-pin="60"].waripin-active  { background: #8a1040; }
/* 選択時はアイコンに白リングで強調 */
.waripin-pin-btn img {
  width: 32px !important; height: 32px !important;
  display: block; flex-shrink: 0;
}
.waripin-pin-btn.waripin-active img {
  outline: 2px solid rgba(255,255,255,0.8);
  outline-offset: 2px;
  border-radius: 50%;
}
.waripin-pin-icon { font-size: 20px; line-height: 1; }
.waripin-pin-label { font-size: 9px; font-weight: bold; line-height: 1.2; text-align: center; color: #fff; }

/* ===== ヒント ===== */
.waripin-hint-bar {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(30,50,90,0.82); padding: 7px 22px; border-radius: 20px;
  font-size: 12px; color: #cce4ff; pointer-events: none; white-space: nowrap;
  backdrop-filter: blur(4px); box-shadow: 0 1px 6px rgba(0,0,0,0.2);
  transition: opacity .4s; z-index: 5;
}

/* ===== 資料箱ドロワー ===== */
.waripin-sticker-drawer {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 680px; max-width: 96%; max-height: 90%;
  background: #fff; border: 2px solid #1e3a5f; border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25); z-index: 200;
  display: flex; flex-direction: column; padding: 12px; gap: 8px;
  overflow-y: auto;
}
.waripin-sticker-drawer.waripin-hidden { display: none !important; }

.waripin-sticker-drawer-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; font-weight: 700; color: #1e3a5f;
  padding-bottom: 8px; border-bottom: 1px solid #dee2e6;
  flex-shrink: 0; cursor: move;
}
.waripin-sticker-drawer-close {
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: #f0f0f0; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.waripin-sticker-drawer-close:hover { background: #e24b4a; color: #fff; }

.waripin-sticker-pen-toolbar {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  padding: 6px 0; border-bottom: 1px solid #eee; flex-shrink: 0;
}
.waripin-pen-color-dot {
  width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
  border: 2.5px solid rgba(255,255,255,0.5); box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  transition: transform .12s, box-shadow .12s; display: inline-block;
}
.waripin-pen-color-dot.waripin-active {
  transform: scale(1.3); border: 2.5px solid #1e3a5f; box-shadow: 0 0 0 2px #f0c000;
}
.waripin-pen-size-btn {
  padding: 4px 10px; border-radius: 8px; border: 1.5px solid #1e3a5f;
  background: #f0f5ff; color: #1e3a5f; font-size: 11px; font-weight: 700; cursor: pointer;
}
.waripin-pen-size-btn.waripin-active { background: #1e3a5f; color: #fff; }
.waripin-tool-btn {
  padding: 4px 10px; border-radius: 8px; border: 1.5px solid #888;
  background: #f5f5f5; color: #444; font-size: 11px; font-weight: 700; cursor: pointer;
}
.waripin-tool-btn.waripin-active { background: #e8e8e8; border-color: #555; }
.waripin-tool-btn:hover { background: #eee; }

.waripin-sticker-canvas-wrap {
  border: 2px solid #1e3a5f; border-radius: 6px; overflow: hidden;
  background-image: linear-gradient(45deg,#ccc 25%,transparent 25%),
    linear-gradient(-45deg,#ccc 25%,transparent 25%),
    linear-gradient(45deg,transparent 75%,#ccc 75%),
    linear-gradient(-45deg,transparent 75%,#ccc 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
  cursor: crosshair; flex-shrink: 0;
}
#waripin-sticker-canvas { display: block; width: 100%; height: auto; }

.waripin-sticker-controls { display: flex; gap: 6px; flex-shrink: 0; }
.waripin-sticker-btn {
  flex: 1; padding: 7px; font-size: 12px; border-radius: 8px;
  border: 1.5px solid #1e3a5f; background: #f0f5ff; color: #1e3a5f;
  cursor: pointer; font-weight: 700;
}
.waripin-sticker-btn:hover { background: #1e3a5f; color: #fff; }
.waripin-sticker-btn.waripin-save { background: #1e3a5f; color: #fff; }
.waripin-sticker-btn.waripin-save:hover { background: #2a5fa0; }

.waripin-sticker-list {
  display: flex; flex-wrap: wrap; gap: 12px;
  max-height: 140px; overflow-y: auto; padding: 8px;
  border: 1px solid #eee; border-radius: 6px; min-height: 60px;
}
.waripin-sticker-empty { font-size: 11px; color: #999; text-align: center; width: 100%; padding: 8px 0; }
.waripin-sticker-item {
  width: 64px; height: 64px; border: 2px solid #ccc; border-radius: 6px;
  overflow: visible; cursor: pointer; background: #fff;
  transition: border-color .15s; position: relative; flex-shrink: 0;
}
.waripin-sticker-item img { width: 100%; height: 100%; object-fit: contain; border-radius: 4px; display: block; }
.waripin-sticker-item:hover { border-color: #1e3a5f; }
.waripin-sticker-item-del {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px;
  border-radius: 50%; background: #e24b4a; color: #fff; border: none;
  font-size: 11px; cursor: pointer; display: none;
  align-items: center; justify-content: center; font-weight: 700; z-index: 5;
}
.waripin-sticker-item:hover .waripin-sticker-item-del { display: flex; }

/* 背景暗幕 */
.waripin-drawer-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,0.3); z-index: 199; display: none;
}
.waripin-drawer-backdrop.waripin-visible { display: block; }

/* ===== 貼り付けオーバーレイ ===== */
.waripin-paste-overlay {
  position: absolute; pointer-events: none; z-index: 100; user-select: none;
}
.waripin-paste-overlay.waripin-active { pointer-events: auto; cursor: move; }
.waripin-paste-overlay.waripin-hidden { display: none !important; }
#waripin-paste-img {
  display: block; border: 2px dashed #1e3a5f; border-radius: 4px;
  opacity: 0.85; -webkit-user-drag: none; pointer-events: none;
}
.waripin-paste-hint {
  text-align: center; font-size: 11px; color: #fff; font-weight: 700;
  background: #1e3a5f; border-radius: 6px; padding: 4px 12px;
  margin-top: 4px; white-space: nowrap; cursor: pointer;
}
.waripin-paste-hint:hover { background: #d4af37; color: #1e3a5f; }

/* ===== SVGアイコン ===== */
.waripin-icon {
  width: 26px; height: 26px; display: block;
  filter: brightness(0) invert(1); /* 未選択：白 */
}
.waripin-tb-btn.waripin-active .waripin-icon {
  filter: brightness(0); /* 選択中：黒（黄色背景に合わせる） */
}
.waripin-tb-btn.waripin-danger .waripin-icon {
  filter: brightness(0) invert(1);
}

/* うごく/とまるボタン */
.waripin-btn-play {
  width: 72px !important; height: 72px !important; border-radius: 18px !important;
  background: #2da84a !important; border: 3px solid #1d8838 !important; color: #fff !important;
  box-shadow: 0 0 0 3px rgba(45,168,74,0.35), 0 3px 12px rgba(0,0,0,0.2) !important;
}
.waripin-btn-play.waripin-running {
  background: #c03838 !important; border-color: #a02828 !important;
  box-shadow: 0 0 0 3px rgba(192,56,56,0.35), 0 3px 12px rgba(0,0,0,0.2) !important;
}
.waripin-btn-play .waripin-icon { width: 30px; height: 30px; }

/* 資料箱ドロワーボタン内アイコン */
.waripin-sticker-btn img {
  width: 20px; height: 20px; display: inline-block; vertical-align: middle; margin-right: 4px;
  filter: brightness(0) saturate(0);
}
.waripin-sticker-btn.waripin-save img { filter: brightness(0) invert(1); }

/* ===== 図形ボタン ===== */
.waripin-shape-btn {
  width: 32px !important; padding: 0 !important;
  font-size: 16px !important; line-height: 32px !important;
  text-align: center;
}
.waripin-shape-btn.waripin-active {
  background: #1e3a5f !important; color: #fff !important; border-color: #1e3a5f !important;
}
