/* css/shell.css */
:root {
  --bg-deep: #071f12;
  --bg-surface: #e9f5ed;
  --bg-surface-alt: #d5ebd9;
  --bg-panel: #ffffff;
  --text-dark: #0a2f1b;
  --text-muted: #3d6e50;
  --border-pond: #c0dec8;
  --border-subtle: #d6e8dc;
  --accent-lime: #00ff66;
  --accent-active: #04d955;
  --meter-bg: #cde4d3;
  --meter-fg: #147a3e;
  --shadow-soft: 0 4px 14px rgba(7, 31, 18, 0.08);
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-surface);
  color: var(--text-dark);
  font-family: var(--font-stack);
  font-size: 14px;
}

body {
  display: flex;
  flex-direction: column;
}

/* 1. BANNER & SEARCH */
#banner {
  flex: 0 0 46px;
  background: var(--bg-deep);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 12px;
  position: relative;
  z-index: 50;
}

.wordmark {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--accent-lime);
  text-transform: lowercase;
}

.search-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

#app-search {
  width: 100%;
  height: 30px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 0 10px;
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
  user-select: text;
  -webkit-user-select: text;
}

#app-search:focus {
  background: #ffffff;
  color: var(--text-dark);
  border-color: var(--accent-lime);
  box-shadow: 0 0 0 2px rgba(0, 255, 102, 0.35);
}

#app-search::placeholder {
  color: rgba(255, 255, 255, 0.5);
  font-weight: 400;
}

.dropdown {
  position: absolute;
  top: 36px;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-pond);
  border-radius: 8px;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(7, 31, 18, 0.2);
  z-index: 100;
}

.dropdown.hidden {
  display: none;
}

.search-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.12s ease;
}

.search-item:last-child {
  border-bottom: none;
}

.search-item.highlighted,
.search-item:hover {
  background: var(--bg-surface-alt);
}

.search-item-icon {
  font-size: 16px;
  margin-right: 10px;
  width: 20px;
  text-align: center;
}

.search-item-info {
  display: flex;
  flex-direction: column;
}

.search-item-name {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 13px;
}

.search-item-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* 2. TABS */
#tabs {
  flex: 0 0 42px;
  display: flex;
  background: var(--bg-surface-alt);
  border-bottom: 1px solid var(--border-pond);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1;
  min-width: 68px;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  padding: 0 8px;
  transition: color 0.15s ease;
}

.tab-btn.active {
  color: var(--text-dark);
  font-weight: 700;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 8px;
  right: 8px;
  height: 3px;
  background: var(--meter-fg);
  border-radius: 3px 3px 0 0;
}

.tab-btn:focus-visible {
  outline: none;
  background: rgba(0, 0, 0, 0.04);
}

/* 3. STAGE & MOUNTS */
#stage {
  flex: 1 1 0%;
  position: relative;
  overflow: hidden;
  background: #ffffff;
}

.mount {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  overflow: auto;
}

.mount.active {
  display: block;
}

/* 4. TAMAGOTCHI STRIP */
#gotchi-strip {
  flex: 0 0 104px;
  height: 104px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-pond);
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 12px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.02);
  position: relative;
}

.gotchi-left {
  flex: 0 0 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.portrait-frame {
  width: 54px;
  height: 54px;
  background: #ffffff;
  border: 2px solid var(--border-pond);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}

#gotchi-img {
  width: 82%;
  height: 82%;
  object-fit: contain;
  animation: frogBob 2.8s ease-in-out infinite;
  display: block;
}

.fallback-frog {
  font-size: 32px;
  animation: frogBob 2.8s ease-in-out infinite;
}

.portrait-sub {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
}

.status-word {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dark);
}

.day-word {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-muted);
}

/* MIDDLE METERS */
.gotchi-middle {
  flex: 1 1 0;
  min-width: 110px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  justify-content: center;
  position: relative;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.stat-lbl {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  width: 58px;
  white-space: nowrap;
}

.meter-track {
  flex: 1;
  height: 7px;
  background: var(--meter-bg);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.meter-fill {
  width: 0%;
  height: 100%;
  background: var(--meter-fg);
  border-radius: 4px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.xp-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
}

.lvl-lbl {
  font-size: 9.5px;
  font-weight: 800;
  color: var(--text-dark);
  width: 58px;
}

.xp-track {
  height: 4px;
  background: #d4e2d7;
}

.xp-fill {
  background: var(--accent-active);
}

/* RIGHT ACTIONS */
.gotchi-right {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  flex: 0 0 132px;
}

.action-btn {
  height: 42px;
  background: #ffffff;
  border: 1px solid var(--border-pond);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 2px 0;
  transition: background 0.1s, transform 0.08s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.action-btn:nth-child(4) {
  grid-column: 1 / span 1;
}

.action-btn:nth-child(5) {
  grid-column: 2 / span 2;
  flex-direction: row;
  gap: 4px;
}

.action-btn:active {
  background: var(--bg-surface-alt);
  transform: scale(0.96);
}

.btn-ic {
  font-size: 14px;
  line-height: 1;
}

.btn-lbl {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-dark);
  margin-top: 1px;
}

/* ANIMATIONS & FLOATING BADGES */
@keyframes frogBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.frog-bounce {
  animation: frogKick 0.32s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

@keyframes frogKick {
  0% { transform: scale(1); }
  45% { transform: scale(1.18) translateY(-6px); }
  100% { transform: scale(1) translateY(0); }
}

.stat-delta {
  position: absolute;
  right: 0;
  top: -8px;
  font-size: 11px;
  font-weight: 800;
  color: var(--meter-fg);
  pointer-events: none;
  animation: floatUpFade 0.75s ease-out forwards;
}

.stat-delta.neg {
  color: #c93b27;
}

@keyframes floatUpFade {
  0% { opacity: 0; transform: translateY(3px); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-12px); }
}

/* 5. TOAST */
.toast {
  position: fixed;
  bottom: 114px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-deep);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  opacity: 1;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.hidden {
  opacity: 0;
  transform: translate(-50%, 8px);
}

@media (max-width: 480px) {
  .tab-label {
    display: none;
  }
  .tab-btn {
    min-width: 0;
    padding: 0 4px;
  }
  .tab-icon {
    font-size: 18px;
  }
  .gotchi-right {
    flex: 0 0 114px;
  }
}
