/* Rules dialog in index.html */
#rules {
    opacity: 0;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 201;
    display: flex;
    justify-content: center;
    align-items: center;
}
#rules-content {
    width: 700px;
    height: 600px;
    width: min(700px, calc(100vw - 32px));
    height: min(600px, calc(100vh - 32px));
    max-height: 95%;
    max-width: 95%;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #1c222d;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
#rules-body {
    flex: 1;
    min-height: 0;
    width: 100%;
    border: 0;
    display: block;
    background: #1c222d;
}

/* Rules page, both standalone and inside the iframe */
.rules-page, .rules-page * {
    box-sizing: border-box;
}
body.rules-page {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #1c222d;
    color: #e8ecf3;
    line-height: 1.6;
    overflow: hidden;
}
.rules-page .rules-container {
    width: 100%;
    height: 100vh;
    overflow-y: auto;
    padding: 24px 28px 28px;
    background: #1c222d;
    scrollbar-color: #607392 #1c222d;
    scrollbar-width: thin;
}
.rules-page .rules-container::-webkit-scrollbar {
    width: 10px;
}
.rules-page .rules-container::-webkit-scrollbar-track {
    background: #1c222d;
}
.rules-page .rules-container::-webkit-scrollbar-thumb {
    background: #607392;
    border: 2px solid #1c222d;
    border-radius: 10px;
}
.rules-page .rules-container::-webkit-scrollbar-thumb:hover {
    background: #3b82f6;
}
.rules-page h1 {
    margin: 0;
    color: #ffffff;
    text-align: center;
    font-size: 32px;
}
.rules-page .subtitle {
    margin: 8px 0 25px;
    color: #aab5c7;
    text-align: center;
}
.rules-page .rule-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: rule;
}
.rules-page .rule-list li {
    position: relative;
    margin: 12px 0;
    padding: 15px 16px 15px 58px;
    background: #252d3a;
    border: 1px solid #343e4e;
    border-radius: 10px;
    counter-increment: rule;
}
.rules-page .rule-list li::before {
    content: counter(rule);
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    color: #ffffff;
    background: #3b82f6;
    border-radius: 8px;
    font-weight: bold;
}
.rules-page .rule-list strong {
    color: #ffffff;
}
.rules-page .exception {
    color: #fbbf24;
    font-weight: bold;
}
.rules-page .warning {
    margin-bottom: 25px;
    padding: 16px;
    background: #38252a;
    border: 1px solid #713b45;
    border-radius: 10px;
}
.rules-page .warning h2 {
    margin: 0 0 6px;
    color: #ff8b96;
    font-size: 18px;
}
.rules-page .warning p {
    margin: 0;
}
@media (max-width: 480px) {
    .rules-page .rules-container {
        padding: 20px 16px;
    }
    .rules-page h1 {
        font-size: 26px;
    }
    .rules-page .rule-list li {
        padding: 13px 12px 13px 48px;
    }
    .rules-page .rule-list li::before {
        left: 10px;
    }
}
