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

body {
  background: #1a1a2e;
  color: #ddd;
  font-family: system-ui, sans-serif;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* TOP BAR */
#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 1.2rem;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  flex-shrink: 0;
  gap: 1rem;
}

#app-title {
  font-size: 1.15rem;
  color: #c4b5fd;
  white-space: nowrap;
}

#score-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

#score-label {
  font-size: 0.78rem;
  color: #888;
  white-space: nowrap;
}

#score-track {
  width: 160px;
  height: 11px;
  background: #0f1827;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #2a2560;
}

#score-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7c3aed, #f59e0b);
  border-radius: 6px;
  transition: width 0.35s ease;
}

#score-num {
  font-size: 1rem;
  font-weight: bold;
  color: #f59e0b;
  min-width: 2.2rem;
  text-align: right;
}

/* MAIN LAYOUT */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* LEFT PANEL */
#left-panel {
  width: 235px;
  flex-shrink: 0;
  background: #12102a;
  border-right: 1px solid #2a2560;
  display: flex;
  flex-direction: column;
  padding: 0.55rem;
  gap: 0.45rem;
  overflow: hidden;
}

#category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.cat-tab {
  background: #1e1c3a;
  border: 1px solid #2a2560;
  color: #aaa;
  padding: 0.28rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.cat-tab:hover { background: #2a2558; color: #ccc; }
.cat-tab.active { background: #6d28d9; color: #fff; border-color: #7c3aed; }

#item-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.38rem;
  overflow-y: auto;
  flex: 1;
}

#item-grid::-webkit-scrollbar { width: 4px; }
#item-grid::-webkit-scrollbar-thumb { background: #2a2560; border-radius: 2px; }

.item-card {
  background: #1e1c3a;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0.45rem 0.25rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.12s;
  user-select: none;
}

.item-card:hover { border-color: rgba(124,58,237,0.45); background: #252347; }
.item-card.selected { border-color: #7c3aed; background: #2d2558; }

.item-emoji { font-size: 1.5rem; display: block; }
.item-name { font-size: 0.67rem; color: #bbb; margin-top: 0.2rem; line-height: 1.2; }
.item-charm { font-size: 0.63rem; color: #a78bfa; margin-top: 0.12rem; }
.item-charm.dim { color: #444; }

/* CENTER PANEL */
#center-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 0.75rem 1rem;
  overflow: hidden;
}

#jotham-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

#jotham-canvas {
  height: min(72vh, 360px);
  width: auto;
  filter: drop-shadow(0 4px 24px rgba(124,58,237,0.25));
}

#child-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

#child-panel.hidden { display: none; }

#child-panel.bounce { animation: childBounce 0.45s ease; }

@keyframes childBounce {
  0%   { opacity: 0; transform: scale(0.7) translateY(18px); }
  65%  { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1) translateY(0); }
}

#child-intro {
  font-size: 0.72rem;
  color: #888;
  text-align: center;
  line-height: 1.4;
}

#child-canvas {
  height: min(32vh, 160px);
  width: auto;
  filter: drop-shadow(0 2px 10px rgba(245,158,11,0.2));
}

#child-label {
  font-size: 0.88rem;
  color: #f59e0b;
  font-weight: 600;
}

/* RIGHT PANEL */
#right-panel {
  width: 198px;
  flex-shrink: 0;
  background: #12102a;
  border-left: 1px solid #2a2560;
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow-y: auto;
}

#right-panel::-webkit-scrollbar { width: 4px; }
#right-panel::-webkit-scrollbar-thumb { background: #2a2560; border-radius: 2px; }

#reaction-wrap {
  background: #1a183a;
  border-radius: 8px;
  padding: 0.6rem;
  border: 1px solid #2a2560;
}

#reaction-text {
  font-size: 0.82rem;
  color: #c4b5fd;
  line-height: 1.45;
  font-style: italic;
}

#combos-title {
  font-size: 0.78rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid #2a2560;
}

.combo-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #1a183a;
  border: 1px solid #252545;
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
  opacity: 0.45;
  transition: opacity 0.2s, border-color 0.2s, background 0.2s;
}

.combo-badge.achieved {
  border-color: #f59e0b;
  background: rgba(245,158,11,0.08);
  opacity: 1;
}

.combo-emoji { font-size: 1rem; flex-shrink: 0; }

.combo-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.combo-name {
  font-size: 0.72rem;
  color: #bbb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.combo-badge.achieved .combo-name { color: #fbbf24; }

.combo-bonus {
  font-size: 0.65rem;
  color: #a78bfa;
  font-weight: 600;
}

.combo-badge.achieved .combo-bonus { color: #f59e0b; }
