/* --- 共通: 基本設定 --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    background-color: #f4f4f4;
    color: #333333;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Header */
.site-header {
    width: 100%;
    background-color: #ffffff;
    color: #333333; 
    padding: 15px 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: 90%;
    max-width: 900px;
    margin: 0 auto;
}
.site-header h1 {
    margin: 0;
    font-size: 1.6em;
    color: #1abc9c;
}
.site-header .subtitle {
    color: #7f8c8d;
    margin: 0;
    font-size: 0.85em;
}

/* Container */
.container {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    width: 90%;
    max-width: 900px;
    margin: 0 auto 40px auto;
    box-sizing: border-box;
}

/* Breadcrumbs */
.breadcrumbs {
    width: 100%;
    padding: 0 0 15px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #eeeeee;
}
.breadcrumbs-content {
    font-size: 0.85em; 
    color: #555555;
}
.breadcrumbs a {
    color: #555555;
    text-decoration: none;
    transition: color 0.2s;
}
.breadcrumbs a:hover {
    color: #1abc9c;
    text-decoration: underline;
}
.current-page {
    color: #95a5a6; 
}

/* Section Common */
h2 {
    font-size: 1.4em;
    color: #34495e;
    border-left: 5px solid #16a085;
    padding-left: 12px;
    margin: 0 0 15px 0;
}
.description-text {
    font-size: 0.9em;
    color: #555555;
    margin-bottom: 25px;
}
.divider {
    border: 0;
    border-top: 1px dashed #dddddd;
    margin: 30px 0;
}
.note {
    font-size: 0.8em;
    color: #95a5a6;
    margin-bottom: 15px;
}

/* Input Styles */
.input-card {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #eeeeee;
}
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}
.form-row:last-child {
    margin-bottom: 0;
}
.form-group {
    flex: 1;
}
.form-group label {
    display: block;
    font-weight: bold;
    font-size: 0.85em;
    color: #555555;
    margin-bottom: 8px;
}
input[type="text"], select {
    padding: 12px;
    font-size: 16px;
    border: 1px solid #dddddd;
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
input[type="text"]:focus, select:focus {
    border-color: #1abc9c;
    outline: none;
}
/* Note Text */
.input-note {
    font-size: 0.8em;
    color: #7f8c8d;
    margin-top: 8px;
    margin-bottom: 0;
}

/* Flex Group for Input + Color Select */
.flex-group {
    display: flex;
    gap: 10px;
}
.flex-input-wrapper {
    flex-grow: 1;
}
.flex-color-wrapper {
    width: 120px;
    flex-shrink: 0;
}

/* Items Input List */
.items-input-container {
    margin-top: 20px;
}
.rank-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}
.rank-label {
    font-weight: bold;
    color: #16a085;
    width: 35px;
    text-align: center;
    flex-shrink: 0;
}
.rank-input-field {
    flex-grow: 1;
}
.rank-color-select {
    width: 110px;
    flex-shrink: 0;
}

/* --- Preview / Capture Target Styles --- */
.capture-target {
    padding: 40px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    border: 1px solid #eee;
    min-width: 320px;
    max-width: 100%;
    box-sizing: border-box;
    background: linear-gradient(135deg, #ffffff 0%, #f9fffd 100%);
}

/* Header in Preview */
.ranking-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #1abc9c;
}
.ranking-header h3 {
    margin: 0 0 10px 0;
    font-size: 1.8em;
    line-height: 1.3;
    color: #2c3e50; 
}
.ranking-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 20px;
    font-size: 0.85em;
    font-weight: bold;
    color: #7f8c8d;
}

/* Display List Container */
.ranking-list-display {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Display Row */
.display-row {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-radius: 8px;
    word-break: break-all;
    background-color: #fff;
    border: 1px solid #e1e8e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.display-rank {
    width: 50px;
    text-align: center;
    margin-right: 15px;
    flex-shrink: 0;
    font-weight: 900;
    font-size: 1.4em;
    color: #95a5a6;
    font-style: italic;
}
.display-name {
    font-size: 1.2em;
    font-weight: bold;
    line-height: 1.3;
    flex-grow: 1;
}

/* Rank Specific Styles */
.rank-1 { background-color: #fffbf0; border-color: #f1c40f; }
.rank-1 .display-rank { color: #f1c40f; font-size: 1.6em; }

.rank-2 { background-color: #fcfcfc; border-color: #bdc3c7; }
.rank-2 .display-rank { color: #95a5a6; font-size: 1.5em; }

.rank-3 { background-color: #fffaf8; border-color: #e67e22; }
.rank-3 .display-rank { color: #d35400; font-size: 1.5em; }


/* Buttons */
.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
}
button {
    font-size: 1.1em;
    padding: 15px 40px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.1s, box-shadow 0.2s, background-color 0.2s;
    min-width: 250px;
}
button:active {
    transform: translateY(2px);
}
.btn-primary {
    background-color: #1abc9c;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(26, 188, 156, 0.3);
}
.btn-primary:hover {
    background-color: #16a085;
}

/* Footer */
.page-footer {
    width: 100%;
    background-color: #2c3e50;
    color: #ffffff;
    padding: 50px 0 20px 0;
    margin-top: auto;
}
.footer-content {
    width: 90%;
    max-width: 900px;
    margin: 0 auto; 
}
.footer-row {
    display: flex;
    justify-content: flex-start;
    gap: 100px; 
    margin-bottom: 50px;
}
.footer-section {
    flex: 0 0 auto;
}
.section-title {
    color: #1abc9c;
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 18px;
}
.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.footer-section li {
    margin-bottom: 12px;
}
.footer-section a {
    color: #ecf0f1;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}
.footer-section a:hover {
    color: #1abc9c;
}
.copyright {
    text-align: center;
    font-size: 0.85rem;
    color: #95a5a6;
    border-top: 1px solid #34495e;
    padding-top: 25px;
    width: 100%;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .container, .header-content, .footer-content {
        width: 95%;
        padding: 20px 15px; /* Padding adjustment for small screens */
    }
    
    /* Settings Area: Stack vertically */
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .flex-group {
        flex-direction: column;
        gap: 5px;
    }
    .flex-color-wrapper {
        width: 100%; /* Settings color select takes full width */
    }

    /* Ranking List Items: Keep horizontal but optimized */
    .rank-input-row {
        gap: 8px; /* Tighter gap */
    }
    .rank-label {
        font-size: 0.9em; /* Slightly smaller label */
        width: 25px; /* Minimize label width */
    }
    .rank-input-field {
        flex-grow: 1; /* Input takes remaining space */
        width: auto;
    }
    .rank-color-select {
        /* FIX: Fixed width for mobile to save space for input */
        width: 95px; 
        flex-shrink: 0;
    }

    /* General Inputs on Mobile */
    input[type="text"], select {
        font-size: 14px; /* Prevent automatic zoom on iOS */
        padding: 10px 8px; /* Tighter padding */
    }

    .footer-row {
        flex-direction: column;
        gap: 30px;
    }
    button {
        width: 100%;
    }
    .capture-target {
        padding: 20px;
    }
    .ranking-header h3 {
        font-size: 1.4em;
    }
    .ranking-meta {
        flex-direction: column;
        gap: 5px;
        align-items: flex-end;
    }
}