:root {
    --primary: #007AFF;
    --primary-light: #E6F1FF;
    --background: #F5F7F9;
    --card-background: #FFFFFF;
    --text: #333333;
    --text-light: #8A8A8F;
    --border: #E1E5E9;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --success: #34C759;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

h1 {
    font-weight: 600;
    font-size: 28px;
    margin-bottom: 8px;
    background: linear-gradient(90deg, var(--primary), #0070E9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.description {
    color: var(--text-light);
    font-size: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.calculator-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 900px) {
    .calculator-container {
        grid-template-columns: 1fr 1fr;
    }
}

.card {
    background-color: var(--card-background);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
}

.section-title svg {
    margin-right: 10px;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 600px) {
    .input-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.input-group {
    margin-bottom: 8px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
}

input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s;
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.unit-selector {
    display: flex;
    margin-bottom: 16px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.unit-option {
    flex: 1;
    text-align: center;
    padding: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.unit-option.active {
    background-color: var(--primary);
    color: white;
}

.result-group {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.result-group:last-child {
    border-bottom: none;
}

.result-label {
    color: var(--text-light);
    display: flex;
    align-items: center;
}

.result-label svg {
    margin-right: 8px;
}

.result-value {
    font-weight: 600;
    color: var(--primary);
}

.button {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 24px auto 0;
    width: 100%;
}

.button:hover {
    background-color: #0062CC;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.25);
}

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

.button svg {
    margin-right: 8px;
}

.preview-container {
    margin-top: 40px;
}

.preview-area {
    background-color: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-top: 16px;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.grid-preview {
    position: relative;
    background-color: #F9F9F9;
    border: 1px solid var(--border);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
}

.grid-cell {
    position: absolute;
    background-color: rgba(0, 122, 255, 0.1);
    border: 1px solid rgba(0, 122, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--primary);
    transition: all 0.2s;
}

.grid-cell:hover {
    background-color: rgba(0, 122, 255, 0.2);
    z-index: 10;
}

.preview-info {
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-light);
    text-align: center;
    padding: 12px;
    background-color: var(--primary-light);
    border-radius: 8px;
}

.ratio-display {
    display: inline-block;
    padding: 4px 8px;
    background-color: var(--primary);
    color: white;
    border-radius: 4px;
    margin-left: 8px;
    font-size: 12px;
}

.input-with-actions {
    display: flex;
}

.input-with-actions input {
    border-radius: 8px 0 0 8px;
}

.input-actions {
    display: flex;
}

.input-action {
    padding: 12px;
    background: var(--background);
    border: 1px solid var(--border);
    border-left: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-action:last-child {
    border-radius: 0 8px 8px 0;
}

.input-action.active {
    background-color: var(--primary);
    color: white;
}

footer {
    text-align: center;
    margin-top: 40px;
    color: var(--text-light);
    font-size: 14px;
}