body {
    font-family: 'Source Code Pro', monospace;
    background-color: #121212;
    /* color: #e0e0e0; */
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    text-align: center;
    border-bottom: 1px solid #333;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

header h1 {
    color: #bb86fc;
    margin: 0;
}

header p {
    color: #888;
}

.sins-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sin-card {
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    transition: transform 0.2s ease-in-out;
    overflow-wrap: break-word;

    display: flex; 
    align-items: center; 
    gap: 20px; 
}

.sin-card:hover {
    transform: translateY(-5px);
}

.description {
    font-size: 1.1em;
    margin: 0 0 15px 0;
    color: #e0e0e0;
    white-space: pre-wrap;
}

.meta {
    font-size: 0.9em;
    color: #888;
    text-align: right;
}


.confess-form {
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

textarea {
    width: 100%;
    box-sizing: border-box;
    background-color: #121212;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 10px;
    font-family: 'Source Code Pro', monospace;
    min-height: 80px;
    margin-bottom: 10px;
}

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

input[type="text"] {
    background-color: #121212;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 8px;
    width: 60%;
}

button {
    background-color: #bb86fc;
    color: #121212;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.api-key-section {
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.new-key-display {
    margin-top: 15px;
    color: #e0e0e0;
}

.new-key-display code {
    background-color: #121212;
    padding: 5px 10px;
    border-radius: 4px;
    color: #bb86fc;
    font-weight: bold;
}
.tags-container {
    display: inline-flex;
    gap: 5px;
    margin-right: 15px;
}
.tag {
    background-color: #444;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
}


.leaderboard {
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    margin-top: 0;          /* keep from second rule */
    flex: 0 0 180px;        /* fixed width */
    max-width: 180px;  /* enforce cap */
}

.leaderboard h2 {
    text-align: center;
    color: #bb86fc;
    margin-top: 0;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #2a2a2a;
    overflow-wrap: break-word;
}
.leaderboard-emoji {
    font-size: 1.5em;
}


.leaderboard-text {
    flex-grow: 1; /* This will take up the remaining space */
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.leaderboard-count {
    font-weight: bold;
    color: #bb86fc;
}


#forgiven-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    
    /* Start hidden and non-interactive */
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
}

#forgiven-overlay.visible {
    pointer-events: auto;
    /* Apply a 3-second animation */
    animation: fade-in-out 5s ease-in-out forwards;
}

#forgiven-overlay .content img {
    max-width: 150px;
}

#forgiven-overlay .content p {
    font-size: 1.5em;
    color: #fff;
    font-weight: bold;
}

/* Define the animation keyframes */
@keyframes fade-in-out {
    0% { opacity: 0; }   /* Start invisible */
    10% { opacity: 1; }  /* Fade in fast */
    80% { opacity: 1; }  /* Hold visible */
    100% { opacity: 0; } /* Fade out slow */
}

.main-content {
    display: flex;
    gap: 20px; /* Space between the columns */
     overflow: hidden;
    max-width: 800px;
}



.sins-list {
    flex: 1;
}

.shakeable {
    transition: transform 0.1s;
}

/* Define the shake animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* The class that applies the animation */
.shaking {
    /* Starts fast, then slows down, runs for 1 second */
    animation: shake 1s ease-out;
}

#char-counter {
    text-align: right;
    font-size: 0.8em;
    color: #888;
    margin-top: -5px;
    margin-bottom: 10px;
}

.search-form {
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row input, .form-row select {
    flex-grow: 1;
    background-color: #121212;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 8px;
    font-family: 'Source Code Pro', monospace;
}

.pagination {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}

.nav-button {
    display: inline-block;
    margin-top: 15px;
    padding: 8px 16px;
    background-color: #333;
    color: #bb86fc;
    border: 1px solid #bb86fc;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.2s, color 0.2s;
}

.nav-button:hover {
    background-color: #bb86fc;
    color: #121212;
}

/* Add these new styles to your style.css */
.emoji-picker {
    display: flex;
    gap: 10px;
    margin-top: 10px;

     max-width: 100%;       /* Ensure it doesn't overflow its parent */
    overflow-x: auto;    /* Allow horizontal scrolling */
    white-space: nowrap;   /* Prevent emojis from wrapping to a new line */
    padding-bottom: 10px;  /* Add space for the scrollbar */
}

.emoji {
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}
.emoji:hover {
    background-color: #333;
}
.emoji.selected {
    background-color: #bb86fc;
}

.sin-emoji {
    font-size: 2.5em;
}

/* Create a new container for the main content to make it take up the rest of the space */
.sin-content {
    flex-grow: 1;
}

   .slot.selected {
        border: 3px solid #03dac6;
        box-shadow: 0 0 10px #03dac6;
    }
#gacha-game-container {
    background-color: #2a2a2a;
    padding: 2%;
    border-radius: 12px;
     /* Increased width for new elements */
    /* margin: 20px auto; */
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    box-sizing: border-box;
    text-align: center;
    aspect-ratio: 2/1;
    width: 60%;
    position: absolute;
}


