/* Dice Page Specific Styles */

/* Dice Selection Area */
.dice-selection-area {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
    position: relative;
    min-height: 180px; /* More space for rotation */
    width: 100%;
}

.die-slot-img-container {
    cursor: pointer;
    transition: transform 0.2s, z-index 0s;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 120px;
    height: 120px;
    margin: 0 -15px; /* Overlap */
}

/* Specific rotations for cluster feel */
.die-slot-img-container:nth-child(2) {
    transform: rotate(-15deg) translateY(10px);
    z-index: 1;
}

.die-slot-img-container:nth-child(3) {
    transform: rotate(10deg) translateY(-5px);
    z-index: 2;
}

.die-slot-img-container:nth-child(4) { /* In case there's a 3rd die (indices are 1-based in CSS, but v-for starts after impact text?) No, v-for is separate div */
    transform: rotate(25deg) translateY(15px);
    z-index: 3;
}
/* Note: The first child in .dice-selection-area is .impact-text-overlay (v-if), so dice are nth-child(2), (3), (4) usually */

/* Reset transform on shake so it doesn't conflict, OR combine them?
   Shake uses translate/rotate. It might override the base rotation.
   Let's wrap the image in a shaker div if needed, or just let shake override.
   The shake animation resets at 0% and 100%, possibly snapping back.
   Actually, let's apply the static rotation to the CONTAINER, and the shake to the IMAGE.
*/

.die-img {
    width: 100%;
    height: auto;
    filter: drop-shadow(3px 3px 0px var(--color-ink));
    transition: transform 0.2s;
}

.die-slot-img-container:active .die-img {
    transform: scale(0.95);
}

.die-slot-img-container.selected .die-img {
    filter: drop-shadow(0px 0px 5px var(--color-cyan)) drop-shadow(3px 3px 0px var(--color-ink));
    transform: scale(1.1);
}

/* Shaking Animation */
@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.die-slot-img-container.shaking .die-img {
    animation: shake 0.5s infinite;
}

/* Impact Text Overlay */
.impact-text-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-5deg);
    font-family: var(--font-heading);
    font-size: 6rem;
    color: var(--color-yellow);
    text-shadow:
        4px 4px 0 var(--color-ink),
        -2px -2px 0 var(--color-ink),
        2px -2px 0 var(--color-ink),
        -2px 2px 0 var(--color-ink),
        4px 4px 0 var(--color-magenta); /* Extra pop */
    z-index: 100;
    pointer-events: none;
    white-space: nowrap;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.impact-text-overlay.red-text {
    color: var(--comic-red);
    text-shadow:
        4px 4px 0 var(--color-ink),
        -2px -2px 0 var(--color-ink),
        2px -2px 0 var(--color-ink),
        -2px 2px 0 var(--color-ink),
        4px 4px 0 var(--color-yellow); /* Yellow shadow for red text */
}

@keyframes popIn {
    0% { transform: translate(-50%, -50%) scale(0) rotate(180deg); opacity: 0; }
    80% { transform: translate(-50%, -50%) scale(1.2) rotate(-10deg); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1) rotate(-5deg); opacity: 1; }
}

/* Roll Button */
.roll-button-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.roll-btn {
    width: 150px;
    height: 120px;
    background: var(--color-yellow);
    color: var(--color-ink);
    font-family: var(--font-heading);
    font-size: 3rem;
    border: 3px solid var(--color-ink);
    /* Starburst shape using clip-path or custom borders */
    /* Since we want comic style, let's use a rough polygon clip-path if possible or just wobbly borders with radial gradient */
    border-radius: 50% 20% 50% 20%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 5px 5px 0px var(--color-ink);
    transition: transform 0.1s;
    text-transform: uppercase;
    transform: rotate(-5deg);
}

.roll-btn:active {
    transform: rotate(-5deg) scale(0.95);
    box-shadow: 2px 2px 0px var(--color-ink);
}

