/* Character maker, home "My room" card, mood bar and the room decorator. */

/* ---------- character maker ---------- */
.maker { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 24px; align-items: start; }
.maker-stage { position: sticky; top: 80px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.maker-title { text-align: center; }
.stage {
  position: relative; width: 100%; aspect-ratio: 4 / 5; display: grid; place-items: center; overflow: hidden;
  border: 2px solid var(--neon-dark);
  background: radial-gradient(circle at 50% 35%, rgba(255, 62, 165, .35), #150f22 70%);
  box-shadow: 0 6px 0 var(--shadow), 0 0 40px rgba(255, 62, 165, .3), inset 0 0 40px rgba(62, 240, 255, .08);
}
.stage canvas { width: 240px; height: 360px; image-rendering: pixelated; position: relative; z-index: 2; animation: float 3s ease-in-out infinite; }
.pedestal {
  position: absolute; bottom: 9%; width: 58%; height: 22px; z-index: 1; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 182, 217, .55), rgba(255, 62, 165, .15) 60%, transparent 70%);
  animation: pedestal 3s ease-in-out infinite;
}
.sparkles i { position: absolute; width: 6px; height: 6px; background: var(--soft); z-index: 3; animation: twinkle 2.4s ease-in-out infinite; }
.sparkles i:nth-child(1) { top: 14%; left: 18%; }
.sparkles i:nth-child(2) { top: 26%; right: 16%; background: var(--cyan); animation-delay: .5s; }
.sparkles i:nth-child(3) { bottom: 30%; left: 12%; background: var(--gold); animation-delay: 1s; }
.sparkles i:nth-child(4) { top: 8%; right: 34%; animation-delay: 1.4s; }
.sparkles i:nth-child(5) { bottom: 22%; right: 12%; background: var(--cyan); animation-delay: 1.9s; }
.stage.pop canvas { animation: pop-avatar .35s cubic-bezier(.2, .8, .2, 1.4); }
.maker-save { margin-top: 0; width: 100%; justify-content: center; }
.maker-save .primary { flex: 1; padding: 12px; font-size: 16px; }
.maker-panel { padding: 0; overflow: hidden; }
.maker-tabs { display: flex; border-bottom: 2px solid var(--line); background: #1a1228; }
.maker-tabs .tab { border: 0; border-bottom: 3px solid transparent; padding: 12px 8px; font-weight: 700; color: var(--muted); box-shadow: none; }
.maker-tabs .tab.active { color: var(--soft); border-bottom-color: var(--neon); background: var(--panel); }
.maker-tabs .tab .ic { font-size: 18px; display: block; }
#avatar-options { padding: 18px; display: grid; gap: 20px; max-height: calc(100vh - 200px); overflow-y: auto; }
.opt-block { animation: view-in .3s both; }
.opt-block h4 { margin: 0 0 8px; font-size: 14px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.opt-block h4 b { color: var(--soft); font-weight: 700; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.tile {
  padding: 6px 4px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: none;
  background: #1a1228; border: 2px solid var(--line); font-size: 11px; color: var(--muted); position: relative;
  transition: transform .12s, border-color .12s, background .12s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--soft); }
.tile.on { border-color: var(--neon); background: linear-gradient(180deg, rgba(255, 62, 165, .25), #1a1228); color: var(--text); box-shadow: 0 0 12px rgba(255, 62, 165, .45); }
.tile.on::after { content: '✓'; position: absolute; top: 2px; inset-inline-end: 4px; color: var(--neon); font-weight: 700; }
.tile canvas { width: 84px; height: 84px; image-rendering: pixelated; background: radial-gradient(circle, rgba(255, 62, 165, .14), transparent 70%); }
.tile .emo { font-size: 26px; line-height: 48px; height: 48px; }
.swatches.big .swatch { width: 32px; height: 32px; }

/* ---------- home: greeting, my room, friends' rooms ---------- */
.greeting { font-size: 22px; margin: 0 0 14px; color: var(--soft); animation: view-in .5s both; }
.home-rooms { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; margin-top: 26px; }
.myroom-card { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; padding: 16px; }
.myroom-preview { position: relative; border: 2px solid var(--neon-dark); box-shadow: 0 0 18px rgba(255, 62, 165, .3); align-self: start; cursor: pointer; }
.myroom-preview canvas { width: 100%; display: block; aspect-ratio: 16 / 9; }
.unlock-badge {
  position: absolute; top: -12px; inset-inline-end: -10px; background: var(--gold); color: #2a1a08; font-weight: 700; font-size: 12px;
  padding: 4px 10px; border: 2px solid #2a1a08; box-shadow: 0 0 16px rgba(255, 216, 106, .8); animation: badge-bounce 1.4s ease-in-out infinite;
}
.myroom-name { font-weight: 700; font-size: 18px; margin-bottom: 4px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.friends-card { padding: 16px; }
.friends-card .code-form { margin-bottom: 6px; }
.friends-card .code-form input { flex: 1; width: auto; }
.visited-list { display: grid; gap: 10px; margin-top: 8px; }
.visited { display: grid; grid-template-columns: 96px 1fr auto; gap: 10px; align-items: center; background: var(--panel-2); border: 2px solid var(--line); padding: 6px; animation: view-in .35s both; }
.visited canvas { width: 96px; aspect-ratio: 16 / 9; display: block; }
.visited .who { font-weight: 700; }
.visited .meta { font-size: 12px; color: var(--muted); }

/* ---------- room: mood bar ---------- */
.mood-bar { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.mood-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.mood-btn { font-size: 20px; padding: 4px 8px; background: var(--panel); box-shadow: none; transition: transform .15s; }
.mood-btn:hover { transform: translateY(-3px) scale(1.1); }
.mood-btn.on { border-color: var(--neon); background: rgba(255, 62, 165, .2); box-shadow: 0 0 12px rgba(255, 62, 165, .5); animation: wiggle .5s; }

/* ---------- decorate my room ---------- */
.editor { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
.editor-wrap #editor-canvas { width: 100%; display: block; aspect-ratio: 16 / 9; touch-action: none; }
#editor-canvas.grab { cursor: grab; }
#editor-canvas.grabbing { cursor: grabbing; }
.selected-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; padding: 8px 12px; background: var(--panel); border: 2px solid var(--neon); animation: view-in .2s both; }
.selected-bar #selected-name { font-weight: 700; color: var(--soft); }
.credits-strip { display: flex; gap: 20px; align-items: center; margin-top: 12px; padding: 12px 16px; background: var(--panel); border: 2px solid var(--line); }
.credits-strip .grow { flex: 1; }
.editor-panel { padding: 0; overflow: hidden; position: sticky; top: 80px; }
.ed-panel { padding: 14px; max-height: calc(100vh - 230px); overflow-y: auto; }
.furn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.furn {
  padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; box-shadow: none;
  background: #1a1228; border: 2px solid var(--line); position: relative; transition: transform .12s, border-color .12s;
}
.furn:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--soft); }
.furn canvas { width: 80px; height: 56px; }
.furn .z { font-size: 10px; color: var(--muted); }
.furn.placed { border-color: var(--cyan); }
.furn.placed::after { content: '✓'; position: absolute; top: 2px; inset-inline-end: 5px; color: var(--cyan); font-weight: 700; }
.furn.locked canvas { filter: brightness(.35) saturate(.3); }
.furn.locked::before { content: '🔒'; position: absolute; top: 20px; font-size: 18px; z-index: 1; }
.furn.can-unlock { border-color: var(--gold); box-shadow: 0 0 10px rgba(255, 216, 106, .4); }
.furn.can-unlock::before { content: '🔓'; position: absolute; top: 20px; font-size: 18px; z-index: 1; animation: badge-bounce 1.2s infinite; }
.furn.just-unlocked { animation: unlock-flash .9s ease-out; }
.style-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 6px 0 10px; }
.style-opt { padding: 0; box-shadow: none; border: 2px solid var(--line); position: relative; }
.style-opt canvas { width: 100%; display: block; aspect-ratio: 16 / 10; }
.style-opt.on { border-color: var(--neon); box-shadow: 0 0 10px rgba(255, 62, 165, .5); }
.style-opt span { position: absolute; bottom: 0; inset-inline: 0; font-size: 10px; background: rgba(0, 0, 0, .55); padding: 1px 3px; color: #fff; }
.check.inline { margin: 0; }
.adm-room-thumb { width: 96px; aspect-ratio: 16 / 9; display: block; border: 1px solid var(--line); }

@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0); } 50% { opacity: 1; transform: scale(1) rotate(45deg); } }
@keyframes pedestal { 50% { transform: scaleX(.85); opacity: .7; } }
@keyframes pop-avatar { 0% { transform: scale(.9); } 60% { transform: scale(1.06); } }
@keyframes badge-bounce { 50% { transform: translateY(-4px); } }
@keyframes wiggle { 25% { transform: rotate(-10deg) scale(1.15); } 75% { transform: rotate(10deg) scale(1.15); } }
@keyframes unlock-flash { 0% { box-shadow: 0 0 0 0 rgba(255, 216, 106, .9); transform: scale(1.1); } 100% { box-shadow: 0 0 0 24px rgba(255, 216, 106, 0); transform: scale(1); } }

@media (max-width: 900px) {
  .maker, .editor, .home-rooms { grid-template-columns: 1fr; }
  .maker-stage, .editor-panel { position: static; }
  .stage { max-width: 320px; }
  .myroom-card { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* color choices: the full palette, the item's own colors, and any color */
.color-block .swatches.big { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 6px; }
.color-block .swatches.big .swatch { width: 100%; height: auto; aspect-ratio: 1; border-radius: 6px; transition: transform .15s ease, box-shadow .15s ease; }
.color-block .swatches.big .swatch:hover { transform: scale(1.18); z-index: 1; box-shadow: 0 4px 10px rgba(0, 0, 0, .25); }
.swatch.orig { background: conic-gradient(#ff9cb6, #ffe36a, #a8e0a0, #6aa8e8, #c8b0f0, #ff9cb6) !important; position: relative; }
.swatch.orig::after { content: '✦'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 13px; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.swatch.any { position: relative; display: grid; place-items: center; cursor: pointer; background: repeating-conic-gradient(#fff 0 25%, #f0e0ea 0 50%) 0 0 / 10px 10px; overflow: hidden; }
.swatch.any input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.swatch.any span { font-size: 14px; pointer-events: none; }
.tile { transition: transform .18s cubic-bezier(.2, .8, .2, 1.2), border-color .15s, box-shadow .15s; }
