:root {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --accent: #00ffcc;
    --tab-bg: #1a1a1a;
    --font-retro: 'DotGothic16', monospace;
    --tab-height: 60px;
}

body, html {
    margin: 0; padding: 0;
    width: 100%; height: 100%;
    overflow: hidden;
    position: fixed; 
    font-family: var(--font-retro);
    background: var(--bg-color);
    color: var(--text-color);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* インストールボタン (右上) */
.install-icon-btn {
    position: fixed;
    top: 15px; right: 15px;
    z-index: 1000;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    border: 2px solid var(--accent);
    color: var(--accent);
    font-size: 1.5rem;
    cursor: pointer;
    align-items: center; justify-content: center;
    padding: 0;
    -webkit-appearance: none; appearance: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

#content-area {
    width: 100%; height: calc(100% - var(--tab-height));
    position: relative; overflow: hidden;
}
.tab-content { display: none; width: 100%; height: 100%; }
.tab-content.active { display: block; }

/* 虚無タブ */
#void-canvas { width: 100%; height: 100%; cursor: crosshair; display: block; }
.weather-overlay {
    position: absolute; top: 10px; left: 10px;
    background: rgba(0,0,0,0.6); padding: 8px 12px;
    border-radius: 6px; pointer-events: none; text-align: left;
}
#weather-info { font-size: 0.9rem; color: #fff; margin-bottom: 2px; }
#connection-status { font-size: 0.7rem; color: #aaa; }

.gacha-hint {
    position: absolute; bottom: 20%; left: 0; width: 100%;
    text-align: center; pointer-events: none; text-shadow: 1px 1px 2px #000;
}
.gacha-hint p { margin: 0; font-size: 1.2rem; color: #fff; margin-bottom: 2px; }
.gacha-hint .prob {
    font-size: 0.65rem; color: #aaa; background: rgba(0,0,0,0.4);
    display: inline-block; padding: 2px 6px; border-radius: 4px; line-height: 1.2;
}
.blink { animation: blinker 2s linear infinite; }
@keyframes blinker { 50% { opacity: 0; } }

/* コンテナ共通 */
.container {
    padding: 20px; box-sizing: border-box;
    display: flex; flex-direction: column; align-items: center; text-align: center;
    height: 100%; 
}
.scroll-y { overflow-y: auto; padding-bottom: 50px; -webkit-overflow-scrolling: touch; }
.fit-screen { overflow: hidden; justify-content: space-between; padding-bottom: 20px; }
.spacer-huge { height: 150px; width: 100%; flex-shrink: 0; }
.spacer-medium { height: 60px; width: 100%; flex-shrink: 0; }

h2 {
    margin: 0 0 10px 0; font-size: 1.3rem; color: var(--accent);
    border-bottom: 2px solid #333; width: 100%; flex-shrink: 0;
}
h3 { margin: 15px 0 5px 0; font-size: 1.1rem; width: 100%; text-align: left; flex-shrink: 0; }
h4 { margin: 15px 0 5px 0; font-size: 0.9rem; width: 100%; text-align: left; color: #aaa; border-bottom: 1px dashed #555; flex-shrink: 0; }

.gallery { width: 100%; margin-bottom: 10px; flex-shrink: 1; min-height: 0; display: flex; flex-direction: column; gap: 5px; }
.photo-card { margin-bottom: 0; background: #000; border: 1px solid #333; padding: 4px; flex: 1; display: flex; flex-direction: column; }
.label { display: block; font-size: 0.7rem; color: var(--accent); margin-bottom: 2px; text-align: left; }
.profile-img { width: 100%; height: 100%; object-fit: cover; max-height: 18vh; }
.zoom-frame { width: 100%; height: 100%; overflow: hidden; position: relative; background: #001133; max-height: 18vh; }
.profile-img-far { width: 100%; height: 100%; object-fit: cover; transform: scale(1.5); filter: contrast(1.2); }

.spec-list { list-style: none; padding: 0; margin: 5px 0; font-size: 0.85rem; text-align: left; width: 100%; flex-shrink: 0; }
.spec-list li { margin-bottom: 2px; }
.comment { font-size: 1.0rem; font-style: italic; color: #aaa; margin: 15px 0 20px 0; min-height: 1.5em; flex-shrink: 0; }

.dev-profile { display: flex; align-items: center; background: #222; padding: 10px; border-radius: 8px; width: 100%; text-align: left; flex-shrink: 0; }
.dev-icon { font-size: 2.5rem; margin-right: 15px; }
.warning-list { text-align: left; font-size: 0.8rem; color: #ffaaaa; padding-left: 15px; margin: 0; line-height: 1.4; flex-shrink: 0; }
.warning-list li { margin-bottom: 8px; }

.credit-area { width: 100%; margin-top: 10px; border-top: 1px solid #333; padding-top: 10px; flex-shrink: 0; }
.credit-list { text-align: left; font-size: 0.75rem; color: #888; padding-left: 15px; margin: 0; line-height: 1.5; }
.credit-list li { margin-bottom: 10px; }
.credit-list strong { color: #aaa; }

/* ボタン類 */
.retro-btn {
    display: block; width: 100%; padding: 12px;
    background: #222; border: 2px solid #555; border-bottom: 4px solid #555;
    color: var(--text-color); font-family: var(--font-retro);
    font-size: 1rem; text-decoration: none; cursor: pointer; box-sizing: border-box; text-align: center;
    flex-shrink: 0;
}
.retro-btn:active { border-bottom: 2px solid #555; transform: translateY(2px); }
.cheer-btn { background: #332200; border-color: #664400; color: #ffcc00; }
.install-btn { background: #003322; border-color: var(--accent); color: var(--accent); font-weight: bold; }

/* ★修正: 画像保存ボタンのレイアウト崩れ防止★ */
#btn-download-item {
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap; /* 折り返し禁止 */
    gap: 8px; /* アイコンと文字の間隔 */
}

/* トースト */
.toast-hidden { display: none; }
#toast-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: flex-end;
    z-index: 2000; pointer-events: auto;
}
.toast-content {
    background: rgba(0, 0, 0, 0.95); border: 2px solid var(--accent);
    padding: 20px; border-radius: 10px 10px 0 0; width: 100%; max-width: 400px;
    box-shadow: 0 -5px 20px rgba(0, 255, 204, 0.3);
    animation: slideUp 0.2s ease-out; margin-bottom: var(--tab-height); text-align: center;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
#toast-title { margin: 0 0 10px 0; color: var(--accent); font-size: 1.2rem; }
#toast-msg { margin: 0 0 20px 0; font-size: 1rem; line-height: 1.5; }
#toast-actions { display: flex; justify-content: center; gap: 10px; }
.small-btn { display: inline-block; width: auto; padding: 8px 20px; font-size: 0.9rem; }

/* モーダル */
.retro-modal {
    background: rgba(0,0,0,0.95); border: 2px solid var(--text-color);
    color: var(--text-color); border-radius: 8px; width: 85%; max-width: 320px; padding: 0;
    z-index: 3000;
}
.retro-modal::backdrop { background: rgba(0,0,0,0.8); }
.modal-header { 
    background: #333; padding: 10px 15px; 
    display: flex; justify-content: center; align-items: center; position: relative; 
}
.modal-header h2 { margin: 0; font-size: 1.0rem; border: none; text-align: center; width: 100%; }
.close-modal-btn { 
    background: none; border: none; color: #fff; font-size: 1.8rem; 
    padding: 0 10px; cursor: pointer; position: absolute; right: 0; top: 50%; transform: translateY(-50%); 
}
.modal-content { 
    padding: 20px; font-size: 0.95rem; line-height: 1.8; white-space: pre-wrap; text-align: left; 
}

/* タブバー */
.tab-bar {
    position: fixed; bottom: 0; left: 0; width: 100%; height: var(--tab-height);
    background: #1a1a1a; display: flex; border-top: 2px solid #333; z-index: 100;
}
.tab-btn {
    flex: 1; border: none; background: none; color: #666;
    display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer;
}
.tab-btn .icon { font-size: 1.5rem; margin-bottom: 2px; }
.tab-btn .label { font-size: 0.7rem; font-family: var(--font-retro); }
.tab-btn.active { color: var(--accent); background: rgba(0, 255, 204, 0.1); }