/* Results Area */
.results-container {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.result-box {
    flex: 1;
    max-width: 100px;
    background: white;
    border: 3px solid var(--color-ink);
    border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
    padding: 0.5rem;
    text-align: center;
    box-shadow: 3px 3px 0px var(--color-ink);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.result-label {
    font-family: var(--font-body);
    font-weight: bold;
    font-size: 1rem;
    text-transform: uppercase;
    border-bottom: 2px solid var(--color-ink);
    margin-bottom: 0.5rem;
    padding-bottom: 0.2rem;
}

.result-value {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    line-height: 1;
}

.result-detail {
    font-family: var(--font-body);
    font-size: 0.8rem;
    margin-top: 0.2rem;
    color: #666;
}

/* Color coding based on reference */
.result-box.min {
    background-color: #d1f7ff; /* Light Cyan */
}
.result-box.min .result-label {
    background-color: var(--color-cyan);
    color: white;
    border: 2px solid var(--color-ink);
    transform: rotate(-2deg);
    margin: -10px -10px 5px -10px;
    padding: 2px 0;
    width: calc(100% + 20px);
}

.result-box.mid {
    background-color: #fff9c4; /* Light Yellow */
    transform: scale(1.1); /* Emphasize Mid */
    z-index: 10;
}
.result-box.mid .result-label {
    background-color: var(--color-yellow);
    color: var(--color-ink);
    border: 2px solid var(--color-ink);
    margin: -15px -10px 5px -10px;
    padding: 2px 0;
    width: calc(100% + 20px);
}

.result-box.max {
    background-color: #dbfadd; /* Light Green */
}
.result-box.max .result-label {
    background-color: var(--color-green);
    color: white;
    border: 2px solid var(--color-ink);
    transform: rotate(2deg);
    margin: -10px -10px 5px -10px;
    padding: 2px 0;
    width: calc(100% + 20px);
}

/* Modifiers Section */
.modifiers-section {
    padding: 1rem;
    background: white;
    border: 3px solid var(--color-ink);
    border-radius: 15px 255px 15px 255px / 255px 15px 225px 15px;
    box-shadow: 4px 4px 0px var(--color-ink);
    margin-bottom: 6rem;
}

.modifiers-header {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    text-align: center;
    text-decoration: underline;
    text-decoration-color: var(--color-yellow);
    text-decoration-thickness: 3px;
}

.modifiers-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.modifier-chip {
    display: flex;
    align-items: center;
    background: #f0f0f0;
    border: 2px solid var(--color-ink);
    border-radius: 15px 225px 15px 255px / 255px 15px 225px 15px;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: bold;
    font-size: 0.9rem;
    transition: transform 0.1s;
    user-select: none;
}

.modifier-chip.active {
    background-color: var(--color-yellow);
    transform: rotate(-1deg) scale(1.05);
    box-shadow: 2px 2px 0px var(--color-ink);
}

.modifier-chip.persistent {
    border-left: 5px solid var(--color-magenta);
}

.modifier-chip.temporary {
    border-left: 5px solid var(--color-cyan);
}

.modifier-value {
    margin-left: 0.5rem;
    background: var(--color-ink);
    color: white;
    padding: 0 0.3rem;
    border-radius: 50%;
    font-size: 0.8rem;
}

.add-modifier-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    background: #eee;
    padding: 0.5rem;
    border-radius: 8px;
    border: 2px dashed var(--color-ink);
}

.add-modifier-form input {
    flex: 1;
    padding: 0.3rem;
    border: 2px solid var(--color-ink);
    font-family: var(--font-body);
}

.add-modifier-form select {
    padding: 0.3rem;
    border: 2px solid var(--color-ink);
    font-family: var(--font-body);
}

.delete-mod-btn {
    margin-left: 0.5rem;
    color: var(--color-magenta);
    font-weight: bold;
    cursor: pointer;
}

/* Modal for Dice Selection */
.dice-selector-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.dice-selector-content {
    background: white;
    padding: 2rem;
    border: 3px solid var(--color-ink);
    border-radius: 1rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    box-shadow: 5px 5px 0 var(--color-ink);
}

.die-option {
    width: 80px;
    height: 80px;
    /* Removed background yellow to let image shine, or keep transparent */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.1s;
}

.die-option:active {
    transform: scale(0.9);
}

.die-option-img {
    width: 100%;
    height: auto;
    filter: drop-shadow(2px 2px 0 var(--color-ink));
}
