:root {
  --pink: #ff5da2;
  --purple: #7c5cff;
  --yellow: #ffce45;
  --blue: #4ea8ff;
  --green: #3ddc84;
  --text: #2c2140;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(160deg, #fff2ac 0%, #ffd6ec 35%, #c9e7ff 100%);
  font-family: "Comic Sans MS", "Malgun Gothic", "Segoe UI", sans-serif;
  color: var(--text);
  padding-bottom: 60px;
}

.kid-topbar {
  text-align: center;
  padding: 24px 16px 12px;
  position: relative;
}

.kid-nav-group {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
}

.kid-nav-link {
  background: white;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--purple);
  text-decoration: none;
  box-shadow: 0 3px 0 rgba(0,0,0,0.1);
  white-space: nowrap;
}

.kid-topbar h1 {
  margin: 0;
  font-size: 32px;
  color: var(--purple);
  text-shadow: 2px 2px 0 white;
}

.kid-subtitle {
  margin: 6px 0 0;
  font-size: 16px;
  color: #6b5b95;
}

@media (max-width: 480px) {
  .kid-nav-group {
    position: static;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 10px;
  }

  .kid-topbar h1 {
    font-size: 24px;
  }
}

.kid-search {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px 6px;
  flex-wrap: wrap;
}

.kid-search input {
  width: 320px;
  max-width: 80vw;
  padding: 14px 18px;
  border-radius: 999px;
  border: 3px solid var(--purple);
  font-size: 16px;
  outline: none;
}

.kid-search button {
  padding: 14px 22px;
  border-radius: 999px;
  border: none;
  background: var(--pink);
  color: white;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 4px 0 #c23f7d;
}

.kid-search button:hover {
  transform: translateY(-1px);
}

.kid-status {
  text-align: center;
  font-size: 15px;
  min-height: 22px;
  padding: 6px;
  color: #6b5b95;
}

.hidden {
  display: none !important;
}

.kid-card {
  max-width: 560px;
  margin: 10px auto 0;
  padding: 0 16px;
}

.kid-card-inner {
  position: relative;
  background: white;
  border-radius: 28px;
  padding: 26px 22px 30px;
  box-shadow: 0 10px 0 rgba(124, 92, 255, 0.25), 0 14px 30px rgba(0,0,0,0.15);
  border: 4px solid var(--purple);
}

.kid-grade-ribbon {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 22px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  color: white;
  background: linear-gradient(90deg, #b08d57, #8a6b3d);
  box-shadow: 0 3px 0 rgba(0,0,0,0.2);
}

.kid-grade-ribbon.silver { background: linear-gradient(90deg, #b8bfc7, #8a949f); }
.kid-grade-ribbon.gold { background: linear-gradient(90deg, #ffd76a, #f5a623); }
.kid-grade-ribbon.diamond { background: linear-gradient(90deg, #8fe9ff, #4ea8ff); }

.kid-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
}

.kid-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 4px solid var(--yellow);
  object-fit: cover;
  background: #eee;
}

.kid-display-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--purple);
}

.kid-username {
  font-size: 13px;
  color: #8b7fb8;
}

.kid-chip {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--green);
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.kid-stats-row {
  display: flex;
  justify-content: space-around;
  margin: 20px 0;
}

.kid-stat-bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #f5f0ff;
  border-radius: 16px;
  padding: 10px 16px;
  min-width: 80px;
}

.kid-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--pink);
}

.kid-stat-label {
  font-size: 12px;
  color: #6b5b95;
  margin-top: 2px;
}

.kid-section {
  margin-top: 18px;
}

.kid-section h2 {
  font-size: 16px;
  color: var(--purple);
  margin: 0 0 10px;
}

.kid-card-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.kid-card-row:empty::before {
  content: "아직 없어요!";
  color: #b3a8d6;
  font-size: 13px;
}

.kid-tile {
  flex: 0 0 auto;
  width: 84px;
  text-align: center;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}

.kid-tile img {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
  background: #eee;
  border: 3px solid var(--blue);
}

.kid-tile.round img {
  border-radius: 50%;
}

.kid-tile-name {
  display: block;
  font-size: 11px;
  margin-top: 4px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kid-chest-btn {
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  background: var(--yellow);
  color: #6b4d00;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 3px 0 #c99a1c;
}

.kid-chest-btn:hover {
  transform: translateY(-1px);
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

.kid-card-row .kid-tile {
  animation: pop-in 0.35s ease backwards;
}

.kid-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(60, 30, 90, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.kid-modal {
  position: relative;
  background: white;
  border-radius: 24px;
  padding: 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  border: 4px solid var(--purple);
}

.kid-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--purple);
  cursor: pointer;
}

.kid-modal img {
  width: 120px;
  height: 120px;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 10px;
  background: #eee;
}

.kid-modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--purple);
  margin-bottom: 6px;
}

.kid-modal-desc {
  font-size: 13px;
  color: #6b5b95;
  white-space: pre-wrap;
}
