:root {
    --primary: #2c3e50;
    --accent: #e67e22;
    --bg: #f4f7f6;
    --legal: #27ae60;
    --tip: #7f8c8d;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    margin: 0;
    padding: 15px;
    color: #333;
    -webkit-tap-highlight-color: transparent;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

h1 {
    font-size: 1.2rem;
    color: var(--primary);
    text-align: center;
    margin-bottom: 20px;
}

.advanced-toggle {
    background: #eee;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
    pointer-events: none;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px; width: 16px;
    left: 4px; bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(22px); }

#advanced-panel {
    background: #fff9f0;
    border: 1px dashed var(--accent);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 0.9rem;
    font-weight: bold;
    border-left: 4px solid var(--primary);
    padding: 5px 8px;
    margin: 20px 0 10px;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    cursor: pointer;
}

.section-title.legal { border-left-color: var(--legal); }
.section-title:hover { background: #eee; }
.section-title::after { content: "リセット ⟲"; font-size: 0.7rem; color: #999; }

.input-group { margin-bottom: 12px; }
label { display: block; font-size: 0.75rem; color: #666; margin-bottom: 4px; }
input {
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    outline: none;
}
input:focus { border-color: var(--primary); background: #fffdfa; }

.quick-buttons { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.btn {
    background: #eee;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
}

.visual-tip {
    font-size: 0.75rem;
    color: var(--tip);
    margin-top: 5px;
    min-height: 1.2em;
    font-style: italic;
    border-top: 1px dotted #ddd;
    padding-top: 5px;
}

.uchi-nori-box, .result-box {
    background: #e8f4fd;
    border-left: 4px solid #3498db;
    padding: 10px;
    margin-top: 5px;
    font-size: 0.9rem;
}

.result-box.legal { background: #eafaf1; border-left-color: var(--legal); }
.ratio-display { display: flex; justify-content: space-between; margin-top: 8px; font-weight: bold; color: var(--legal); }