.gacha-main-area {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    position: relative;
    margin-left: 12%;
}

.gacha-center-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 100%;
    height: 100%;
}


/* The visible "window". It's 4 items wide. */
#gacha-viewport {
    width: 100%; /* 80px per item * 4 items */
    height: 100%;
    background-color: #1e1e1e;
    border: 2px solid #444;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}
/* A marker in the middle of the viewport to show the winning spot */
#gacha-viewport::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 70px;  /* Match the slot size */
    height: 70px; /* Match the slot size */
    background-color: transparent; /* No fill */
    border: 4px dashed rgba(255, 255, 255, 0.4); /* Dashed outline */
    border-radius: 0%; /* Make it a circle to match the slots */
    box-sizing: border-box;
    z-index: 1;
}

/* The long strip of emojis that moves */
#gacha-reel {
    display: flex;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 5; /* Set a lower layer order */
}

.gacha-reel-area {
    position: relative;
    width: 99%;
    height: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}


/* A single emoji item in the reel */
.reel-item {
    flex-shrink: 0;
    height: 100%;
    width: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: xx-large;
    box-sizing: border-box;
    transition: opacity 0.3s ease; /* For fading out the prize */
    aspect-ratio: 1/1;
}

/* Position the roll button on top of the viewport */
#gacha-roll-button-visual {
    position: absolute;
    top: -10%; /* Position it overlapping the right side */
    transform: translateY(-50%);
    z-index: -10;
    width: 90px;
    height: 90px;
    font-size: 40px;
    border-radius: 8px; /* Square with rounded corners */
    padding: 0;
    border: 3px solid #444;
    right: 41%;
}
#gacha-roll-button {
    position: absolute;
    top: -15%; /* Position it overlapping the right side */
    transform: translateY(-50%);
    z-index: 15;
    width: 90px;
    height: 90px;
    font-size: 40px;
    border-radius: 8px; /* Square with rounded corners */
    padding: 0;
    border: 3px solid #444;
    right: 0%;
    opacity: 0;
}
.gacha-slot-overlay {
    position: relative; /* Change from absolute */
    left: 0;
    top: 0;
    transform: none; /* Remove the transform from the button itself */
    z-index: 10; /* Set a HIGHER layer order to be on top and clickable */

    
    /* Ensure the emoji text is visible and looks good */
    color: white;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.7);

    /* Make sure it doesn't interfere with mouse events on the reel below */
    pointer-events: auto;

    background-color: transparent !important;
    border: none !important;
}

.gacha-slot-overlay.selected {
    /* A more visible selection style for an invisible button */
    border: 3px dashed #03dac6 !important;
    background-color: rgba(3, 218, 198, 0.1) !important; /* Slight glow */
    box-shadow: 0 0 10px #03dac6;
    aspect-ratio: 1/1;
    height: 70px;
    width: 70px;
}


/* Styling for the inventory and gacha slots */
.inventory-area, .gacha-slot-area {
    margin-top: 1%;
    height: 50%;
}
.slots-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 5px;
    height: 100%;
}
.slot {
    max-width: 100%;
    max-height: 100%;
    font-size: xx-large;
    background-color: #333;
    border: 2px solid #555;
    color: white;
    border-radius: 50%; /* Make all slots circles */
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    /* aspect-ratio: 1/1; */
    height: 90%;
    width: 100%;
    aspect-ratio: 1 / 1;
    -rarity-color: #55555500;
    box-shadow: inset 0 0 10px 2px var(--rarity-color);
    /* We add a transition to make color changes smooth */
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.slot-wrapper {
    position: relative; /* For positioning the luck display */
    aspect-ratio: 1/1;
    /* height: 80%; */
    /* width: 80%; */
}

#item-display-circle {
    width: 100%;
    height: 100%;
    flex-direction: column; /* Stack emoji and text vertically */
    border: 4px solid #444;
    background-color: #1e1e1e;
    position: relative; /* This is the key fix for the info panel */
    overflow: hidden;
    aspect-ratio: 1/1;
}
#item-display-emoji {
    font-size: 70px;
    height: 80px;
}
#item-display-luck {
    font-size: 18px;
    color: #aaa;
}

