/* --- 基本設定 --- */
*, *::before, *::after { box-sizing: border-box; }

html {
    min-height: 100%;
}

body {
    background-color: #1a1a1a;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    padding-bottom: 0;
    margin: 0;
    min-height: 100vh;
    overscroll-behavior: none;
}

.main-container {
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: max-width 0.3s;
    flex: 1;
}

/* 実寸モード時はコンテナの最大幅制限を解除 */
.main-container.real-scale-active {
    max-width: none;
    width: 100%;
    padding: 0 20px;
}

header h1 { margin: 0 0 5px 0; font-size: 1.2rem; text-align: center;}
header .subtitle { font-size: 0.75rem; color: #888; text-align: center; margin-top: 0;}

/* ヘッダーリード文 */
.header-lead {
    font-size: 0.9rem;
    color: #888;
    margin-top: 8px;
    line-height: 1.8;
    text-align: center;
    letter-spacing: 0.03em;
}
.header-lead strong {
    color: #fff;
    font-weight: 500;
}
.sp-only {
    display: none;
}

.top-dashboard {
    display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; width: 100%;
}

.controls-wrapper {
    flex: 2; min-width: 300px; background: #2d2d2d; padding: 15px;
    border-radius: 8px; display: flex; flex-direction: column; gap: 12px; width: 100%;
}

.specs-panel {
    flex: 1; min-width: 280px; background: #252525; padding: 15px;
    border-radius: 8px; border: 1px solid #444; height: auto; width: 100%;
}
.specs-panel h3 { margin: 0 0 10px 0; font-size: 0.9rem; border-bottom: 1px solid #555; padding-bottom: 5px; color: #ccc; }

.spec-card {
    background: #333; border-radius: 4px; padding: 10px; border-left: 4px solid #555; font-size: 0.85rem;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.spec-card h4 { margin: 0 0 8px 0; font-size: 1rem; color: #fff; display: flex; justify-content: space-between; align-items: center; }
.spec-card table { width: 100%; border-collapse: collapse; }
.spec-card td { padding: 4px 0; color: #bbb; border-bottom: 1px solid #444; }
.spec-card td:last-child { border-bottom: none; }
.spec-card td.val { text-align: right; color: #fff; font-weight: bold; }

.no-selection-msg { color: #888; text-align: center; padding: 10px; font-size: 0.9rem; }

.device-list { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.device-row {
    display: flex; align-items: center; gap: 8px; background: #333; padding: 5px 8px;
    border-radius: 4px; border-left: 4px solid #555; width: 100%; transition: background 0.2s;
}
.device-row.selected-row { background: #444; border-left-color: #007aff; }

select {
    flex: 1; width: 0; min-width: 0; padding: 8px;
    border-radius: 4px; border: 1px solid #444; background: #222; color: white; font-size: 16px; 
}
optgroup { background: #333; color: #aaa; font-style: normal; font-weight: bold; }
option { background: #222; color: white; padding: 5px; }

button {
    padding: 8px 12px; border-radius: 4px; border: 1px solid #444; background: #222; color: white;
    cursor: pointer; font-size: 0.9rem; flex-shrink: 0;
}
button:active { background: #555; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-icon { padding: 8px 10px; font-size: 1rem; margin-left: 5px; }
.btn-remove { color: #ff453a; border-color: #552222; }
.btn-add { background: #007aff; border-color: #005bb5; width: 100%; font-weight:bold; }

/* 実寸モードボタン */
.btn-real-scale {
    background: #ff2d55; border-color: #cc2444; width: 100%; font-weight: bold; margin-bottom: 5px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-real-scale.active {
    background: #fff; color: #ff2d55; border: 2px solid #ff2d55;
}

.pc-only-controls { display: block; }

.mode-switch {
    display: flex; background: #111; border-radius: 4px;
    overflow: hidden; border: 1px solid #444; margin-bottom: 5px; width: 100%;
}
.mode-btn {
    border: none; background: transparent; color: #888;
    padding: 10px; font-weight: bold; border-radius: 0;
    cursor: pointer; font-size: 0.85rem; flex: 1;
}
.mode-btn.active { background: #007aff; color: white; }

.book-controls {
    display: none; gap: 10px; margin-top: 5px; background: #000;
    padding: 5px; border-radius: 4px; justify-content: center; align-items: center; width: 100%;
}
body.mode-book .book-controls { display: flex; }
.page-indicator { font-size: 0.8rem; color: #aaa; min-width: 60px; text-align: center; }

.comparison-stage {
    position: relative; width: 100%; 
    height: 85vh;
    min-height: 900px;
    border: 1px dashed #444; background-color: #222; overflow: hidden; border-radius: 8px;
    transition: width 0.3s, height 0.3s, min-height 0.3s, border-color 0.3s;
}

/* 実寸モード時の拡張スタイル */
.comparison-stage.real-scale-mode {
    width: 100%;         
    height: auto;        
    min-height: 150vh;   
    border: 2px solid #ff2d55;
}

.device {
    position: absolute; background: #000; border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5); 
    transition: width 0.3s, height 0.3s, box-shadow 0.2s, border-color 0.2s; 
    display: flex; justify-content: center; align-items: center;
    cursor: grab; pointer-events: auto !important; 
    border: 2px solid transparent;
    touch-action: none; 
}
.device:active { cursor: grabbing; box-shadow: 0 10px 30px rgba(0,0,0,0.7); }
.device.selected {
    border-color: #007aff; box-shadow: 0 0 25px rgba(0, 122, 255, 0.4); z-index: 999 !important;
}

/* --- ホームボタン --- */
.home-btn {
    position: absolute;
    border-radius: 50%;
    border: 2px solid #333;
    background: #101010;
    z-index: 5;
    box-shadow: inset 0 0 2px rgba(255,255,255,0.1);
}

.screen {
    background: #000; width: 100%; height: 100%;
    overflow: hidden; position: relative; border-radius: 4px; 
    display: flex; justify-content: center; align-items: center;
}
.home-screen-ui {
    width: 100%; height: 100%; background: linear-gradient(160deg, #0093E9 0%, #80D0C7 100%);
    display: none; flex-direction: column; justify-content: flex-start; align-items: center; padding-top: 8%; position: relative;
}
.app-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10%; width: 80%; pointer-events: none; }
.device.landscape .app-grid { grid-template-columns: repeat(6, 1fr); gap: 8%; width: 85%; }
.app-icon { width: 100%; aspect-ratio: 1; background: rgba(255,255,255,0.25); border-radius: 20%; backdrop-filter: blur(4px); box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.drag-hint {
    position: absolute; bottom: 20px; color: rgba(255,255,255,0.9); font-weight: bold; font-size: 0.8rem;
    background: rgba(0,0,0,0.4); padding: 6px 12px; border-radius: 20px; backdrop-filter: blur(4px); z-index: 10;
}
.screen iframe { width: 100%; height: 100%; border: none; display: none; }
.ebook-container { display: none; justify-content: center; align-items: center; background-color: #222; width: 100%; height: 100%; }
.manga-wrapper { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; gap: 0; }
.manga-img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; }
.device:not(.landscape) .manga-img { max-width: 100%; }
.device.landscape .manga-img { max-width: 50%; height: auto; max-height: 100%; }

body.mode-drag .home-screen-ui { display: flex; }
body.mode-play iframe { display: block; }
body.mode-book .ebook-container { display: flex; }
body.is-dragging iframe { pointer-events: none; }

.label {
    position: absolute; top: -30px; left: 0;
    background: #333; color: #fff; padding: 4px 8px; border-radius: 4px;
    font-size: 0.75rem; white-space: nowrap; opacity: 1.0; z-index: 200;
    cursor: grab; border: 1px solid #555;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.mobile-sticky-bar {
    display: none; position: fixed; bottom: 0; left: 0; width: 100%;
    background: rgba(20, 20, 20, 0.95); backdrop-filter: blur(10px);
    border-top: 1px solid #444; padding: 10px; z-index: 9999;
    flex-direction: column; gap: 8px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
}
.sticky-row { display: flex; gap: 10px; width: 100%; justify-content: space-between; }
.sticky-btn {
    flex: 1; padding: 12px 0; font-size: 0.85rem;
    background: #333; border: 1px solid #555; border-radius: 6px;
    display: flex; align-items: center; justify-content: center; color: #ddd;
}
.sticky-btn.active { background: #007aff; color: white; border-color: #007aff; }
.sticky-btn.btn-top { flex: 0.6; background: #444; border-color: #666; font-weight:bold; }

.sticky-book-controls {
    display: none; width: 100%; gap: 10px; align-items: center;
    background: #222; padding: 5px; border-radius: 6px;
}
body.mode-book .sticky-book-controls { display: flex; }

.scroll-top-btn {
    display: none; position: fixed; 
    bottom: 125px; right: 20px;
    width: 44px; height: 44px;
    background: #007aff; color: white;
    border-radius: 50%; border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    z-index: 9000;
    justify-content: center; align-items: center;
    font-size: 1.2rem; cursor: pointer; transition: transform 0.2s;
}
.scroll-top-btn:active { transform: scale(0.95); }

/* --- 実寸キャリブレーション用モーダル --- */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); z-index: 10000;
    justify-content: center; align-items: center;
}
.modal-content {
    background: #222; padding: 25px; border-radius: 12px; width: 90%; max-width: 500px;
    text-align: center; border: 1px solid #444; box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.modal-content h2 { margin-top: 0; color: #fff; }
.modal-content p { color: #ccc; font-size: 0.9rem; line-height: 1.5; margin-bottom: 20px; }
.modal-note {
    background: #333; color: #ffcc00; padding: 8px; border-radius: 4px; font-size: 0.85rem; font-weight: bold; margin-bottom: 20px;
}

.calibration-box {
    margin: 20px auto;
    height: 150px; 
    background: #ddd; 
    border-radius: 4px;
    position: relative;
    display: flex; justify-content: center; align-items: center;
    transition: width 0.1s;
}
.card-visual {
    width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: 10px; box-sizing: border-box;
}
.card-text { font-weight: bold; color: rgba(0,0,0,0.5); font-size: 1.2rem; }
.ruler-guide {
    position: absolute; bottom: -30px; left: 0; width: 100%; height: 15px;
    border-bottom: 1px solid #fff; display: flex; justify-content: space-between;
}
.ruler-tick { width: 1px; height: 10px; background: #fff; }
.ruler-label { color: #aaa; font-size: 0.75rem; margin-top: 15px; }

input[type=range] { width: 100%; margin: 20px 0; cursor: pointer; }

.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.btn-primary { background: #007aff; border: none; font-weight: bold; font-size: 1rem; padding: 10px 20px; }
.btn-secondary { background: #444; border: 1px solid #666; }

/* --- カラー設定 --- */
.color-1 { border: 1px solid #444; } .text-color-1 { color: #007aff; } .row-color-1 { border-left-color: #007aff; } #lbl_dev_1 { border-bottom: 2px solid #007aff; }
.color-2 { border: 1px solid #444; } .text-color-2 { color: #ff9500; } .row-color-2 { border-left-color: #ff9500; } #lbl_dev_2 { border-bottom: 2px solid #ff9500; }
.color-3 { border: 1px solid #444; } .text-color-3 { color: #34c759; } .row-color-3 { border-left-color: #34c759; }
.color-4 { border: 1px solid #444; } .text-color-4 { color: #af52de; } .row-color-4 { border-left-color: #af52de; }
.spec-border-1 { border-left-color: #007aff; } .spec-border-2 { border-left-color: #ff9500; } .spec-border-3 { border-left-color: #34c759; } .spec-border-4 { border-left-color: #af52de; }

/* ============================
   フッター
   ============================ */
.site-footer {
    background: #0a0a0a;
    margin-top: auto;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    position: relative;
}

.footer-main {
    border-top: 1px solid #222;
    padding: 50px 20px 40px;
}
.footer-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 40px;
    flex-wrap: wrap;
}

.footer-brand {
    flex: 1;
    min-width: 200px;
    max-width: 280px;
}
.footer-brand-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
    letter-spacing: 0.05em;
}
.footer-brand-desc {
    font-size: 0.75rem;
    color: #666;
    line-height: 1.8;
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 50px;
    flex-wrap: wrap;
}
.footer-col h4 {
    font-size: 0.7rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 15px 0;
    font-weight: 600;
}
.footer-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.footer-col li {
    margin-bottom: 10px;
}
.footer-col a {
    color: #999;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}
.footer-col a:hover {
    color: #fff;
}

/* 注意書き・クレジット */
.footer-notes {
    border-top: 1px solid #1a1a1a;
    padding: 20px;
    text-align: center;
}
.footer-disclaimer {
    font-size: 0.7rem;
    color: #555;
    line-height: 1.8;
    margin: 0 0 10px 0;
}
.footer-credits {
    font-size: 0.7rem;
    color: #666;
    margin: 0;
}

.footer-bottom {
    border-top: 1px solid #1a1a1a;
    padding: 20px;
    text-align: center;
}
.footer-copyright {
    font-size: 0.75rem;
    color: #444;
    letter-spacing: 0.05em;
    margin: 0;
}

/* ============================
   スペックパネル内リンク
   ============================ */
.spec-links {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #444;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.spec-link {
    display: block;
    padding: 10px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.8rem;
    transition: background 0.2s, transform 0.2s;
}

.spec-link:hover {
    transform: translateX(3px);
}

.spec-link-article {
    background: rgba(255, 255, 255, 0.05);
    color: #aaa;
    border: 1px solid #333;
}

.spec-link-article:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.spec-link-affiliate {
    background: rgba(255, 149, 0, 0.08);
    color: #ff9500;
    border: 1px solid rgba(255, 149, 0, 0.25);
}

.spec-link-affiliate:hover {
    background: rgba(255, 149, 0, 0.15);
}

/* ============================
   レスポンシブ
   ============================ */
@media (max-width: 768px) {
    .top-dashboard { flex-direction: column; gap: 15px; }
    .controls-wrapper, .specs-panel { width: 100%; min-width: 0; }
    .pc-only-controls { display: none; }
    .mobile-sticky-bar { display: flex; }
    .comparison-stage { height: 60vh; min-height: 500px; }
    h1 { font-size: 1.1rem; }
    
    .sp-only { display: inline; }
    .header-lead { font-size: 0.8rem; line-height: 1.7; }
    
    .footer-main { padding: 40px 20px 30px; }
    .footer-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 30px;
    }
    .footer-brand { max-width: 100%; }
    .footer-links { justify-content: center; gap: 30px; }
    .footer-col h4 { margin-bottom: 10px; }
    .footer-col li { margin-bottom: 8px; }
}

/* モバイルでフッターが sticky-bar に隠れないよう余白追加 */
@media (max-width: 900px) {
    .footer-bottom {
        padding-bottom: 160px;
    }
}

/* ============================
   広告セクション (Balance Tuned)
   ============================ */
.recommend-section {
    width: 100%;
    margin-top: 40px;
    margin-bottom: 40px;
    animation: fadeIn 0.5s ease;
}

.recommend-inner {
    display: flex;
    gap: 20px;
    align-items: stretch; /* 高さを揃える */
}

/* 左カラム: 記事リンク */
.recommend-article {
    flex: 1.2; /* 記事側を少し広く確保 */
    background: #252525;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px; /* 余白を増やしてリッチに */
    display: flex;
    flex-direction: column;
    min-height: 280px; /* 広告エリア(約280px)と釣り合う最低高さを確保 */
}

.recommend-article h3 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
}

.article-card {
    display: flex;
    gap: 20px;
    text-decoration: none;
    color: inherit;
    flex: 1;
    align-items: center; /* 上下中央揃え */
    transition: transform 0.2s, background 0.2s;
    border-radius: 8px;
    padding: 10px;
}
.article-card:hover {
    background: #2a2a2a;
    transform: translateY(-2px);
}

.article-thumb {
    width: 35%; /* サムネイルを大きめに */
    max-width: 200px;
    aspect-ratio: 16 / 9;
    background-size: cover;
    background-position: center;
    background-color: #111;
    border-radius: 6px;
    flex-shrink: 0;
    border: 1px solid #444;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.article-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
}

.article-title {
    margin: 0;
    font-size: 1.1rem; /* タイトルを大きく */
    font-weight: bold;
    color: #fff;
    line-height: 1.5;
}

.article-desc {
    margin: 0;
    font-size: 0.85rem;
    color: #aaa;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-btn {
    display: inline-block;
    align-self: flex-start;
    background: #007aff;
    color: white;
    font-size: 0.85rem;
    font-weight: bold;
    padding: 8px 16px;
    border-radius: 20px;
    margin-top: 5px;
    transition: background 0.2s;
}
.article-card:hover .article-btn {
    background: #005bb5;
}

/* 右カラム: アドセンス */
.recommend-ad {
    flex: 1;
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 280px; /* 高さを確保 */
}

.ad-label {
    position: absolute;
    top: 5px;
    right: 8px;
    font-size: 0.6rem;
    color: #444;
}

/* レスポンシブ対応 */
@media (max-width: 900px) {
    .recommend-inner {
        flex-direction: column;
    }
    
    .recommend-article, .recommend-ad {
        width: 100%;
        min-height: auto;
    }
    
    .article-card {
        padding: 0; /* スマホでは余白を詰める */
    }

    .article-thumb {
        width: 120px; /* スマホではサムネサイズを固定 */
    }
    
    .article-title {
        font-size: 1rem;
    }
    
    .article-desc {
        display: none; /* スマホでは説明文を消してスッキリさせる */
    }
}

/* ============================
   シェアボタン
   ============================ */
.share-area {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.btn-share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #fff;
    font-size: 0.85rem;
    font-weight: bold;
    padding: 8px 16px;
    border-radius: 20px;
    transition: opacity 0.2s, transform 0.1s;
    min-width: 100px;
}

.btn-share:hover {
    opacity: 0.8;
}
.btn-share:active {
    transform: scale(0.96);
}

.share-icon {
    margin-right: 6px;
    font-weight: normal;
    font-size: 1rem;
}

/* X (Twitter) Styling */
.btn-x {
    background-color: #000;
    border: 1px solid #333;
}

/* LINE Styling */
.btn-line {
    background-color: #06c755;
    border: 1px solid #06c755;
}