@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.dr-wrap {
    font-family: 'Inter', sans-serif;
    max-width: 860px;
    margin: 0 auto;
    background: #0f0f1a;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,0.5);
}

/* HEADER */
.dr-header {
    background: linear-gradient(135deg, #6c3fff 0%, #a855f7 50%, #ec4899 100%);
    padding: 36px 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.dr-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: headerPulse 4s ease-in-out infinite;
}

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

.dr-header h1 {
    font-size: 32px;
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
}

.dr-header p {
    font-size: 15px;
    color: rgba(255,255,255,0.8);
    margin-top: 8px;
    position: relative;
    z-index: 1;
}

/* TABS */
.dr-tabs {
    display: flex;
    background: #16162a;
    padding: 16px 24px 0;
    gap: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.dr-tab {
    padding: 12px 28px;
    border-radius: 12px 12px 0 0;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    background: transparent;
    letter-spacing: 0.3px;
}

.dr-tab:hover {
    color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.05);
}

.dr-tab.active {
    background: #0f0f1a;
    color: #a855f7;
    border-top: 2px solid #a855f7;
}

/* TAB CONTENT */
.dr-tab-content {
    display: none;
    padding: 32px 40px;
}

.dr-tab-content.active {
    display: block;
}

/* SECTION LABEL */
.dr-section-label {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.35);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

/* DICE TYPE BUTTONS */
.dr-dice-types {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 28px;
}

.dr-dice-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 90px;
    height: 90px;
    border-radius: 16px;
    border: 2px solid rgba(255,255,255,0.08);
    background: #1e1e35;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.dr-dice-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(168,85,247,0.15), rgba(236,72,153,0.15));
    opacity: 0;
    transition: opacity 0.3s;
}

.dr-dice-btn:hover::before,
.dr-dice-btn.active::before {
    opacity: 1;
}

.dr-dice-btn:hover,
.dr-dice-btn.active {
    border-color: #a855f7;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(168,85,247,0.3);
}

.dr-dice-btn .dice-icon {
    font-size: 28px;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}

.dr-dice-btn .dice-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    position: relative;
    z-index: 1;
}

.dr-dice-btn .dice-sub {
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    position: relative;
    z-index: 1;
}

.dr-dice-btn.active .dice-name {
    color: #a855f7;
}

/* COUNT SELECTOR */
.dr-count-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.dr-count-control {
    display: flex;
    align-items: center;
    background: #1e1e35;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
}

.dr-count-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    color: #a855f7;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.dr-count-btn:hover {
    background: rgba(168,85,247,0.15);
}

.dr-count-display {
    min-width: 50px;
    text-align: center;
    font-size: 20px;
    font-weight: 800;
    color: #fff;
}

.dr-quick-counts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dr-quick-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: #1e1e35;
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.dr-quick-btn:hover {
    border-color: #a855f7;
    color: #a855f7;
    background: rgba(168,85,247,0.1);
}

/* ROLL BUTTON */
.dr-roll-btn {
    width: 100%;
    padding: 18px;
    border-radius: 16px;
    border: none;
    background: linear-gradient(135deg, #6c3fff, #a855f7, #ec4899);
    background-size: 200% 200%;
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
}

.dr-roll-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.dr-roll-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(168,85,247,0.5);
}

.dr-roll-btn:hover::after {
    opacity: 1;
}

.dr-roll-btn:active {
    transform: translateY(0);
}

.dr-roll-btn.rolling {
    animation: btnPulse 0.3s ease infinite alternate;
}

@keyframes btnPulse {
    from { box-shadow: 0 8px 25px rgba(168,85,247,0.4); }
    to { box-shadow: 0 15px 40px rgba(236,72,153,0.6); }
}

/* RESULTS AREA */
.dr-results-area {
    min-height: 160px;
    background: #16162a;
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 24px;
    border: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: center;
}

.dr-placeholder {
    text-align: center;
    color: rgba(255,255,255,0.2);
    font-size: 15px;
    font-weight: 500;
    width: 100%;
}

.dr-placeholder span {
    display: block;
    font-size: 48px;
    margin-bottom: 8px;
    opacity: 0.4;
}

