:root {
    --page-green: #179b28;
    --panel-green: rgba(45, 138, 49, 0.72);
    --panel-border: rgba(255, 255, 255, 0.55);
    --white: #ffffff;
    --ink: #172018;
    --blue: #136ad8;
    --accent: #ffd52b;
    --danger: #ff1e1e;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    font-family: "Trebuchet MS", Arial, sans-serif;
    background-color: var(--page-green);
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.04)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cg fill='none' stroke='%230b6f1b' stroke-opacity='.18' stroke-width='2'%3E%3Crect x='14' y='18' width='34' height='34' rx='4' transform='rotate(-16 31 35)'/%3E%3Ccircle cx='28' cy='32' r='2' fill='%230b6f1b' fill-opacity='.16'/%3E%3Ccircle cx='40' cy='38' r='2' fill='%230b6f1b' fill-opacity='.16'/%3E%3Cpath d='M86 18l16 12-4 20-20 4-12-16 8-18z'/%3E%3Ccircle cx='90' cy='36' r='12'/%3E%3Cpath d='M18 92c24-8 42-8 66 0M30 106c18-6 34-6 52 0M98 98h24M110 86v24'/%3E%3C/g%3E%3C/svg%3E");
    background-size: auto, 140px 140px;
}

body.theme-blue,
body.theme-sab-blue {
    --page-green: #1784d4;
    --panel-green: rgba(34, 117, 190, 0.72);
    background-color: #1784d4;
}

body.theme-red,
body.theme-sab-red {
    --page-green: #cd3535;
    --panel-green: rgba(170, 50, 50, 0.72);
    background-color: #cd3535;
}

body.theme-pink {
    --page-green: #cf63bd;
    --panel-green: rgba(169, 62, 151, 0.72);
    background-color: #cf63bd;
}

body.theme-bw,
body.theme-sab-black {
    --page-green: #252525;
    --panel-green: rgba(28, 28, 28, 0.78);
    background-color: #252525;
}

body.theme-bronze {
    --page-green: #9b6c42;
    --panel-green: rgba(121, 77, 40, 0.76);
    background-color: #9b6c42;
}

body.theme-silver {
    --page-green: #8a969e;
    --panel-green: rgba(94, 104, 112, 0.76);
    background-color: #8a969e;
}

body.theme-gold {
    --page-green: #d99c1c;
    --panel-green: rgba(167, 112, 11, 0.76);
    background-color: #d99c1c;
}

a {
    color: inherit;
}

button,
select,
input {
    font: inherit;
}

.top-ad {
    position: relative;
    width: min(660px, calc(100% - 32px));
    min-height: 76px;
    margin: 0 auto;
    padding: 12px 58px 12px 170px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
}

.top-ad::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 155px;
    background: linear-gradient(135deg, #7c8a95, #eef4fb 48%, #2d353a);
}

.top-ad button {
    position: absolute;
    right: -28px;
    bottom: -16px;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    color: white;
    background: #4b4f55;
    font-size: 28px;
    cursor: pointer;
}

.ad-copy {
    display: grid;
    gap: 5px;
    font-size: 13px;
}

.ad-copy strong {
    font-size: 16px;
}

.site-shell {
    width: min(1140px, calc(100% - 28px));
    margin: 0 auto 88px;
}

.brand-title,
.roll-panel h1,
.roll-panel h2,
.streamer-panel h2 {
    margin: 0;
    color: #fff;
    text-align: center;
    font-family: "Arial Black", "Trebuchet MS", Arial, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0;
    text-shadow:
        0 3px 0 #16852a,
        2px 2px 0 #16852a,
        -2px 2px 0 #16852a,
        0 5px 8px rgba(0, 0, 0, 0.28);
}

.brand-title {
    margin: 8px 0 22px;
    color: #ffe36b;
    font-size: clamp(36px, 6vw, 58px);
    line-height: 1;
    text-shadow:
        0 3px 0 #df7d25,
        2px 2px 0 #8d521a,
        -2px 2px 0 #8d521a,
        0 5px 8px rgba(0, 0, 0, 0.25);
}

.discover-panel {
    overflow: hidden;
    margin: 0 auto 32px;
    border-radius: 4px;
    background: #fff;
    box-shadow: var(--shadow);
}

.discover-panel h2 {
    margin: 0;
    padding: 13px 20px;
    background: #e9f1fe;
    font-size: 16px;
}

