/* ========================================
   計算ツール共通スタイル (tools.css)
   作成日: 2026-06-04
   読み込みは style.css の後
   ======================================== */

.tool-page {
    background-color: var(--gray-50);
    min-height: 100vh;
}

/* ツール本体エリア */
.tool-container {
    max-width: 760px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* ツールヘッダー（タイトル + 説明） */
.tool-header {
    text-align: center;
    margin-bottom: 2rem;
}
.tool-header h1 {
    font-size: 1.75rem;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}
.tool-header p {
    color: var(--gray-600);
    font-size: 1rem;
    line-height: 1.7;
}
@media (max-width: 640px) {
    .tool-header h1 { font-size: 1.4rem; }
}

/* パンくず */
.tool-breadcrumb {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}
.tool-breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}
.tool-breadcrumb a:hover { text-decoration: underline; }
.tool-breadcrumb .sep { margin: 0 0.5rem; }

/* 入力カード */
.input-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.75rem 1.5rem;
    margin-bottom: 1.5rem;
}
.input-card h2 {
    font-size: 1.15rem;
    color: var(--gray-800);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.input-card h2 i { color: var(--primary-color); }

.field {
    margin-bottom: 1.25rem;
}
.field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--gray-700);
    font-size: 0.95rem;
}
.field .hint {
    display: block;
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
    line-height: 1.5;
}
.field input[type="number"],
.field input[type="text"],
.field select {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    color: var(--gray-800);
    background: #fff;
    transition: border-color 0.15s;
}
.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* 計算ボタン */
.btn-calc {
    display: block;
    width: 100%;
    padding: 0.9rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.1s, box-shadow 0.15s;
    box-shadow: var(--shadow-md);
}
.btn-calc:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-calc:active { transform: translateY(0); }
.btn-calc i { margin-right: 0.5rem; }

/* 結果カード */
.result-card {
    background: linear-gradient(135deg, #eff6ff 0%, #e0e7ff 100%);
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.result-card h2 {
    font-size: 1.1rem;
    color: var(--primary-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
@media (max-width: 480px) {
    .result-grid { grid-template-columns: 1fr; }
}
.result-cell {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    box-shadow: var(--shadow-sm);
}
.result-cell .label {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}
.result-cell .value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gray-900);
}
.result-cell .value.primary { color: var(--primary-color); }
.result-cell .value.success { color: var(--success-color); }
.result-cell .value.warning { color: var(--warning-color); }
.result-cell .value.danger { color: var(--danger-color); }
.result-cell .unit {
    font-size: 0.9rem;
    color: var(--gray-500);
    margin-left: 0.25rem;
    font-weight: 500;
}

/* 確率テーブル */
.prob-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9rem;
    background: #fff;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.prob-table th,
.prob-table td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}
.prob-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
}
.prob-table td { color: var(--gray-700); }
.prob-table tr:last-child td { border-bottom: none; }

/* チャートコンテナ */
.chart-container {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1.5rem;
    height: 360px;
    box-shadow: var(--shadow-sm);
}
.chart-container canvas {
    max-width: 100%;
    max-height: 100%;
}

/* シェアエリア */
.share-area {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    margin: 1.5rem 0;
}
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    background: #fff;
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.share-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.share-btn.x { background: #000; color: #fff; border-color: #000; }
.share-btn.x:hover { background: #333; color: #fff; }

/* 解説・記事リンク */
.explainer {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.explainer h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--gray-800);
}
.explainer p {
    color: var(--gray-700);
    line-height: 1.8;
    margin-bottom: 0.75rem;
}
.explainer ul {
    margin-left: 1.5rem;
    color: var(--gray-700);
    line-height: 2;
}
.explainer code {
    background: var(--gray-100);
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.9em;
    color: var(--primary-dark);
}

/* 関連リンクリスト */
.related-articles {
    list-style: none;
    padding: 0;
    margin: 0;
}
.related-articles li {
    border-bottom: 1px solid var(--gray-100);
}
.related-articles li:last-child { border-bottom: none; }
.related-articles a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}
.related-articles a:hover { color: var(--primary-dark); }
.related-articles a i { color: var(--gray-400); }

/* 注意ボックス（依存症啓発・免責等） */
.notice-box {
    background: #fef3c7;
    border-left: 4px solid var(--warning-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    color: #78350f;
    font-size: 0.9rem;
    line-height: 1.7;
}
.notice-box strong { color: #92400e; }
.notice-box a {
    color: #92400e;
    text-decoration: underline;
    font-weight: 600;
}

/* 関連記事リンク枠（中立スタイル・内部リンク用） */
.related-link-box {
    background: #f8fafc;
    border: 1px solid var(--gray-200);
    border-left: 3px solid var(--primary-color);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.25rem;
    margin: 1.5rem 0;
}
.related-link-box .label {
    font-size: 0.78rem;
    color: var(--gray-500);
    font-weight: 600;
    margin-bottom: 0.4rem;
    letter-spacing: 0.04em;
}
.related-link-box .label i { margin-right: 0.3rem; color: var(--gray-400); }
.related-link-box h3 {
    font-size: 1rem;
    color: var(--gray-800);
    margin-bottom: 0.4rem;
    font-weight: 600;
}
.related-link-box p {
    color: var(--gray-600);
    line-height: 1.65;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
.related-link-box a.related-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}
.related-link-box a.related-link:hover { text-decoration: underline; }

/* スポンサー枠（外部広告・アフィリエイト用に予約） */
.sponsor-box {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fcd34d;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin: 1.5rem 0;
}
.sponsor-box .sponsor-label {
    font-size: 0.8rem;
    color: #92400e;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}
.sponsor-box .sponsor-label i { margin-right: 0.3rem; }
.sponsor-box h3 {
    font-size: 1.05rem;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}
.sponsor-box p {
    color: var(--gray-700);
    line-height: 1.7;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}
.sponsor-box a.cta-link {
    display: inline-block;
    background: #d97706;
    color: #fff;
    padding: 0.6rem 1.3rem;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
}
.sponsor-box a.cta-link:hover { background: #b45309; }

/* ツール一覧ページ */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin: 2rem 0;
}
.tool-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.15s, box-shadow 0.15s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--gray-100);
}
.tool-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}
.tool-card .icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.tool-card h3 {
    font-size: 1.05rem;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}
.tool-card p {
    font-size: 0.88rem;
    color: var(--gray-600);
    line-height: 1.6;
    flex-grow: 1;
}
.tool-card .tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: var(--gray-100);
    color: var(--gray-600);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    margin-top: 0.75rem;
    align-self: flex-start;
}
.tool-card .tag.new {
    background: #dcfce7;
    color: #15803d;
}

/* レスポンシブ */
@media (max-width: 640px) {
    .tool-container { margin: 1rem auto; padding: 0 0.75rem; }
    .input-card, .result-card, .explainer, .chart-container { padding: 1.25rem 1rem; }
    .result-cell .value { font-size: 1.2rem; }
    .chart-container { height: 280px; }
}
