* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

body {
    font-family: Arial, sans-serif;
    display: flex;
    min-height: 100vh;
    background-color: #f0f0f0;
    font-size: 16px;
    padding: 20px;
}

.container {
    background-color: white;
    padding: 1% 1%;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    text-align: center;
    width: 100%;
    margin: 0 auto;
}

h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
}

.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    font-size: 1em;
    background-color: #f0f0f0;
    border: none;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    transition: background-color 0.3s;
}

.tab.active {
    background-color: #4CAF50;
    color: white;
}

.input-version {
    margin-bottom: 20px;
}

#diceInput {
    text-align: center;
    width: 100%;
    max-width: 300px;
    padding: 10px;
    font-size: 1.2em;
    margin-bottom: 10px;
}

#diceInputsContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.dice-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.number-input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.number-input {
    width: 40px;
    padding: 5px;
    text-align: center;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.arrow-button {
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 5px;
    width: 100%;
    aspect-ratio: 1/1;
    color: #555;
    line-height: 1;
}

.arrow-button:hover {
    background: #e0e0e0;
}

.dice-separator {
    font-size: 1.5em;
    font-weight: bold;
}

.sides-select {
    padding: 5px;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 4px;
    height: 35px;
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
}

.add-dice-button,
.toggle-constant-button,
.remove-dice-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    width: 40px;
    height: 40px;
    line-height: 40px;
    padding: 0;
}

.add-dice-button:hover,
.toggle-constant-button:hover {
    background-color: #45a049;
}

.toggle-constant-button.active {
    background-color: #f44336;
}

.toggle-constant-button.active:hover {
    background-color: #d32f2f;
}

.remove-dice-button {
    background-color: #f44336;
    font-size: 18px;
}

.remove-dice-button:hover {
    background-color: #d32f2f;
}

.constant-input-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

#submit,
#submitButton,
#submitText {
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    padding: 10px 20px;
    font-size: 1.2em;
    width: 100%;
    max-width: 200px;
    margin-top: 10px;
}

#submit:hover,
#submitButton:hover,
#submitText:hover {
    background-color: #45a049;
}

#result {
    margin-top: 20px;
    font-size: 1.5em;
    word-wrap: break-word;
}

@media (prefers-color-scheme: dark) {
    body {
        background-color: #0f0f0f;
        color: white;
    }

    .container {
        background-color: #1a1a1a;
        box-shadow: 0 0 10px rgba(255,255,255,0.1);
    }

    .tab {
        background-color: #333;
        color: #fff;
    }

    #diceInput,
    .number-input,
    .arrow-button,
    .sides-select {
        background-color: #333;
        color: white;
        border-color: #555;
    }

    .arrow-button:hover {
        background-color: #444;
    }
}
