/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700;800&family=Noto+Sans+JP:wght@500;700;900&display=swap');

:root {
    --ym-red: #ff0033;
    --ym-red-light: #fff0f3;
    --ym-black: #1a1a1a;
    --ym-text: #1a1a1a;
    --ym-gray: #f5f7fa;
    --ym-border: #e2e8f0;
    --ym-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --radius: 16px;
    --font-num: 'Montserrat', sans-serif;
    --toggle-bg-off: #e0e0e0;
    --toggle-bg-on: #34c759;
}

.ym-sim-container {
    font-family: 'Noto Sans JP', sans-serif;
    background: #fff;
    max-width: 800px;
    margin: 0 auto;
    color: var(--ym-text);
    line-height: 1.5;
    contain: content;
    padding-bottom: 80px;
    -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------
   Header (Modern Style)
-------------------------------------------------- */
.ym-header-modern {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 10px;
    font-family: 'Noto Sans JP', sans-serif;
}

.ym-header-sub {
    display: block;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    color: var(--ym-red);
    letter-spacing: 0.1em;
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.ym-header-main {
    display: block;
    font-size: 2rem;
    font-weight: 900;
    color: var(--ym-black);
    margin-bottom: 20px;
    line-height: 1.3;
    letter-spacing: -0.03em;
}

.ym-header-desc {
    display: block;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.8;
    max-width: 640px;
    margin: 0 auto;
}

.ym-highlight {
    background: linear-gradient(transparent 60%, #fff0f3 60%);
    font-weight: bold;
    color: var(--ym-text);
    padding: 0 2px;
}

/* --------------------------------------------------
   Cards & Sections
-------------------------------------------------- */
.ym-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--ym-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.ym-section-header {
    font-size: 1.1rem;
    font-weight: 900;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1;
}

.ym-section-header::before {
    content: '';
    display: block;
    width: 6px;
    height: 24px;
    background: var(--ym-red);
    border-radius: 3px;
    flex-shrink: 0;
}

.ym-sub-header {
    margin-top: 28px;
    margin-bottom: 14px;
    font-size: 0.95rem;
    font-weight: 900;
    color: var(--ym-text);
    display: flex;
    align-items: center;
    line-height: 1;
}

.ym-sub-header::before {
    content: '▼';
    font-size: 0.7em;
    margin-right: 8px;
    color: var(--ym-red);
    position: relative;
    top: -1px;
}

/* --------------------------------------------------
   Contract Type List (Vertical)
-------------------------------------------------- */
.ym-contract-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ym-select-box-row {
    position: relative;
    cursor: pointer;
    width: 100%;
}

.ym-select-box-row input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ym-box-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid var(--ym-border);
    border-radius: 12px;
    padding: 16px 20px;
    transition: 0.2s;
    font-weight: bold;
    color: var(--ym-text);
}

.ym-select-box-row:hover .ym-box-label-row {
    border-color: #ffcccc;
}

.ym-select-box-row input:checked + .ym-box-label-row {
    border-color: var(--ym-red);
    background: var(--ym-red-light);
    color: var(--ym-red);
    box-shadow: 0 0 0 1px var(--ym-red);
}

.ym-box-label-row::before {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 50%;
    margin-right: 15px;
    box-sizing: border-box;
    transition: 0.2s;
}

.ym-select-box-row input:checked + .ym-box-label-row::before {
    border-color: var(--ym-red);
    background: var(--ym-red);
    box-shadow: inset 0 0 0 4px #fff;
}

.ym-box-label-row .label-main {
    flex: 1;
}

.ym-box-label-row .label-sub {
    font-size: 0.75rem;
    font-weight: normal;
    color: #666;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
}

.ym-select-box-row input:checked + .ym-box-label-row .label-sub {
    color: var(--ym-red);
    background: rgba(255, 255, 255, 0.6);
}

/* --------------------------------------------------
   Tooltips
-------------------------------------------------- */
.ym-label-group {
    display: flex;
    align-items: center;
}

.ym-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ccc;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    margin-left: 4px;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    top: -1px;
}

.ym-tooltip:hover {
    background: var(--ym-text);
}

.ym-tooltip-box {
    position: absolute;
    bottom: 150%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    width: 220px;
    line-height: 1.5;
    text-align: left;
    visibility: hidden;
    opacity: 0;
    transition: 0.2s;
    z-index: 10;
    pointer-events: none;
    font-weight: normal;
}

.ym-tooltip-box::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.ym-tooltip:hover .ym-tooltip-box {
    visibility: visible;
    opacity: 1;
}

/* --------------------------------------------------
   Grids & Select Boxes
-------------------------------------------------- */
.ym-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    align-items: stretch;
}

