/* Các khối dùng lại ở nhiều màn */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--tap);
}
.topbar h1 { font-size: 22px; color: var(--violet-600); text-align: center; flex-grow: 1; }
.topbar .spacer { width: var(--tap); height: var(--tap); flex-shrink: 0; }

.btn-round {
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  background: var(--paper);
  color: var(--violet-600);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-btn);
  flex-shrink: 0;
  transition: transform 120ms ease;
}
.btn-round:active { transform: scale(0.92); }
.btn-round.is-faint { background: rgba(255, 255, 255, 0.6); color: var(--violet-300); box-shadow: none; }
.btn-round svg { width: 22px; height: 22px; }

.btn-primary {
  height: 64px;
  border-radius: 32px;
  background: var(--pink-400);
  color: #fff;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 10px 24px rgba(240, 98, 146, 0.4);
  width: 100%;
  transition: transform 120ms ease;
}
.btn-primary:active { transform: scale(0.97); }
/* Nút hành động mời bé bấm: nhún nhẹ và vòng sáng lan ra, kèm vệt sáng chạy qua, cho tới khi bé chạm */
.btn-primary.is-attention { position: relative; overflow: hidden; animation: cta-bounce 1500ms ease-in-out infinite; }
.btn-primary.is-attention::before { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 0 rgba(240, 98, 146, 0.55); animation: cta-ring 1500ms ease-out infinite; pointer-events: none; }
.btn-primary.is-attention::after { content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; background: linear-gradient(100deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.45) 50%, rgba(255,255,255,0) 100%); animation: cta-shine 2400ms ease-in-out infinite; pointer-events: none; }
@keyframes cta-bounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes cta-ring { 0% { box-shadow: 0 0 0 0 rgba(240, 98, 146, 0.55); } 100% { box-shadow: 0 0 0 18px rgba(240, 98, 146, 0); } }
@keyframes cta-shine { 0%, 55% { left: -60%; } 100% { left: 130%; } }
@media (prefers-reduced-motion: reduce) { .btn-primary.is-attention, .btn-primary.is-attention::before, .btn-primary.is-attention::after { animation: none; } }
.btn-primary.is-violet { background: var(--violet-600); box-shadow: 0 10px 24px rgba(122, 62, 140, 0.35); font-size: 20px; height: 56px; }
.btn-primary svg { width: 26px; height: 26px; }

.card {
  background: var(--paper);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}
.card.is-soft { background: rgba(255, 255, 255, 0.7); box-shadow: none; border-radius: var(--radius-md); padding: 12px 14px; }

/* Bong bóng lời thoại của công chúa */
.bubble {
  flex-grow: 1;
  background: var(--paper);
  border-radius: 20px 20px 20px 4px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-soft);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
  text-align: left;
}
.bubble svg { width: 24px; height: 24px; color: var(--pink-400); flex-shrink: 0; }

/* Nút loa to để bé bấm nghe lại */
.speaker {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--pink-400);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 8px rgba(240, 98, 146, 0.22), 0 8px 20px rgba(240, 98, 146, 0.35);
  flex-shrink: 0;
}
.speaker svg { width: 30px; height: 30px; }
.speaker.is-small { width: 56px; height: 56px; box-shadow: 0 0 0 7px rgba(240, 98, 146, 0.22); }
/* Đang có giọng nói: nút loa và biểu tượng loa trong bong bóng nhấp nháy, để bé biết tiếng đang phát từ đâu */
.speaker.is-playing, .is-voice-playing .speaker { animation: pulse 700ms ease-in-out infinite alternate; }
.is-voice-playing .bubble svg { animation: pulse 700ms ease-in-out infinite alternate; color: var(--pink-600); }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.08); } }

