/* =========================================
   1. GLOBALS & HARDWARE SHELL
   ========================================= */
:root {
  --hardware-color: #f0f0f0;  
  --dsi-select-color: #f6529e; 
  --link-hover: #4eb5e6; 
}

@font-face {
  font-family: "NDS BIOS";
  /* Ensure this path is correct on your Neocities dashboard */
  src: url("/ndsbios_memesbruh03.ttf") format("truetype");
}

body {
  background-color: #e8e8e8;
  background-image: radial-gradient(#d8d8d8 2px, transparent 2px);
  background-size: 30px 30px;
  margin: 0; 
  padding: 20px 0;
  display: flex; 
  justify-content: center;
  /* Apply the DS font globally here */
  font-family: "NDS BIOS", "Courier New", monospace; 
  image-rendering: pixelated; /* Keeps the font and icons sharp */
}

/* Ensure all labels and review text inherit the font */
.sound-text-box p, 
.review-scroll-area, 
.review-scroll-area p,
.album-labels-box p {
    font-family: "NDS BIOS", sans-serif;
    letter-spacing: 0.5px;
}


/* =========================================
   1. VARIABLES & GLOBALS
   ========================================= */
:root {
  --unit: 120px; 
  --page-background: #e8e8e8; 
  --hardware-color: #f0f0f0;  
  --grid-color: #d8d8d8;
  --scan-color: #e0e0e0;
  
  --p: 2; 
  --pixel: calc(var(--p) * 1px); 
  --s: calc(var(--pixel) * 3); 

  --box-text: #333;
  --box-background: white;
  --box-border: #a1ccdd; 

  --date-text: #fff;
  --date-background: #a1ccdd;

  --link: #f1b4c5; 
  --link-hover: #4eb5e6; 
  
  /* Authentic DSi Menu Selection Pink */
  --dsi-select-color: #f6529e; 
}

@font-face {
  font-family: "NDS BIOS";
  src: url("ndsbios_memesbruh03.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

body, a, button, .box {
  cursor: url('stylus.gif') 0 32, auto;
}

body {
  background-color: var(--page-background);
  background-image: linear-gradient(0deg, transparent 24%, rgba(255, 255, 255, .3) 25%, rgba(255, 255, 255, .3) 26%, transparent 27%, transparent 74%, rgba(255, 255, 255, .3) 75%, rgba(255, 255, 255, .3) 76%, transparent 77%, transparent), linear-gradient(90deg, transparent 24%, rgba(255, 255, 255, .3) 25%, rgba(255, 255, 255, .3) 26%, transparent 27%, transparent 74%, rgba(255, 255, 255, .3) 75%, rgba(255, 255, 255, .3) 76%, transparent 77%, transparent);
  background-size: 50px 50px;
  margin: 0; 
  padding: 20px 0;
  display: flex;
  justify-content: center;
  image-rendering: auto; /* Smoother rendering for the glossy icons */
  animation: bootUp 1s cubic-bezier(0.1, 0.9, 0.2, 1);
}

@keyframes bootUp {
    0% { opacity: 0; transform: scale(0.95) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

a { text-decoration: none; color: var(--link); transition: all 0.2s; }
a:hover { color: var(--link-hover); }

/* =========================================
   2. GIANT NINTENDO DS CONSOLE WRAPPER
   ========================================= */
.ds-console {
    width: 95%;
    max-width: 750px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.ds-hardware-shell {
    background: var(--hardware-color);
    border: 2px solid #ccc;
    border-radius: 24px;
    padding: 15px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 
        inset -2px -2px 6px rgba(0,0,0,0.05), 
        inset 2px 2px 6px rgba(255,255,255,0.8),
        0 10px 20px rgba(0,0,0,0.1);
}

.ds-screen-bezel {
    background: #111;
    border-radius: 12px;
    padding: 12px;
    box-shadow: inset 2px 2px 8px rgba(0,0,0,0.9), 0 2px 0 rgba(255,255,255,0.4);
    height: 400px; 
    display: flex;
    flex-direction: column;
}

.ds-screen-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 4px;
    border: 2px inset #555;
    overflow: hidden; 
    background-color: #f8f8f8;
}

.ds-display {
    background-image: 
        linear-gradient(to right, #ececec 1px, transparent 1px), 
        linear-gradient(to bottom, #ececec 1px, transparent 1px);
    background-size: 20px 20px;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 15px;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

/* Authentic LCD Scanline Texture */
.ds-lcd-effect {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.03),
        rgba(0, 0, 0, 0.03) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none; 
    z-index: 50;
    mix-blend-mode: multiply;
}

/* =========================================
   3. THE HINGE & INTEGRATED MUSIC PLAYER
   ========================================= */
.ds-hinge {
    width: 92%;
    height: 40px;
    background: linear-gradient(to bottom, #d8d8d8, #bfbfbf, #d8d8d8);
    border-radius: 20px;
    border-top: 1px solid #fff;
    border-bottom: 1px solid #999;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    box-sizing: border-box;
    box-shadow: 0 4px 5px rgba(0,0,0,0.1);
}

.hinge-joint {
    width: 12px;
    height: 100%;
    background: #a0a0a0;
    border-left: 1px solid #888;
    border-right: 1px solid #ccc;
}

.hinge-music-player {
    background: #111;
    border: 2px inset #444;
    border-radius: 4px;
    width: 80%;
    height: 30px;
    display: flex;
    align-items: center;
    padding: 2px 4px;
    box-sizing: border-box;
    box-shadow: 0 0 8px rgba(97,216,54,0.2);
}

.hinge-btn {
    background: linear-gradient(to bottom, #555, #333);
    border: 1px solid #111;
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    height: 100%;
    padding: 0 8px;
    border-radius: 3px;
    margin-right: 4px;
    box-shadow: inset 1px 1px 0px rgba(255,255,255,0.1);
}
.hinge-btn:hover { background: linear-gradient(to bottom, #666, #444); color: #fff; }
.hinge-btn:active { background: #222; transform: translateY(1px); }

.hinge-btn.play-btn { color: #61d836; font-weight: bold; width: 40px; }
.hinge-btn.play-btn.active { background: #222; box-shadow: none; border-color: #61d836; }

.hinge-music-info {
    flex-grow: 1;
    overflow: hidden;
    margin-left: 4px;
    color: #61d836; 
    font-family: 'NDS BIOS', monospace;
    font-size: 18px;
    line-height: 24px;
    white-space: nowrap;
    text-shadow: 0 0 3px rgba(97, 216, 54, 0.8);
    display: flex;
    align-items: center;
}

/* =========================================
   4. TOP SCREEN UI (Header)
   ========================================= */
.dsi-top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: Arial, sans-serif;
    color: #444;
    font-size: 12px;
    font-weight: bold;
    background: linear-gradient(to bottom, #f0f0f0, #d8d8d8);
    border: 1px solid #aaa;
    border-radius: 2px;
    padding: 4px 8px;
    margin-bottom: 15px;
    box-shadow: 1px 1px 0px #fff inset;
}
.header-left { display: flex; align-items: center; gap: 4px; }
.header-center { color: #222; }
.header-right { color: #666; font-size: 14px; }

/* =========================================
   5. BOTTOM SCREEN UI (Authentic DSi Menu)
   ========================================= */
.dsi-menu-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between; 
}

.dsi-carousel {
    display: flex;
    gap: 12px;
    align-items: flex-end; 
    overflow-x: auto;
    overflow-y: hidden;
    height: 200px; 
    padding: 0 15px 15px 15px; 
    scrollbar-width: none; 
}
.dsi-carousel::-webkit-scrollbar { display: none; }

/* The App Frame */
.dsi-app {
    min-width: 76px;
    height: 76px;
    background: linear-gradient(180deg, #fefefe 0%, #e8e8e8 75%, #c8c8c8 75%, #a8a8a8 100%);
    border-radius: 12px;
    border: 1px solid #999;
    box-shadow: 0 4px 4px rgba(0,0,0,0.1), inset 0 2px 2px #fff;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 8px; 
    position: relative; 
    text-decoration: none;
    transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}

/* The White Screen Cutout Inside the frame */
.dsi-app-inner {
    width: 58px;
    height: 58px;
    background: #fff;
    border-radius: 6px;
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.2), 0 1px 0 rgba(255,255,255,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.15s;
    position: relative; 
    overflow: hidden;
}

/* The START text */
.dsi-app::after {
    content: "START";
    position: absolute;
    bottom: 3px;
    font-family: "NDS BIOS", sans-serif;
    font-size: 13px;
    color: white;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.1s;
    letter-spacing: 1px;
}

/* HOVER: PINK SELECTION FRAME */
.dsi-app:hover, .dsi-app:focus {
    transform: scale(1.15) translateY(-5px); 
    background: linear-gradient(180deg, #ff7ad8 0%, #f6529e 75%, #d4277b 75%, #b51564 100%);
    border-color: #b51564;
    box-shadow: 0 6px 12px rgba(246, 82, 158, 0.4), inset 0 2px 2px rgba(255,255,255,0.6);
    padding-top: 6px; 
    z-index: 10;
    outline: none;
}

.dsi-app:hover .dsi-app-inner {
    width: 66px;   
    height: 46px;  
    border-radius: 4px;
}
.dsi-app:hover::after { opacity: 1; }

/* =========================================
   6. PURE CSS 32-BIT GLOSSY ICONS
   ========================================= */

/* Icon Container: Centers and gracefully shrinks the icons on hover! */
.dsi-icon-container {
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.15s;
}
.dsi-app:hover .dsi-icon-container {
    transform: scale(0.85) translateY(-2px); 
}

/* --- 1. Home (Cute 3D House) --- */
.css-icon-home { position: relative; width: 32px; height: 32px; }
.css-icon-home .roof { position: absolute; top: 2px; left: 0; width: 0; height: 0; border-left: 16px solid transparent; border-right: 16px solid transparent; border-bottom: 14px solid #e63946; filter: drop-shadow(0 2px 1px rgba(0,0,0,0.2)); z-index: 2; }
.css-icon-home .wall { position: absolute; bottom: 2px; left: 4px; width: 24px; height: 16px; background: linear-gradient(to bottom, #f1faee, #ccc); border: 2px solid #555; border-top: none; z-index: 1; box-shadow: 2px 2px 3px rgba(0,0,0,0.1); }
.css-icon-home .door { position: absolute; bottom: 0; left: 8px; width: 8px; height: 10px; background: #c1121f; border-radius: 2px 2px 0 0; }

/* --- 2. Profile (Glossy Silhouette) --- */
.css-icon-profile { position: relative; width: 32px; height: 32px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.css-icon-profile .head { width: 14px; height: 14px; background: linear-gradient(135deg, #a8dadc, #457b9d); border: 2px solid #1d3557; border-radius: 50%; z-index: 2; margin-bottom: -2px; box-shadow: 0 2px 3px rgba(0,0,0,0.2); }
.css-icon-profile .body { width: 26px; height: 14px; background: linear-gradient(135deg, #a8dadc, #457b9d); border: 2px solid #1d3557; border-radius: 12px 12px 4px 4px; z-index: 1; box-shadow: 0 2px 3px rgba(0,0,0,0.2); }

/* --- 3. PictoChat (Authentic Smiling Face) --- */
.css-icon-picto { position: relative; width: 36px; height: 30px; background: linear-gradient(to bottom, #fff, #ddd); border: 2px solid #555; border-radius: 6px; box-shadow: 2px 2px 3px rgba(0,0,0,0.15), inset -2px -2px 4px rgba(0,0,0,0.1); display: flex; justify-content: center; align-items: center; }
.css-icon-picto::after { content: ''; position: absolute; top: -6px; left: 14px; width: 4px; height: 4px; background: #fff; border: 2px solid #555; border-bottom: none; border-radius: 2px 2px 0 0; }
.css-icon-picto .face { position: relative; width: 18px; height: 10px; border: 2px solid #111; border-top: none; border-radius: 0 0 10px 10px; margin-top: 4px; }
.css-icon-picto .eyes { position: absolute; top: -6px; left: 2px; width: 3px; height: 3px; background: #111; border-radius: 50%; box-shadow: 10px 0 0 #111; }

/* --- 4. Music (Shiny Radial Icon) --- */
.css-icon-music { position: relative; width: 36px; height: 36px; background: radial-gradient(circle at 30% 30%, #ffb703, #e63946); border: 2px solid #780000; border-radius: 8px; box-shadow: 2px 2px 3px rgba(0,0,0,0.2), inset 1px 1px 3px rgba(255,255,255,0.6); display: flex; justify-content: center; align-items: center; }
.css-icon-music .note { position: relative; width: 12px; height: 14px; border-right: 3px solid #fff; border-top: 3px solid #fff; top: -2px; left: -2px; filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.3)); }
.css-icon-music .note::before { content: ''; position: absolute; width: 8px; height: 6px; background: #fff; border-radius: 50%; bottom: -4px; left: -6px; }
.css-icon-music .note::after { content: ''; position: absolute; width: 8px; height: 6px; background: #fff; border-radius: 50%; bottom: -4px; right: -2px; }

/* --- 5. Camera (Glass Lens) --- */
.css-icon-camera { position: relative; width: 38px; height: 26px; background: linear-gradient(to bottom, #f8f9fa, #adb5bd); border: 2px solid #343a40; border-radius: 4px; box-shadow: 2px 2px 3px rgba(0,0,0,0.2), inset 1px 1px 2px #fff; }
.css-icon-camera .lens { position: absolute; top: 3px; left: 10px; width: 14px; height: 14px; background: radial-gradient(circle at 30% 30%, #a8dadc, #1d3557 60%, #000); border: 2px solid #212529; border-radius: 50%; box-shadow: 0 2px 3px rgba(0,0,0,0.3); }
.css-icon-camera .flash { position: absolute; top: 4px; right: 4px; width: 6px; height: 4px; background: #fff; border: 1px solid #6c757d; border-radius: 1px; }

/* --- 6. Anime (Retro CRT TV) --- */
.css-icon-tv { position: relative; width: 36px; height: 28px; background: linear-gradient(to bottom, #8338ec, #3a0ca3); border: 2px solid #240046; border-radius: 6px; box-shadow: 2px 2px 3px rgba(0,0,0,0.2), inset 1px 1px 2px rgba(255,255,255,0.3); margin-top: 4px; }
.css-icon-tv .screen { position: absolute; top: 4px; left: 4px; width: 20px; height: 16px; background: radial-gradient(circle at 50% 50%, #4cc9f0, #4361ee); border: 2px solid #111; border-radius: 4px; box-shadow: inset 1px 1px 3px rgba(0,0,0,0.5); }
.css-icon-tv .knob { position: absolute; top: 6px; right: 3px; width: 4px; height: 4px; background: #fff; border-radius: 50%; box-shadow: 0 8px 0 #fff; }
.css-icon-tv .antenna { position: absolute; top: -8px; left: 8px; width: 2px; height: 10px; background: #adb5bd; transform: rotate(-30deg); border: 1px solid #495057; }

/* --- 7. Manga (Open Book) --- */
.css-icon-manga { position: relative; width: 38px; height: 26px; background: #e76f51; border: 2px solid #9b2226; border-radius: 3px; display: flex; justify-content: center; align-items: center; box-shadow: 2px 2px 3px rgba(0,0,0,0.2); }
.css-icon-manga .pages { width: 30px; height: 20px; background: linear-gradient(to right, #fff, #f1faee 48%, #ccc 50%, #fff 52%, #f1faee); border: 1px solid #6c757d; border-radius: 2px; position: relative; }
.css-icon-manga .pages::after { content:''; position: absolute; left: 4px; top: 4px; width: 8px; height: 10px; border: 1px solid #adb5bd; box-shadow: 14px 0 0 -1px #adb5bd; }

/* --- 8. Books (3D Library Stack) --- */
.css-icon-stack { position: relative; width: 34px; height: 30px; }
.css-icon-stack .book { position: absolute; width: 30px; height: 8px; border: 2px solid #212529; border-radius: 2px; box-shadow: 1px 1px 2px rgba(0,0,0,0.2); }
.css-icon-stack .book::after { content: ''; position: absolute; right: 0; top: 0; width: 5px; height: 100%; background: #fff; border-left: 1px solid #212529; }
.css-icon-stack .b1 { bottom: 0; left: 2px; background: linear-gradient(to right, #4361ee, #4cc9f0); transform: rotate(2deg); z-index: 1; }
.css-icon-stack .b2 { bottom: 9px; left: -2px; background: linear-gradient(to right, #e63946, #ffb703); transform: rotate(-3deg); z-index: 2; }
.css-icon-stack .b3 { bottom: 18px; left: 4px; background: linear-gradient(to right, #2a9d8f, #e9c46a); transform: rotate(1deg); z-index: 3; }

/* --- 9. YouTube (Red Tube) --- */
.css-icon-yt { position: relative; width: 38px; height: 28px; background: linear-gradient(to bottom, #e63946, #d90429); border: 2px solid #800f2f; border-radius: 8px; display: flex; justify-content: center; align-items: center; box-shadow: 2px 2px 3px rgba(0,0,0,0.2), inset 1px 1px 3px rgba(255,255,255,0.4); }
.css-icon-yt .play { width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 10px solid #fff; margin-left: 4px; filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.3)); }


/* =========================================
   7. DSi APP TOOLTIP BUBBLES
   ========================================= */
.dsi-app-tooltip {
    position: absolute;
    top: 0px; 
    left: 50%;
    transform: translateX(-50%) scale(0.5); 
    transform-origin: bottom center;
    background: #fff;
    border: 2px solid var(--dsi-select-color); 
    border-radius: 8px;
    padding: 6px 12px;
    font-family: "NDS BIOS", sans-serif;
    font-size: 18px;
    color: #444;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); 
    box-shadow: 2px 4px 6px rgba(0,0,0,0.15);
    z-index: 20;
}

.dsi-app-tooltip::after {
    content: ''; position: absolute; bottom: -8px; left: 50%;
    transform: translateX(-50%); border-width: 8px 6px 0 6px;
    border-style: solid; border-color: var(--dsi-select-color) transparent transparent transparent;
}
.dsi-app-tooltip::before {
    content: ''; position: absolute; bottom: -5px; left: 50%;
    transform: translateX(-50%); border-width: 6px 5px 0 5px;
    border-style: solid; border-color: #fff transparent transparent transparent; z-index: 1;
}

.dsi-app:hover .dsi-app-tooltip {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    top: -55px; 
    color: var(--dsi-select-color);
}

.dsi-scrollbar-track {
    background: #e0e0e0;
    height: 12px;
    border-radius: 6px;
    border: 1px inset #ccc;
    margin: 0 20px 10px 20px; 
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 4px;
}
.dsi-scrollbar-thumb {
    width: 40px;
    height: 8px;
    background: #888;
    border-radius: 4px;
    border: 1px solid #666;
}

/* =========================================
   8. PICTOCHAT LOGS (Top Screen Messages)
   ========================================= */
.box {
  box-sizing: border-box; font-family: "NDS BIOS", Arial, sans-serif; 
  font-size: 20px; 
  position: relative; margin: calc(var(--pixel) * 5) 0; background-color: var(--box-background); color: var(--box-text);
  clip-path: polygon(var(--s) 0%, calc(100% - var(--s)) 0%, 100% var(--s), 100% calc(100% - var(--s)), calc(100% - var(--s)) 100%, var(--s) 100%, 0% calc(100% - var(--s)), 0% var(--s));
  transition: transform 0.2s;
}

.box:hover { transform: translateX(2px); }

.box:before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: -1;
  background: linear-gradient(45deg, var(--box-border), var(--box-border));
  --g1: #000 var(--pixel), #0000 0 calc(100% - var(--pixel)), #000 0;
  --g2: #0000 calc(0.707*var(--s)), #000 0 calc(0.707*var(--s) + var(--pixel)), #0000 0 calc(100% - 0.707*var(--s) - var(--pixel)), #000 0 calc(100% - 0.707*var(--s)), #0000 0;
  -webkit-mask: linear-gradient(45deg ,var(--g2)), linear-gradient(-45deg,var(--g2)), linear-gradient(90deg ,var(--g1)) 50%/100% calc(100% - 2*var(--s)) no-repeat, linear-gradient(180deg,var(--g1)) 50%/calc(100% - 2*var(--s)) 100% no-repeat;
  mask: linear-gradient(45deg ,var(--g2)), linear-gradient(-45deg,var(--g2)), linear-gradient(90deg ,var(--g1)) 50%/100% calc(100% - 2*var(--s)) no-repeat, linear-gradient(180deg,var(--g1)) 50%/calc(100% - 2*var(--s)) 100% no-repeat;
}

.date {
  float: left; position: relative; z-index: -2; padding: calc(var(--pixel) * 0) calc(var(--pixel) * 4);
  color: var(--date-text); background: var(--date-background);
  clip-path: polygon(var(--s) 0, 100% 0, 100% calc(100% - var(--s)), calc(100% - var(--s)) 100%, 0 100%, 0 var(--s));
  margin-right: calc(var(--pixel) * 3); line-height: calc(var(--pixel) * 19); margin-top: calc(var(--pixel) * -1); box-sizing: border-box;
}

.date:before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(45deg, var(--box-border), var(--box-border));
  --g3: #0000 0 calc(100% - var(--pixel)), #000 0;
  --g4: #0000 calc(0.707*var(--s)), #000 0 calc(0.707*var(--s) + var(--pixel)), #0000 0 calc(100% - 0.707*var(--s) - var(--pixel)), #0000 0;
  -webkit-mask: linear-gradient(-45deg,var(--g4)), linear-gradient(90deg ,var(--g3)) 100% calc(100% - var(--s)) no-repeat, linear-gradient(180deg,var(--g3)) calc(100% - var(--s)) 100% no-repeat;
  mask: linear-gradient(-45deg,var(--g4)), linear-gradient(90deg ,var(--g3)) 100% calc(100% - var(--s)) no-repeat, linear-gradient(180deg,var(--g3)) calc(100% - var(--s)) 100% no-repeat;
}

.message { padding: calc(var(--pixel) * 0) calc(var(--pixel) * 4) calc(var(--pixel) * 4) calc(var(--pixel) * 4); line-height: calc(var(--pixel) * 18); clear: both; }

.blue {
  --date-text: #fff; --date-background: #4eb5e6;
  --box-border: #4eb5e6;
}

.typing-cursor { display: inline-block; width: 8px; height: 14px; background-color: var(--box-border); animation: blink 0.8s infinite; margin-left: 2px; vertical-align: middle; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* =========================================
   9. MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 700px) {
    :root { --p: 1.5; }
    .ds-hardware-shell { padding: 8px; border-radius: 16px; }
    .ds-screen-bezel { height: 320px; padding: 10px; border-radius: 10px; }
    
    .dsi-carousel { height: 170px; gap: 10px; padding: 0 10px 10px 10px; }
    
    .dsi-app { min-width: 66px; height: 66px; padding-top: 6px; border-radius: 10px; }
    .dsi-app-inner { width: 48px; height: 48px; }
    
    .dsi-app:hover .dsi-app-inner { width: 56px; height: 38px; }
    .dsi-app::after { font-size: 11px; bottom: 2px; }
    
    .dsi-app-tooltip { font-size: 14px; padding: 4px 8px; top: -45px; }
    
    .box { font-size: 16px; margin: calc(var(--pixel) * 8) 0; }
    
    .ds-hinge { height: 35px; padding: 0 15px; border-radius: 15px; }
    .hinge-music-player { width: 90%; }
    .hinge-music-info { font-size: 14px; }
}

/* =========================================
   10. DSI GALLERY APP (LOCKED SCROLL & ANIMATED)
   ========================================= */

/* Forces the gallery screens to never scroll vertically */
.gallery-locked-screen {
    overflow: hidden !important; 
    display: flex; 
    flex-direction: column; 
    padding: 8px !important;
}

.gallery-container { display: flex; flex-direction: column; justify-content: space-between; height: 100%; }
.gallery-top-bar, .gallery-bottom-bar { display: flex; justify-content: space-between; gap: 8px; padding: 4px; flex-shrink: 0; }

/* Glossy UI Buttons */
.gallery-btn {
    flex-grow: 1; background: linear-gradient(to bottom, #f8f8f8, #e0e0e0); border: 2px solid #aaa; border-radius: 6px;
    padding: 6px 0; font-family: "NDS BIOS", Arial, sans-serif; font-size: 16px; font-weight: bold; color: #444;
    cursor: pointer; box-shadow: inset 1px 1px 0px #fff, 1px 1px 2px rgba(0,0,0,0.1); 
    transition: all 0.1s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gallery-btn:hover { background: linear-gradient(to bottom, #fff, #eaeaea); border-color: #4eb5e6; color: #4eb5e6; }
.gallery-btn:active { transform: translateY(3px) scale(0.98); box-shadow: inset 1px 1px 2px rgba(0,0,0,0.1); background: #d0d0d0; transition: all 0.05s ease-out; }

/* Mini Home Button */
.gallery-home-btn { 
    display: flex; justify-content: center; align-items: center; width: 40px; background: linear-gradient(to bottom, #f8f8f8, #e0e0e0);
    border: 2px solid #aaa; border-radius: 6px; cursor: pointer; text-decoration: none; box-shadow: inset 1px 1px 0px #fff, 1px 1px 2px rgba(0,0,0,0.1);
    transition: all 0.1s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gallery-home-btn:hover { background: #fff; border-color: #4eb5e6; }
.gallery-home-btn:active { transform: translateY(3px) scale(0.95); }
.gallery-home-btn .icon-wrapper { transform: scale(0.6); filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1)); }

/* DSi Pastel Pattern Area */
.gallery-middle-area {
    flex-grow: 1; margin: 8px 0; background-color: #e8ded5; border: 2px inset #999; border-radius: 4px; display: flex; align-items: center; position: relative;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill-rule='evenodd' opacity='0.6'%3E%3Cpolygon points='15,0 30,15 15,30 0,15' fill='%23a1ccdd'/%3E%3Cpolygon points='45,30 60,45 45,60 30,45' fill='%23f1b4c5'/%3E%3Cpolygon points='45,0 60,15 45,30 30,15' fill='%23c1d9ad'/%3E%3Cpolygon points='15,30 30,45 15,60 0,45' fill='%23eade93'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 45px 45px; overflow: hidden;
}

/* Pulsing Arrows */
@keyframes arrowPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); color: #4eb5e6; } }
.gallery-arrow {
    background: rgba(255,255,255,0.8); border: 2px solid #aaa; border-radius: 4px; width: 24px; height: 40px; display: flex; justify-content: center; align-items: center;
    cursor: pointer; font-size: 14px; color: #666; z-index: 5; margin: 0 4px; box-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    animation: arrowPulse 2s infinite; transition: all 0.1s;
}
.gallery-arrow:hover { background: #fff; color: #4eb5e6; border-color: #4eb5e6; animation: none; transform: scale(1.1); }
.gallery-arrow:active { transform: scale(0.9); background: #ccc; }

.gallery-thumbs {
    display: flex; gap: 12px; overflow-x: auto; scroll-behavior: smooth; width: 100%; padding: 10px 0; scrollbar-width: none; 
}
.gallery-thumbs::-webkit-scrollbar { display: none; }

/* Bouncy Thumbnails */
@keyframes thumbEnter { 0% { opacity: 0; transform: scale(0) translateY(20px); } 100% { opacity: 0.7; transform: scale(1) translateY(0); } }
@keyframes dsiPop { 0% { transform: scale(1); } 30% { transform: scale(0.85); filter: brightness(0.8); } 70% { transform: scale(1.25); } 100% { transform: scale(1.15); } }

.dsi-thumb {
    width: 60px; height: 60px; border: 3px solid #fff; box-shadow: 2px 2px 4px rgba(0,0,0,0.3); cursor: pointer; flex-shrink: 0; object-fit: cover; 
    opacity: 0; animation: thumbEnter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; /* Fades in on load */
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.dsi-thumb:hover { opacity: 1; transform: translateY(-4px); z-index: 5; }
.dsi-thumb.active { opacity: 1; border-color: #d84b22; z-index: 10; animation: dsiPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; box-shadow: 0 0 0 2px #fff, 3px 3px 6px rgba(0,0,0,0.5); }

/* Top Screen Desk Wrapper (Rhombus Background) */
.gallery-photo-display {
    background-color: #e8ded5; 
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill-rule='evenodd' opacity='0.6'%3E%3Cpolygon points='15,0 30,15 15,30 0,15' fill='%23a1ccdd'/%3E%3Cpolygon points='45,30 60,45 45,60 30,45' fill='%23f1b4c5'/%3E%3Cpolygon points='45,0 60,15 45,30 30,15' fill='%23c1d9ad'/%3E%3Cpolygon points='15,30 30,45 15,60 0,45' fill='%23eade93'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 45px 45px; border: 2px inset #999; border-radius: 4px; position: relative; width: 100%; flex-grow: 1;
    box-sizing: border-box; display: flex; justify-content: center; align-items: center; box-shadow: inset 2px 2px 5px rgba(0,0,0,0.15); overflow: hidden;
}

/* Empty State Blinking Text */
.empty-state-text {
    position: absolute; font-family: "NDS BIOS", sans-serif; color: #888; text-shadow: 1px 1px 0 #fff; font-size: 18px;
    animation: blink 1.5s infinite; transition: opacity 0.3s; pointer-events: none;
}

/* Tossed Polaroid Animation */
.gallery-photo-display img { 
    max-width: 85%; max-height: 80%; object-fit: contain; background: #fff; padding: 6px 6px 24px 6px; 
    border: 1px solid #ccc; box-shadow: 2px 4px 10px rgba(0,0,0,0.3); z-index: 2;
    /* Starts hidden and small */
    opacity: 0; transform: scale(0.5) rotate(-10deg); transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gallery-photo-display img.show { opacity: 1; transform: scale(1) rotate(2deg); /* Slightly skewed polaroid look */ }
.gallery-photo-display img.switching { opacity: 0; transform: scale(1.2) rotate(15deg) translateY(30px); /* Drops out playfully */ }

/* Orange Date Stamp Animation */
@keyframes badgePopIn { 0% { opacity: 0; transform: scale(0) translateY(20px); } 60% { transform: scale(1.2) translateY(-2px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }
.dsi-date-badge {
    position: absolute; bottom: 10px; right: 10px; background: #d84b22; color: #fff; font-size: 14px; font-family: "NDS BIOS", sans-serif;
    padding: 2px 6px; font-weight: bold; border-radius: 2px; box-shadow: 1px 1px 0px rgba(0,0,0,0.3); z-index: 5;
    opacity: 0; /* Hidden by default */
}
.dsi-date-badge.pop { animation: badgePopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }


/* Top Screen Info Display (Cleaned up) */
.sound-info-display {
    display: flex; 
    flex-direction: column;
    padding: 15px; 
    gap: 12px; 
    flex-grow: 1; 
    align-items: center;
    text-align: center;
    transition: opacity 0.25s ease-in-out, transform 0.25s ease-in-out;
    z-index: 5;
    position: relative;
}

.sound-info-display.switching {
    opacity: 0;
    transform: scale(0.95);
}

.sound-album-art {
    width: 100px; 
    height: 100px; 
    border: 2px solid #333; 
    border-radius: 4px; 
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.4), 2px 4px 8px rgba(0,0,0,0.3);
    background: #111;
    object-fit: cover;
}

.sound-text-box {
    font-family: Arial, sans-serif;
    color: #333;
    line-height: 1.4;
}
.sound-text-box h3 { margin: 0 0 4px 0; font-size: 16px; color: #a210a6; }
.sound-text-box p { margin: 0; font-size: 13px; font-weight: bold; }
.sound-text-box .genre { color: #666; font-size: 12px; margin-bottom: 6px; font-weight: normal; }

/* Ensure elements sit ON TOP of the vinyl record */
.sound-middle-area, .sound-controls, .dsi-scrollbar-track {
    z-index: 5;
    position: relative;
}

.sound-middle-area {
    flex-grow: 1; 
    display: flex; 
    align-items: center; 
}

/* =========================================
   12. DSI SOUND APP UI (STABILIZED)
   ========================================= */

.sound-app-screen {
    background-color: #fcfcfc;
    background-image: repeating-linear-gradient(transparent, transparent 19px, #e0e0e0 19px, #e0e0e0 20px);
    flex-grow: 1; display: flex; flex-direction: column; position: relative; overflow: hidden; width: 100%;
}

.sound-header {
    background: linear-gradient(to bottom, #df4be3, #a210a6);
    color: #fff; font-family: "NDS BIOS", sans-serif; font-size: 16px;
    padding: 6px 15px; border-bottom: 2px solid #444;
    display: flex; align-items: center; gap: 8px; z-index: 100;
}

/* TOP SCREEN: Information Zone */
.album-info-zone {
    flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; gap: 12px; padding: 15px; transition: all 0.3s ease; z-index: 5;
}

.glossy-art {
    width: 110px; height: 110px; border: 3px solid #333; border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3), inset 0 2px 4px #fff; background: #111;
}

.album-labels-box {
    background: rgba(255,255,255,0.9); border: 1px solid #ccc; border-radius: 8px;
    padding: 8px 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.album-labels-box h3 { margin: 0; font-family: "NDS BIOS", sans-serif; color: #a210a6; font-size: 18px; }
.album-labels-box p { margin: 2px 0 0 0; color: #444; font-size: 13px; font-weight: bold; }

/* BOTTOM SCREEN: Interactive Zone */
.interactive-zone {
    flex-grow: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden;
}

/* THE SPINNING VINYL (Centered) */
@keyframes vinylSpin { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } }
.dsi-vinyl-bg {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 250px; height: 250px; border-radius: 50%;
    background: radial-gradient(circle at center, #df4be3 15%, #222 16%, #111 100%);
    opacity: 0.3; z-index: 1; animation: vinylSpin 8s linear infinite;
}

/* THE CAROUSEL WRAPPER */
.music-carousel-wrapper {
    width: 100%; display: flex; justify-content: center; align-items: center; gap: 15px; z-index: 50; padding-bottom: 10px;
}

/* FOOTER BUTTONS */
.sound-footer {
    background: linear-gradient(to bottom, #f8f8f8, #d0d0d0);
    border-top: 2px inset #fff; padding: 8px 15px;
    display: flex; justify-content: space-between; align-items: center; z-index: 200;
}

.ds-glossy-btn {
    background: linear-gradient(to bottom, #fff, #e0e0e0);
    border: 2px solid #888; border-radius: 6px; padding: 6px 15px;
    font-family: "NDS BIOS", sans-serif; font-size: 15px; color: #444;
    cursor: pointer; box-shadow: inset 1px 1px 0 #fff, 1px 2px 3px rgba(0,0,0,0.1);
    transition: transform 0.1s; text-decoration: none; text-align: center;
}
.ds-glossy-btn:active { transform: translateY(2px); background: #ccc; }
.ds-glossy-btn.purple { color: #fff; background: linear-gradient(to bottom, #df4be3, #a210a6); border-color: #6a086d; }

/* 32-BIT APP CARDS */
.dsi-app-music {
    min-width: 80px; height: 80px;
    background: linear-gradient(180deg, #fefefe 0%, #e8e8e8 75%, #c8c8c8 75%, #a8a8a8 100%);
    border-radius: 12px; border: 1px solid #999; box-shadow: 0 4px 4px rgba(0,0,0,0.1);
    display: flex; justify-content: center; align-items: flex-start; padding-top: 8px; cursor: pointer; transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.dsi-app-music .inner { width: 62px; height: 62px; background: #fff; border-radius: 4px; overflow: hidden; box-shadow: inset 2px 2px 5px rgba(0,0,0,0.1); }
.dsi-app-music.active {
    transform: scale(1.15) translateY(-5px); 
    background: linear-gradient(180deg, #ff7ad8 0%, #f6529e 75%, #d4277b 75%, #b51564 100%);
    border-color: #b51564; box-shadow: 0 6px 12px rgba(246, 82, 158, 0.4);
}