.discover-panel a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 56px;
    padding: 0 28px 0 20px;
    border-top: 1px solid #edf0f2;
    color: #1f2833;
    text-decoration: none;
}

.discover-panel span {
    color: #9aa4ad;
    font-size: 38px;
    line-height: 1;
}

.game-layout {
    display: grid;
    grid-template-columns: minmax(190px, 270px) minmax(340px, 1fr) minmax(190px, 270px);
    gap: 10px;
    align-items: start;
}

.streamer-panel,
.roll-panel {
    border: 4px solid var(--panel-border);
    border-radius: 18px;
    background: var(--panel-green);
    box-shadow: var(--shadow);
}

.streamer-panel {
    padding: 18px 14px;
    max-height: 430px;
    overflow: hidden;
}

.streamer-panel h2 {
    margin-bottom: 14px;
    font-size: 15px;
}

.streamer-card {
    position: relative;
    display: grid;
    grid-template-columns: 46px 1fr;
    gap: 10px;
    align-items: center;
    min-height: 58px;
    padding: 8px 8px;
    margin-bottom: 6px;
    border: 1px solid rgba(255, 255, 255, 0.36);
    border-radius: 6px;
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
}

.streamer-card strong {
    display: block;
    font-family: "Arial Black", "Trebuchet MS", Arial, sans-serif;
    font-size: 14px;
    text-transform: uppercase;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
}

.streamer-card small {
    display: block;
    margin-top: 2px;
    font-weight: 700;
}

.streamer-card em {
    position: absolute;
    left: 16px;
    bottom: 4px;
    padding: 1px 5px;
    border-radius: 4px;
    color: #fff;
    background: #ff0037;
    font-size: 10px;
    font-style: normal;
    font-weight: 800;
}

.avatar {
    width: 42px;
    height: 42px;
    border: 3px solid #ff2f5d;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 35%, #fff 0 11%, transparent 12%),
        radial-gradient(circle at 50% 70%, #252525 0 28%, transparent 29%),
        linear-gradient(135deg, #c4d4e4, #1e2c3a);
}

.avatar.alt {
    background:
        radial-gradient(circle at 50% 35%, #ffe5b6 0 13%, transparent 14%),
        radial-gradient(circle at 50% 72%, #753a12 0 29%, transparent 30%),
        linear-gradient(135deg, #ffda70, #2232a6);
}

.roll-panel {
    padding: 18px;
}

.roll-panel h1,
.roll-panel h2 {
    margin-bottom: 6px;
    font-size: clamp(24px, 4vw, 30px);
}

.roll-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    gap: 9px;
    align-items: center;
    margin: 4px 0 14px;
}

.roll-controls select,
.verify-search input {
    width: 100%;
    min-width: 0;
    height: 36px;
    padding: 0 12px;
    border: 2px solid #088d1f;
    border-radius: 4px;
    color: #00841b;
    background: #fff;
    font-family: "Arial Black", "Trebuchet MS", Arial, sans-serif;
    font-size: 15px;
    text-transform: uppercase;
    outline: none;
}

.roll-button,
.verify-search button,
.admin-button {
    min-height: 36px;
    padding: 0 16px;
    border: 2px solid #08791b;
    border-radius: 4px;
    color: #08791b;
    background: var(--accent);
    font-family: "Arial Black", "Trebuchet MS", Arial, sans-serif;
    text-transform: uppercase;
    cursor: pointer;
}

.roll-button:disabled {
    opacity: 0.72;
    cursor: wait;
}

.dice-stage {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(68px, 78px));
    justify-content: center;
    gap: 12px;
    min-height: 114px;
    padding: 14px;
    align-items: center;
}

.dice-stage.many-dice {
    grid-template-columns: repeat(auto-fit, minmax(42px, 48px));
    max-height: 310px;
    overflow-y: auto;
}

.dice-face {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    min-width: 0;
    border: 6px solid #fff;
    border-radius: 10px;
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.2);
}

.many-dice .dice-face {
    border-width: 4px;
    border-radius: 7px;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.18);
}

.color-face {
    background: var(--die-color);
}

.color-face span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
}