.ym-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    align-items: stretch;
}

.ym-select-box {
    position: relative;
    cursor: pointer;
    height: 100%;
}

.ym-select-box input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ym-box-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 2px solid var(--ym-border);
    border-radius: 12px;
    padding: 16px 8px;
    height: 100%;
    transition: 0.2s;
    text-align: center;
    min-height: 80px;
    box-sizing: border-box;
}

.ym-select-box input:checked + .ym-box-label {
    border-color: var(--ym-red);
    background: var(--ym-red-light);
    color: var(--ym-red);
    font-weight: 700;
}

.plan-gb {
    font-family: var(--font-num);
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}

.plan-gb small {
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Noto Sans JP', sans-serif;
    margin-left: 2px;
}

/* プラン名 */
.plan-name {
    display: block;
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 4px;
    color: var(--ym-text);
}

/* --------------------------------------------------
   Option List (Checkboxes/Toggles)
-------------------------------------------------- */
.ym-option-list {
    display: grid;
    gap: 10px;
}

.ym-option-label {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--ym-border);
    border-radius: 10px;
    cursor: pointer;
    background: #fff;
    transition: 0.2s;
    min-height: 64px;
    box-sizing: border-box;
    justify-content: space-between;
}

.ym-option-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 50px;
    height: 30px;
    background: var(--toggle-bg-off);
    border-radius: 50px;
    position: relative;
    cursor: pointer;
    transition: 0.3s;
    flex-shrink: 0;
    margin: 0;
    order: 3;
}

.ym-option-label input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 26px;
    height: 26px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: 0.3s;
}

.ym-option-label input[type="checkbox"]:checked {
    background: var(--ym-red);
}

.ym-option-label input[type="checkbox"]:checked::after {
    transform: translateX(20px);
}

.ym-label-text,
.ym-option-label > span:first-child {
    order: 1;
    flex: 1;
    line-height: 1.3;
    padding-right: 10px;
}

.price-right {
    order: 2;
    margin-left: auto;
    font-weight: bold;
    color: var(--ym-text);
    white-space: nowrap;
    margin-right: 16px;
}

.price-right small {
    font-size: 0.85em;
    color: inherit;
}

.ym-option-label.disabled {
    background: #f9f9f9;
    border-color: #eee;
    color: #aaa;
    pointer-events: none;
}

.ym-option-label.disabled input[type="checkbox"] {
    opacity: 0.4;
    background: #ddd;
}

.ym-option-label.disabled .price-right {
    color: #aaa;
}

/* --------------------------------------------------
   Vertical Radio List
-------------------------------------------------- */
.ym-radio-list-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}

.ym-radio-item {
    position: relative;
    cursor: pointer;
}

.ym-radio-item input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ym-radio-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--ym-border);
    border-radius: 12px;
    transition: 0.2s;
    min-height: 60px;
    box-sizing: border-box;
}

.ym-radio-item input:checked + .ym-radio-content {
    border-color: var(--ym-red);
    background: var(--ym-red-light);
}

.ym-radio-content .name-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.ym-radio-content .name {
    font-weight: bold;
    font-size: 0.95rem;
    color: var(--ym-text);
    display: flex;
    align-items: center;
    gap: 14px;
    line-height: 1.2;
}

.ym-radio-content .name::before {
    content: '';
    display: block;
    width: 22px;
    height: 22px;
    border: 2px solid #ccc;
    border-radius: 50%;
    box-sizing: border-box;
    flex-shrink: 0;
    transition: 0.2s;
}

.ym-radio-item input:checked + .ym-radio-content .name::before {
    border-color: var(--ym-red);
    background: var(--ym-red);
    box-shadow: inset 0 0 0 5px #fff;
}

