a {
    text-decoration: none;
    color: inherit;
}

body {
    font-family: sans-serif;
    background-color: #f0f0f0;
    color: #333;
    text-align: center;
    margin-top: 50px;
}

h1 {
    color: #1a1a1a;
    display: inline-block; /* Added */
    margin: 0 auto; /* Added */
}

button {
    background-color: #ffffff;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 15px;
    /* margin: 10px; */ /* Removed margin here */
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 220px; /* Set a fixed width */
}

button:hover {
    background-color: #e9e9e9;
}

button:active {
    transform: scale(0.98);
}

button img {
    width: 24px;
    height: 24px;
    margin-right: 10px;
}

/* --- Result Table Styles --- */
.results-container {
    margin-top: 30px;
    display: inline-block;
    width: 700px; /* Button width * 3 + margins */
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

th, td {
    padding: 6px 15px; /* Reduced vertical padding */
    text-align: left;
    border-bottom: 1px solid #ddd;
}

tr:last-child td {
    border-bottom: none;
}

th {
    background-color: #e9e9e9;
    font-weight: bold;
}

td:last-child {
    text-align: right;
    font-size: 15px;
}

td:last-child button {
    margin: 0 auto; /* Center the button */
    display: block; /* Make it a block element to center */
}

.copy-btn {
    padding: 5px 10px; /* Reduced padding */
    font-size: 14px; /* Slightly smaller font */
}

.summary {
    margin-bottom: 20px;
    text-align: center;
    font-size: 22px;
    font-weight: bold;
}

.summary div {
    margin-bottom: 8px;
}

.disclaimer {
    font-size: 12px;
    color: #777;
    margin-top: 10px;
}

/* --- Calculator Page Styles --- */
.calculator-container {
    background-color: #ffffff;
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: block; /* Changed to block */
    margin: 20px auto; /* Centered */
    text-align: left;
    width: 500px;
}

.calc-section {
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}
.calc-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 10px;
}

.options-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 15px 20px;
    align-items: center;
}

label {
    font-weight: bold;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    justify-self: center;
}

select, input[type="number"] {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 16px;
    max-width: 200px;
}

#runs-per-char-display {
    font-size: 28px;
    font-weight: bold;
    color: #0056b3;
    text-align: center;
    margin-top: 10px;
}

.expectation-value {
    font-weight: bold;
    color: #333;
    font-size: 18px;
}

/* Comparison styles */
.comparison-plus {
    color: green;
}

.comparison-minus {
    color: red;
}

/* Adjust inputs-grid for 4 columns */
.inputs-grid {
    grid-template-columns: auto 1fr 1fr 1fr; /* Label, Expected Value, Input, Comparison */
    gap: 15px 20px;
    align-items: center;
}

/* Specific styles for the new input fields */
.inputs-grid input[type="number"] {
    max-width: 80px; /* Make them a bit smaller */
}

.inputs-grid .expectation-value,
.inputs-grid .comparison-value {
    text-align: right; /* Align values to the right */
    padding-right: 5px;
}

.main-buttons-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px; /* Space between buttons */
    max-width: 720px; /* 3 buttons * 220px + 2*20px gap */
    margin: 20px auto 40px auto; /* Center the container and add bottom margin */
}

.header-link {
    display: block; /* Make it a block element */
    margin: 0 auto 20px auto; /* Center the block element and add bottom margin */
    width: fit-content; /* Make it only as wide as its content */
}

/* enchant.html styles */
.enchant-buttons-container {
    text-align: center;
    margin-bottom: 20px;
}

.enchant-buttons-container button {
    padding: 10px 20px;
    font-size: 16px;
    margin: 0 10px;
    cursor: pointer;
}

#enchant-main-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.enchant-sub-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 10px;
    border: 1px solid #ddd;
    padding: 15px;
    width: 600px; /* Increased width */
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.enchant-box {
    border: 1px solid #eee;
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 8px;
    min-height: 100px;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.enchant-box-title {
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    color: #555;
    /* The title should not be centered with flex, so we add a wrapper for the items */
}

.enchant-box .items-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    gap: 5px;
}

.enchant-box.transparent {
    visibility: hidden;
}

.card-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-item img {
    width: 24px;
    height: 24px;
}

.card-item .card-name {
    flex-grow: 1;
}

.card-item .card-price {
    font-weight: bold;
    font-size: 13px;
    color: #0056b3;
}

.hidden {
    display: none;
}

#card-tooltip {
    position: absolute;
    background-color: #333;
    color: #fff;
    padding: 10px;
    border-radius: 5px;
    z-index: 1000;
    pointer-events: none; /* Allow clicks to pass through */
    text-align: left;
    min-width: 150px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

#card-tooltip h4 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 14px;
    color: #f0f0f0;
    border-bottom: 1px solid #555;
    padding-bottom: 5px;
}

#card-tooltip p {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
}

#card-tooltip.hidden {
    display: none;
}

.game-subtitle {
    font-size: 24px; /* Slightly smaller than h1 */
    color: #555;
    margin-top: 10px;
    margin-bottom: 10px;
}

.separator {
    border-top: 1px solid #ccc;
    opacity: 0.5;
    margin: 20px auto;
    width: 80%;
    max-width: 700px;
}

.game-title {
    font-size: 16px; /* Same as button text */
    font-weight: bold;
    color: #333;
    margin-top: 30px;
    margin-bottom: 10px;
}

.simulator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.simulator-header .stats-link button {
    padding: 5px 10px;
    font-size: 14px;
    width: auto;
}

.container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: left; /* Align text to left within container */
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px; /* Adjust as needed */
}

.modal-header h2 {
    margin: 0; /* Remove default h2 margin */
    flex-grow: 1; /* Allow h2 to take remaining space */
    text-align: center; /* Center the h2 */
}

.modal-header .stats-link button {
    padding: 5px 10px;
    font-size: 14px;
    width: auto;
}