/* --- General Body and Container --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    background-color: #f4f4f4;
    color: #333;
    display: flex;
    flex-direction: column; 
    align-items: center; 
    min-height: 100vh;
    margin: 0;
    padding: 0; 
}

/* --- Header Style --- */
.site-header {
    width: 100%;
    background-color: #ffffff;
    color: #333333; 
    padding: 10px 0;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); 
    position: sticky;
    top: 0;
    z-index: 100; 
}
.header-content {
    width: 95%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 10px;
    box-sizing: border-box;
}
.site-header h1 {
    margin: 0;
    font-size: 1.4em;
    color: #1abc9c;
}
.site-header .subtitle {
    color: #7f8c8d;
    margin: 0;
    font-size: 0.85em;
}

/* --- Main Container Style --- */
.container {
    background-color: #fff;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 95%;
    max-width: 1000px;
    margin: 0 auto 20px auto; 
    box-sizing: border-box;
}

/* --- Breadcrumbs --- */
.breadcrumb-area {
    width: 100%;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}
.breadcrumb-content {
    font-size: 0.85em;
    color: #7f8c8d;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}
.breadcrumb-content a {
    color: #7f8c8d;
    text-decoration: none;
}
.breadcrumb-content .delimiter {
    margin: 0 8px;
    color: #95a5a6;
}
.breadcrumb-content .current {
    color: #34495e; 
}

h2 { 
    font-size: 1.2em; 
    color: #34495e; 
    border-left: 5px solid #16a085; 
    padding-left: 10px; 
    margin: 20px 0 15px; 
}
h3 { 
    font-size: 1.05em;
    color: #2c3e50; 
    margin: 10px 0; 
}

/* --- Controls Layout --- */
.controls-wrapper { 
    background-color: #f8f9fa; 
    padding: 15px; 
    border-radius: 8px; 
    margin-bottom: 20px; 
}
.control-group {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #ddd;
}
.control-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* Inputs */
.input-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.input-field {
    flex: 1 1 140px; /* スマホで横並びになりやすい幅 */
    display: flex;
    flex-direction: column;
}
.input-field label {
    font-weight: bold;
    color: #555;
    margin-bottom: 3px;
    font-size: 0.85rem;
}
.input-field input[type="text"],
.input-field select {
    padding: 0 10px;
    height: 40px;    
    line-height: 40px;
    font-size: 16px; /* iOSでズームしないサイズ */
    border: 1px solid #ddd;
    border-radius: 5px;
    width: 100%;
    box-sizing: border-box;
    background-color: #fff;
}

/* --- Buttons --- */
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.main-btn, .sub-btn, .mode-btn { 
    padding: 10px 15px; 
    font-size: 14px; 
    font-weight: bold; 
    border: none; 
    border-radius: 5px; 
    cursor: pointer; 
    transition: all 0.2s; 
    /* タッチデバイスで押しやすいように */
    min-height: 44px;
    flex: 1;
    white-space: nowrap;
}

.main-btn { 
    background-color: #1abc9c; 
    color: #fff; 
}
.main-btn:hover { background-color: #16a085; }

.sub-btn { 
    background-color: #34495e; 
    color: #fff; 
}
.sub-btn:hover { background-color: #2c3e50; }

.reset-btn {
    background-color: #e74c3c;
    color: #fff;
}
.reset-btn:hover { background-color: #c0392b; }

/* Mode Buttons */
.mode-btn {
    background-color: #fff;
    color: #34495e;
    border: 1px solid #34495e;
    font-size: 13px;
}
.mode-btn.active {
    background-color: #34495e;
    color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.mode-btn[data-mode="delete"].active {
    background-color: #e74c3c;
    border-color: #e74c3c;
}

/* --- Utility --- */
.notice { font-size: 0.85em; color: #7f8c8d; margin-top: 5px; }
.notice-mini { font-size: 0.75em; color: #95a5a6; display: block; margin-top: 3px;}
.instruction { font-size: 0.9em; color: #34495e; margin-bottom: 8px; }
.instruction-danger { font-size: 0.9em; color: #e74c3c; font-weight: bold; }
.hidden { display: none !important; }

/* --- Canvas Area --- */
.canvas-wrapper {
    margin-top: 10px;
    width: 100%;
}
.canvas-title {
    margin-bottom: 10px;
}

/* スマホでキャンバスがはみ出る場合でも操作できるよう
  横スクロールも考慮しつつ、基本は画面幅に合わせる
*/
.canvas-scroll-container {
    width: 100%;
    overflow: hidden; /* JavaScriptでリサイズするためhidden */
    background-color: #e8f8f5;
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
    border: 1px solid #1abc9c;
}

#chart-canvas {
    display: block;
    background-color: #ffffff;
    cursor: default;
    /* タッチ操作時にブラウザ全体のスクロールを防ぐ重要設定 */
    touch-action: none; 
}

.canvas-note {
    font-size: 0.8em;
    color: #95a5a6;
    text-align: center;
    margin-top: 5px;
}

/* --- Usage Caution --- */
.usage-caution {
    margin-top: 30px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eee;
}
.usage-caution h3 {
    font-size: 1em;
    border-left: 4px solid #7f8c8d;
    padding-left: 8px;
}
.usage-caution ul {
    margin: 0;
    padding-left: 20px;
}
.usage-caution li {
    font-size: 0.85em;
    color: #555;
    margin-bottom: 5px;
}

/* --- Footer --- */
.page-footer {
    width: 100%;
    background-color: #34495e;
    color: #ddd;
    padding: 20px 0;
    margin-top: auto; 
}
.footer-content {
    width: 95%;
    max-width: 1000px;
    margin: 0 auto; 
    padding: 0 10px;
    box-sizing: border-box;
}
.footer-links-row {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #556c80;
    padding-bottom: 15px;
}
.footer-section .section-title {
    font-size: 1em;
    font-weight: bold;
    color: #1abc9c; 
    margin-bottom: 5px;
    margin-top: 0;
}
.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.footer-section li a {
    color: #ccc;
    text-decoration: none;
    font-size: 0.85em;
}
.copyright {
    text-align: center;
    font-size: 0.75em;
    color: #95a5a6;
    margin: 0;
}

/* --- Responsive Layout --- */
@media (min-width: 651px) {
    .site-header h1 { font-size: 1.8em; }
    .site-header { padding: 15px 0; }
    
    .footer-links-row {
        flex-direction: row;
        gap: 60px;
    }
    .input-field { flex: 0 1 200px; }
}

@media (min-width: 1024px) {
    .header-content,
    .container, 
    .footer-content {
        width: 80%;        
        max-width: none;   
    }
}