/* MetisRicerca - CSS "ABSOLUTE RESTORATION" */

:root {
  --bg-color: #0b0c10;
  --header-bg: rgba(11, 12, 16, 0.98);
  --text-primary: #66fcf1;
  --text-dim: #c5c6c7; /* Ripristinato valore desktop originale */
  --accent-color: #45a29e;
  --highlight-color: #fbdf5b;
  --glass-bg: rgba(31, 40, 51, 0.4);
  --glass-border: rgba(69, 162, 158, 0.3);
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
  --tooltip-bg: #fbdf5b;
  --home-bg-grad: radial-gradient(circle at center, #1f2833 0%, #0b0c10 100%);
  --safe-color: #66fcf1;
  --warn-color: #fbdf5b;
  --danger-color: #ff5f5f;
}

body.theme-light {
  --bg-color: #24292e;
  --header-bg: rgba(36, 41, 46, 0.98);
  --text-primary: #e1e4e8;
  --text-dim: #959da5;
  --accent-color: #0366d6;
  --highlight-color: #f66a0a;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  --tooltip-bg: #f66a0a;
  --home-bg-grad: radial-gradient(circle at center, #2f363d 0%, #24292e 100%);
  --safe-color: #28a745;
  --warn-color: #ffd33d;
  --danger-color: #d73a49;
}

body.theme-eyes {
  --bg-color: #2b211e;
  --header-bg: rgba(43, 33, 30, 0.95);
  --text-primary: #f2e3c6;
  --text-dim: #cca88b;
  --accent-color: #d97743;
  --highlight-color: #8caba1;
  --glass-bg: rgba(64, 48, 43, 0.6);
  --glass-border: rgba(217, 119, 67, 0.3);
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  --tooltip-bg: #8caba1;
  --home-bg-grad: radial-gradient(circle at center, #40302b 0%, #2b211e 100%);
  --safe-color: #8caba1;
  --warn-color: #d97743;
  --danger-color: #b05a41;
}

body.theme-contrast {
  --bg-color: #000000;
  --header-bg: #000000;
  --text-primary: #ffffff;
  --text-dim: #ffff00;
  --accent-color: #00ffff;
  --highlight-color: #ff00ff;
  --glass-bg: #000000;
  --glass-border: #ffffff;
  --shadow: none;
  --tooltip-bg: #ffffff;
  --home-bg-grad: #000000;
  --safe-color: #00ffff;
  --warn-color: #ffff00;
  --danger-color: #ff0000;
}

body.theme-metis {
  --bg-color: #030a16;
  --header-bg: rgba(3, 10, 22, 0.98);
  --text-primary: #b0e0e6;
  --text-dim: #7ba6b5;
  --accent-color: #6a0dad;
  --highlight-color: #ffd700;
  --glass-bg: rgba(13, 31, 61, 0.6);
  --glass-border: rgba(106, 13, 173, 0.4);
  --shadow: 0 8px 32px 0 rgba(0, 5, 15, 0.9);
  --tooltip-bg: #ffd700;
  --home-bg-grad: radial-gradient(circle at center, #091a38 0%, #030a16 100%);
  --safe-color: #49D1CF;
  --warn-color: #ffd700;
  --danger-color: #ff5f5f;
}

body.theme-teal {
  --bg-color: #071212;
  --header-bg: rgba(15, 92, 102, 0.98);
  --text-primary: #49D1CF;
  --text-dim: #a0c4cc;
  --accent-color: #1F7A8C;
  --highlight-color: #8A7450;
  --glass-bg: rgba(15, 92, 102, 0.15);
  --glass-border: rgba(73, 209, 207, 0.2);
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.9);
  --tooltip-bg: #8A7450;
  --home-bg-grad: radial-gradient(circle at center, #0F5C66 0%, #071212 100%);
  --safe-color: #49D1CF;
  --warn-color: #8A7450;
  --danger-color: #e67e22;
}

#metis-search-view *, #results-view *, .modal * { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-dim);
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  line-height: 1.6;
}

body.home-active {
    overflow: hidden !important;
    height: 100vh;
}

/* --- `[x]` Fix Emergenza Layout (Pulsanti sicuri su Laptop)
- `[x]` Creazione `editor.php` (Interfaccia Dashboard Premium)
- `[x]` Implementazione Motore PHP (Salvataggio persistente in `style.css`)
- `[x]` Logica Live Preview (Iniezione CSS in real-time)
- `[x]` Aggiunta Tasto "Copia Log / CSS" 
- `[x]` Verifica finale di coerenza e stabilità */

/* --- HOME SEARCH VIEW (Centratura e Logo) --- */
#metis-search-view {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 30px 20px 36px;
  gap: 14px;
  background: var(--home-bg-grad);
  overflow: visible;
}

.logo {
  flex: 0 0 auto;
  display: block;
  font-size: 3.5rem;
  font-weight: 900;
  letter-spacing: -2px;
  background: linear-gradient(90deg, var(--text-primary), var(--accent-color));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
  transform: translateY(-10px);
}

.main-logo-img {
    height: auto;
    max-height: 35vh;
    max-width: 450px;
    filter: drop-shadow(0 0 20px var(--accent-color));
    cursor: pointer;
    transition: transform 0.3s ease, max-height 0.3s ease;
}

.search-subtitle {
  margin: -6px 0 6px;
  max-width: 820px;
  text-align: center;
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1.45;
}

.search-seo-copy {
  max-width: 860px;
  margin: 0 0 8px;
  padding: 8px 12px;
  text-align: center;
  color: var(--text-dim);
  opacity: 0.92;
}

.search-seo-copy h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.search-seo-copy p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
}

.usage-chip {
  position: fixed;
  right: 14px;
  bottom: 12px;
  z-index: 10020;
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(11, 12, 16, 0.8);
  color: var(--text-dim);
  font-size: 0.78rem;
  backdrop-filter: blur(6px);
}

.usage-chip strong {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
  .usage-chip {
    right: 8px;
    bottom: 8px;
    font-size: 0.72rem;
    padding: 5px 8px;
    gap: 8px;
  }
}

.search-container {
    width: 100%;
    max-width: 650px;
    position: relative;
    z-index: 10;
    margin-bottom: 0;
}

#metis-search-view .search-box, #results-view .search-box {
  width: 100%;
  padding: 20px 30px;
  padding-right: 120px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 35px;
  color: var(--text-primary);
  font-size: 1.2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  outline: none;
}

.search-buttons {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 8px;
}

.search-btn {
  background: var(--text-primary);
  color: #1f2833;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  font-weight: 700;
  cursor: pointer;
}

.search-inline-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(11, 12, 16, 0.6);
  color: var(--text-primary);
  font-size: 1.05rem;
  cursor: pointer;
  z-index: 6;
}

.search-form-inline {
  position: relative;
  width: 100%;
}

.search-inline-btn:hover {
  color: var(--highlight-color);
  border-color: rgba(251, 223, 91, 0.45);
}

#search-btn-inline-results {
  position: static;
  transform: none;
  flex: 0 0 auto;
}

.tool-belt {
  margin-top: 12px;
  display: flex;
  flex-direction: row; 
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.05);
  padding: 10px 20px;
  border-radius: 40px;
  border: 1px solid var(--glass-border);
  width: min(100%, 980px);
}

.tool-item {
  color: var(--accent-color);
  text-decoration: none;
  font-size: 1.3rem;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.tool-item:hover, .tool-item.active {
    color: var(--highlight-color);
}

.tool-item.active {
    background: radial-gradient(circle, rgba(251, 223, 91, 0.3) 0%, transparent 80%);
    box-shadow: 0 0 15px rgba(251, 223, 91, 0.4);
    border: 1px solid rgba(251, 223, 91, 0.5);
}

.tool-item[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: -34px;
    transform: translateX(-50%) translateY(6px);
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    background: rgba(11, 12, 16, 0.95);
    color: var(--highlight-color);
    border: 1px solid rgba(251, 223, 91, 0.45);
    border-radius: 10px;
    padding: 5px 10px;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1;
    z-index: 10050;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .tool-item[data-tooltip]:hover::after {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

#metis-hint {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--highlight-color);
    font-size: 0.85rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
    text-shadow: 0 4px 10px rgba(0,0,0,1);
    background: rgba(11, 12, 16, 0.9);
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid var(--highlight-color);
    pointer-events: none;
}

/* --- THEME OVERLAY MENU --- */
.theme-menu {
    position: absolute;
    bottom: 60px;
    right: 0;
    background: var(--header-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 15px;
    display: none;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow);
    z-index: 1000;
    min-width: 180px;
}

.theme-menu.active {
    display: flex;
    animation: fadeInScale 0.2s ease-out;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.theme-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--glass-border);
}

.theme-option.selected {
    background: var(--glass-bg);
    color: var(--highlight-color);
    border-color: var(--highlight-color);
}

.theme-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
}