.luck-display {
    position: absolute;
    top: -5px;
    left: -5px;
    background-color: #bb86fc;
    color: #121212;
    border-radius: 50px; /* Make it a pill shape */
    min-width: 24px; /* Ensure it's a circle for single digits */
    height: 24px;
    padding: 0 5px; /* Add horizontal padding */
    font-size: 16px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
    box-sizing: border-box;
}
/* 5. Left Vertical Bar Styling */
.gacha-left-bar {
    width: 70%;
    height: 100%; /* Adjust height to match reel + slots */
    background-color: #1e1e1e;
    border: 2px solid #444;
    border-radius: 8px;
    position: absolute;
    overflow: hidden;
    left: -200%;
    top: 10;
}



#severity-selector-bar {
    width: 50px;
    height: 100%;
    background-color: #1e1e1e;
    display: flex;
    flex-direction: column; /* Stack sections vertically */
    position: relative; /* For positioning the handle */
    z-index: 10;
}
.severity-section {
    flex-grow: 1; /* Each section takes up equal space */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid #444;
    height: 20%;
}
.severity-section:last-child {
    border-bottom: none;
}
/* Color gradient for severity */
.severity-section[data-severity="1"] { background-color: #4caf50; } /* Green */
.severity-section[data-severity="2"] { background-color: #ffeb3b; } /* Yellow */
.severity-section[data-severity="3"] { background-color: #ff9800; } /* Orange */
.severity-section[data-severity="4"] { background-color: #f44336; } /* Red */
.severity-section[data-severity="5"] { background-color: #9c27b0; } /* Purple */


/* 5. Draggable Severity Handle */
#severity-handle-wrapper {
    position: absolute;
    left: 0;
    width: 100%;
    height: 36px; /* Height of one section */
    cursor: ns-resize; /* North-South resize cursor indicates vertical dragging */
    /* top property will be set by JavaScript */
    transition: top 0.1s ease-out; /* For smooth snapping */
}
#severity-handle-wrapper::before { /* The hollow rectangle */
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    border: 4px solid white;
    border-radius: 6px;
    box-shadow: 0 0 8px white;
}


.severity-control-wrapper {
    position: absolute;
    display: flex;
     /* This is crucial for positioning the handle */
    height: 100%;
    left: 0;
    top: 0;
}

#gacha-bar-fill {
    position: absolute;
    top: 1%; /* Anchor the fill to t.he TOP of the bar */
    width: 300px;
    /* height and background-color will be set by JavaScript */
    transition: height 0.1s ease-out, background-color 0.1s ease-out;
    z-index: 15;
    border-radius: 12px;
}

/* Draggable Severity Handle - UPDATED for new shape and size */
#severity-handle-wrapper {
    position: absolute;
    left: 0;
    /* This is the invisible draggable area. It should match the bar's width. */
    width: 60px;
    height: 36px;
    cursor: ns-resize;
    z-index: 0;
    transition: top 0.1s ease-out;
    --handle-color: white;
}

#severity-handle-wrapper::before { /* This is the VISUAL part */
    content: '';
    position: absolute;
    /* Make the visual part wider and center it */
    transform: translateX(-50%);
    width: 70%; /* Wider visual handle */
    height: 36px;
    border: 4px solid var(--handle-color);
    border-radius: 6px;
    box-shadow: 0 0 8px var(--handle-color);
    transition: border-color 0.1s ease-out;
    left: 40%;
}

#severity-handle-grip {
    position: absolute;
    right: 95%; /* Position it relative to the wrapper */
    top: 60%;
    transform: translateY(-50%);
    width: 100px; /* Your desired wider grip */
    height: 80%;
    background-color: var(--handle-color);
    border-radius: 4px;
    transition: background-color 0.1s ease-out;
}

#item-display-info {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
    border-radius: 6px;
    padding: 5px;
    font-size: 14px;
    color: #e0e0e0;
    text-align: left;
    white-space: pre-wrap; /* Allows line breaks with \n */
}

