/*! HTML5 Boilerplate v9.0.1 | MIT License | https://html5boilerplate.com/ */

/* main.css 3.0.0 | MIT License | https://github.com/h5bp/main.css#readme */
/*
 * What follows is the result of much research on cross-browser styling.
 * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
 * Kroc Camen, and the H5BP dev community and team.
 */

/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */

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

html {
  color: #222;
  font-size: 1em;
  line-height: 1.4;
}

/*
 * Remove text-shadow in selection highlight:
 * https://twitter.com/miketaylr/status/12228805301
 *
 * Customize the background color to match your design.
 */

::-moz-selection {
  background: #b3d4fc;
  text-shadow: none;
}

::selection {
  background: #b3d4fc;
  text-shadow: none;
}

/*
 * A better looking default horizontal rule
 */

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1em 0;
  padding: 0;
}

/*
 * Remove the gap between audio, canvas, iframes,
 * images, videos and the bottom of their containers:
 * https://github.com/h5bp/html5-boilerplate/issues/440
 */

audio,
canvas,
iframe,
img,
svg,
video {
  vertical-align: middle;
}

/*
 * Remove default fieldset styles.
 */

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

/*
 * Allow only vertical resizing of textareas.
 */

textarea {
  resize: vertical;
}

/* ==========================================================================
   Author's custom styles
   ========================================================================== */

/* 전체 레이아웃 */
body {
  margin: 0;
  padding: 20px;
  background-color: #f5f5f5;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

main {
  max-width: 1400px;
  margin: 0 auto;
}

.game-container {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  height: 880px;
}

/* 캐릭터 영역 */
.character-area {
  position: relative;
  background: white;
  margin-left: 20px;
  border-radius: 15px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 0;
}

#character {
  display: block;
  pointer-events: none;
}

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

#character-items img {
  position: absolute;
  pointer-events: auto;
}

#character-items .placed-group {
  position: relative;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

/* 아이템 보드 */
.item-board {
  flex: 1;
  background: white;
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  height: 880px;
  overflow-y: auto;
}

.item-board h2 {
  margin-top: 0;
  margin-bottom: 25px;
  color: #333;
  font-size: 24px;
  border-bottom: 2px solid #4CAF50;
  padding-bottom: 10px;
}

.item-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  align-items: stretch; /* 자식 요소들의 높이를 맞춤 */
}

.item-row .item-category {
  display: flex;
  flex-direction: column;
  margin-bottom: 30px;
}

.item-category {
  margin-bottom: 30px;
  width: 100%;
}

.item-category h3 {
  margin: 0 0 15px 0;
  color: #555;
  font-size: 18px;
}

.item-list {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  padding: 10px;
  background-color: #f9f9f9;
  border-radius: 10px;
  min-height: 100px; /* 아이템이 없어도 최소 높이 유지 */
  flex: 1; /* item-row 내에서 남은 공간을 채워 높이를 맞춤 */
}

.item {
  width: 120px;
  height: auto;
  padding: 10px;
  background: white;
  border: 2px solid #ddd;
  border-radius: 8px;
  cursor: grab;
  transition: all 0.2s ease;
}

.item[data-category="top"],
.item[data-category="outer"],
.item[data-category="headwear"]
{
  width: 150px;
}

.item[data-category="socks"],
.item[data-category="shoes"] {
  width: 200px;
}

.item:hover {
  transform: scale(1.05);
  border-color: #4CAF50;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.item.dragging {
  opacity: 0;
  cursor: grabbing;
  transform: scale(1.1);
}

/* 드롭 가능 영역 하이라이트 */
.character-area.drag-over {
  background-color: #e8f5e9;
  border: 2px dashed #4CAF50;
}

/* 로딩 화면 */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #4CAF50;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-screen p {
  margin-top: 20px;
  color: #555;
  font-size: 16px;
  font-weight: 500;
}