/* Specific dots */
.dot-default { background: linear-gradient(135deg, #0b0c10, #66fcf1); }
.dot-light { background: linear-gradient(135deg, #24292e, #e1e4e8); }
.dot-eyes { background: linear-gradient(135deg, #2b211e, #f2e3c6); }
.dot-contrast { background: linear-gradient(135deg, #000, #fff); }
.dot-metis { background: linear-gradient(135deg, #030a16, #ffd700); }
.dot-teal { background: linear-gradient(135deg, #0F5C66, #49D1CF); }

/* Risposizione Header Results */
.results-header .theme-menu {
    bottom: auto;
    top: 60px;
}

.tool-item.theme-btn.active {
    color: var(--highlight-color);
    background: var(--glass-bg);
}
#results-view { display: none; flex-direction: column; min-height: 100vh; }

.results-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(15px);
  padding: 10px 40px;
  display: flex;
  align-items: center;
  gap: 30px;
  border-bottom: 1px solid var(--glass-border);
}

.logo-small {
  display: flex;
  align-items: center;
  gap: 0;
  cursor: pointer;
  transition: transform 0.2s;
}

.logo-small:hover { transform: scale(1.02); }

.small-logo-img {
  height: 120px;
  margin: -40px -10px -40px -10px; /* Compensa la trasparenza mostruosa orizzontale e verticale */
  filter: drop-shadow(0 0 10px rgba(102, 252, 241, 0.4));
}

.logo-text {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
}

.search-bar-results {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-grow: 1;
  max-width: 1100px;
}

#tool-belt-results {
  padding: 6px 15px;
  border-radius: 12px;
  gap: 10px;
  margin: 0;
}

.results-layout { display: flex; padding: 20px 40px; gap: 40px; max-width: 1400px; margin: 0 auto; }
#results-container { flex: 3; }
.infobox-sidebar { flex: 1; position: sticky; top: 100px; height: fit-content; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 15px; padding: 25px; }
.infobox-title { color: var(--highlight-color); font-size: 1rem; font-weight: 800; margin-bottom: 15px; text-transform: uppercase; letter-spacing: 1px; }
.infobox-content { color: #fff; font-size: 0.95rem; line-height: 1.6; margin-bottom: 25px; }

/* Brainstorm Links */
.infobox-brainstorm { border-top: 1px solid var(--glass-border); padding-top: 20px; }
.brainstorm-q { display: block; font-size: 0.95rem; color: var(--text-primary); margin-bottom: 10px; font-style: italic; cursor: pointer; padding: 8px 12px; border-radius: 8px; background: rgba(102, 252, 241, 0.05); transition: all 0.3s; border: 1px solid transparent; }
.brainstorm-q:hover { background: var(--text-primary); color: var(--bg-color); transform: translateX(5px); font-weight: 600; font-style: normal; }

/* --- BADGES (STILE ORIGINALE BELLO) --- */

.result-item { margin-bottom: 40px; position: relative; }
.result-item-archive { border-left: 3px solid var(--highlight-color); padding-left: 20px; background: linear-gradient(90deg, rgba(251, 223, 91, 0.03) 0%, transparent 100%); }

.result-title { display: block; font-size: 1.3rem; color: var(--text-primary); text-decoration: none; font-weight: 600; margin-bottom: 8px; transition: opacity 0.2s; }
.result-title:hover { opacity: 0.8; }
.result-snippet { font-size: 0.95rem; color: var(--text-dim); }

.censorship-container { display: flex; align-items: center; gap: 15px; margin: 10px 0; position: relative; }
.censorship-label { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; font-weight: 700; }
.censorship-bar { flex-grow: 1; max-width: 200px; height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; overflow: hidden; }
.censorship-fill { height: 100%; transition: width 0.5s ease; }

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(102, 252, 241, 0.05); /* TRASPARENTE */
  border: 1px solid var(--accent-color); /* BORDO NEON */
  color: var(--text-primary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  margin-top: 10px;
  margin-right: 10px;
  cursor: help;
  position: relative;
}

.privacy-badge[onclick*="openSpark"] { 
    color: var(--highlight-color); 
    border-color: var(--highlight-color); 
    background: rgba(251, 223, 91, 0.05); 
}

/* --- TOOLTIP (OVERLAY MOUSE) - FIX LEGGIBILITÀ --- */

.privacy-badge::after, .censorship-container::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 140%;
  left: 0;
  background: rgba(11, 12, 16, 0.95) !important;
  color: var(--text-dim) !important;
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  width: 260px;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  z-index: 99999;
  box-shadow: 0 5px 20px rgba(0,0,0,0.8);
  border: 1px solid var(--highlight-color);
  line-height: 1.5;
}

.privacy-badge:hover::after, .censorship-container:hover::after {
  opacity: 1;
  transform: translateY(0);
}

/* --- MODALS & STATS --- */
.results-stats { padding: 10px 40px; color: var(--accent-color); font-size: 13px; font-weight: 500; }
.modal { display: none; position: fixed; z-index: 100000; width: 100%; height: 100%; top: 0; left: 0; background: rgba(11,12,16,0.98); backdrop-filter: blur(10px); }
.modal-content { 
    background: #0b0c10; 
    margin: 5vh auto; 
    width: 90%; 
    max-width: 900px;
    height: auto; 
    max-height: 90vh; 
    border-radius: 20px; 
    border: 1px solid var(--glass-border); 
    position: relative; 
    overflow-y: auto; /* Permette lo scroll interno */
    scrollbar-width: thin;
    scrollbar-color: var(--highlight-color) transparent;
}
.close-modal { position: absolute; right: 25px; top: 15px; color: #fff; font-size: 40px; cursor: pointer; z-index: 100001; }
#spark-frame { width: 100%; height: 100%; border: none; }

/* Spark modal must use almost full viewport */
#spark-modal .modal-content {
    width: min(96vw, 1700px);
    height: calc(100dvh - 32px);
    max-width: 96vw;
    max-height: calc(100dvh - 32px);
    margin: 16px auto;
    border-radius: 14px;
    overflow: hidden;
    padding-top: 48px;
}

#spark-modal .close-modal {
    top: 8px;
    right: 14px;
    font-size: 34px;
    line-height: 1;
}

#spark-modal #spark-frame {
    width: 100%;
    height: calc(100% - 48px);
    display: block;
}

/* Manifesto Styling */
.manifesto-content { padding: 40px 20px; overflow-y: auto; text-align: center; height: 90vh; }
.manifesto-title { font-size: 2.5rem; color: var(--text-primary); margin-top: 20px; margin-bottom: 5px; text-shadow: 0 0 15px rgba(102, 252, 241, 0.5); }
.manifesto-subtitle { font-size: 1.2rem; color: var(--accent-color); font-weight: 300; margin-bottom: 40px; letter-spacing: 3px; text-transform: uppercase; }
.manifesto-text { max-width: 800px; margin: 0 auto; }
.manifesto-text p { font-size: 1.1rem; line-height: 1.9; margin-bottom: 30px; color: var(--text-dim); }
.manifesto-text p.manifesto-footer { font-size: 0.95rem; font-style: italic; color: var(--highlight-color); margin-top: 50px; text-shadow: 0 0 10px rgba(251, 223, 91, 0.3); opacity: 0.9; }

/* Philosophy modal specific */
.philosophy-content {
    background: linear-gradient(180deg, #0b0c10 0%, #1f2833 100%);
    border: 1px solid var(--highlight-color);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
    padding: 60px 40px;
}

.philosophy-content h2 {
    color: var(--highlight-color);
    margin-bottom: 25px;
    font-size: 2.2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.philosophy-content h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.philosophy-content p {
    text-align: left;
    margin-bottom: 20px;
    border-left: 2px solid rgba(251, 223, 91, 0.3);
    padding-left: 20px;
}

.info-btn:hover {
    transform: scale(1.2);
    color: var(--highlight-color);
    text-shadow: 0 0 10px var(--highlight-color);
}

.pagination-nav { display: flex; justify-content: center; gap: 12px; margin: 40px 0; padding-bottom: 60px; }
.page-num { width: 40px; height: 40px; border: 1px solid var(--accent-color); display: flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--accent-color); cursor: pointer; transition: 0.3s; }
.page-num.active { background: var(--accent-color); color: #000; box-shadow: 0 0 15px var(--accent-color); }

/* Results layout specialization */
.result-item.video-result {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.video-thumbnail {
    width: 200px;
    height: 120px;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    box-shadow: var(--shadow);
    flex-shrink: 0;
    position: relative;
    border: 1px solid var(--glass-border);
}

.video-thumbnail::after {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 2rem;
    opacity: 0.8;
}

.file-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 900;
    background: #ff5f5f;
    color: white;
    border-radius: 4px;
    margin-right: 10px;
    vertical-align: middle;
}

.torrent-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 900;
    border-radius: 4px;
    margin-right: 10px;
    vertical-align: middle;
    letter-spacing: 0.5px;
}

.torrent-badge-magnet {
    background: rgba(251, 223, 91, 0.12);
    border: 1px solid rgba(251, 223, 91, 0.55);
    color: var(--highlight-color);
}

.torrent-badge-torrent {
    background: rgba(102, 252, 241, 0.07);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}

/* --- MOBILE & RESPONSIVE ADAPTATION --- */
@media (max-width: 768px) {
    :root {
        --text-dim: #e1e4e8 !important; /* Contrasto mobile-only */
    }
    
    body, html { width: 100%; max-width: 100%; overflow-x: hidden; min-height: 100dvh; }
    
    #metis-search-view {
        position: relative !important;
        width: 100% !important;
        height: 100dvh !important;
        min-height: 100dvh !important;
        overflow-y: auto;
        overflow-x: hidden;
        display: grid !important;
        grid-template-rows: auto 1fr auto !important; /* Gabbia a tre settori: Top, Centro, Bottom */
        align-items: stretch;
        padding: 20px 10px;
        box-sizing: border-box;
    }
    
    .logo {
        grid-row: 1;
        flex: 0 0 auto;
        font-size: 1.25rem !important; 
        margin: 10px 0;
        text-align: center;
        width: 100%;
        color: var(--text-dim);
    }
    
    .main-logo-img { 
        max-height: 10vh;
        width: auto;
        display: block;
        margin: 0 auto 10px;
    }
    
    .search-container {
        grid-row: 2;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center; /* Forza la barra al centro della riga 2 */
        margin: 0;
        padding: 20px 0;
    }

    .search-box {
        font-size: 0.98rem;
        padding: 14px 52px 14px 18px;
        border-radius: 24px;
        width: 100%;
        max-width: 90vw;
    }

    .search-inline-btn {
        width: 38px;
        height: 38px;
        right: 8px;
    }
    
    .tool-belt {
        grid-row: 3;
        position: relative;
        width: 100%;
        margin-top: 20px;
        padding: 15px 10px;
        display: grid;
        grid-template-columns: repeat(8, 1fr);
        gap: 5px;
        background: rgba(11, 12, 16, 0.92);
        border-radius: 20px;
        border: 1px solid rgba(255,255,255,0.05);
        backdrop-filter: blur(14px);
        box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.28);
        z-index: 10;
    }
    #tool-belt-results {
        position: static;
        width: 100%;
        max-width: none;
        left: auto;
        right: auto;
        bottom: auto;
        box-shadow: none;
        padding: 10px;
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
    .tool-item {
        font-size: 1rem;
        width: 38px;
        height: 38px;
        min-width: 0;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.05);
    }
    .tool-separator { display: none; }
    .lang-select-mini { font-size: 0.8rem; width: 100%; text-align: center; }

    .tool-item.active {
        transform: none;
        box-shadow: 0 0 14px rgba(251, 223, 91, 0.25);
    }

    .theme-menu {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 132px);
        top: auto;
        min-width: 0;
        max-height: 38dvh;
        overflow-y: auto;
        border-radius: 18px;
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }

    .theme-option {
        padding: 12px 14px;
        font-size: 0.88rem;
    }
    
    .results-header { padding: 15px 10px; flex-direction: column; gap: 15px; align-items: stretch; }
    .logo-small { justify-content: center; }
    .small-logo-img { height: 100px; margin: -30px -10px; }
    .logo-text { font-size: 1.4rem; }
    .search-bar-results { flex-direction: column; width: 100%; gap: 12px; align-items: stretch; }
    #tool-belt-results { justify-content: center; padding: 10px; border-radius: 20px; flex-wrap: wrap; }
    
    .results-layout { flex-direction: column; padding: 10px; gap: 20px; }
    .infobox-sidebar { position: static; width: 100%; }
    
    .result-item.video-result { flex-direction: column; align-items: center; }
    .video-thumbnail { width: 100%; height: 180px; }
    .result-title { font-size: 1.1rem; word-break: break-all; }
    .result-snippet { font-size: 0.85rem; }
    
    .censorship-bar { max-width: 100%; }
    .privacy-badge::after, .censorship-container::after { width: 90vw; left: 5px; transform: translateX(0); }

    .pet-panel {
        left: 10px;
        right: 10px;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 92px);
        width: auto;
        max-width: none;
        max-height: 52dvh;
        overflow-y: auto;
        border-radius: 18px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }

    .pet-panel-sections {
        gap: 8px;
    }

    .pet-panel-sections > .pet-rewards-block,
    .pet-panel-sections > .pet-inventory-block,
    .pet-panel-sections > .pet-settings-block,
    .pet-panel-sections > .pet-rewards-block:first-child,
    .pet-panel-sections > .pet-rewards-block:nth-child(3) {
        flex-basis: 100%;
    }

    .pet-actions,
    .pet-settings-row {
        flex-wrap: wrap;
    }

    .pet-action-btn {
        min-width: calc(50% - 4px);
    }

    #spark-modal .modal-content {
        width: 100vw;
        height: 100dvh;
        max-width: 100vw;
        max-height: 100dvh;
        margin: 0;
        border-radius: 0;
        padding-top: 46px;
    }

    #spark-modal .close-modal {
        top: 6px;
        right: 10px;
        font-size: 30px;
    }

    #spark-modal #spark-frame {
        height: calc(100% - 46px);
    }
}

/* --- SPIRIT OF METIS: NEON SPIRIT PRO --- */
#metis-spirit-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    filter: drop-shadow(0 0 10px rgba(251, 223, 91, 0.3));
}

