.calculator {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    max-width: 100%;
    margin: 0;
    padding: 1.5rem;
    border: 1px solid var(--border, #e5e4e7);
    border-radius: 8px;
    background: var(--code-bg, #f9f9f9);
    color: var(--text, #333);
    text-align: left;
}

.calculator-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .calculator-body {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: start;
        gap: 2rem;
    }
}

.field {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

.field.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.field.radio-group {
    margin-top: 0.5rem;
}

.radio-title {
    font-weight: bold;
    margin-bottom: 0.35rem;
}

.radio-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: normal;
    cursor: pointer;
}

label {
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.field-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

.preset-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #555;
}

.preset-btn {
    font-family: inherit;
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    padding: 0.2rem 0.45rem;
    font-size: 0.75rem;
    cursor: pointer;
    line-height: 1.2;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.preset-btn:hover {
    background-color: #e0e0e0;
    border-color: #999;
    color: #000;
}

.preset-btn:active {
    background-color: #d0d0d0;
}

input[type="text"], textarea {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace, "Segoe UI Symbol", sans-serif;
    font-size: 0.95rem;
    color: #111827;
    background-color: #ffffff;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:focus, textarea:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.25);
}

input.is-valid, textarea.is-valid {
    border-color: #2e7d32;
    background-color: #e8f5e9;
    color: #1b5e20;
}

input.is-valid:focus, textarea.is-valid:focus {
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.25);
}

input.is-invalid, textarea.is-invalid {
    border-color: #d32f2f;
    background-color: #ffebee;
    color: #b71c1c;
}

input.is-invalid:focus, textarea.is-invalid:focus {
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.25);
}

.token-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.token {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace, "Segoe UI Symbol", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
    cursor: pointer;
    line-height: 1.2;
    transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}

.token:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.token:active {
    transform: translateY(0);
}

.token-remove {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Segoe UI Symbol", sans-serif;
    font-size: 0.85rem;
    font-weight: bold;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.token:hover .token-remove {
    opacity: 1;
}

.token.valid {
    background-color: #e8f5e9;
    border: 1px solid #81c784;
    color: #1b5e20;
}

.token.invalid {
    background-color: #ffebee;
    border: 1px solid #e57373;
    color: #b71c1c;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

.error {
    color: #d00;
    margin-top: 0;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: #ffebee;
    border: 1px solid #ef9a9a;
    border-radius: 4px;
}

.results {
    padding: 1rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.results h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.results-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.75rem 0;
    max-height: 400px;
    overflow-y: auto;
}

.results-list li {
    background: #fafafa;
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.25rem;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace, "Segoe UI Symbol", sans-serif;
    font-size: 0.9rem;
}

.results-comma {
    background: #fafafa;
    padding: 0.6rem;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace, "Segoe UI Symbol", sans-serif;
    font-size: 0.9rem;
    word-break: break-all;
    margin-bottom: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.5;
}

.total-count {
    margin: 0;
    font-size: 0.9rem;
}