/* Nessa's birthday island - UI styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: 'Nunito', 'Trebuchet MS', 'Segoe UI', Verdana, sans-serif;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#game-container { position: fixed; inset: 0; background: #87ceeb; }
#game-canvas { display: block; width: 100%; height: 100%; touch-action: none; }

/* subtle vignette for depth */
#vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(20, 30, 50, 0.18) 100%);
}

.hidden { display: none !important; }

/* ---------- Fade overlay ---------- */
#fade-overlay {
  position: absolute; inset: 0; z-index: 45;
  background: #1a2810;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
#fade-overlay.active { opacity: 1; pointer-events: all; }

/* ---------- HUD pills ---------- */
#hud {
  position: absolute; top: 14px; left: 14px; right: 14px;
  display: flex; justify-content: space-between;
  pointer-events: none; z-index: 10;
}
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255, 253, 245, 0.92);
  border: 3px solid #7a5230;
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 700; font-size: 18px; color: #5a3a1e;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
  letter-spacing: 0.3px;
}
.bell-coin {
  width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe98a, #f0b429 70%);
  border: 2px solid #b8860b;
  display: inline-block;
}
#bells-pill.pulse { animation: pulse 0.35s ease; }
@keyframes pulse { 50% { transform: scale(1.12); } }

#hud-right { display: flex; align-items: center; gap: 10px; }
.hud-btn {
  pointer-events: auto; cursor: pointer;
  padding: 6px 14px; font-size: 20px; line-height: 1;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 3px solid #7a5230; background: rgba(255,253,245,0.92);
}
.hud-btn:hover { transform: scale(1.1); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.hud-btn:active { transform: scale(0.95); }

#btn-wardrobe {
  width: 52px; height: 52px; border-radius: 50%;
  background: #8ec6e6; border-color: #5a9ab5; font-size: 20px;
}

/* ---------- Context prompt ---------- */
#prompt {
  position: absolute; bottom: 118px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 253, 245, 0.95);
  border: 3px solid #7a5230; border-radius: 999px;
  padding: 8px 18px 8px 8px;
  font-size: 17px; font-weight: 700; color: #5a3a1e;
  z-index: 10; pointer-events: none;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
  letter-spacing: 0.3px;
}
#prompt-key {
  width: 34px; height: 34px; border-radius: 50%;
  background: #58b368; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; border: 2px solid #3d8b4e;
}

/* ---------- Alt prompt (Q - Drink) ---------- */
#prompt-alt {
  position: absolute; bottom: 62px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: rgba(230, 248, 255, 0.95);
  border: 3px solid #2e8bb0; border-radius: 999px;
  padding: 8px 18px 8px 8px;
  font-size: 17px; font-weight: 700; color: #1a5a7a;
  z-index: 10; pointer-events: none;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
  letter-spacing: 0.3px;
  animation: promptAltFadeIn 0.25s ease;
}
#prompt-alt-key {
  width: 34px; height: 34px; border-radius: 50%;
  background: #3aa8d8; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; border: 2px solid #2683a8;
}
@keyframes promptAltFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---------- Speed boost indicator ---------- */
#boost-indicator {
  position: absolute; top: 60px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, rgba(102, 221, 255, 0.92), rgba(120, 200, 255, 0.92));
  border: 3px solid #2e8bb0; border-radius: 999px;
  padding: 8px 18px;
  font-size: 16px; font-weight: 800; color: #fff;
  z-index: 12; pointer-events: none;
  box-shadow: 0 3px 12px rgba(46, 139, 176, 0.45);
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.25);
  animation: boostPulse 1.5s ease-in-out infinite;
}
.boost-icon::before {
  content: '\26A1';
  font-size: 18px;
}
@keyframes boostPulse {
  0%, 100% { box-shadow: 0 3px 12px rgba(46, 139, 176, 0.45); }
  50% { box-shadow: 0 3px 20px rgba(46, 139, 176, 0.7), 0 0 30px rgba(102, 221, 255, 0.3); }
}