.main-logo-img {
    height: auto;
    max-height: 40vh; /* Dinamico per schermi bassi */
    max-width: 450px;
    width: auto;
    cursor: pointer;
    transition: transform 0.3s ease, filter 0.3s ease, max-height 0.3s ease;
    filter: drop-shadow(0 0 10px rgba(251, 223, 91, 0.1));
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

#metis-owl {
    width: 170px;
    height: 170px;
    position: absolute;
    z-index: 10000;
}

.owl-part {
    fill: none;
    stroke: #fbdf5b;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 5px #fbdf5b);
}

.filament-1 {
    stroke-width: 1.5;
    opacity: 0.8;
    stroke-dasharray: 40 160;
    animation: stroke-flow 3s linear infinite;
}

.filament-2 {
    stroke-width: 0.8;
    opacity: 0.4;
    stroke-dasharray: 20 80;
    animation: stroke-flow 2s linear infinite reverse;
}

@keyframes stroke-flow {
    from { stroke-dashoffset: 200; }
    to { stroke-dashoffset: 0; }
}

.wing-l-spirit { 
    stroke-width: 1.2;
    animation: flap-spirit-l 1.2s ease-in-out infinite alternate; 
    transform-origin: 25px 55px; 
}
.wing-r-spirit { 
    stroke-width: 1.2;
    animation: flap-spirit-r 1.2s ease-in-out infinite alternate; 
    transform-origin: 72px 55px; 
}

@keyframes flap-spirit-l { 
    0% { transform: rotate(-8deg); } 
    100% { transform: rotate(15deg) scaleX(1.1); } 
}
@keyframes flap-spirit-r { 
    0% { transform: rotate(8deg); } 
    100% { transform: rotate(-15deg) scaleX(1.1); } 
}

.eye-glow {
    fill: #fbdf5b;
    opacity: 0.3;
    filter: blur(4px);
    animation: eye-pulse 2s ease-in-out infinite;
}

.eye-soul {
    fill: #fff;
    filter: drop-shadow(0 0 3px #fff);
}

@keyframes eye-pulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.2); opacity: 0.6; }
}

.beak-spirit {
    fill: #fbdf5b;
    stroke: none;
}

.wisdom-sparkle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #fff;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 10px #fbdf5b, 0 0 5px #fff;
    animation: sparkle-ethereal 1.5s ease-out forwards;
}

@keyframes sparkle-ethereal {
    0% { transform: scale(1) translateY(0); opacity: 1; }
    100% { transform: scale(0) translateY(-20px) rotate(45deg); opacity: 0; }
}

/* --- METIS SPIRIT MODEL B (PIXAR) --- */
#metis-owl {
    --wing-left-rot: -10deg;
    --wing-right-rot: 10deg;
    --owl-lift: 0px;
    --owl-drift-x: 0px;
    --owl-rock: 0deg;
    --owl-squash: 1;
    --owl-face-y: 0px;
    --owl-face-x: 0px;
    --owl-aura-scale: 1;
    --owl-aura-opacity: 0.08;
    transform-box: fill-box;
    transform-origin: center center;
    will-change: transform;
    overflow: visible;
}

#metis-owl #owl-body,
#metis-owl #owl-ear-left,
#metis-owl #owl-ear-right,
#metis-owl #owl-shoulder-left,
#metis-owl #owl-shoulder-right,
#metis-owl #owl-wing-l-shape,
#metis-owl #owl-wing-r-shape {
    fill: rgba(102, 252, 241, 0.22);
    stroke: var(--accent-color);
    stroke-width: 2.8;
    stroke-linejoin: round;
}

#metis-owl #owl-belly {
    fill: rgba(102, 252, 241, 0.32);
}

#metis-owl #owl-wing-l-feather,
#metis-owl #owl-wing-r-feather {
    fill: none;
    stroke: rgba(214, 255, 252, 0.78);
    stroke-width: 2;
    stroke-linecap: round;
}

#metis-owl #owl-beak {
    fill: #fbdf5b;
}

#metis-owl #owl-eye-l,
#metis-owl #owl-eye-r {
    fill: #ffffff;
    stroke: rgba(137, 168, 196, 0.35);
    stroke-width: 1.2;
}

#metis-owl .pupil-core { fill: #0b0c10; }
#metis-owl .pupil-glint { fill: #ffffff; }
#metis-owl .pupil-glint-soft { fill: rgba(255, 255, 255, 0.35); }