.meta-text {
    font-size: 0.75rem;
    color: #666;
    margin-left: 36px;
    font-weight: normal;
    line-height: 1.3;
}

.ym-radio-content .price {
    font-weight: bold;
    color: var(--ym-text);
    text-align: right;
    white-space: nowrap;
    margin-left: 12px;
    display: flex;
    align-items: baseline;
}

.ym-radio-content .price .val {
    font-family: var(--font-num);
    font-size: 1.15rem;
    font-weight: 700;
}

.ym-radio-item input:checked + .ym-radio-content .price .val {
    color: var(--ym-red);
}

/* --------------------------------------------------
   Comparison Area
-------------------------------------------------- */
.ym-compare-area {
    background: #f9f9f9;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    border: 1px dashed var(--ym-border);
}

.compare-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.compare-label {
    font-weight: bold;
    font-size: 0.9rem;
}

.compare-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1.2rem;
    font-family: var(--font-num);
    text-align: right;
    max-width: 150px;
}

.compare-result {
    /* Brand Red Gradient */
    background: linear-gradient(135deg, #ff0033 0%, #d6002b 100%);
    color: #fff;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(255, 0, 51, 0.3);
    display: none;
    animation: popIn 0.5s;
}

.compare-result.is-visible {
    display: block;
}

.compare-val {
    font-family: var(--font-num);
    font-size: 1.8rem;
    font-weight: 800;
}

.ym-year-total-area {
    margin-top: 20px;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    text-align: right;
    font-size: 0.9rem;
}

.ym-year-val {
    font-family: var(--font-num);
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--ym-text);
    margin-left: 10px;
}

@keyframes popIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --------------------------------------------------
   Result Plan Tabs
-------------------------------------------------- */
.ym-result-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 0 5px;
}

.ym-result-tab {
    flex: 1;
    max-width: 140px;
    padding: 10px 0;
    text-align: center;
    background: #f5f7fa;
    border-radius: 8px;
    cursor: pointer;
    color: #888;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
    user-select: none;
}

.ym-result-tab:hover {
    background: #eef1f5;
}

.ym-result-tab.active {
    background: #fff;
    border-color: var(--ym-red);
    color: var(--ym-red);
    box-shadow: 0 4px 12px rgba(255, 0, 51, 0.15);
    font-weight: bold;
    transform: translateY(-2px);
}

.ym-tab-plan-label {
    display: block;
    font-size: 0.75rem;
    margin-bottom: 2px;
    font-family: 'Noto Sans JP', sans-serif;
}

.ym-tab-plan-name {
    display: block;
    font-family: var(--font-num);
    font-size: 1.4rem;
    line-height: 1;
    font-weight: 800;
}

.ym-tab-plan-name small {
    font-size: 0.8rem;
    margin-left: 1px;
}

/* --------------------------------------------------
   Result Grid & Cards
-------------------------------------------------- */
.ym-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    width: 100%;
}

.ym-res-card {
    background: #fff;
    border: 1px solid var(--ym-border);
    border-radius: var(--radius);
    /* 注釈用に下の余白を確保 */
    padding: 24px 24px 50px 24px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}

.ym-res-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, var(--ym-red), #ff6b6b);
    border-radius: var(--radius) var(--radius) 0 0;
}

.res-badge {
    display: inline-block;
    background: #1a1a1a;
    color: #fff;
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 20px;
    margin-bottom: 16px;
    font-weight: bold;
    align-self: flex-start;
}

.res-price-area {
    font-family: var(--font-num);
    color: var(--ym-red);
    border-bottom: 2px dashed var(--ym-border);
    padding-bottom: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: baseline;
    justify-content: center;
}

.res-price-val {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
}

.res-price-unit {
    font-size: 1rem;
    color: var(--ym-text);
    margin-left: 4px;
    font-weight: bold;
    font-family: 'Noto Sans JP', sans-serif;
}

.res-detail-list {
    margin-top: 15px;
    border-top: 1px dashed #eee;
    padding-top: 10px;
}

.res-item-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: #333;
    line-height: 1.4;
}

.res-item-row.discount {
    color: #ff0033;
}

.res-item-row .val {
    font-weight: bold;
    white-space: nowrap;
    margin-left: 10px;
}

.res-item-name {
    flex: 1;
}

