/* ===== RESET & BASE ===== */
/* 폰트 교체: 아래 @font-face 블록과 :root 의 --app-font-family 를 함께 수정 */
@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Thin.woff2') format('woff2');
  font-weight: 100;
  font-display: swap;
}

@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-ExtraLight.woff2') format('woff2');
  font-weight: 200;
  font-display: swap;
}

@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Light.woff2') format('woff2');
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Medium.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}

@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Black.woff2') format('woff2');
  font-weight: 900;
  font-display: swap;
}

/* ===== SIMS 4 UI PRESETS (재사용) ===== */
:root {
  /* 폰트 패밀리만 여기서 바꾸면 됨 (@font-face 의 font-family 이름과 맞출 것) */
  --app-font-family: 'Pretendard', system-ui, sans-serif;
  --main-text: #040732;

  --sims4-btn-radius: 8px;
  --sims4-btn-gradient-start: #FEFEFE;
  --sims4-btn-gradient-end: #E9E9EE;
  --sims4-btn-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.25);

  --sims4-panel-radius: 10px;
  --sims4-panel-bg: rgba(255, 255, 255, 0.7);
  --sims4-panel-border: 1px solid #fff;
  --sims4-panel-blur: 4px;
}

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

html, body {
  height: 100%;
  font-family: var(--app-font-family);
  background: #1a1a2e;
  overflow: hidden;
  touch-action: none;
}

.sims4-btn {
  border-radius: var(--sims4-btn-radius);
  background: linear-gradient(
    to bottom,
    var(--sims4-btn-gradient-start),
    var(--sims4-btn-gradient-end)
  );
  box-shadow: var(--sims4-btn-shadow);
}

.sims4-panel {
  border-radius: var(--sims4-panel-radius);
  background: var(--sims4-panel-bg);
  border: var(--sims4-panel-border);
  -webkit-backdrop-filter: blur(var(--sims4-panel-blur));
  backdrop-filter: blur(var(--sims4-panel-blur));
}

/* ===== APP CONTAINER ===== */
#app {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ===== PHONE FRAME (PC) — 배경은 html에 두어 #app 자식에 가려지지 않게 함 ===== */
@media (min-width: 600px) {
  html {
    background: #ffffff;
    min-height: 100%;
  }
  body {
    background: transparent;
  }
  #app {
    background: transparent;
  }
}

/* ===== SCREENS ===== */
.screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: none;
  overflow: hidden;
}
.screen.active { display: block; }

@media (min-width: 600px) {
  .screen {
    max-width: 390px;
    width: 390px !important;
    inset: auto;
    left: 50%;
    right: auto;
    top: 32px;
    bottom: 32px;
    height: auto;
    transform: translateX(-50%);
    border-radius: 20px !important;
    overflow: hidden;
    box-shadow: 0 0 0 10px #1a1a1a, 0 30px 80px rgba(0,0,0,0.7);
  }
}

/* ===== HEADER BUBBLE (에디터만) ===== */
#header-bubble {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: none;
}

#header-bubble span {
  background: white;
  color: var(--main-text);
  font-size: 16px;
  font-weight: 700;
  padding: 7px 18px;
  border-radius: 5px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  position: relative;
}
#header-bubble span::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: white;
  border-bottom: none;
}

#editor-screen #header-bubble {
  pointer-events: auto;
  cursor: pointer;
}
#editor-screen #header-bubble span {
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.12s;
}
#editor-screen #header-bubble:hover span {
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}
#editor-screen #header-bubble:active span {
  transform: scale(0.98);
}