/* Skin: AZZURRA (default) */
#metis-owl[data-skin="azzurra"] #owl-body,
#metis-owl:not([data-skin]) #owl-body {
    fill: rgba(102, 252, 241, 0.15);
    stroke: #66fcf1;
}
#metis-owl[data-skin="azzurra"] #owl-belly,
#metis-owl:not([data-skin]) #owl-belly {
    fill: rgba(102, 252, 241, 0.3);
}
#metis-owl[data-skin="azzurra"] #owl-ear-left,
#metis-owl[data-skin="azzurra"] #owl-ear-right,
#metis-owl:not([data-skin]) #owl-ear-left,
#metis-owl:not([data-skin]) #owl-ear-right {
    fill: rgba(102, 252, 241, 0.4);
}

/* Skin: AZZURRA MASCHIO (piu scuro) */
#metis-owl[data-skin="azzurra-m"] #owl-body {
    fill: rgba(70, 180, 175, 0.2);
    stroke: #4ab8b2;
}
#metis-owl[data-skin="azzurra-m"] #owl-belly {
    fill: rgba(80, 190, 185, 0.35);
}

/* Skin: ROSSA */
#metis-owl[data-skin="rossa"] #owl-body {
    fill: rgba(255, 90, 90, 0.15);
    stroke: #ff6b6b;
}
#metis-owl[data-skin="rossa"] #owl-belly {
    fill: rgba(255, 120, 120, 0.3);
}
#metis-owl[data-skin="rossa"] #owl-ear-left,
#metis-owl[data-skin="rossa"] #owl-ear-right {
    fill: rgba(255, 100, 100, 0.4);
}

/* Skin: ROSSA MASCHIO */
#metis-owl[data-skin="rossa-m"] #owl-body {
    fill: rgba(180, 60, 60, 0.2);
    stroke: #cc5555;
}
#metis-owl[data-skin="rossa-m"] #owl-belly {
    fill: rgba(190, 80, 80, 0.35);
}

/* Skin: ROSA */
#metis-owl[data-skin="rosa"] #owl-body {
    fill: rgba(255, 182, 193, 0.2);
    stroke: #ffb6c1;
}
#metis-owl[data-skin="rosa"] #owl-belly {
    fill: rgba(255, 200, 210, 0.35);
}
#metis-owl[data-skin="rosa"] #owl-ear-left,
#metis-owl[data-skin="rosa"] #owl-ear-right {
    fill: rgba(255, 190, 200, 0.4);
}

/* Skin: ROSA MASCHIO (piu scuro) */
#metis-owl[data-skin="rosa-m"] #owl-body {
    fill: rgba(200, 130, 145, 0.2);
    stroke: #d496a0;
}
#metis-owl[data-skin="rosa-m"] #owl-belly {
    fill: rgba(210, 150, 165, 0.35);
}

/* Skin: VERDE */
#metis-owl[data-skin="verde"] #owl-body {
    fill: rgba(120, 220, 120, 0.15);
    stroke: #90ee90;
}
#metis-owl[data-skin="verde"] #owl-belly {
    fill: rgba(150, 230, 150, 0.3);
}
#metis-owl[data-skin="verde"] #owl-ear-left,
#metis-owl[data-skin="verde"] #owl-ear-right {
    fill: rgba(140, 220, 140, 0.4);
}

/* Skin: VERDE MASCHIO */
#metis-owl[data-skin="verde-m"] #owl-body {
    fill: rgba(80, 160, 80, 0.2);
    stroke: #70c870;
}
#metis-owl[data-skin="verde-m"] #owl-belly {
    fill: rgba(90, 170, 90, 0.35);
}

/* Legacy skins (compatibilita) */
#metis-owl[data-skin="aurora"] #owl-body {
    fill: rgba(111, 255, 214, 0.2);
    stroke: #7bffd2;
}
#metis-owl[data-skin="aurora"] #owl-belly {
    fill: rgba(111, 255, 214, 0.34);
}
#metis-owl[data-skin="ember"] #owl-body {
    fill: rgba(255, 173, 92, 0.18);
    stroke: #ffb15c;
}
#metis-owl[data-skin="ember"] #owl-belly {
    fill: rgba(255, 208, 120, 0.28);
}
#metis-owl[data-skin="midnight"] #owl-body {
    fill: rgba(134, 152, 255, 0.18);
    stroke: #a7b6ff;
}
#metis-owl[data-skin="midnight"] #owl-belly {
    fill: rgba(134, 152, 255, 0.28);
}

#owl-motion {
    transform-origin: center center;
    transform: translate(var(--owl-drift-x), var(--owl-lift)) rotate(var(--owl-rock)) scaleY(var(--owl-squash));
    transition: transform 140ms ease-out;
}

#owl-face {
    transform: translate(var(--owl-face-x), var(--owl-face-y));
    transform-origin: center center;
    transition: transform 140ms ease-out;
}

#owl-aura {
    transform-origin: center center;
    transform: scale(var(--owl-aura-scale));
    opacity: var(--owl-aura-opacity);
    transition: transform 220ms ease-out, opacity 220ms ease-out;
}

#owl-accessories .owl-accessory {
    transform-origin: center center;
    transition: transform 180ms ease-out;
}

#metis-owl[data-equip-crown="true"] #owl-crown,
#metis-owl[data-equip-bell="true"] #owl-bell,
#metis-owl[data-equip-cape="true"] #owl-cape,
#metis-owl[data-equip-pillow="true"] #owl-pillow {
    opacity: 1;
}

#metis-owl[data-equip-crown="true"] #owl-crown {
    animation: owl-crown-spark 3s ease-in-out infinite;
}

#metis-owl[data-equip-bell="true"] #owl-bell {
    animation: owl-bell-swing 2s ease-in-out infinite;
}

#metis-owl[data-equip-cape="true"] #owl-cape {
    animation: owl-cape-drift 2.6s ease-in-out infinite;
}

#metis-owl[data-equip-pillow="true"] #owl-pillow {
    transform: translateY(0);
}

.pixar-blink {
    /* Keep the class for transform-origin but no animation */
}

#eyelid-l,
#eyelid-r {
    fill: none;
    stroke: rgba(102, 252, 241, 0.7);
    stroke-width: 1.5;
    stroke-linecap: round;
    display: none;
}

#metis-owl.show-eyelashes #eyelid-l,
#metis-owl.show-eyelashes #eyelid-r {
    display: block;
}

.wing-pivot {
    transition: none;
}

.wing-rotor {
    transition: none;
}

.owl-wing {
    opacity: 0.98;
    transition: opacity 180ms ease-out, filter 180ms ease-out;
}

#metis-owl[data-state="flying"] #owl-motion {
    animation: owl-cruise 2.8s cubic-bezier(0.42, 0, 0.24, 1) infinite;
}

#metis-owl[data-state="flying"] .owl-wing {
    filter: drop-shadow(0 0 7px rgba(102, 252, 241, 0.18));
}

#metis-owl[data-state="flying"] #owl-aura,
#metis-owl[data-state="hungry"] #owl-aura,
#metis-owl[data-pose="happy"] #owl-aura {
    animation: owl-aura-pulse 1.8s ease-in-out infinite;
}

#metis-owl[data-state="perching"] #owl-motion {
    animation: owl-perch-settle 2.2s ease-in-out infinite;
}

#metis-owl[data-state="hungry"] #owl-motion {
    animation: owl-hungry-hover 1.4s ease-in-out infinite;
}

#metis-owl[data-state="sleeping"] #owl-motion {
    animation: owl-sleep-breathe 3.4s ease-in-out infinite;
}

#metis-owl[data-pose="reward"] #owl-motion {
    animation: owl-reward-bounce 0.55s ease-in-out 4;
}

#metis-owl[data-pose="playful"] #owl-face {
    animation: owl-face-bob 0.45s ease-in-out 4;
}

#metis-owl[data-pose="rested"] #owl-motion {
    animation: owl-sleep-breathe 1.8s ease-in-out 2;
}

#metis-owl[data-pose="happy"] #owl-face {
    animation: owl-face-bob 0.75s ease-in-out 2;
}

#metis-owl[data-pose="happy"] .owl-wing {
    filter: drop-shadow(0 0 8px rgba(251, 223, 91, 0.35));
}

#metis-owl[data-pose="cuddled"] #owl-motion {
    animation: owl-cuddle-bounce 0.6s ease-out 2;
}

#metis-owl[data-pose="look-around"] #owl-face,
#metis-owl[data-pose="curious"] #owl-face,
#metis-owl[data-pose="peek"] #owl-face {
    animation: owl-look-around 1.15s ease-in-out;
}

#metis-owl[data-pose="flap-boost"] #wing-l-rotor,
#metis-owl[data-pose="flap-boost"] #wing-r-rotor,
#metis-owl[data-pose="hover-proud"] #wing-l-rotor,
#metis-owl[data-pose="hover-proud"] #wing-r-rotor {
    animation: owl-wing-burst 0.8s ease-out;
}

#metis-owl[data-pose="glide-left"] #owl-motion {
    animation: owl-glide-left 1.1s ease-in-out;
}

#metis-owl[data-pose="glide-right"] #owl-motion {
    animation: owl-glide-right 1.1s ease-in-out;
}

#metis-owl[data-pose="head-tilt"] #owl-motion,
#metis-owl[data-pose="tail-wag"] #owl-motion,
#metis-owl[data-pose="sniff"] #owl-motion {
    animation: owl-tilt-curious 1s ease-in-out;
}

#metis-owl[data-pose="preen"] #owl-face {
    animation: owl-preen 1.3s ease-in-out;
}