/* DICE DISPLAY */
.dr-die {
    width: 72px;
    height: 72px;
    background: linear-gradient(145deg, #2a2a45, #1a1a30);
    border-radius: 14px;
    border: 2px solid rgba(168,85,247,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 900;
    color: #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
    transition: all 0.3s;
    position: relative;
}

.dr-die.rolling {
    animation: dieRoll 0.15s ease infinite alternate;
    border-color: #ec4899;
    box-shadow: 0 0 20px rgba(236,72,153,0.5);
}

@keyframes dieRoll {
    from { transform: rotate(-8deg) scale(0.95); }
    to { transform: rotate(8deg) scale(1.05); }
}

.dr-die.landed {
    animation: dieLand 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-color: #a855f7;
    box-shadow: 0 0 25px rgba(168,85,247,0.4);
}

@keyframes dieLand {
    0% { transform: scale(1.3) rotate(10deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* D6 DOTS */
.dr-die.d6-die {
    flex-direction: column;
}

.dr-dots {
    display: grid;
    width: 50px;
    height: 50px;
    padding: 6px;
    gap: 4px;
}

.dr-dots.face-1 { grid-template: 1fr / 1fr; place-items: center; }
.dr-dots.face-2 { grid-template: 1fr 1fr / 1fr; }
.dr-dots.face-3 { grid-template: 1fr 1fr 1fr / 1fr; }
.dr-dots.face-4 { grid-template: 1fr 1fr / 1fr 1fr; }
.dr-dots.face-5 { grid-template: 1fr 1fr 1fr / 1fr 1fr; }
.dr-dots.face-6 { grid-template: 1fr 1fr 1fr / 1fr 1fr; }

.dr-dot {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(168,85,247,0.6);
}

.dr-dots.face-1 .dr-dot:nth-child(1) { grid-area: 1/1; justify-self: center; align-self: center; }
.dr-dots.face-2 .dr-dot:nth-child(1) { align-self: start; justify-self: end; }
.dr-dots.face-2 .dr-dot:nth-child(2) { align-self: end; justify-self: start; }
.dr-dots.face-3 .dr-dot:nth-child(1) { justify-self: end; }
.dr-dots.face-3 .dr-dot:nth-child(2) { justify-self: center; align-self: center; }
.dr-dots.face-3 .dr-dot:nth-child(3) { justify-self: start; }
.dr-dots.face-5 .dr-dot:nth-child(5) { grid-column: 1 / span 2; justify-self: center; }

/* STATS BAR */
.dr-stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.dr-stat-card {
    background: #1e1e35;
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.06);
    transition: all 0.3s;
}

.dr-stat-card:hover {
    border-color: rgba(168,85,247,0.3);
    transform: translateY(-2px);
}

.dr-stat-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.35);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.dr-stat-value {
    font-size: 22px;
    font-weight: 800;
    color: #a855f7;
}

/* TOTAL DISPLAY */
.dr-total-display {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(108,63,255,0.15), rgba(236,72,153,0.15));
    border-radius: 16px;
    border: 1px solid rgba(168,85,247,0.2);
    margin-bottom: 24px;
}

.dr-total-label {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.dr-total-value {
    font-size: 48px;
    font-weight: 900;
    background: linear-gradient(135deg, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* NON-CONVENTIONAL */
.dr-nc-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.dr-nc-field label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.dr-nc-field input {
    width: 100%;
    padding: 14px 18px;
    background: #1e1e35;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.3s;
    text-align: center;
}

.dr-nc-field input:focus {
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168,85,247,0.15);
}

.dr-nc-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.dr-preset-btn {
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: #1e1e35;
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.dr-preset-btn:hover {
    border-color: #a855f7;
    color: #a855f7;
    background: rgba(168,85,247,0.1);
}

/* NC RESULTS */
.dr-nc-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.dr-nc-stat {
    background: #1e1e35;
    border-radius: 14px;
    padding: 16px;
    border: 1px solid rgba(255,255,255,0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dr-nc-stat-label {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    font-weight: 500;
}

.dr-nc-stat-value {
    font-size: 18px;
    font-weight: 800;
    color: #a855f7;
}

/* HISTORY */
.dr-history-wrap {
    margin-top: 8px;
}

.dr-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.dr-history-title {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.35);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.dr-clear-btn {
    font-size: 12px;
    font-weight: 600;
    color: rgba(236,72,153,0.7);
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: color 0.2s;
}

.dr-clear-btn:hover {
    color: #ec4899;
}

.dr-history-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(168,85,247,0.3) transparent;
}

.dr-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #16162a;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.04);
    animation: historyIn 0.3s ease;
}

@keyframes historyIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.dr-history-dice {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
}

.dr-history-rolls {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    font-weight: 500;
}

.dr-history-total {
    font-size: 15px;
    font-weight: 800;
    color: #a855f7;
}

.dr-history-time {
    font-size: 11px;
    color: rgba(255,255,255,0.25);
}

/* RESPONSIVE */
@media (max-width: 640px) {
    .dr-tab-content { padding: 24px 20px; }
    .dr-header { padding: 28px 24px; }
    .dr-stats-bar { grid-template-columns: repeat(2, 1fr); }
    .dr-dice-btn { width: 75px; height: 75px; }
    .dr-nc-inputs { grid-template-columns: 1fr; }
    .dr-total-value { font-size: 36px; }
}