/* ---------- Action menu ---------- */
#action-menu {
  position: absolute; bottom: 26px; left: 50%;
  transform: translateX(-50%);
  width: min(480px, 92vw);
  background: #fff8e7;
  border: 4px solid #7a5230; border-radius: 22px;
  padding: 20px 20px 12px;
  z-index: 22; 
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  animation: actionMenuIn 0.2s ease;
}
@keyframes actionMenuIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px) scale(0.95); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
#action-menu-name {
  position: absolute; top: -18px; left: 22px;
  background: #d4883a; color: #fff;
  border: 3px solid #a96828; border-radius: 999px;
  padding: 4px 16px; font-weight: 800; font-size: 16px;
  letter-spacing: 0.4px;
}
#action-menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 6px;
}
.action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: rgba(255,255,255,0.8);
  border: 3px solid #c9a87a; border-radius: 14px;
  padding: 10px 6px 8px; cursor: pointer;
  transition: transform 0.12s, background 0.12s, border-color 0.12s;
  position: relative;
  font-family: 'Nunito', sans-serif;
}
.action-btn:hover, .action-btn:focus-visible {
  background: #ffeab6;
  border-color: #d4883a;
  transform: scale(1.06);
}
.action-btn:active {
  transform: scale(0.96);
}
.action-icon { font-size: 26px; line-height: 1; }
.action-label { font-size: 13px; font-weight: 700; color: #5a3a1e; }
.action-key {
  position: absolute; top: 4px; right: 6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #7a5230; color: #fff;
  font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.action-menu-hint {
  text-align: center; font-size: 12px; color: #a08a70;
  margin-top: 8px; font-weight: 600;
}

/* ---------- Dialog ---------- */
#dialog {
  position: absolute; bottom: 26px; left: 50%;
  transform: translateX(-50%);
  width: min(620px, 92vw);
  background: #fff8e7;
  border: 4px solid #7a5230; border-radius: 22px;
  padding: 18px 24px 14px;
  z-index: 20; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
#dialog-name {
  position: absolute; top: -18px; left: 22px;
  background: #58b368; color: #fff;
  border: 3px solid #3d8b4e; border-radius: 999px;
  padding: 4px 16px; font-weight: 800; font-size: 16px;
  letter-spacing: 0.4px;
}
#dialog-text {
  font-size: 19px; color: #4a3120; min-height: 52px; line-height: 1.5;
  font-weight: 600;
}
#dialog-hint { text-align: right; font-size: 12px; color: #a08a70; margin-top: 6px; font-weight: 600; }