#metis-owl[data-pose="blink-long"] #eyelid-l,
#metis-owl[data-pose="blink-long"] #eyelid-r {
    animation: owl-long-blink 0.95s ease-in-out;
}

#metis-owl[data-pose="sleep-twitch"] #owl-motion,
#metis-owl[data-pose="sleep-roll"] #owl-motion {
    animation: owl-sleep-twitch 1.15s ease-in-out;
}

#metis-owl[data-pose="mini-dance"] #owl-motion,
#metis-owl[data-pose="happy-hop"] #owl-motion {
    animation: owl-mini-dance 1.1s ease-in-out;
}

#metis-owl[data-pose="wing-stretch"] #wing-l-rotor,
#metis-owl[data-pose="wing-stretch"] #wing-r-rotor {
    animation: owl-wing-stretch 1.25s ease-in-out;
}

#metis-owl[data-pose="little-spin"] #owl-motion {
    animation: owl-little-spin 1s ease-in-out;
}

#metis-owl[data-pose="bounce"] #owl-motion {
    animation: owl-bounce 0.9s ease-in-out;
}

#metis-owl[data-pose="nod"] #owl-face {
    animation: owl-nod 0.9s ease-in-out;
}

#metis-owl[data-pose="yawn"] #owl-beak {
    animation: owl-yawn-beak 1.2s ease-in-out;
    transform-origin: center center;
}

#metis-owl[data-state="sleeping"] .pixar-blink {
    transform: scaleY(1) !important;
    animation: none;
}

@keyframes owl-cruise {
    0%, 100% { transform: translate(var(--owl-drift-x), calc(var(--owl-lift) - 2px)) rotate(var(--owl-rock)) scaleY(var(--owl-squash)); }
    35% { transform: translate(calc(var(--owl-drift-x) + 1px), calc(var(--owl-lift) + 1px)) rotate(calc(var(--owl-rock) + 1deg)) scaleY(calc(var(--owl-squash) - 0.008)); }
    70% { transform: translate(calc(var(--owl-drift-x) - 1px), calc(var(--owl-lift) + 3px)) rotate(calc(var(--owl-rock) - 0.8deg)) scaleY(calc(var(--owl-squash) - 0.02)); }
}

@keyframes owl-hungry-hover {
    0%, 100% { transform: translate(var(--owl-drift-x), calc(var(--owl-lift) - 2px)) rotate(var(--owl-rock)) scaleY(var(--owl-squash)); }
    50% { transform: translate(calc(var(--owl-drift-x) + 1px), calc(var(--owl-lift) + 6px)) rotate(calc(var(--owl-rock) + 1.2deg)) scaleY(calc(var(--owl-squash) - 0.015)); }
}

@keyframes owl-perch-settle {
    0%, 100% { transform: translate(var(--owl-drift-x), var(--owl-lift)) rotate(var(--owl-rock)) scaleY(var(--owl-squash)); }
    50% { transform: translate(calc(var(--owl-drift-x) - 1px), calc(var(--owl-lift) + 1px)) rotate(calc(var(--owl-rock) - 0.5deg)) scaleY(calc(var(--owl-squash) - 0.01)); }
}

@keyframes owl-sleep-breathe {
    0%, 100% { transform: translate(var(--owl-drift-x), var(--owl-lift)) rotate(var(--owl-rock)) scale(1, var(--owl-squash)); }
    50% { transform: translate(var(--owl-drift-x), calc(var(--owl-lift) + 2px)) rotate(calc(var(--owl-rock) - 0.3deg)) scale(0.985, calc(var(--owl-squash) + 0.01)); }
}

@keyframes owl-aura-pulse {
    0%, 100% { opacity: var(--owl-aura-opacity); transform: scale(var(--owl-aura-scale)); }
    50% { opacity: calc(var(--owl-aura-opacity) + 0.08); transform: scale(calc(var(--owl-aura-scale) + 0.06)); }
}

@keyframes owl-face-bob {
    0%, 100% { transform: translate(var(--owl-face-x), var(--owl-face-y)); }
    50% { transform: translate(calc(var(--owl-face-x) + 1px), calc(var(--owl-face-y) - 2px)); }
}

@keyframes owl-cuddle-bounce {
    0%, 100% { transform: translateY(var(--owl-lift)) scaleY(var(--owl-squash)); }
    50% { transform: translateY(calc(var(--owl-lift) - 3px)) scale(1.02, calc(var(--owl-squash) - 0.02)); }
}

@keyframes owl-look-around {
    0%, 100% { transform: translate(var(--owl-face-x), var(--owl-face-y)); }
    25% { transform: translate(calc(var(--owl-face-x) - 2px), calc(var(--owl-face-y) - 1px)); }
    60% { transform: translate(calc(var(--owl-face-x) + 2px), calc(var(--owl-face-y) - 1px)); }
}

@keyframes owl-wing-burst {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-2px) scale(1.05); }
}

@keyframes owl-glide-left {
    0%, 100% { transform: translate(var(--owl-drift-x), var(--owl-lift)) rotate(var(--owl-rock)); }
    50% { transform: translate(calc(var(--owl-drift-x) - 5px), calc(var(--owl-lift) - 2px)) rotate(-3deg); }
}

@keyframes owl-glide-right {
    0%, 100% { transform: translate(var(--owl-drift-x), var(--owl-lift)) rotate(var(--owl-rock)); }
    50% { transform: translate(calc(var(--owl-drift-x) + 5px), calc(var(--owl-lift) - 2px)) rotate(3deg); }
}

@keyframes owl-tilt-curious {
    0%, 100% { transform: translate(var(--owl-drift-x), var(--owl-lift)) rotate(var(--owl-rock)); }
    50% { transform: translate(var(--owl-drift-x), calc(var(--owl-lift) - 1px)) rotate(4deg); }
}

@keyframes owl-preen {
    0%, 100% { transform: translate(var(--owl-face-x), var(--owl-face-y)); }
    50% { transform: translate(calc(var(--owl-face-x) - 1px), calc(var(--owl-face-y) + 3px)); }
}

@keyframes owl-long-blink {
    0%, 100% { transform: scaleY(1); }
    45%, 65% { transform: scaleY(0.12); }
}

@keyframes owl-sleep-twitch {
    0%, 100% { transform: translate(var(--owl-drift-x), var(--owl-lift)) rotate(var(--owl-rock)); }
    30% { transform: translate(calc(var(--owl-drift-x) - 1px), calc(var(--owl-lift) + 1px)) rotate(-1.5deg); }
    60% { transform: translate(calc(var(--owl-drift-x) + 1px), calc(var(--owl-lift) + 1px)) rotate(1.5deg); }
}

@keyframes owl-mini-dance {
    0%, 100% { transform: translate(var(--owl-drift-x), var(--owl-lift)) scale(1); }
    25% { transform: translate(calc(var(--owl-drift-x) - 2px), calc(var(--owl-lift) - 3px)) scale(1.02); }
    50% { transform: translate(calc(var(--owl-drift-x) + 2px), calc(var(--owl-lift) - 1px)) scale(1.01); }
    75% { transform: translate(calc(var(--owl-drift-x) - 1px), calc(var(--owl-lift) - 2px)) scale(1.015); }
}

@keyframes owl-yawn-beak {
    0%, 100% { transform: scaleY(1); }
    40% { transform: scaleY(1.35) translateY(1px); }
}

@keyframes owl-wing-stretch {
    0%, 100% { transform: rotate(0deg); }
    45% { transform: rotate(16deg); }
    75% { transform: rotate(8deg); }
}

@keyframes owl-little-spin {
    0% { transform: translate(var(--owl-drift-x), var(--owl-lift)) rotate(0deg); }
    50% { transform: translate(var(--owl-drift-x), calc(var(--owl-lift) - 2px)) rotate(6deg); }
    100% { transform: translate(var(--owl-drift-x), var(--owl-lift)) rotate(0deg); }
}

@keyframes owl-bounce {
    0%, 100% { transform: translate(var(--owl-drift-x), var(--owl-lift)) scale(1); }
    30% { transform: translate(var(--owl-drift-x), calc(var(--owl-lift) - 4px)) scale(1.02); }
    65% { transform: translate(var(--owl-drift-x), calc(var(--owl-lift) - 2px)) scale(1.01); }
}

@keyframes owl-nod {
    0%, 100% { transform: translate(var(--owl-face-x), var(--owl-face-y)); }
    45% { transform: translate(var(--owl-face-x), calc(var(--owl-face-y) + 2px)); }
}

@keyframes owl-crown-spark {
    0%, 100% { transform: translateY(0); filter: drop-shadow(0 0 0 rgba(247, 215, 91, 0)); }
    50% { transform: translateY(-1px); filter: drop-shadow(0 0 8px rgba(247, 215, 91, 0.5)); }
}

@keyframes owl-bell-swing {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(7deg); }
    75% { transform: rotate(-7deg); }
}

@keyframes owl-cape-drift {
    0%, 100% { transform: scaleX(1); opacity: 1; }
    50% { transform: scaleX(1.03) translateX(1px); opacity: 0.92; }
}

@keyframes owl-reward-bounce {
    0%, 100% { transform: translateY(var(--owl-lift)) scaleY(var(--owl-squash)); }
    50% { transform: translateY(calc(var(--owl-lift) - 5px)) scale(1.05, calc(var(--owl-squash) - 0.03)); }
}