.color-face small {
    position: absolute;
    left: 3px;
    right: 3px;
    bottom: -22px;
    overflow: hidden;
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    text-align: center;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

.many-dice .color-face small {
    display: none;
}

.number-face {
    color: #111;
    background: #fff;
}

.number-face b {
    font-family: "Arial Black", "Trebuchet MS", Arial, sans-serif;
    font-size: clamp(20px, 4vw, 34px);
}

.rolling .dice-face {
    animation: bounce 0.36s ease-in-out infinite alternate;
}

@keyframes bounce {
    from {
        transform: translateY(0) rotate(-2deg);
    }

    to {
        transform: translateY(-8px) rotate(2deg);
    }
}

.game-id {
    margin: 2px 0 12px;
    color: #fff;
    text-align: center;
    text-shadow: 0 2px 3px rgba(0, 0, 0, 0.28);
}

.game-id strong {
    font-size: 22px;
}

.notice,
.empty-state {
    margin: 0 auto;
    max-width: 540px;
    padding: 12px;
    border-radius: 8px;
    color: var(--danger);
    background: #fff;
    font-weight: 800;
    text-align: center;
}

.notice a,
.game-id a {
    color: #d60000;
}

.follow-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 10px;
    background: #121212;
}

.follow-bar button,
.follow-bar a {
    display: inline-grid;
    place-items: center;
    min-height: 25px;
    padding: 0 11px;
    border: 0;
    border-radius: 4px;
    color: #fff;
    background: #ff2f5d;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.verify-shell {
    width: min(820px, calc(100% - 28px));
    margin: 42px auto 80px;
}

.back-link {
    display: inline-block;
    margin-bottom: 12px;
    color: #fff;
    font-weight: 800;
}

.verify-panel {
    color: #fff;
}

.verify-search {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.verify-details {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0 16px;
}

.verify-details div {
    padding: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.18);
}

.verify-details dt {
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.verify-details dd {
    margin: 5px 0 0;
    font-weight: 800;
}

.admin-body {
    background-color: #116f26;
}

.admin-shell {
    width: min(1120px, calc(100% - 28px));
    margin: 34px auto 80px;
}

.admin-card {
    padding: 22px;
    border: 4px solid var(--panel-border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
}

.admin-card + .admin-card {
    margin-top: 16px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.admin-header h1,
.admin-card h2 {
    margin: 0;
    color: #09851d;
    font-family: "Arial Black", "Trebuchet MS", Arial, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-nav a {
    padding: 9px 12px;
    border-radius: 4px;
    color: #fff;
    background: #136ad8;
    font-weight: 800;
    text-decoration: none;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.stat {
    padding: 16px;
    border: 2px solid #d5e6d8;
    border-radius: 8px;
    background: #f6fff8;
}

.stat strong {
    display: block;
    color: #09851d;
    font-family: "Arial Black", "Trebuchet MS", Arial, sans-serif;
    font-size: 30px;
}

.admin-form {
    display: grid;
    gap: 12px;
}

.admin-form label {
    display: grid;
    gap: 5px;
    font-weight: 800;
}

.admin-form input,
.admin-form select {
    min-height: 40px;
    padding: 8px 10px;
    border: 2px solid #c7d2cb;
    border-radius: 4px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 10px;
    border-bottom: 1px solid #dfe8e1;
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    color: #08791b;
    font-size: 12px;
    text-transform: uppercase;
}

.admin-table input[type="text"],
.admin-table input[type="number"] {
    width: 100%;
    min-width: 82px;
    min-height: 34px;
    padding: 6px 8px;
    border: 1px solid #b9c7bc;
    border-radius: 4px;
}

.message {
    padding: 12px;
    border-radius: 6px;
    background: #eaf9ee;
    color: #086f1b;
    font-weight: 800;
}

.message.error {
    background: #ffeceb;
    color: #b10000;
}

.type-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 18px;
}

.type-tabs a {
    padding: 9px 11px;
    border-radius: 4px;
    color: #08791b;
    background: #e9f7ec;
    font-weight: 900;
    text-decoration: none;
}

.type-tabs a.active {
    color: #fff;
    background: #136ad8;
}

.chance-total {
    margin: 0 0 12px;
    font-weight: 900;
}

@media (max-width: 920px) {
    .game-layout {
        grid-template-columns: 1fr;
    }

    .streamer-panel {
        display: none;
    }

    .roll-controls,
    .verify-details,
    .admin-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .top-ad {
        display: none;
    }

    .site-shell {
        width: min(100% - 18px, 1140px);
        margin-top: 18px;
    }

    .roll-controls,
    .verify-search {
        grid-template-columns: 1fr;
    }

    .dice-stage {
        grid-template-columns: repeat(auto-fit, minmax(56px, 66px));
    }

    .admin-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-table {
        display: block;
        overflow-x: auto;
    }
}