/* ---------- Panels (inventory / shop) ---------- */
.panel {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, 92vw);
  background: #fff8e7;
  border: 4px solid #7a5230; border-radius: 22px;
  padding: 22px 26px;
  z-index: 25;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.panel h2 { color: #5a3a1e; margin-bottom: 8px; font-weight: 800; letter-spacing: 0.5px; }
.panel-hint { font-size: 13px; color: #a08a70; margin-top: 10px; font-weight: 600; }
#inventory-grid { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.inv-cell {
  flex: 1 1 100px;
  background: #fffdf5; border: 3px solid #d8c49a; border-radius: 16px;
  padding: 12px; text-align: center; color: #5a3a1e;
}
.item-icon {
  width: 34px; height: 34px; margin: 0 auto 8px;
  border-radius: 50%; border: 2px solid rgba(0,0,0,0.2);
}
.icon-apple   { background: radial-gradient(circle at 35% 35%, #ff8a80, #d32f2f 70%); }
.icon-orange  { background: radial-gradient(circle at 35% 35%, #ffcc80, #ef6c00 70%); }
.icon-coconut { background: radial-gradient(circle at 35% 35%, #a1887f, #4e342e 70%); }
.icon-flower  { background: radial-gradient(circle at 35% 35%, #f8bbd0, #e91e63 70%); }
.icon-fish    { background: radial-gradient(circle at 35% 35%, #90caf9, #1e88e5 70%); }
.inv-name { font-weight: 700; font-size: 15px; }
.inv-count { font-size: 13px; color: #8a7358; font-weight: 600; }

.shop-line {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 4px; border-bottom: 2px dashed #e0d0ac;
  color: #5a3a1e; font-size: 16px; font-weight: 600;
}
.shop-line-right {
  display: flex; align-items: center; gap: 8px;
}
.sell-one-btn {
  font-size: 12px !important; padding: 4px 10px !important;
  border-radius: 999px; border: 2px solid #b57f36 !important;
  background: #e0a458 !important; color: #fff;
  font-weight: 700 !important; cursor: pointer;
}
#shop-total {
  margin-top: 12px; text-align: right;
  font-weight: 800; font-size: 18px; color: #5a3a1e;
}
.shop-buttons { display: flex; gap: 10px; margin-top: 14px; }
button {
  font-family: 'Nunito', inherit; font-weight: 800; font-size: 16px;
  border-radius: 999px; border: 3px solid #3d8b4e;
  background: #58b368; color: #fff;
  padding: 10px 22px; cursor: pointer;
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
  letter-spacing: 0.4px;
  transition: transform 0.1s ease, filter 0.1s ease;
}
button:hover { filter: brightness(1.08); transform: translateY(-1px); }
button:active { transform: translateY(2px); }
button:disabled { background: #b7b7a5; border-color: #8f8f7e; cursor: default; transform: none; }
#shop-close-btn { background: #e0a458; border-color: #b57f36; }

/* ---------- Toasts ---------- */
#toasts {
  position: absolute; top: 70px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 30; pointer-events: none;
}
.toast {
  background: rgba(90, 58, 30, 0.92); color: #fff8e7;
  border-radius: 999px; padding: 9px 20px;
  font-weight: 700; font-size: 16px;
  animation: toast-in 0.25s ease, toast-out 0.4s ease 1.9s forwards;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3);
  letter-spacing: 0.3px;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(0.9); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px); } }

/* ---------- Touch controls ---------- */
#touch-ui { position: absolute; inset: 0; z-index: 15; pointer-events: none; }
#joystick {
  position: absolute; bottom: 30px; left: 26px;
  width: 128px; height: 128px; border-radius: 50%;
  background: rgba(255,255,255,0.25);
  border: 3px solid rgba(255,255,255,0.5);
  pointer-events: auto; touch-action: none;
}
#joystick-knob {
  position: absolute; left: 50%; top: 50%;
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255,253,245,0.9);
  border: 3px solid #7a5230;
  transform: translate(-50%, -50%);
}
#touch-buttons {
  position: absolute; bottom: 44px; right: 26px;
  display: flex; align-items: flex-end; gap: 14px;
  pointer-events: auto;
}
#btn-interact {
  width: 74px; height: 74px; border-radius: 50%; font-size: 26px;
}
#btn-drink {
  width: 60px; height: 60px; border-radius: 50%; font-size: 22px;
  background: #3aa8d8; border-color: #2683a8;
}
#btn-menu {
  width: 52px; height: 52px; border-radius: 50%;
  background: #e0a458; border-color: #b57f36; font-size: 20px;
}

/* ---------- Title screen ---------- */
#title-screen {
  position: absolute; inset: 0; z-index: 50;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  background:
    radial-gradient(ellipse at 50% 110%, #7ec850 0%, #4a9b47 34%, transparent 60%),
    linear-gradient(170deg, #79c7ee 0%, #a5dcf5 45%, #cdeffb 75%, #e8f5e9 100%);
  text-align: center; padding: 20px;
  overflow: hidden;
}

/* Floating leaves background */
#title-leaves {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.floating-leaf {
  position: absolute;
  font-size: 28px;
  opacity: 0.35;
  animation: leaf-fall linear infinite;
  filter: hue-rotate(var(--hue, 0deg));
}
@keyframes leaf-fall {
  0% { transform: translateY(-60px) rotate(0deg) scale(var(--scale, 1)); opacity: 0; }
  10% { opacity: 0.35; }
  90% { opacity: 0.35; }
  100% { transform: translateY(calc(100vh + 60px)) rotate(720deg) scale(var(--scale, 1)); opacity: 0; }
}

/* Title header with leaf icon */
.title-header {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  animation: title-bounce-in 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes title-bounce-in {
  0% { opacity: 0; transform: scale(0.3) translateY(40px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.title-leaf {
  font-size: clamp(46px, 8vw, 72px);
  animation: leaf-sway 3s ease-in-out infinite;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
  line-height: 1;
}
@keyframes leaf-sway {
  0%, 100% { transform: rotate(-8deg) scale(1); }
  50% { transform: rotate(8deg) scale(1.05); }
}

#title-screen h1 {
  font-family: 'Nunito', sans-serif;
  font-size: clamp(38px, 8.5vw, 78px);
  font-weight: 900;
  color: #fffdf5;
  text-shadow:
    0 3px 0 #4a9b47,
    0 6px 0 #3d8b3e,
    0 9px 18px rgba(0,0,0,0.25);
  letter-spacing: 2.5px;
  line-height: 1.1;
}
.tagline {
  font-size: clamp(15px, 2.8vw, 20px); color: #2c5d33;
  font-weight: 700; letter-spacing: 1.5px;
  opacity: 0;
  animation: tagline-fade 0.6s ease 0.5s forwards;
}
@keyframes tagline-fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.controls-list {
  background: rgba(255, 253, 245, 0.88);
  border: 3px solid #7a5230; border-radius: 18px;
  padding: 12px 24px; color: #5a3a1e; font-size: 14px;
  line-height: 1.9; font-weight: 600;
  opacity: 0;
  animation: tagline-fade 0.5s ease 0.8s forwards;
}

#start-btn {
  font-family: 'Nunito', sans-serif;
  font-size: 22px; font-weight: 900;
  padding: 14px 48px; margin-top: 4px;
  background: linear-gradient(180deg, #6bc97a 0%, #4a9b47 100%);
  border: 3px solid #357a38;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.3);
  letter-spacing: 1px;
  display: flex; align-items: center; gap: 10px;
  opacity: 0;
  animation: start-btn-appear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 1.0s forwards;
}
@keyframes start-btn-appear {
  0% { opacity: 0; transform: scale(0.7) translateY(20px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
#start-btn:hover {
  background: linear-gradient(180deg, #7dd68c 0%, #58b368 100%);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 6px 18px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
}
#start-btn:active {
  transform: translateY(2px) scale(0.98);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.btn-icon { font-size: 26px; line-height: 1; }

/* ---------- Character creator ---------- */
#creator-card {
  display: flex; align-items: stretch; gap: 20px;
  background: rgba(255, 253, 245, 0.93);
  border: 3px solid #7a5230; border-radius: 20px;
  padding: 16px 22px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
  max-width: 640px; width: 92vw;
  opacity: 0;
  animation: tagline-fade 0.5s ease 0.6s forwards;
}
#char-preview {
  border-radius: 14px;
  border: 3px solid #d8c49a;
  background: radial-gradient(circle at 50% 25%, #e3f6ff, #9fd8f2);
  min-width: 180px;
}
#creator-options { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
#creator-tabs { display: flex; gap: 4px; margin-bottom: 4px; }
.tab-btn {
  flex: 1; border-radius: 12px 12px 0 0 !important;
  padding: 7px 8px !important; font-size: 13px !important;
  background: #ede4d4 !important; color: #7a5a3e !important;
  border: 2px solid #d8c49a !important; border-bottom: none !important;
  box-shadow: none !important;
}
.tab-btn.active {
  background: #58b368 !important; color: #fff !important;
  border-color: #3d8b4e !important;
}
.tab-panel { display: none; flex-direction: column; gap: 9px; max-height: 280px; overflow-y: auto; padding-right: 4px; }
.tab-panel.active { display: flex; }
#randomize-btn {
  margin-top: 6px; font-size: 14px !important; padding: 7px 16px !important;
  background: #e0a458 !important; border-color: #b57f36 !important;
  align-self: flex-start;
}
.opt-group { display: flex; align-items: center; gap: 10px; }
.opt-group label {
  width: 56px; text-align: right;
  font-weight: 700; font-size: 14px; color: #5a3a1e;
}
.swatches { display: flex; gap: 7px; flex-wrap: wrap; max-width: 290px; }
.swatches button { box-shadow: none; }
.swatch {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.25) !important;
  padding: 0 !important; background: none;
  transition: transform 0.15s ease;
}
.swatch:hover { transform: scale(1.15); }
.swatch.selected { outline: 3px solid #58b368; outline-offset: 2px; }
.swatch-text {
  border-radius: 999px !important;
  padding: 5px 14px !important;
  font-size: 13px !important; font-weight: 700 !important;
  background: #fffdf5 !important; color: #5a3a1e !important;
  border: 2px solid #d8c49a !important;
  transition: transform 0.15s ease;
}
.swatch-text:hover { transform: scale(1.05); }
.swatch-text.selected {
  background: #58b368 !important; color: #fff !important;
  border-color: #3d8b4e !important;
}
#name-input {
  font-family: 'Nunito', sans-serif; font-size: 15px; font-weight: 600;
  padding: 7px 14px; border-radius: 999px;
  border: 2px solid #d8c49a; background: #fffdf5; color: #5a3a1e;
  width: 160px; outline: none;
}
#name-input:focus { border-color: #58b368; }
#name-input::placeholder { color: #b8a67e; font-weight: 600; }

/* ---------- Title screen transition ---------- */
#title-screen.closing {
  animation: title-close 0.6s ease forwards;
}
@keyframes title-close {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.08); filter: blur(4px); }
}

@media (max-width: 600px) {
  #creator-card { flex-direction: column; gap: 12px; padding: 12px 16px; }
  #char-preview { width: 140px; height: 177px; }
}
@media (max-height: 780px) {
  #title-screen { justify-content: flex-start; overflow-y: auto; padding-top: 4vh; padding-bottom: 4vh; }
}

/* ---------- Wardrobe overlay ---------- */
#wardrobe-overlay {
  position: absolute; inset: 0; z-index: 35;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}
#wardrobe-card {
  background: #fff8e7;
  border: 4px solid #7a5230; border-radius: 22px;
  padding: 20px 22px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  max-width: 580px; width: 92vw;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
#wardrobe-card h2 { color: #5a3a1e; margin: 0; }
#wardrobe-preview {
  border-radius: 12px; border: 3px solid #d8c49a;
  background: radial-gradient(circle at 50% 25%, #e3f6ff, #9fd8f2);
}
#wardrobe-options { width: 100%; }
#wardrobe-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.wtab-btn {
  flex: 1; border-radius: 12px 12px 0 0 !important;
  padding: 7px 8px !important; font-size: 13px !important;
  background: #ede4d4 !important; color: #7a5a3e !important;
  border: 2px solid #d8c49a !important; border-bottom: none !important;
  box-shadow: none !important;
}
.wtab-btn.active {
  background: #58b368 !important; color: #fff !important;
  border-color: #3d8b4e !important;
}
.wtab-panel { display: none; flex-direction: column; gap: 9px; max-height: 200px; overflow-y: auto; padding-right: 4px; }
.wtab-panel.active { display: flex; }
.wardrobe-buttons { display: flex; gap: 10px; }
#wardrobe-done-btn { font-size: 18px; padding: 10px 36px; }