/* --- METIS PET ENGINE (TAMAGOTCHI) --- */
.pet-panel {
    position: fixed;
    bottom: 120px;
    right: 40px;
    width: clamp(300px, 24vw, 360px);
    max-height: min(82vh, 920px);
    background: linear-gradient(160deg, rgba(8, 18, 35, 0.97) 0%, rgba(20, 40, 60, 0.95) 50%, rgba(12, 25, 45, 0.97) 100%);
    border: 1.5px solid rgba(102, 252, 241, 0.5);
    padding: 14px 18px;
    border-radius: 22px;
    z-index: 9000;
    box-shadow: 0 0 30px rgba(102, 252, 241, 0.25), 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow-y: auto;
}

.pet-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(102, 252, 241, 0.3);
    justify-content: space-around;
}

.pet-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 6px;
    background: linear-gradient(135deg, rgba(102, 252, 241, 0.1), rgba(102, 252, 241, 0.05));
    border: 1px solid rgba(102, 252, 241, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    opacity: 0.6;
}

.pet-tab:hover {
    opacity: 0.9;
    background: linear-gradient(135deg, rgba(102, 252, 241, 0.2), rgba(102, 252, 241, 0.1));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 252, 241, 0.2);
}

.pet-tab.active {
    opacity: 1;
    background: linear-gradient(135deg, rgba(102, 252, 241, 0.3), rgba(102, 252, 241, 0.15));
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(102, 252, 241, 0.4), inset 0 0 10px rgba(102, 252, 241, 0.1);
}

.pet-tab-icon {
    font-size: 20px;
    filter: drop-shadow(0 0 3px rgba(102, 252, 241, 0.5));
}

.pet-tab-name {
    font-size: 9px;
    color: var(--text-primary);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.pet-tab.active .pet-tab-name {
    color: var(--highlight-color);
    text-shadow: 0 0 8px rgba(251, 223, 91, 0.5);
}

.pet-tab-content {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.pet-hint {
    text-align: center;
    font-size: 11px;
    color: var(--text-dim);
    margin: 10px 0;
}

.pet-quick-actions {
    display: flex;
    gap: 8px;
    margin: 10px 0;
}

.pet-quick-actions .pet-action-btn {
    flex: 1;
    padding: 10px;
    font-size: 11px;
}

.pet-inventory-mini {
    text-align: center;
    font-size: 10px;
    color: var(--text-dim);
    padding: 8px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    margin-top: 8px;
}

.pet-game-cost {
    text-align: center;
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.pet-settings-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--glass-border);
}

.pet-settings-btn {
    padding: 8px 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.pet-settings-btn:hover {
    background: rgba(102, 252, 241, 0.1);
}

.pet-mini-star {
    font-size: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.3));
}

.pet-mini-star:hover {
    transform: scale(1.2);
}

.pet-mini-star.win-glow {
    animation: starPulse 0.5s ease infinite;
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.8));
}

@keyframes starPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.pet-mini-star.win {
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.5));
}

.pet-mini-star.lose {
    opacity: 0.4;
    filter: grayscale(0.5);
}

