/* 광장 꾸미기: 게임 꾸미기와 같은 흐름(위 큰 화면 + 아래 도구 서랍, 넓은 화면은 오른쪽 서랍) */
:root { --ink: #2f2927; --pink: #ef789f; --pink-dark: #d85d86; --charcoal: #2e2a2d; --line: rgba(65, 48, 45, 0.12); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; color: var(--ink); font-family: Pretendard, "Noto Sans KR", system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; }
body { height: 100dvh; overflow: hidden; background: #f7efe7; }
[hidden] { display: none !important; }
.app { position: relative; height: 100dvh; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.stage { position: relative; min-height: 0; background: linear-gradient(#f6ece4 0 62%, #e5d4c5 62%); overflow: hidden; }
#preview { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.stage-top { position: absolute; z-index: 3; left: 10px; right: 10px; top: max(10px, env(safe-area-inset-top)); display: flex; gap: 8px; align-items: center; }
.stage-top .title { flex: 1; font-weight: 800; color: #6b5a52; font-size: 13px; }
.pill { border: 1px solid var(--line); background: rgba(255, 253, 251, 0.92); border-radius: 999px; padding: 7px 12px; font-size: 12px; font-weight: 800; color: var(--ink); text-decoration: none; cursor: pointer; }
.pixel-preview { position: absolute; z-index: 2; right: 10px; top: 56px; margin: 0; padding: 6px 6px 4px; background: rgba(255, 253, 251, 0.9); border: 1px solid var(--line); border-radius: 14px; text-align: center; }
#pixel { display: block; width: 96px; height: 120px; image-rendering: pixelated; }
.pixel-preview figcaption { font-size: 10px; font-weight: 800; color: #8a756c; }
.stage-name { position: absolute; z-index: 2; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; background: rgba(255, 253, 251, 0.92); border: 1px solid var(--line); border-radius: 999px; padding: 5px 6px 5px 14px; white-space: nowrap; }
.stage-name strong { font-size: 17px; letter-spacing: -0.03em; }
.stage-name small { color: #9a8981; font-weight: 800; }
.stage-hint { position: absolute; left: 12px; bottom: 58px; margin: 0; font-size: 10px; color: #9a8981; }
.drawer { margin: 0 8px 8px; padding: 10px 10px 8px; border-radius: 26px; background: rgba(255, 253, 251, 0.96); box-shadow: 0 22px 70px rgba(81, 55, 46, 0.14); border: 1px solid #fff; height: min(48dvh, 460px); display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
.drawer-head { display: flex; gap: 8px; align-items: center; padding: 0 2px 8px; }
.drawer-head span { flex: 1; font-size: 12px; font-weight: 800; color: #6b5a52; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.button-primary { border: 0; border-radius: 999px; padding: 9px 16px; background: var(--pink-dark); color: #fff; font-weight: 900; font-size: 13px; cursor: pointer; white-space: nowrap; }
.button-primary:disabled { opacity: 0.5; }
.button-secondary { border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; background: #fff; color: var(--ink); font-weight: 800; font-size: 13px; cursor: pointer; white-space: nowrap; }
.button-secondary[aria-pressed="true"] { background: var(--pink-dark); color: #fff; border-color: var(--pink-dark); }
.sub-tabs { display: flex; gap: 7px; padding: 0 2px 9px; overflow-x: auto; scrollbar-width: none; }
.sub-tabs::-webkit-scrollbar { display: none; }
.sub-tab { min-height: 34px; padding: 0 13px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, 0.72); color: #746965; font-size: 12px; font-weight: 800; cursor: pointer; }
.sub-tab.is-active { border-color: var(--charcoal); background: var(--charcoal); color: #fff; }
.content-region { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.asset-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 1px 2px 8px; }
.asset-card { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 100px; padding: 4px 4px 7px; place-items: center; border: 1px solid var(--line); border-radius: 17px; background: rgba(255, 255, 255, 0.76); color: var(--ink); cursor: pointer; }
.asset-card.is-selected { border: 2px solid var(--pink-dark); background: #fff5f8; }
.asset-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 13px; background: #f2e6dc; }
.asset-card .icon { width: 100%; aspect-ratio: 1; display: grid; place-items: center; font-size: 26px; border-radius: 13px; background: linear-gradient(145deg, #faf3ed, #f2e3d8); }
.asset-card-name { width: 100%; overflow: hidden; color: #665d59; font-size: 10px; font-weight: 800; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.asset-card .check { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--pink-dark); color: #fff; font-size: 12px; display: grid; place-items: center; }
.tool-strip { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 0 2px 8px; }
.tool-strip small, .note { color: #8a756c; font-size: 11px; }
.panel { padding: 2px 2px 10px; }
.panel h4 { margin: 10px 0 6px; font-size: 12px; color: #6b5a52; }
.color-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.swatch { width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(65, 48, 45, 0.18); cursor: pointer; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--pink-dark); }
input[type="color"] { width: 34px; height: 30px; border: 0; padding: 0; background: none; }
.slider { display: grid; grid-template-columns: 74px 1fr 44px; gap: 6px; align-items: center; font-size: 12px; margin: 4px 0; }
.mat-card { border: 1px solid var(--line); border-radius: 16px; padding: 8px 10px; margin-bottom: 8px; background: #fff; }
.mat-card b { font-size: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.text-input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; font-size: 14px; }
.tag { display: inline-block; font-size: 10px; font-weight: 800; border-radius: 6px; padding: 1px 5px; background: #fbeef3; color: var(--pink-dark); }
/* 이름 룰렛(게임 「이름 정하기」와 같은 슬롯·잠금·축하) */
.name-machine { display: grid; grid-template-columns: minmax(72px, 1.3fr) minmax(58px, 1fr) minmax(58px, 1fr); gap: 7px; }
.name-slot { display: grid; min-height: 124px; grid-template-rows: 20px 44px 20px; align-content: center; place-items: center; padding: 8px 4px; overflow: hidden; border: 2px solid #c9a999; border-radius: 5px; background: #fff9f3; box-shadow: inset 0 -6px 0 rgba(169, 123, 101, 0.08), 4px 4px 0 rgba(89, 60, 49, 0.1); color: var(--ink); cursor: pointer; touch-action: manipulation; font: inherit; }
.name-slot small, .name-slot .lock-state { color: #8a756c; font-size: 9px; font-weight: 800; }
.name-slot.is-locked { border-color: var(--pink-dark); background: #fff0f5; }
.name-slot.is-locked .lock-state::before { content: "🔒 "; }
.slot-window { display: block; width: 100%; height: 44px; overflow: hidden; border-top: 1px solid rgba(126, 96, 82, 0.13); border-bottom: 1px solid rgba(126, 96, 82, 0.13); background: rgba(255, 255, 255, 0.45); }
.slot-reel-track { display: flex; width: 100%; flex-direction: column; will-change: transform; }
.slot-reel-track b { display: grid; width: 100%; height: 44px; flex: 0 0 44px; place-items: center; font-size: clamp(20px, 5.8vw, 30px); font-weight: 900; letter-spacing: -0.08em; line-height: 1; white-space: nowrap; }
.name-slot.is-rolling { border-color: #e38bab; }
.name-slot.is-stopped { animation: slot-stop 150ms ease-out; }
@keyframes slot-stop { 0% { transform: translateY(-3px); } 60% { transform: translateY(2px); } 100% { transform: translateY(0); } }
.full-name { display: flex; justify-content: space-between; align-items: center; margin: 10px 2px; font-size: 13px; color: #6b5a52; }
.full-name strong { font-size: 22px; color: var(--ink); }
.name-celebration { position: fixed; z-index: 30; top: 42%; left: 50%; width: 1px; height: 1px; pointer-events: none; }
.name-celebration i { position: absolute; width: 7px; height: 7px; transform: translate(-50%, -50%); opacity: 0; background: #f36f9d; }
.name-celebration i[data-color="1"] { background: #ffc857; }
.name-celebration i[data-color="2"] { background: #5fd2c8; }
.name-celebration i[data-color="3"] { background: #8d7ff0; }
.name-celebration i[data-color="4"] { background: #fff; box-shadow: 0 0 0 1px #c99f8a; }
.name-celebration.is-active i { animation: pixel-burst 590ms cubic-bezier(.17, .72, .23, 1) var(--delay) forwards; }
@keyframes pixel-burst { 0% { transform: translate(-50%, -50%) scale(.4) rotate(0turn); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1) rotate(var(--turn)); opacity: 0; } }
dialog.sheet { border: 0; border-radius: 24px; padding: 18px; max-width: min(92vw, 420px); box-shadow: 0 22px 70px rgba(81, 55, 46, 0.25); color: var(--ink); }
dialog.sheet::backdrop { background: rgba(47, 41, 39, 0.35); }
dialog.sheet h3 { margin: 0 0 8px; }
dialog.sheet .big-name { font-size: 24px; font-weight: 900; color: var(--pink-dark); margin: 6px 0 10px; }
dialog.sheet p { font-size: 13px; line-height: 1.55; margin: 6px 0; }
dialog.sheet .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.icon-button { width: 34px; height: 34px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--ink); font-size: 16px; font-weight: 900; cursor: pointer; padding: 0; }
.icon-button:disabled { opacity: 0.35; }
.stage-note { position: absolute; z-index: 2; left: 50%; top: 56px; transform: translateX(-50%); margin: 0; max-width: 70vw; text-align: center; font-size: 12px; font-weight: 800; color: #6b5a52; background: rgba(255, 253, 251, 0.85); border-radius: 12px; padding: 0 8px; }
.stage-note:empty { display: none; }
body { touch-action: pan-x pan-y; } /* 꾸미기에서는 화면 확대(핀치) 막기 */
/* 멜꾸 색상 조정(재질) */
.material-color-control { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.modern-color-picker { display: grid; grid-template-columns: 35px 1fr; gap: 9px; min-height: 48px; padding: 6px 10px 6px 7px; align-items: center; border: 1px solid rgba(124, 91, 78, 0.17); border-radius: 14px; background: #fff; color: #655751; font-size: 10px; font-weight: 850; cursor: pointer; text-align: left; }
.modern-color-picker > span:last-child { display: grid; gap: 2px; }
.modern-color-picker small { color: #9b8379; font: 9px ui-monospace, Consolas, monospace; }
.color-picker-swatch { width: 35px; height: 35px; border: 3px solid #fff; border-radius: 11px; background: var(--picked-color, #fff); box-shadow: 0 0 0 1px rgba(82, 61, 54, 0.18), 0 3px 8px rgba(80, 57, 49, 0.12); }
.material-hex-field { display: grid; grid-template-columns: auto 1fr; gap: 8px; min-height: 48px; padding: 7px 9px; align-items: center; border: 1px solid rgba(124, 91, 78, 0.17); border-radius: 14px; background: #fff; }
.material-hex-field span { color: #9b8379; font-size: 9px; font-weight: 900; }
.material-hex-field input { min-width: 0; padding: 7px 8px; border: 0; border-radius: 9px; outline: none; background: #f8f2ee; color: #4d423e; font: 850 12px ui-monospace, Consolas, monospace; text-transform: uppercase; }
.recent-color-row { display: flex; grid-column: 1 / -1; gap: 7px; align-items: center; flex-wrap: wrap; }
.recent-color { width: 27px; height: 27px; padding: 0; border: 3px solid #fff; border-radius: 9px; background: var(--recent-color); box-shadow: 0 0 0 1px rgba(82, 61, 54, 0.17); cursor: pointer; }
.color-picker-layer:empty { display: none; }
.color-picker-backdrop { position: fixed; z-index: 80; inset: 0; background: transparent; }
.gradient-color-picker { position: fixed; z-index: 81; left: 0; right: 0; bottom: 0; max-height: min(60dvh, 520px); overflow-y: auto; padding: 12px 14px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid rgba(113, 81, 69, 0.2); border-radius: 20px 20px 0 0; background: #fffaf6; box-shadow: 0 -12px 40px rgba(47, 34, 29, 0.2); }
.gradient-color-heading, .color-comparison, .gradient-color-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gradient-color-heading > div { display: grid; gap: 3px; }
.gradient-color-heading span { color: #987c70; font-size: 10px; font-weight: 850; }
.gradient-color-heading strong { font-size: 14px; }
.gradient-close { width: 36px; min-height: 36px; padding: 0; border: 1px solid #e3d5cc; border-radius: 50%; background: #fff; color: #705d55; font-size: 22px; }
.color-comparison { margin: 10px 0 8px; }
.color-comparison > div { display: grid; grid-template-columns: 36px 1fr; flex: 1 1 0; gap: 1px 9px; align-items: center; min-width: 0; padding: 8px; border: 1px solid #eaded5; border-radius: 13px; background: #fff; }
.color-comparison i { grid-row: 1 / 3; width: 36px; height: 36px; border: 2px solid #fff; border-radius: 10px; background: var(--comparison-color, var(--selected-color, #fff)); box-shadow: 0 0 0 1px rgba(65, 47, 41, 0.18); }
.color-comparison span { color: #9a837a; font-size: 9px; font-weight: 800; }
.color-comparison b { overflow: hidden; color: #594a44; font: 800 10px ui-monospace, Consolas, monospace; text-overflow: ellipsis; }
.color-gradient-guide { display: flex; justify-content: space-between; gap: 8px; margin: 0 2px 7px; color: #78665e; font-size: 10px; font-weight: 850; }
.color-gradient-area { position: relative; width: 100%; min-height: clamp(120px, 22dvh, 200px); overflow: hidden; border: 1px solid rgba(75, 56, 49, 0.24); border-radius: 16px; background: linear-gradient(to bottom, transparent, #000), linear-gradient(to right, #fff, var(--picker-hue)); cursor: crosshair; touch-action: none; }
.color-gradient-marker { position: absolute; width: 24px; height: 24px; border: 3px solid #fff; border-radius: 50%; background: var(--marker-color); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); transform: translate(-50%, -50%); pointer-events: none; }
.hue-gradient-control, .gradient-hex-field { display: grid; gap: 7px; margin-top: 12px; color: #75645d; font-size: 10px; font-weight: 850; }
.hue-gradient-control input { width: 100%; height: 28px; margin: 0; appearance: none; border: 4px solid #fff; border-radius: 999px; outline: 1px solid rgba(74, 54, 47, 0.2); background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.hue-gradient-control input::-webkit-slider-thumb { width: 28px; height: 28px; appearance: none; border: 3px solid #fff; border-radius: 50%; background: transparent; box-shadow: 0 0 0 2px #5b4a43, 0 2px 7px rgba(0, 0, 0, 0.28); }
.gradient-hex-field input { min-height: 40px; padding: 8px 12px; border: 1px solid #ded0c7; border-radius: 12px; background: #fff; color: #4d423e; font: 850 14px ui-monospace, Consolas, monospace; text-transform: uppercase; }
.gradient-color-actions { margin-top: 12px; }
.gradient-color-actions button { flex: 1 1 0; min-height: 44px; border: 1px solid #e3d5cc; border-radius: 13px; background: #fff; font-weight: 800; }
.gradient-color-actions .is-primary { border-color: #bd5378; background: #ca5c82; color: #fff; }
@media (min-width: 820px) {
  .gradient-color-picker { left: auto; right: 22px; bottom: 22px; width: 430px; border-radius: 22px; }
  .app { grid-template-rows: 1fr; }
  .drawer { position: absolute; top: 70px; right: 22px; bottom: 22px; width: 430px; height: auto; margin: 0; }
  .pixel-preview { right: 470px; }
  .stage-name { left: calc(50% - 220px); }
}
/* 좁은 휴대폰·큰 글꼴: 서랍 윗줄·탭 줄의 최소 폭이 화면을 밀어내 옆이 잘리지 않게(칸은 화면 폭 안에서만 줄어든다) */
.app, .drawer { grid-template-columns: minmax(0, 1fr); }
.app > *, .drawer > * { min-width: 0; }
.stage-top .title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-name { max-width: calc(100% - 20px); }
.stage-name strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.material-color-control { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.slider { grid-template-columns: minmax(56px, auto) minmax(0, 1fr) 40px; }
.slider input { min-width: 0; width: 100%; }
@media (max-width: 380px) {
  .drawer { margin: 0 6px 6px; padding: 9px 8px 7px; }
  .drawer-head { gap: 5px; }
  .icon-button { width: 30px; height: 30px; font-size: 14px; }
  .button-primary { padding: 8px 12px; font-size: 12px; }
  .asset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pixel-preview { top: 50px; }
  #pixel { width: 72px; height: 90px; }
  .stage-top .pill { padding: 6px 9px; font-size: 11px; }
}