.res-item-note {
    display: block;
    font-size: 0.75rem;
    color: #ff0033;
    margin-top: 2px;
}

.res-detail-row.total-line {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #eee;
    font-weight: bold;
    color: var(--ym-text);
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --------------------------------------------------
   Initial Fee Note
-------------------------------------------------- */
.ym-init-fee-note {
    font-size: 0.75rem;
    text-align: right;
    color: #666;
    line-height: 1.4;
    
    /* カード底に固定 */
    position: absolute;
    bottom: 15px;
    right: 24px;
    left: 24px;
}

.ym-init-fee-note.free {
    color: var(--ym-red);
    font-weight: bold;
}

/* --------------------------------------------------
   Apply Area & Buttons
-------------------------------------------------- */
.ym-apply-area {
    text-align: center;
    margin-top: 30px;
}

.ym-campaign-info {
    margin-bottom: 15px;
    background: #fff0f3;
    color: var(--ym-red);
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.9rem;
    display: inline-block;
}

.ym-btn-base {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 18px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.ym-btn-base:hover {
    transform: translateY(-2px);
}

.ym-btn-base img {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.ym-btn-apply {
    background: linear-gradient(135deg, #ff0033 0%, #d6002b 100%);
    box-shadow: 0 10px 20px -5px rgba(255, 0, 51, 0.4);
}

.ym-btn-apply:hover {
    box-shadow: 0 15px 25px -5px rgba(255, 0, 51, 0.5);
}

.ym-btn-apply.disabled {
    background: #ccc;
    box-shadow: none;
    pointer-events: none;
    opacity: 0.6;
}

.ym-btn-sub {
    background: var(--ym-black);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
    margin-top: 15px;
    font-size: 1rem;
}

.ym-btn-sub:hover {
    box-shadow: 0 15px 25px -5px rgba(0, 0, 0, 0.4);
}

/* --------------------------------------------------
   Accordion
-------------------------------------------------- */
.ym-accordion-wrapper {
    margin-top: 5px;
    margin-bottom: 10px;
}

.ym-accordion-trigger {
    font-size: 0.85rem;
    color: #666;
    cursor: pointer;
    padding: 8px 5px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: 0.2s;
}

.ym-accordion-trigger:hover {
    color: var(--ym-text);
}

.ym-accordion-trigger .arrow {
    font-size: 0.7em;
    transition: transform 0.3s;
}

.ym-accordion-trigger.is-open .arrow {
    transform: rotate(180deg);
}

.ym-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.ym-accordion-content.is-open {
    max-height: 500px;
}

.ym-accordion-inner {
    padding: 10px 15px;
    background: #f9f9f9;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #444;
    line-height: 1.5;
    margin-bottom: 10px;
    border: 1px solid #eee;
}

.ym-accordion-inner dl dt {
    font-weight: bold;
    color: var(--ym-text);
    margin-bottom: 4px;
    margin-top: 10px;
}

.ym-accordion-inner dl dt:first-child {
    margin-top: 0;
}

.ym-accordion-inner dl dd {
    margin-left: 0;
    margin-bottom: 10px;
    font-size: 0.95em;
}

/* --------------------------------------------------
   Responsive
-------------------------------------------------- */
@media (max-width: 768px) {
    .ym-header-main {
        font-size: 1.6rem;
    }
    
    .ym-header-desc {
        font-size: 0.9rem;
        text-align: left;
    }

    .ym-grid-3 {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .ym-box-label {
        padding: 12px 4px;
        min-height: 70px;
    }

    .plan-gb {
        font-size: 1.5rem;
    }

    .ym-radio-content,
    .ym-option-label {
        padding: 14px;
        min-height: auto;
    }

    .ym-radio-content .name {
        font-size: 0.9rem;
        gap: 12px;
    }

    .ym-result-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .ym-result-tab {
        padding: 8px 0;
    }

    .ym-tab-plan-name {
        font-size: 1.2rem;
    }

    .ym-res-card:not(:last-child)::after {
        content: '▼';
        position: absolute;
        bottom: -28px;
        left: 50%;
        transform: translateX(-50%);
        color: #ddd;
        font-size: 16px;
        font-weight: bold;
    }

    .ym-res-card {
        overflow: visible;
    }
}