/* ===== UPLOAD SCREEN ===== */
#upload-screen {
  background-color: #1a1a2e;
  background-image: url('assets/background.png');
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.upload-center {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  pointer-events: none;
}
.upload-decor-bubble {
  position: relative;
  max-width: 260px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--main-text);
  text-align: center;
  line-height: 1.35;
  border: 1px solid rgba(255, 255, 255, 0.9);
  margin-bottom: 2px;
  pointer-events: none;
}
.upload-decor-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: #d4d4dc;
  border-bottom: none;
}
.upload-icon-wrap {
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.35));
  transition: transform 0.15s ease;
  cursor: pointer;
  pointer-events: auto;
}
.upload-icon-wrap .upload-app-icon {
  display: block;
  width: 110px;
  height: 110px;
  border-radius: 28px;
  object-fit: contain;
  pointer-events: none;
}
.upload-icon-wrap:hover  { transform: scale(1.06); }
.upload-icon-wrap:active { transform: scale(0.96); }
.upload-icon-wrap:focus {
  outline: none;
}
.upload-icon-wrap:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
  border-radius: 32px;
}
.upload-label {
  color: white;
  font-size: 16px;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  pointer-events: none;
}

/* ===== EDITOR SCREEN ===== */
#editor-screen {
  background-color: #1a1a2e;
  background-image: url('assets/background.png');
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

/* ===== PHOTO AREA ===== */
#photo-area {
  position: absolute;
  top: 80px;
  left: 0; right: 0;
  bottom: 250px;
  overflow: hidden;
  background: transparent;
}

#zoom-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  transform-origin: 50% 50%;
}

/* 실제 사진(object-fit) 영역만 — 스티커 클리핑·저장 범위 */
#photo-clip {
  position: absolute;
  overflow: visible;  /* hidden → visible: box-shadow/rounded corner가 경계에서 잘리는 현상 방지 */
  pointer-events: none;
  z-index: 1;
  box-shadow: 0 0 15px 4px rgba(0, 0, 0, 0.5);
}

#photo-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

#sticker-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

/* 컬러 소망: 인라인 SVG (html2canvas·고해상도에서 mask보다 안정적) */
.wish-bubble-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* ===== PHOTO ZOOM SLIDER (bottom overlay) ===== */
#photo-zoom-bar {
  position: absolute;
  left: 0; right: 0;
  bottom: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 10px;
  pointer-events: auto;
  touch-action: manipulation;
}
#zoom-label {
  flex-shrink: 0;
  min-width: 2.25rem;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
#zoom-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255,255,255,0.25);
  outline: none;
  cursor: pointer;
}
#zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fff, #e9e9ee);
  border: 2px solid #7B5EA7;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}
#zoom-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fff, #e9e9ee);
  border: 2px solid #7B5EA7;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}
#zoom-slider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.25);
}

/* ===== BOTTOM PANEL ===== */
#bottom-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  margin: 8px;
  /* margin-bottom: -2px; */
  height: 210px;
  overflow: hidden;
  z-index: 50;
  
  border-radius: var(--sims4-panel-radius);
  background: var(--sims4-panel-bg);
  border: var(--sims4-panel-border);
  -webkit-backdrop-filter: blur(var(--sims4-panel-blur));
  backdrop-filter: blur(var(--sims4-panel-blur));
}

/* ===== BOTTOM SHEET VIEWS (#menu-panel, #plumbbob-panel, #emotion-panel) ===== */
.bottom-sheet-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  overflow: hidden;
  gap: 12px;
}
.bottom-sheet-view.hidden {
  display: none !important;
}

#menu-panel {
  padding: 6px 8px 12px;
}