/* Ba cánh cửa ở trang chủ */
.castle {
  position: relative;
  background: var(--paper);
  border-radius: var(--radius-lg);
  padding: 22px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-card);
  margin-top: 12px;
}
.castle::before, .castle::after, .castle .tower {
  content: '';
  position: absolute;
  top: -14px;
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-bottom: 18px solid #E1C4F5;
}
.castle::before { left: 24px; }
.castle::after { right: 24px; }
.castle .tower {
  left: 50%;
  top: -22px;
  margin-left: -18px;
  border-left-width: 18px;
  border-right-width: 18px;
  border-bottom: 26px solid var(--gold-400);
}
.doors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
/* Cửa chính "Quà hôm nay": to nhất, nằm ngang, nhún mời chạm khi có chữ mới */
.door.is-main { flex-direction: row; justify-content: flex-start; gap: 14px; padding: 14px 16px; min-height: 104px; border-radius: 24px; text-align: left;
  background: var(--gold-100); border-color: #F8D98F; color: var(--gold-700); box-shadow: 0 0 0 6px rgba(242, 184, 75, 0.22), 0 10px 26px rgba(242, 184, 75, 0.25); }
.door.is-main .icon { position: relative; width: 76px; height: 76px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.door.is-main .icon > svg { width: 76px; height: 76px; }
.door.is-main .icon .glyph { font-size: 56px; color: var(--pink-600); }
.door.is-main .text { flex-grow: 1; min-width: 0; }
.door.is-main .title { font-family: var(--font-display); font-weight: 800; font-size: 22px; line-height: 1.15; }
.door.is-main .sub { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.door.is-main > svg:last-child { width: 26px; height: 26px; flex-shrink: 0; color: var(--gold-600); }
.door.is-main .badge { position: absolute; right: -4px; top: -4px; width: 28px; height: 28px; border-radius: 50%; background: var(--gold-400); color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 17px; display: flex; align-items: center; justify-content: center; }
.door.is-main .badge.is-tick { background: var(--green-400); }
.door.is-main .badge svg { width: 16px; height: 16px; }
.door.is-main.is-new { animation: cta-bounce 1500ms ease-in-out infinite; }
.door.is-main.is-new .icon.is-box svg { animation: bob 1200ms ease-in-out infinite alternate; overflow: visible; }
.door.is-main.is-done { background: var(--paper); border-color: var(--violet-100); box-shadow: var(--shadow-soft); color: var(--green-600); }
.door.is-main.is-done .icon > svg { width: 52px; height: 52px; color: var(--green-400); }
/* Cửa Ôn lại: chữ đi lạc nghiêng trong vòng tròn; chưa có gì để ôn thì mờ */
.door .sub { font-size: 12px; color: var(--ink-soft); text-align: center; }
.door .glyph.is-lost { width: 52px; height: 52px; border-radius: 50%; background: var(--paper); font-size: 32px; display: flex; align-items: center; justify-content: center; transform: rotate(-12deg); box-shadow: var(--shadow-soft); }
.door.is-dim { opacity: 0.55; filter: saturate(0.5); }
@media (prefers-reduced-motion: reduce) { .door.is-main.is-new, .door.is-main.is-new .icon.is-box svg { animation: none; } }
.door {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border-radius: 22px 22px 12px 12px;
  padding: 14px 8px 12px;
  border: 3px solid;
  min-height: 120px;
  transition: transform 120ms ease;
}
.door:active { transform: scale(0.95); }
.door .glyph { font-family: var(--font-display); font-weight: 800; font-size: 52px; line-height: 1; }
.door .label { font-size: 14px; font-weight: 800; }
.door svg { width: 52px; height: 52px; }
.door.is-pink { background: var(--pink-100); border-color: var(--pink-200); color: var(--pink-600); }
.door.is-pink .label { color: var(--pink-700); }
.door.is-violet { background: var(--violet-100); border-color: var(--violet-200); color: var(--violet-600); }
.door.is-gold { background: var(--gold-100); border-color: #F8D98F; color: var(--gold-600); }
.door.is-gold .label { color: var(--gold-700); }
.hint { text-align: center; font-size: 13px; color: var(--violet-300); }

/* Ngọc tiến độ */
.gems { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.gems .row { gap: 10px; }
.gems .dots { display: flex; gap: 8px; }
.gems .dot { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 2px dashed var(--violet-200); }
.gems .dot.is-on { border: 0; box-shadow: inset 0 -4px 0 rgba(0,0,0,0.12); }
.gems .caption { font-size: 13px; color: var(--ink-faint); }
.gems svg { width: 34px; height: 34px; }

/* Ô chọn màu và ô nhập ở màn cài đặt */
.swatches { display: flex; align-items: center; gap: 12px; }
.swatches .kind { width: 44px; height: 44px; border-radius: 14px; background: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--violet-600); }
.swatches .kind svg { width: 24px; height: 24px; }
.swatch { width: 56px; height: 56px; border-radius: 50%; border: 0; transition: transform 120ms ease; }
.swatch:active { transform: scale(0.9); }
.swatch.is-on { box-shadow: 0 0 0 4px #fff, 0 0 0 8px var(--gold-400); }

.field { display: flex; flex-direction: column; gap: 10px; }
.field label { font-size: 15px; font-weight: 800; }
.field input {
  height: 48px; border-radius: 14px; border: 2px solid var(--violet-200); background: #FBF8FE;
  padding: 0 14px; font-size: 16px; font-weight: 700; color: var(--ink); width: 100%;
}
.field input:focus { outline: none; border-color: var(--violet-600); }
.field .note { font-size: 12px; color: var(--ink-faint); }
.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.choice { height: 44px; border-radius: 12px; background: var(--bg-parent); font-size: 14px; font-weight: 800; color: var(--ink-soft); }
.choice.is-on { background: var(--violet-600); color: #fff; }
.card.is-flat { border-radius: var(--radius-md); padding: 16px; box-shadow: var(--shadow-soft); }
.step { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 800; }
.step .num { width: 28px; height: 28px; border-radius: 50%; background: var(--violet-600); color: #fff; font-family: var(--font-display); font-size: 16px; display: flex; align-items: center; justify-content: center; }

/* Sân khấu đặt công chúa */
.stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.stage::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 40px; background: var(--pink-100); }
.stage .floor { position: absolute; left: 50%; bottom: 8px; width: 200px; height: 22px; margin-left: -100px; border-radius: 50%; background: var(--pink-200); }
.stage .princess { position: relative; }

/* Màn chưa làm */
.placeholder { flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; color: var(--ink-faint); }
.placeholder .big { font-family: var(--font-display); font-size: 64px; color: var(--violet-200); line-height: 1; }