.pet-panel-title {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

.pet-level-row,
.pet-stat-row,
.pet-xp-meta,
.pet-inventory-grid,
.pet-actions,
.pet-panel-sections {
    display: flex;
}

.pet-panel-sections {
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

.pet-panel-sections > .pet-rewards-block {
    flex: 1 1 100%;
    min-width: 0;
    margin-top: 0;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
}

.pet-panel-sections > .pet-inventory-block,
.pet-panel-sections > .pet-settings-block,
.pet-panel-sections > .pet-test-block,
.pet-panel-sections > .pet-rewards-block:first-child,
.pet-panel-sections > .pet-rewards-block:nth-child(3) {
    flex-basis: calc(50% - 5px);
}

.pet-level-row {
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.pet-level-label {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
}

.pet-level-sub,
.pet-xp-meta,
.pet-status-note {
    color: var(--text-dim);
    font-size: 11px;
}

.pet-mood-chip {
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(251, 223, 91, 0.45);
    color: var(--highlight-color);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.pet-xp-track,
.pet-bar {
    overflow: hidden;
}

.pet-xp-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    margin-bottom: 6px;
}

.pet-xp-fill {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--highlight-color), var(--accent-color));
    transition: width 0.4s ease;
}

.pet-xp-meta {
    justify-content: flex-end;
    margin-bottom: 12px;
}

.pet-stat-row {
    margin-bottom: 8px;
    align-items: center;
}

.pet-stat-last {
    margin-bottom: 14px;
}

.pet-stat-label {
    margin-right: 10px;
    font-size: 12px;
    width: 74px;
}

.pet-bar {
    flex: 1;
    height: 8px;
    background: #333;
    border-radius: 4px;
}

.pet-action-selector {
    margin-bottom: 14px;
    padding: 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    border: 1px solid var(--glass-border);
}

.pet-action-label {
    font-size: 10px;
    color: var(--text-dim);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pet-action-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.pet-action-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.pet-action-option:hover {
    background: rgba(102, 252, 241, 0.1);
}

.pet-action-option.active {
    background: rgba(102, 252, 241, 0.2);
    border-color: var(--accent-color);
    box-shadow: 0 0 8px rgba(102, 252, 241, 0.3);
}

.pet-action-icon {
    font-size: 18px;
}

.pet-action-name {
    font-size: 8px;
    color: var(--text-dim);
}

.pet-action-option.active .pet-action-name {
    color: var(--text-primary);
}

.pet-actions {
    gap: 8px;
    margin-bottom: 14px;
}

.pet-settings-row {
    display: flex;
    gap: 8px;
}

.pet-action-btn {
    flex: 1;
    padding: 8px;
    background: var(--accent-color);
    border: none;
    border-radius: 8px;
    color: #0b0c10;
    font-weight: 700;
    cursor: pointer;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pet-action-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.pet-test-block {
    border-top: 1px solid var(--glass-border);
    padding-top: 12px;
    margin-top: 8px;
}

.pet-test-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pet-test-btn {
    flex: 1;
    min-width: 60px;
    padding: 8px 4px;
    background: rgba(102, 252, 241, 0.15);
    border: 1px solid rgba(102, 252, 241, 0.4);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.pet-test-btn:hover {
    background: rgba(102, 252, 241, 0.3);
    border-color: var(--text-primary);
}

/* SKIN GRID */
.pet-skin-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 6px;
}

.pet-skin-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1.5px solid rgba(255,255,255,0.15);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 8px rgba(255,255,255,0.2), 0 0 6px rgba(255,255,255,0.1);
}

.pet-skin-btn::before {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 4px;
}

.pet-skin-btn[data-skin="azzurra"]::before { background: linear-gradient(135deg, #99fff5, #33ddd8); box-shadow: 0 0 8px #66fcf1; }
.pet-skin-btn[data-skin="azzurra-m"]::before { background: linear-gradient(135deg, #7dd4ce, #3aaa9f); box-shadow: 0 0 8px #4ab8b2; }
.pet-skin-btn[data-skin="rossa"]::before { background: linear-gradient(135deg, #ff9999, #ff4444); box-shadow: 0 0 8px #ff6b6b; }
.pet-skin-btn[data-skin="rossa-m"]::before { background: linear-gradient(135deg, #dd7777, #bb4444); box-shadow: 0 0 8px #cc5555; }
.pet-skin-btn[data-skin="rosa"]::before { background: linear-gradient(135deg, #ffd4dc, #ff9eb0); box-shadow: 0 0 8px #ffb6c1; }
.pet-skin-btn[data-skin="rosa-m"]::before { background: linear-gradient(135deg, #e8b8c0, #c4828c); box-shadow: 0 0 8px #d496a0; }
.pet-skin-btn[data-skin="verde"]::before { background: linear-gradient(135deg, #b8f5b8, #78dd78); box-shadow: 0 0 8px #90ee90; }
.pet-skin-btn[data-skin="verde-m"]::before { background: linear-gradient(135deg, #98d898, #58b858); box-shadow: 0 0 8px #70c870; }

.pet-skin-btn.active {
    border-color: var(--highlight-color);
    box-shadow: 0 0 12px var(--highlight-color), inset 0 0 8px rgba(251, 223, 91, 0.3);
    transform: scale(1.05);
}

.pet-skin-btn.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

/* WARDROBE */
.pet-wardrobe-section {
    background: rgba(102, 252, 241, 0.05);
    border-radius: 12px;
    padding: 10px;
    margin-top: 8px;
    border: 1px solid rgba(102, 252, 241, 0.15);
}

.pet-wardrobe-title {
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pet-skin-grid {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.pet-skin-grid .pet-skin-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.pet-wardrobe-slots {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.pet-wardrobe-slot {
    padding: 8px 14px;
    background: linear-gradient(135deg, rgba(102, 252, 241, 0.15), rgba(102, 252, 241, 0.08));
    border: 1.5px solid rgba(102, 252, 241, 0.35);
    border-radius: 20px;
    font-size: 10px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pet-wardrobe-slot:hover {
    background: linear-gradient(135deg, rgba(102, 252, 241, 0.25), rgba(102, 252, 241, 0.12));
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(102, 252, 241, 0.3);
}

.pet-wardrobe-slot.active {
    background: linear-gradient(135deg, var(--accent-color), rgba(102, 252, 241, 0.6));
    border-color: var(--highlight-color);
    color: #0b0c10;
    box-shadow: 0 0 15px rgba(102, 252, 241, 0.5);
}

.pet-wardrobe-items {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
    padding: 8px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

.pet-wardrobe-item {
    padding: 10px 6px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(102, 252, 241, 0.08));
    border: 1.5px solid rgba(102, 252, 241, 0.25);
    border-radius: 10px;
    font-size: 9px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.pet-wardrobe-item .item-icon {
    font-size: 18px;
    filter: drop-shadow(0 0 4px rgba(102, 252, 241, 0.5));
}

.pet-wardrobe-item:hover {
    background: linear-gradient(135deg, rgba(102, 252, 241, 0.25), rgba(102, 252, 241, 0.15));
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 252, 241, 0.3);
}

.pet-wardrobe-item.equipped {
    background: linear-gradient(135deg, rgba(251, 223, 91, 0.3), rgba(102, 252, 241, 0.2));
    border-color: var(--highlight-color);
    color: var(--highlight-color);
    box-shadow: 0 0 12px rgba(251, 223, 91, 0.4);
    box-shadow: 0 0 10px rgba(251, 223, 91, 0.3), inset 0 0 6px rgba(251, 223, 91, 0.2);
}

.pet-wardrobe-item.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.pet-rewards-block {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.pet-panel-sections > .pet-rewards-block {
    border-top: none;
}

.pet-block-title {
    color: var(--highlight-color);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.pet-reward-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 22px;
}

.pet-equipped-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pet-reward-chip,
.pet-inventory-item,
.pet-equipped-chip {
    border-radius: 999px;
    font-size: 10px;
}

.pet-reward-chip {
    padding: 4px 8px;
    background: rgba(251, 223, 91, 0.1);
    border: 1px solid rgba(251, 223, 91, 0.28);
    color: var(--highlight-color);
}

.pet-reward-empty {
    color: var(--text-dim);
    font-size: 11px;
}

.pet-inventory-grid {
    flex-wrap: wrap;
    gap: 8px;
}

.pet-inventory-item {
    padding: 5px 9px;
    background: rgba(102, 252, 241, 0.06);
    border: 1px solid rgba(102, 252, 241, 0.16);
    color: var(--text-primary);
}

.pet-equipped-chip {
    padding: 5px 9px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.pet-equipped-chip.active {
    background: rgba(251, 223, 91, 0.12);
    border-color: rgba(251, 223, 91, 0.4);
    color: var(--highlight-color);
}

.pet-minigame-copy,
.pet-minigame-status,
.pet-shop-copy {
    color: var(--text-dim);
    font-size: 11px;
}

.pet-minigame-copy {
    margin-bottom: 8px;
}

.pet-shop-copy {
    margin-bottom: 8px;
}

.pet-missions-list,
.pet-shop-list {
    display: grid;
    gap: 8px;
}

.pet-reward-list,
.pet-equipped-list,
.pet-inventory-grid,
.pet-missions-list,
.pet-shop-list,
.pet-minigame-board,
.pet-settings-row {
    min-width: 0;
}

.pet-reset-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(102, 252, 241, 0.2);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pet-reset-btn, .pet-tutorial-btn {
    padding: 16px 28px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 160px;
    border: none;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.pet-reset-btn {
    background: linear-gradient(145deg, #c0392b, #a93226);
    color: #fff;
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.pet-reset-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.pet-reset-btn:hover {
    background: linear-gradient(145deg, #e74c3c, #c0392b);
    box-shadow: 
        0 8px 15px rgba(231, 76, 60, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-3px) scale(1.02);
}

.pet-reset-btn:hover::before {
    left: 100%;
}

.pet-reset-btn:active {
    transform: translateY(-1px) scale(1.01);
}

.pet-tutorial-btn {
    background: linear-gradient(145deg, #2980b9, #1a5276);
    color: #fff;
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.pet-tutorial-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.pet-tutorial-btn:hover {
    background: linear-gradient(145deg, #3498db, #2980b9);
    box-shadow: 
        0 8px 15px rgba(52, 152, 219, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-3px) scale(1.02);
}

.pet-tutorial-btn:hover::before {
    left: 100%;
}

.pet-tutorial-btn:active {
    transform: translateY(-1px) scale(1.01);
}

.pet-debug-btn {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(145deg, #5a5a5a, #444);
    color: #ccc;
    border: none;
    transition: all 0.2s ease;
}

.pet-debug-btn:hover {
    background: linear-gradient(145deg, #666, #555);
    transform: translateY(-2px);
}

.pet-force-btn {
    background: linear-gradient(145deg, #27ae60, #1e8449);
    color: #fff;
}

.pet-force-btn:hover {
    background: linear-gradient(145deg, #2ecc71, #27ae60);
}

.pet-mission-card,
.pet-shop-item {
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.pet-daily-bonus-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(251, 223, 91, 0.12), rgba(102, 252, 241, 0.08));
    border: 1px solid rgba(251, 223, 91, 0.3);
}

.pet-daily-claim-btn {
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid rgba(251, 223, 91, 0.4);
    background: rgba(251, 223, 91, 0.16);
    color: var(--highlight-color);
    cursor: pointer;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.pet-daily-claim-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.pet-mission-title,
.pet-shop-title {
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 700;
}

.pet-mission-meta,
.pet-shop-meta {
    color: var(--text-dim);
    font-size: 10px;
    margin-top: 4px;
}

.pet-mission-progress {
    margin-top: 7px;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.pet-mission-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--highlight-color));
}

.pet-mission-card.complete {
    border-color: rgba(251, 223, 91, 0.28);
    background: rgba(251, 223, 91, 0.08);
}

.pet-shop-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.pet-shop-buy {
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid rgba(251, 223, 91, 0.28);
    background: rgba(251, 223, 91, 0.1);
    color: var(--highlight-color);
    cursor: pointer;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.pet-shop-buy:disabled {
    opacity: 0.4;
    cursor: default;
}

.pet-minigame-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.pet-mini-star {
    padding: 10px 0;
    border-radius: 10px;
    border: 1px solid rgba(102, 252, 241, 0.18);
    background: rgba(102, 252, 241, 0.05);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 18px;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.pet-mini-star:hover {
    transform: translateY(-1px);
    border-color: rgba(251, 223, 91, 0.35);
}

.pet-mini-star.win {
    background: rgba(251, 223, 91, 0.16);
    border-color: rgba(251, 223, 91, 0.55);
    color: var(--highlight-color);
}

.pet-mini-star.lose {
    opacity: 0.65;
}

.pet-minigame-status {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-dim);
    text-align: center;
    min-height: 16px;
}

.dice-board {
    text-align: center;
    padding: 10px;
}

.dice-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 10px;
}

.die {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(102, 252, 241, 0.08));
    border: 2px solid rgba(102, 252, 241, 0.4);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 10px rgba(102, 252, 241, 0.15);
}

.die:hover {
    transform: scale(1.05);
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(102, 252, 241, 0.3);
}

.die.rolled {
    animation: diceShake 0.5s ease-out;
}

.die.win {
    border-color: var(--highlight-color);
    background: linear-gradient(135deg, rgba(251, 223, 91, 0.2), rgba(102, 252, 241, 0.1));
    box-shadow: 0 0 20px var(--highlight-color);
}

.die.lose {
    opacity: 0.5;
    border-color: rgba(255,255,255,0.15);
}

@keyframes diceShake {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(-15deg) scale(1.1); }
    40% { transform: rotate(15deg) scale(1.1); }
    60% { transform: rotate(-10deg); }
    80% { transform: rotate(10deg); }
}

.dice-score {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 600;
}

.dice-score span {
    color: var(--highlight-color);
    font-size: 18px;
}

.dice-result {
    font-size: 12px;
    color: var(--text-dim);
    min-height: 20px;
    margin-bottom: 10px;
}

.dice-result.win {
    color: var(--highlight-color);
    font-weight: 600;
}

.dice-result.lose {
    color: #ff6b6b;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.game-card {
    background: linear-gradient(135deg, rgba(102, 252, 241, 0.15), rgba(102, 252, 241, 0.08));
    border: 1.5px solid rgba(102, 252, 241, 0.3);
    border-radius: 14px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.game-card:hover {
    background: linear-gradient(135deg, rgba(102, 252, 241, 0.25), rgba(102, 252, 241, 0.15));
    border-color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 252, 241, 0.3);
}

.game-icon {
    font-size: 28px;
    margin-bottom: 6px;
    filter: drop-shadow(0 0 6px rgba(102, 252, 241, 0.5));
}

.game-name {
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 4px;
}

.game-cost {
    color: var(--highlight-color);
    font-size: 10px;
    font-weight: 600;
}

.active-game-area {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    min-height: 100px;
}

.game-instructions {
    color: var(--text-dim);
    text-align: center;
    font-size: 12px;
    padding: 20px;
}

.dice-game-container {
    text-align: center;
}

.dice-game-container .dice-container {
    gap: 15px;
    justify-content: center;
    margin-bottom: 15px;
}

.dice-game-container .die {
    width: 55px;
    height: 55px;
    font-size: 32px;
}

.dice-game-container .dice-result {
    font-size: 16px;
    padding: 10px;
    border-radius: 10px;
    margin: 10px 0;
}

.dice-game-container .dice-result.win {
    background: linear-gradient(135deg, rgba(251, 223, 91, 0.2), rgba(102, 252, 241, 0.1));
    border: 1px solid var(--highlight-color);
}

.dice-game-container .dice-result.lose {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.star-catch-container {
    text-align: center;
}

.star-grid {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 15px 0;
}

.star-option {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(102, 252, 241, 0.08));
    border: 2px solid rgba(102, 252, 241, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.2s;
}

.star-option:hover {
    transform: scale(1.1);
    border-color: var(--highlight-color);
    box-shadow: 0 0 15px rgba(251, 223, 91, 0.4);
}

.star-option.revealed {
    animation: starReveal 0.5s ease-out;
}

.star-option.winner {
    background: linear-gradient(135deg, rgba(251, 223, 91, 0.4), rgba(255, 215, 0, 0.3));
    border-color: var(--highlight-color);
    box-shadow: 0 0 25px var(--highlight-color);
    animation: starPulse 0.5s ease infinite;
}

.star-option.loser {
    opacity: 0.4;
}

@keyframes starReveal {
    0% { transform: scale(0) rotate(-180deg); }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes starPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.memory-game-container {
    text-align: center;
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 10px 0;
}

.memory-card {
    aspect-ratio: 1;
    background: linear-gradient(135deg, rgba(102, 252, 241, 0.15), rgba(102, 252, 241, 0.08));
    border: 1.5px solid rgba(102, 252, 241, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.2s;
}

.memory-card:hover {
    transform: scale(1.05);
    border-color: var(--accent-color);
}

.memory-card.flipped {
    background: linear-gradient(135deg, rgba(251, 223, 91, 0.3), rgba(102, 252, 241, 0.2));
    border-color: var(--highlight-color);
}

.memory-card.matched {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.3), rgba(102, 252, 241, 0.2));
    border-color: #2ecc71;
    opacity: 0.7;
}

.catch-food-container {
    text-align: center;
}

.food-target {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(102, 252, 241, 0.1));
    border: 2px solid rgba(102, 252, 241, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    cursor: pointer;
    margin: 15px auto;
    transition: all 0.15s;
    animation: foodBounce 0.6s ease infinite;
}

.food-target:hover {
    transform: scale(1.15);
    border-color: var(--highlight-color);
    box-shadow: 0 0 20px rgba(251, 223, 91, 0.5);
}

.food-target.caught {
    animation: foodCatch 0.3s ease-out;
}

@keyframes foodBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes foodCatch {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(0); opacity: 0; }
}

.game-reward-info {
    display: flex;
    justify-content: space-around;
    margin-top: 10px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.game-reward-info div {
    color: var(--highlight-color);
    font-size: 11px;
    font-weight: 600;
}

.pet-status-note {
    margin-top: 12px;
    text-align: center;
}

.pet-feedback {
    position: fixed;
    transform: translateX(-50%);
    color: #f6fbff;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0.01em;
    max-width: min(320px, 80vw);
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(10, 18, 28, 0.86);
    backdrop-filter: blur(4px);
    text-align: center;
    pointer-events: none;
    animation: floatUp 3200ms forwards;
    z-index: 10000;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.pet-feedback.reward {
    border-color: rgba(251, 223, 91, 0.45);
    background: rgba(54, 45, 18, 0.9);
}

.pet-feedback.levelup {
    border-color: rgba(102, 252, 241, 0.52);
    background: rgba(15, 54, 54, 0.9);
}

.pet-feedback.minigame {
    border-color: rgba(140, 184, 255, 0.45);
    background: rgba(16, 29, 54, 0.9);
}

.pet-feedback.sad {
    border-color: rgba(255, 133, 133, 0.55);
    background: rgba(66, 24, 24, 0.92);
}

.pet-feedback.love {
    border-color: rgba(255, 164, 208, 0.55);
    background: rgba(64, 24, 48, 0.92);
}

@media (max-height: 820px) and (min-width: 769px) {
    .pet-panel {
        bottom: 18px;
        right: 18px;
        max-height: calc(100vh - 36px);
        width: clamp(290px, 23vw, 340px);
    }

    .pet-panel-sections > .pet-rewards-block,
    .pet-panel-sections > .pet-inventory-block,
    .pet-panel-sections > .pet-settings-block,
    .pet-panel-sections > .pet-rewards-block:first-child,
    .pet-panel-sections > .pet-rewards-block:nth-child(3) {
        flex-basis: 100%;
    }
}
@keyframes floatUp {
    0% { transform: translateX(-50%) translateY(0) scale(1); opacity: 0; }
    10% { opacity: 1; }
    85% { opacity: 1; }
    100% { transform: translateX(-50%) translateY(-6px) scale(1.01); opacity: 0; }
}

.pet-sad .eye-white { fill: #d9d9d9; }
.pet-sad .owl-beak { transform: translateY(2px) scaleX(0.92); transform-origin: center top; }

.pet-fat .owl-body,
.pet-fat #owl-body {
    transform: scale(1.1, 1.05);
    transform-origin: 130px 140px;
}
.pet-fat .owl-belly,
.pet-fat #owl-belly {
    transform: scale(1.15, 1.08);
    transform-origin: 130px 170px;
}

.pet-thin .owl-body,
.pet-thin #owl-body {
    transform: scale(0.9, 0.95);
    transform-origin: 130px 140px;
}
.pet-thin .owl-belly,
.pet-thin #owl-belly {
    transform: scale(0.85, 0.92);
    transform-origin: 130px 170px;
}

.pet-tired .owl-eye-l,
.pet-tired .owl-eye-r,
.pet-tired #owl-eye-l,
.pet-tired #owl-eye-r {
    opacity: 0.7;
}

.pet-excited .owl-body {
    animation: excitedBounce 0.3s ease infinite;
}

.pet-night .owl-aura,
.pet-night #owl-aura {
    fill: rgba(30, 30, 80, 0.4);
    filter: blur(3px);
}

.pet-night .owl-body,
.pet-night #owl-body {
    fill: rgba(50, 50, 100, 0.25);
    stroke: #6a6aaa;
}

.pet-night .owl-belly,
.pet-night #owl-belly {
    fill: rgba(70, 70, 120, 0.35);
}

.pet-evolution-baby {
    filter: brightness(1.15) saturate(1.1);
}

.pet-evolution-child {
    filter: brightness(1.05);
}

.pet-evolution-adult {
    filter: brightness(1);
}

.pet-evolution-adult .owl-aura {
    animation: owl-aura-pulse 1.8s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.pet-rebellious {
    animation: rebelliousShake 2s ease-in-out infinite;
}

@keyframes rebelliousShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px) rotate(-1deg); }
    75% { transform: translateX(2px) rotate(1deg); }
}

@keyframes excitedBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

.pet-sleepy .owl-body,
.pet-sleepy .owl-belly {
    animation: breathe 3s infinite alternate;
    transform-origin: center bottom;
}

.pet-sleepy .owl-ear {
    opacity: 0.7;
}

.pet-happy .owl-body,
.pet-happy .owl-belly {
    filter: drop-shadow(0 0 10px rgba(251, 223, 91, 0.18));
}

@keyframes breathe {
    from { transform: scaleY(1); }
    to { transform: scaleY(1.05); }
}

/* Eclipse e Pulse Logo */
body.spirit-eclipse::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.6) 100%);
    z-index: 9998;
    pointer-events: none;
    animation: fadeInSpirit 2.5s forwards;
}

.main-logo-img.spirit-pulse {
    animation: logo-glow-pulse 3s ease-in-out infinite;
}

@keyframes logo-glow-pulse {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(251,223,91,0.2)); transform: scale(1); }
    50% { filter: drop-shadow(0 0 40px rgba(251,223,91,0.5)); transform: scale(1.01); }
}

/* --- METIS ARCHITECT BLOCK START --- */
/* Custom overrides intentionally reset to keep desktop buttons clickable. */
/* --- METIS ARCHITECT BLOCK END --- */

/* Spawn bubble animation */
@keyframes owl-spawn-bubble {
    0% { transform: scale(0.2); opacity: 0; }
    20% { transform: scale(1.05); opacity: 0.85; }
    35% { transform: scale(1); opacity: 0.9; }
    55% { transform: scale(1.08); opacity: 0.7; }
    70% { transform: scale(1.12); opacity: 0.4; }
    85% { transform: scale(1.2); opacity: 0.15; }
    100% { transform: scale(1.3); opacity: 0; }
}

@keyframes owl-spawn-appear {
    0% { opacity: 0; transform: scale(0.15); }
    25% { opacity: 1; transform: scale(0.8); }
    45% { transform: scale(1.05); }
    60% { transform: scale(0.97); }
    75% { transform: scale(1.02); }
    100% { transform: scale(1); opacity: 1; }
}

#metis-owl.spawning {
    animation: owl-spawn-appear 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#pet-spawn-bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.9), rgba(102,252,241,0.3) 40%, rgba(102,252,241,0.1) 70%, transparent 100%);
    border: 2px solid rgba(102, 252, 241, 0.6);
    box-shadow: 0 0 20px rgba(102, 252, 241, 0.4), inset 0 0 15px rgba(255,255,255,0.3);
    pointer-events: none;
    z-index: 9998;
    animation: owl-spawn-bubble 1.2s ease-out forwards;
}