.panel-header {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.panel-back-btn {
  grid-column: 1;
  justify-self: start;
  border: none;
  height: 32px;
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 700;
  color: var(--main-text);
  cursor: pointer;
  padding: 0 4px 2px 4px;
  line-height: 1;
  transition: background 0.12s;
  font-family: inherit;
}
.panel-back-btn:hover { background: #f0eef8; }
.panel-back-btn.sims4-btn:hover,
.panel-back-btn.sims4-btn:active {
  background: linear-gradient(
    to bottom,
    var(--sims4-btn-gradient-start),
    var(--sims4-btn-gradient-end)
  );
  filter: brightness(0.96);
}

.panel-actions-single {
  margin-top: auto;
  padding-top: 10px;
  flex-shrink: 0;
}
.panel-actions-single .cancel-btn {
  flex: 1;
  width: 100%;
}
#plumbbob-panel .plumbbob-grid {
  flex: 1;
  align-items: center;
}
.panel-title {
  grid-column: 2;
  justify-self: center;
  width: 100%;
  font-size: 14px;
  font-weight: 500;
  color: var(--main-text);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
}

/* ─── Menu list ─── */
.menu-list { 
  list-style: none; 
  display: flex;
  flex-direction: column;
  gap: 4px;  
}
.menu-separator {
  list-style: none;
  height: 0;
  margin: 4px 10px;
  padding: 0;
  border: none;
  border-top: 1px solid #e4e4ea;
  pointer-events: none;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--main-text);
  cursor: pointer;
  transition: background 0.12s;
}
.menu-item:hover,
.menu-item:active { background: #f0eef8; }
.menu-item.sims4-btn:hover,
.menu-item.sims4-btn:active {
  background: linear-gradient(
    to bottom,
    var(--sims4-btn-gradient-start),
    var(--sims4-btn-gradient-end)
  );
  filter: brightness(0.96);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
}
.menu-icon {
  width: 22px;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ─── Plumb bob ─── */
.plumbbob-grid {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex: 1;
  align-items: center;
}
.plumbbob-btn {
  background: transparent;
  border: none;
  border-radius: 16px;
  padding: 12px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  box-shadow: none;
}
.plumbbob-btn img {
  display: block;
  width: 52px;
  height: 52px;
  object-fit: contain;
  pointer-events: none;
}
.plumbbob-btn:hover  { transform: scale(1.08); box-shadow: 0 4px 12px rgba(0,0,0,0.18); }
.plumbbob-btn:active { transform: scale(0.95); }

/* ─── Bubble panel ─── */
.bubble-panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.bubble-modal-tabs {
  flex-shrink: 0;
  width: 100%;
}
.bubble-type-tabs {
  width: 100%;
}
.live-preview-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: #f8f8fc;
  border-radius: 12px;
  padding: 14px 12px;
  overflow: visible;
  min-height: 76px;
  flex-shrink: 0;
}
.bubble-s3-tail-section {
  flex-shrink: 0;
  width: 100%;
  min-height: 0;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Compact tab bar (inside bubble panel) */
.tab-bar.compact {
  border-radius: 10px;
  margin-bottom: 0;
}
.bubble-modal-tabs .tab-bar.compact {
  margin-bottom: 0;
}
.tab-bar.compact .tab-btn {
  padding: 5px 0;
  font-size: 11px;
  border-radius: 7px;
}

/* Style option buttons */
.style-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.s3-opts { gap: 3px; }
.style-opt {
  padding: 4px 7px;
  border-radius: 7px;
  border: 1.5px solid #ddd;
  background: #fff;
  font-size: 11px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.style-opt.active {
  border-color: #7B5EA7;
  background: #f0eef8;
  color: var(--main-text);
  font-weight: 700;
}
.style-opt:hover { border-color: #9B7EC8; }

/* ─── Emotion panel ─── */
.emotion-field {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--main-text);
  padding: 12px;
  gap: 12px;
  background-color: #fff;
  border-radius: 5px;
}
.emotion-panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.emotion-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1;
  align-items: center;
}
.color-swatch {
  width: 36px; height: 36px;
  border-radius: 5px;
  border: 2px solid #fff;
  cursor: pointer;
  transition: transform 0.12s;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.color-swatch-none {
  background: linear-gradient(135deg, #fff, #f0f0f4) !important;
  border: 2px solid #fff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.color-swatch-x {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: #666;
  pointer-events: none;
}
.color-swatch-none.active {
  border-color: var(--main-text) !important;
  transform: scale(1.12);
}
.color-swatch.active { border-color: var(--main-text); transform: scale(1.15); }
/* :hover만 두면 .active보다 뒤에 있어 선택된 스와치가 호버 시 scale이 줄어들며 깜빡임 */
.color-swatch:hover:not(.active) { transform: scale(1.08); }

.emotion-text-field.hidden {
  display: none !important;
}

/* ─── Panel action buttons ─── */
.panel-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.cancel-btn {
  flex: 1;
  padding: 10px 0;
  border-radius: 30px;
  border: 1.5px solid #ddd;
  background: linear-gradient(135deg, #fff, #e9e9ee);
  color: #666;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.confirm-btn {
  flex: 2;
  padding: 10px 0;
  border-radius: 30px;
  border: none;
  background: linear-gradient(135deg, #9B7EC8, var(--main-text));
  color: white;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.12s;
}
.confirm-btn:hover { opacity: 0.9; }
.pill-btn {
  flex: 1;
  padding: 10px 0;
  border-radius: 30px;
  border: none;
  background: #fff;
  color: var(--main-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  /* background 그라데이션끼리 transition 시 브라우저가 보간 못 해 깜빡임 → 그림자만 보간 */
  transition: box-shadow 0.12s, filter 0.12s;
}
.pill-btn:hover {
  background: linear-gradient(135deg, #e9e9ee, #d8d8e8);
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  filter: brightness(0.98);
}
.pill-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  filter: none;
}

/* Text input */
.text-input {
  width: 100%;
  padding: 9px 14px;
  border-radius: 5px;
  background: #0000001a;
  border: none;
  font-size: 13px;
  font-family: inherit;
  color: #222;
  outline: none;
  transition: border-color 0.15s;
  flex-shrink: 0;
}
.text-input:focus { border-color: #7B5EA7; }

/* ===== MODALS (inside #editor-screen, position:absolute) ===== */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-overlay.hidden { display: none; }

.modal-sheet {
  width: 100%;
  max-width: 360px;
  max-height: min(90vh, calc(100% - 40px));
  margin: auto;
  border-radius: var(--sims4-btn-radius);
  background: linear-gradient(
    to bottom,
    var(--sims4-btn-gradient-start),
    var(--sims4-btn-gradient-end)
  );
  box-shadow: var(--sims4-btn-shadow);
  padding: 20px 20px 24px;
  overflow-y: auto;
  flex-shrink: 0;
}
.modal-header {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}
.modal-header-spacer {
  grid-column: 1;
  width: 36px;
  height: 32px;
  pointer-events: none;
  flex-shrink: 0;
}
.modal-title {
  grid-column: 2;
  justify-self: center;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--main-text);
  min-width: 0;
}
.modal-close-btn {
  grid-column: 3;
  justify-self: end;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: var(--main-text);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.modal-close-btn:hover {
  background: #f0eef8;
}
.modal-close-btn.sims4-btn:hover,
.modal-close-btn.sims4-btn:active {
  background: linear-gradient(
    to bottom,
    var(--sims4-btn-gradient-start),
    var(--sims4-btn-gradient-end)
  );
  filter: brightness(0.96);
}
.modal-field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  margin-bottom: 6px;
}
.modal-text-input {
  margin-bottom: 12px;
}
.modal-hint {
  font-size: 11px;
  font-weight: 500;
  color: #888;
  line-height: 1.35;
  margin: 0 0 12px;
}

/* Tab bar (modals) */
.tab-bar {
  display: flex;
  background: #f0eef8;
  border-radius: 12px;
  padding: 3px;
  margin-bottom: 14px;
  gap: 2px;
}
.tab-btn {
  flex: 1;
  padding: 7px 0;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.tab-btn.active {
  background: white;
  color: var(--main-text);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* Wish position selector */
.wish-positions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.wish-pos-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: #f5f5f8;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: #555;
  font-family: inherit;
  transition: border-color 0.12s;
}
.wish-pos-btn.active {
  border-color: var(--main-text);
  color: var(--main-text);
  font-weight: 700;
}
.wish-pos-thumb {
  width: 40px;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  flex-shrink: 0;
}

/* Icon preview */
.icon-preview-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.icon-preview-box {
  width: 90px; height: 90px;
  border-radius: 10px;
  background: linear-gradient(135deg, #82D51E, #14B74B);
  border: 4px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.icon-preview-text {
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.35);
  line-height: 1;
  text-align: center;
  max-width: 100%;
  padding: 6px;
  pointer-events: none;
}

.wish-live-preview-wrap {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f0eef6;
  border: 1px solid #e4e0ee;
}
.wish-live-preview-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #888;
  margin-bottom: 8px;
}
.wish-live-preview-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 50px;
}
.wish-live-preview-inner .wish-sticker-root {
  transform: scale(1.2);
  transform-origin: center center;
}
.upload-label-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 0;
  border-radius: 30px;
  background: linear-gradient(135deg, #fff, #e9e9ee);
  color: var(--main-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  border: 1px solid #e0e0e0;
  font-family: inherit;
  transition: box-shadow 0.12s, filter 0.12s;
}
.upload-label-btn:hover {
  background: linear-gradient(135deg, #e9e9ee, #d8d8e8);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  filter: brightness(0.98);
}

/* Modal action buttons */
.modal-actions { display: flex; gap: 8px; }
.modal-confirm-btn {
  flex: 1;
  text-align: right;
  padding:0 12px;
  border-radius: 30px;
  background-color: transparent;
  border: none;
  color: var(--main-text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.12s;
}
.modal-confirm-btn:hover { opacity: 0.9; }

/* ===== STICKERS ===== */
/* PNG 합성 저장 시 편집 핸들 제외 (비율·텍스트 왜곡 방지) */
body.exporting-photo .sticker-delete,
body.exporting-photo .sticker-resize,
body.exporting-photo .sticker-rotate,
body.exporting-photo .sticker-edit,
body.exporting-photo .emotion-icon-remove-btn {
  display: none !important;
}

.sticker {
  position: absolute;
  cursor: grab;
  user-select: none;
  touch-action: none;
  pointer-events: all;
  transform-origin: center center;
}
.sticker-content {
  position: relative;
  display: inline-block;
}
.sticker:active { cursor: grabbing; }
.sticker.selected .sticker-delete { display: flex; }
.sticker.selected .sticker-edit { display: flex; }
.sticker.selected .sticker-resize { display: flex; }
/* 감정 오버레이: 오버레이 본문 선택 → 전체 삭제·크기조절만 (아이콘 × 숨김) */
.sticker-emotion.selected:not(.emotion-icon-slot-focus) .emotion-icon-remove-btn { display: none !important; }
/* 아이콘 슬롯 선택 → 아이콘 삭제만 (오버레이 삭제·크기조절 숨김) */
.sticker-emotion.selected.emotion-icon-slot-focus .sticker-delete,
.sticker-emotion.selected.emotion-icon-slot-focus .sticker-resize { display: none !important; }
.sticker-emotion.selected.emotion-icon-slot-focus .emotion-icon-remove-btn { display: flex; }
.sticker-plumbbob.selected .sticker-rotate { display: flex; }

.sticker-rotate {
  display: none;
  position: absolute;
  top: -10px;
  left: -10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FF8B43;
  color: white;
  font-size: 14px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  cursor: grab;
  z-index: 10;
  line-height: 1;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  pointer-events: all;
  touch-action: none;
}
.sticker-rotate:active { cursor: grabbing; }
.sticker-rotate-icon {
  display: block;
  transform: translateY(0.5px);
  pointer-events: none;
}

.sticker-edit {
  display: none;
  position: absolute;
  top: -10px; left: -10px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #4169E1;
  color: white;
  font-size: 12px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  line-height: 1;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  padding: 0;
  font-family: inherit;
  pointer-events: all;
}

.sticker-resize {
  display: none;
  position: absolute;
  bottom: -10px; right: -10px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #7B5EA7;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  cursor: nwse-resize;
  z-index: 10;
  align-items: center;
  justify-content: center;
  pointer-events: all;
  touch-action: none;
}
.sticker-resize::after {
  content: '';
  width: 8px; height: 8px;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
}

.sticker-delete {
  display: none;
  position: absolute;
  top: -10px; right: -10px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #e03030;
  color: white;
  font-size: 14px;
  font-weight: bold;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  line-height: 1;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* Plumb bob sticker — 루트 박스를 이미지와 동일 비율로 고정(변형·캡처 시 기준 통일) */
.sticker-plumbbob .sticker-content {
  display: block;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}
.sticker-plumbbob .plumbbob-sticker-img {
  display: block;
  width: 60px;
  height: 60px;
  object-fit: contain;
  pointer-events: none;
}

/* Bubble sticker */
/* width: max-content — 가장자리에서도 shrink-to-fit(남은 폭)으로 너비가 줄어들며
   텍스트가 자동 줄바꿈되지 않게 함 */
.sticker-bubble {
  width: max-content;
  min-width: 80px;
  max-width: 260px;
  overflow: visible;
}
.sticker-bubble .sticker-content {
  overflow: visible;
}
.sticker-wish .sticker-content {
  overflow: visible;
}

.bubble-body {
  margin: 4px;
  box-sizing: border-box;
  position: relative;
  padding: 8px 16px 8px;
  border-radius: 40px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  word-break: break-all;
  white-space: pre-wrap;
  pointer-events: none;
}
.bubble-body.s4 {
  background: linear-gradient(
    to bottom,
    var(--sims4-btn-gradient-start),
    #c5c5d6
  );
  box-shadow: var(--sims4-btn-shadow);
  color: #194295;
}

/* 심즈3: 둥근 본체(border-radius 50%) + assets/tail.png 꼬리 */
.bubble-s3-root {
  display: inline-flex;
  position: relative;
  align-items: center;
  justify-content: center;
  max-width: 220px;
  /* filter:drop-shadow 대신 box-shadow를 outer에 적용 — html2canvas에서 filter는 불안정 */
}

/* 그라데이션 테두리 래퍼: 외부 그라데이션(테두리색) + 2px padding = 테두리 두께 */
.bubble-s3-outer {
  display: inline-block;
  line-height: 0;
  padding: 2px;
  border-radius: 22px;
  background: linear-gradient(180deg, #DFF7FF 0%, #84ADF4 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  margin: 6px;
}
.bubble-s3-root.bubble-s3-pos-top {
  flex-direction: column;
}
.bubble-s3-root.bubble-s3-pos-top .bubble-s3-tail {
  order: -1;
  margin-bottom: -2px;
}
.bubble-s3-root.bubble-s3-pos-bottom {
  flex-direction: column;
}
.bubble-s3-root.bubble-s3-pos-bottom .bubble-s3-tail {
  margin-top: -2px;
}
.bubble-s3-root.bubble-s3-pos-left {
  flex-direction: row;
}
.bubble-s3-root.bubble-s3-pos-left .bubble-s3-tail {
  order: -1;
  margin-right: -2px;
}
.bubble-s3-root.bubble-s3-pos-right {
  flex-direction: row;
}
.bubble-s3-root.bubble-s3-pos-right .bubble-s3-tail {
  margin-left: -2px;
}
.bubble-body.s3 {
  border-radius: 40px;
  padding: 8px 16px 8px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  border: none;
  background: linear-gradient(180deg, #BBEBFF 0%, #6B9DEB 100%);
  color: var(--main-text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  max-width: 200px;
}
.bubble-s3-text {
  display: inline;
  max-width: 100%;
}
.bubble-s3-tail {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  object-fit: contain;
  pointer-events: none;
  display: block;
}

/* 버블 모달 — 심즈3 방향 패널 (미리보기 아래) */
.bubble-tab-panel {
  margin-top: 0;
}
.bubble-s3-dir-label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: #666;
}
/* 심즈4는 이 영역에 콘텐츠 없음 — 레이아웃만 맞추기 위한 토글용 노드 */
.bubble-s3-tail-section .tab-content[data-tab="sims4"] {
  display: none !important;
}

/* Emotion sticker — 박스를 정확히 100×100으로 고정 (inline-block 베이스라인 여백 방지 → 확대 시 하단 어긋남 해소) */
.sticker-emotion {
  pointer-events: all;
  width: 200px;
  height: 200px;
  box-sizing: border-box;
  overflow: visible;
}
.sticker-emotion .sticker-content {
  display: block;
  width: 100%;
  height: 100%;
  line-height: 0;
  box-sizing: border-box;
}
/* 한 변 길이 = app.js EMOTION_QUARTER_LAYOUT_HEIGHT (그라데이션 circle 반지름과 동일) */
.emotion-quarter {
  width: 200px;
  height: 200px;
  border-radius: 0;
  position: relative;
  overflow: hidden;
}
.sticker-emotion .emotion-quarter {
  width: 100%;
  height: 100%;
}
.emotion-quarter-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 0 12px 12px;
  box-sizing: border-box;
}
.emotion-vertical-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 20px;
  font-weight: 400;
  color: rgba(255,255,255,0.96);
  text-shadow: 0 0 3px rgba(0,0,0,0.4);
  line-height: 1.25;
  letter-spacing: -0.15em;
  flex-shrink: 0;
  max-height: none;
  overflow: visible;
  padding-bottom: 3px;
  box-sizing: border-box;
}
.emotion-icons-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  align-content: flex-end;
  gap: 6px;
  flex: 1;
  min-width: 0;
  max-height: 100%;
  justify-content: flex-start;
  padding-bottom:8px;
}
.emotion-icon-slot {
  position: relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-width: 52px;
  min-height: 52px;
  padding: 0px 6px 3px;
  border-radius: 8px;
  border: 2.5px solid rgba(255,255,255,0.92);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  overflow: visible;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  font-family: inherit;
  box-sizing: border-box;
}
.emotion-icon-remove-btn {
  display: none;
  position: absolute;
  top: -7px;
  right: -7px;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #e03030;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 4;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  border: 2px solid #fff;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.emotion-icon-text {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.45);
  line-height: 1;
  text-align: center;
  pointer-events: none;
}
.emotion-icon-slot img {
  max-width: 28px;
  max-height: 24px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.emotion-icon {
  position: absolute;
  left: 10px;
  bottom: 10px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.emotion-icon img { width: 100%; height: 100%; object-fit: contain; }
.emotion-plain {
  width: 100px;
  height: 100px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  position: relative;
  border-radius: 0;
  overflow: hidden;
}
.emotion-plain img,
.emotion-plain svg {
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
}

/* Wish sticker (SVG cloud + text + optional image) */
.sticker-wish { pointer-events: all; }
.wish-sticker-root {
  position: relative;
  width: 46px;
  /* 구름 SVG는 42px 높이 — 아래쪽 글자 descender가 박스 밖으로 나가면 html2canvas가 잘라냄 */
  height: 44px;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.22)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.14));
}
.wish-bubble-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 42px;
  pointer-events: none;
}
.wish-bubble-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  display: block;
}
.wish-bubble-fill {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}
.wish-sticker--gray .wish-bubble-bg {
  filter: grayscale(1) brightness(1.12);
}
.wish-sticker-front {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 7px 10px 11px;
  box-sizing: border-box;
  pointer-events: none;
  overflow: visible;
}
.wish-sticker-text {
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  max-width: 100%;
  overflow: visible;
}
.wish-sticker--gray .wish-sticker-text {
  color: var(--main-text);
}
.wish-sticker--color-tint .wish-sticker-text {
  color: #fff;
}