#gacha-viewport > .slot-wrapper {
    position: absolute;
    left: 50%;
    top: 50%;
    /* Move the centering transform here, to the wrapper */
    transform: translate(-50%, -50%); 
    z-index: 10;
}




#item-display-circle-container{
     background-color: #2a2a2a;
     padding: 20px;
     border-radius: 12px;
     /* Increased width for new elements */
     box-shadow: 0 8px 16px rgba(0,0,0,0.3);
     box-sizing: border-box;
     text-align: center;
     position: absolute;
     right: 22%;
     z-index: -1;
     height: 190px;
     aspect-ratio: 1/1;
     top: 1%;
}

#luck-sum-container{
     background-color: #2a2a2a;
     padding: 20px;
     border-radius: 12px;
     /* Increased width for new elements */
     box-shadow: 0 8px 16px rgba(0,0,0,0.3);
     box-sizing: border-box;
     text-align: center;
     position: absolute;
     right: 0;
     z-index: -1;
     bottom: -30%;
}



#outer-gacha-game-container {
    position: relative;
    width: 0;
    height: 0;
    top: 0;
    left: 0;
     overflow: hidden;
     transition: all 0.5s ease-in-out;
}


#outer-gacha-game-container.open {
    position: relative;
    width: 700px;
    height: 400px;
    top: 50px;
    left: 350px;
       overflow: visible;
}

.relative-wrapper
{
    position:relative;
}

.slot:hover {
    /* Inner glow effect using an inset box-shadow */
    box-shadow: inset 0 0 15px 5px rgba(255, 255, 255, 0.1);
}

/* 3. Rarity color glow for selected slots */
#gacha-game-container .slot.selected { /* <-- More specific selector */
    --rarity-color: #03dac6; 
    
    border: 3px solid var(--rarity-color);
    box-shadow: 0 0 15px var(--rarity-color);
}

#collection-container {
    border-radius: 8px;
    padding: 3%;
    width: 100%;
    height: 100%; /* You can adjust this height */
    overflow-y: auto; /* Adds a scrollbar if items overflow */
    box-sizing: border-box;
    color: #ccc;
    padding-top: 0%;
    overflow: visible;
}

#collection-container h3 {
    margin-top: 0;
    text-align: center;
    font-size: 16px;
}

#collection-grid {
    display: grid;
    /* Creates a responsive grid with 2 columns */
    grid-template-columns: repeat(5, 1fr);
    height: 100%;
    width: 100%;
}

.collection-item {
    border-radius: 50%;
    text-align: center;
    position: relative;
    white-space: nowrap;
    overflow: visible;
}

.collection-item-emoji {
    font-size: 20px;
    /* This CSS filter creates the black silhouette effect */
    filter: grayscale(100%) brightness(0%);
    opacity: 096;
    transition: filter 0.3s, opacity 0.3s;
    overflow: visible;
    white-space: nowrap;
}

/* This class is added by JS to show the full-color emoji */
.collection-item.discovered .collection-item-emoji {
    filter: none; /* Removes the silhouette effect */
    opacity: 1;
}

.collection-item-chance {
    font-size: 12px;
    color: #000000;
    display: block;
}

.collection-item-counter {
    position: absolute;
    bottom: 2px;
    right: 4px;
    background-color: rgba(0, 0, 0, 0.6);
    color: #e0e0e0;
    font-size: 11px;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 4px;
}

.gacha-bar-fill-wrapper{
    height: 100%;
    position: relative;
    right: 800%;
}

.prize-info {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 150px; /* Give it some width */
    font-weight: bold;
    color: #e0e0e0;
    text-shadow: 0 1px 3px #000;
    pointer-events: none; /* Make sure it doesn't block clicks */
    opacity: 0; /* Hidden by default */
    transition: opacity 0.3s ease-in-out;
}

.prize-info.visible {
    opacity: 1; /* Make it visible when it has content */
}

.prize-info.top {
    bottom: 105%; /* Position it above the wrapper */
    font-size: 16px;
}

.prize-info.bottom {
    top: 90%; /* Position it below the wrapper */
    font-size: 14px;
    color: #aaa;
    z-index: 10;
}

.prize-info.top-rarity {
    bottom: 125%; /* Position it highest */
    font-size: 14px;
    font-style: italic;
    /* The color will be set by JavaScript */
}

.prize-info.top-name {
    bottom: 105%; /* Position it just above the slot */
    font-size: 16px;
}