body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    margin: 20px;
    background-color: #f4f4f4;
    color: #333;
}

h1 {
    color: #0056b3;
    text-align: center;
    margin-bottom: 20px;
}

.formula-display {
  text-align: center;
  margin: 15px 0;
  font-size: 1.1em;
  color: #333;
  overflow-x: auto;
}

.input-container {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.input-group label {
    display: inline-block;
    width: 120px;
    font-weight: bold;
    margin-right: 10px;
    flex-shrink: 0;
}

.input-group input[type="number"] {
    flex-grow: 1;
    min-width: 150px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    height: calc(2.25rem + 2px);
    box-sizing: border-box;
}
.input-group input[type="number"]::-webkit-inner-spin-button,
.input-group input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.input-group input[type="number"] {
  -moz-appearance: textfield;
}

.input-group .unit-select {
    padding: 0 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    margin-left: 10px;
    font-size: 0.9em;
    cursor: pointer;
    height: calc(2.25rem + 2px);
    box-sizing: border-box;
    min-width: 70px;
    text-align: center;
    flex-shrink: 0;
}

button#calculateBtn {
    display: block;
    width: 100%;
    padding: 12px 20px;
    font-size: 1.1em;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-bottom: 10px; /* エラーメッセージとの間隔調整 */
}

button#calculateBtn:hover {
    background-color: #0056b3;
}

.error {
    color: #dc3545;
    font-weight: bold;
    margin-top: 0; /* ボタンの直下なので上マージン不要 */
    margin-bottom: 15px; /* 結果コンテナとの間隔 */
    min-height: 1.2em;
    text-align: center;
}

.result-container {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.result-header h3 {
    margin: 0;
    color: #0056b3;
    font-size: 1.3em;
}

.header-buttons {
    display: flex;
    align-items: center;
}

.header-buttons button {
    width: auto;
    height: 32px;
    padding: 5px 10px;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    position: relative;
    flex-shrink: 0;
}
.header-buttons button svg {
    width: 18px;
    height: 18px;
    fill: white;
    margin-right: 5px;
}
.header-buttons button span:not(.copy-tooltip) {
    font-size: 0.9em;
}

button#copyBtn {
    background-color: #6c757d;
    margin-right: 10px;
}
button#copyBtn:hover {
    background-color: #5a6268;
}
button#copyBtn .copy-tooltip {
    visibility: hidden;
    width: 80px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px 0;
    position: absolute;
    z-index: 1;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s, background-color 0.3s;
    font-size: 0.8em;
    white-space: nowrap;
}
button#copyBtn:hover .copy-tooltip {
    visibility: visible;
    opacity: 1;
}
button#copyBtn.copied .copy-tooltip {
    visibility: visible;
    opacity: 1;
    background-color: #28a745;
}
button#copyBtn.copied[data-copy-state="error"] .copy-tooltip {
    background-color: #dc3545;
}

button#resetBtn {
    background-color: #dc3545;
}
button#resetBtn:hover {
    background-color: #c82333;
}

textarea#result {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    resize: vertical;
    min-height: 250px;
    background-color: #e9ecef;
    color: #333;
}

.katex-display {
    margin: 0.5em 0;
}