/* ==========================================================================
   HEISEI RETRO CAMERA - Y2K STYLESHEET
   ========================================================================== */

/* 1. Core Design System & Variables */
:root {
    --bg-color: #fce4ec; /* Y2Kパステルピンク */
    --phone-color: #ff69b4; /* ガラケーのメタリックピンク */
    --phone-accent: #ff1493; /* ディープピンク */
    --phone-metal: #e0e0e0; /* シルバーの金属パーツ */
    --key-bg: #ffffff; /* キーの背景色 */
    --key-text: #333333;
    --lcd-bg: #8fa382; /* 懐かしのモノクロ液晶風グリーン（デフォルト時） */
    --lcd-glow: #e0f2f1; /* 液晶バックライト光 */
    --text-color: #2c3e50;
    --neon-blue: #00ffff;
    --neon-yellow: #fff350;
    
    /* Fonts */
    --font-pixel: 'DotGothic16', 'VT323', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #e8eaf6;
    /* Y2Kレトロフューチャーなグラデーションとグリッド背景 */
    background-image: 
        linear-gradient(45deg, #f3e5f5 25%, transparent 25%), 
        linear-gradient(-45deg, #f3e5f5 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #f3e5f5 75%), 
        linear-gradient(-45deg, transparent 75%, #f3e5f5 75%),
        linear-gradient(135deg, #ffdeeb 0%, #cbe3fc 100%);
    background-size: 40px 40px, 40px 40px, 40px 40px, 40px 40px, 100% 100%;
    font-family: var(--font-pixel);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

/* 2. Layout Wrapper */
.app-wrapper {
    width: 100%;
    max-width: 900px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Header Design (Y2K Neon Pop Style) */
.app-header {
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 2px 2px 0px #ffffff, 4px 4px 0px rgba(255, 20, 147, 0.2);
}

.logo-text {
    font-size: 2.5rem;
    color: var(--phone-accent);
    letter-spacing: 2px;
    animation: rainbow-glow 8s infinite linear;
}

.sub-text {
    font-size: 1rem;
    margin-top: 5px;
    color: #4a5568;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 4px 12px;
    border-radius: 12px;
    display: inline-block;
    border: 2px dashed var(--phone-color);
}

.main-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 40px;
    width: 100%;
    flex-wrap: wrap;
}

/* 3. The Garakei (Feature Phone) Machine Body */
.phone-case {
    background: linear-gradient(135deg, #ff80df 0%, #ff1493 50%, #b30059 100%);
    border: 8px solid #4a0d25;
    border-radius: 36px;
    box-shadow: 
        0 15px 0px #300414, 
        0 25px 30px rgba(0,0,0,0.4),
        inset 0 4px 6px rgba(255,255,255,0.6),
        inset 0 -10px 10px rgba(0,0,0,0.3);
    width: 360px;
    display: flex;
    flex-direction: column;
    overflow: visible;
    position: relative;
    user-select: none;
    transform: perspective(800px) rotateX(5deg);
}

/* Upper Part (Screen Half) */
.phone-upper {
    padding: 20px 20px 15px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(to bottom, rgba(255,255,255,0.15), rgba(0,0,0,0.15));
    border-radius: 28px 28px 0 0;
}

.speaker {
    width: 60px;
    height: 8px;
    background-color: #300414;
    border-radius: 4px;
    margin-bottom: 15px;
    box-shadow: inset 0 2px 2px rgba(0,0,0,0.6), 0 1px 1px rgba(255,255,255,0.3);
}

.screen-bezel {
    width: 100%;
    background-color: #1a1a1a;
    border: 5px solid #2d2d2d;
    border-radius: 16px;
    padding: 8px;
    box-shadow: 
        inset 0 3px 6px rgba(0,0,0,0.8),
        0 2px 2px rgba(255,255,255,0.1);
}

.screen-inner {
    background-color: #000;
    width: 100%;
    height: 340px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    border: 2px solid #000;
}

/* Status Bar */
.status-bar {
    height: 22px;
    background-color: #111;
    color: #00ff00; /* レトログリーン */
    font-size: 9px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
    border-bottom: 1px solid #222;
    letter-spacing: 0px;
    white-space: nowrap;
}

.sig-bars {
    color: #00ff00;
}

.quality-mode {
    color: #ffeb3b; /* 黄金色 */
    font-weight: bold;
    font-size: 8px;
    border: 1px solid #ffeb3b;
    padding: 0px 3px;
    border-radius: 3px;
    line-height: 1.2;
    transform: scale(0.85);
    white-space: nowrap;
    margin: 0 2px;
}

/* LCD Screen Display Area */
.screen-display {
    flex-grow: 1;
    position: relative;
    background-color: #111;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#display-canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated; /* ドットをくっきり引き伸ばす */
    image-rendering: crisp-edges;
    display: block;
}

#display-canvas.fit-contain {
    object-fit: contain;
    background-color: #0f1519; /* 全体表示時の余白 */
}

/* Placeholder State */
.screen-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #2b3a4a;
    color: #e0f2f1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    z-index: 10;
    gap: 15px;
    background-image: radial-gradient(circle, #2c3e50 0%, #0f171e 100%);
}

.placeholder-icon {
    font-size: 3.5rem;
    animation: bounce-slow 2s infinite ease-in-out;
}

.placeholder-title {
    font-size: 14px;
    line-height: 1.5;
    color: #00ffff;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

.placeholder-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 80%;
}

.screen-btn {
    background: linear-gradient(to bottom, #ff5e97, #e1005f);
    border: 2px solid #fff;
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-family: var(--font-pixel);
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 4px 0 #8c003a, 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.1s, box-shadow 0.1s;
}

.screen-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #8c003a, 0 2px 3px rgba(0,0,0,0.3);
}

/* Scanlines Effect Overlay */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        rgba(0, 0, 0, 0.15) 0px,
        rgba(0, 0, 0, 0.15) 1px,
        transparent 2px,
        transparent 4px
    );
    pointer-events: none;
    z-index: 5;
}

/* LCD Pixel Grid Overlay */
.lcd-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(to right, rgba(0, 0, 0, 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
    background-size: 3px 3px;
    pointer-events: none;
    z-index: 4;
}

/* Flash Effect overlay */
.flash-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    opacity: 0;
    pointer-events: none;
    z-index: 20;
}

.flash-active {
    animation: flash-animation 0.4s ease-out;
}

/* Screen Guide (Footer) */
.screen-guide {
    height: 24px;
    background: linear-gradient(to bottom, #222, #111);
    border-top: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 6px;
    color: #e0f2f1;
    font-size: 11px;
}

.guide-item {
    flex: 1;
    text-align: center;
    color: #00ffff;
    font-weight: bold;
}
.guide-item:first-child { text-align: left; }
.guide-item:last-child { text-align: right; color: #ff1493; }

/* Hinge (Center Folding Part) */
.phone-hinge {
    height: 25px;
    background: linear-gradient(to bottom, #b30059, #660033);
    border-top: 2px solid rgba(255,255,255,0.2);
    border-bottom: 2px solid rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    position: relative;
}

.hinge-center {
    width: 80%;
    height: 100%;
    background: linear-gradient(to right, #4a0d25, #ff69b4, #4a0d25);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}

/* Lower Part (Keyboard Side) */
.phone-lower {
    background: linear-gradient(to bottom, #ff1493 0%, #b30059 100%);
    padding: 15px 20px 25px 20px;
    border-radius: 0 0 28px 28px;
}

.keypad-container {
    background-color: rgba(0,0,0,0.3);
    border-radius: 16px;
    padding: 12px;
    border: 3px solid rgba(0,0,0,0.4);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.6);
}

/* Navigation and D-Pad */
.navigation-keys {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    position: relative;
    height: 100px;
}

.key-btn {
    background: linear-gradient(135deg, #ffffff 0%, #dedede 100%);
    border: none;
    border-radius: 10px;
    color: var(--key-text);
    font-family: var(--font-pixel);
    cursor: pointer;
    box-shadow: 
        0 4px 0px #9e9e9e,
        0 6px 10px rgba(0,0,0,0.4);
    transition: all 0.05s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-weight: bold;
}

.key-btn:active, .key-btn.active {
    transform: translateY(3px);
    box-shadow: 
        0 1px 0px #9e9e9e,
        0 2px 4px rgba(0,0,0,0.4);
}

.side-btn {
    width: 55px;
    height: 45px;
    font-size: 10px;
    border: 2px solid #ff1493;
}

.side-btn .key-label {
    margin-top: 2px;
    font-size: 11px;
}

/* Cross / Directional Key (D-Pad) */
.d-pad {
    position: relative;
    width: 100px;
    height: 100px;
}

.d-btn {
    position: absolute;
    background: linear-gradient(135deg, #e0e0e0 0%, #bdbdbd 100%);
    border: 1px solid #9e9e9e;
    color: #333;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 3px 0 #757575, 0 3px 5px rgba(0,0,0,0.3);
    transition: all 0.05s;
    font-family: var(--font-pixel);
}

.d-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #757575, 0 1px 3px rgba(0,0,0,0.3);
}

.d-up {
    top: 0; left: 32px; width: 36px; height: 28px;
    border-radius: 6px 6px 0 0;
}
.d-down {
    bottom: 0; left: 32px; width: 36px; height: 28px;
    border-radius: 0 0 6px 6px;
}
.d-left {
    top: 32px; left: 0; width: 28px; height: 36px;
    border-radius: 6px 0 0 6px;
}
.d-right {
    top: 32px; right: 0; width: 28px; height: 36px;
    border-radius: 0 6px 6px 0;
}

.d-ok {
    top: 30px;
    left: 30px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    z-index: 2;
    background: linear-gradient(135deg, #ff1493 0%, #ff69b4 100%);
    color: white;
    border: 2px solid #ffffff;
    font-size: 11px;
    font-weight: bold;
    box-shadow: 0 4px 0 #9c004f, 0 4px 8px rgba(0,0,0,0.4);
}

.d-ok:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #9c004f, 0 2px 4px rgba(0,0,0,0.4);
}

/* Numeric Keys (3x4 Grid) */
.num-keys {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.num-btn {
    height: 46px;
    font-size: 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.num-btn .num {
    font-size: 18px;
    font-weight: bold;
}

.num-btn .letters {
    font-size: 8px;
    color: #666;
    margin-top: -2px;
}

/* バックライト点灯エフェクト（ホバー/アクティブ時） */
.num-btn:hover {
    background: linear-gradient(135deg, #fff9c4 0%, #fff59d 100%);
    box-shadow: 
        0 4px 0px #fbc02d,
        0 6px 10px rgba(0,0,0,0.3),
        0 0 8px rgba(255, 235, 59, 0.6);
}

/* 4. Outside Control Panel (Sidebar) */
.control-panel {
    background: rgba(255, 255, 255, 0.85);
    border: 4px solid var(--phone-color);
    border-radius: 20px;
    padding: 20px;
    width: 340px;
    box-shadow: 8px 8px 0px rgba(255, 105, 180, 0.2), 0 10px 20px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.panel-section {
    margin-bottom: 20px;
}

.panel-section:last-child {
    margin-bottom: 0;
}

.panel-section h3 {
    color: var(--phone-accent);
    border-bottom: 2px dashed var(--phone-color);
    padding-bottom: 6px;
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.filter-indicator {
    background-color: #2b3a4a;
    color: #00ffff;
    padding: 8px;
    border-radius: 8px;
    text-align: center;
    font-size: 13px;
    margin-bottom: 12px;
    border: 2px solid #1a2530;
}

.filter-controls {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
    gap: 4px;
}

.filter-controls label {
    font-size: 12px;
    font-weight: bold;
}

.filter-controls input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e0e0e0;
    outline: none;
}

.filter-controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--phone-accent);
    cursor: pointer;
    border: 2px solid white;
}

.filter-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.filter-preset-btn {
    background-color: #fff;
    border: 2px solid #ccc;
    border-radius: 8px;
    padding: 6px;
    font-family: var(--font-pixel);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-preset-btn:hover {
    border-color: var(--phone-color);
    background-color: #fff0f6;
}

.filter-preset-btn.active {
    background-color: var(--phone-accent);
    color: white;
    border-color: var(--phone-accent);
    box-shadow: 0 0 5px rgba(255, 20, 147, 0.4);
}

.instructions ul {
    list-style-type: none;
}

.instructions li {
    font-size: 11px;
    margin-bottom: 8px;
    line-height: 1.4;
    position: relative;
    padding-left: 14px;
}

.instructions li::before {
    content: "★";
    position: absolute;
    left: 0;
    color: var(--phone-accent);
    font-size: 9px;
    top: 2px;
}

/* Footer Styles */
.app-footer {
    width: 100%;
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    font-size: 10px;
    color: #7f8c8d;
    border-top: 1px dashed #bdc3c7;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes rainbow-glow {
    0%, 100% { color: var(--phone-accent); text-shadow: 0 0 8px rgba(255,20,147,0.3); }
    33% { color: #8e44ad; text-shadow: 0 0 8px rgba(142,68,173,0.3); }
    66% { color: #2980b9; text-shadow: 0 0 8px rgba(41,128,185,0.3); }
}

@keyframes bounce-slow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes flash-animation {
    0% { opacity: 0; }
    20% { opacity: 1; }
    100% { opacity: 0; }
}

/* Media Queries for smaller screens */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        align-items: center;
    }
}

/* Side keys styling (Zoom / Flash) */
.side-keys {
    position: absolute;
    left: -14px;
    top: 460px; /* キーパッド「ｶﾒﾗ切替」の横に移動 */
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10;
}

.side-key-btn {
    width: 20px;
    height: 36px;
    background: linear-gradient(to right, #dedede 0%, #bdbdbd 100%);
    border: 2px solid #5a0d25;
    border-radius: 6px 0 0 6px;
    color: #333;
    font-family: var(--font-pixel);
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 
        -3px 3px 0px rgba(0,0,0,0.4),
        inset 1px 1px 2px rgba(255,255,255,0.8);
    transition: all 0.05s ease;
    padding: 0;
}

.side-key-btn:active {
    transform: translateX(2px);
    box-shadow: 
        -1px 1px 0px rgba(0,0,0,0.4),
        inset 1px 1px 2px rgba(255,255,255,0.8);
}

#btn-side-light {
    height: 28px;
    background: linear-gradient(to right, #ffd54f 0%, #ffb300 100%);
    color: #333;
}

/* Status Bar indicators */
.status-indicators {
    display: flex;
    gap: 6px;
    font-size: 9px;
    color: #00ffff;
    white-space: nowrap;
}

.status-item {
    font-weight: bold;
}

/* 💎 Premium Button in Screen Bezel */
.screen-premium-btn {
    background: linear-gradient(to bottom, #ffd54f, #ffb300);
    border: 1px solid #fff;
    border-radius: 12px;
    color: #222;
    padding: 3px 10px;
    font-family: var(--font-pixel);
    font-size: 8px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 4px;
    box-shadow: 0 2px 0 #b78a00;
    animation: pulse-slow 1.5s infinite ease-in-out;
}

.screen-premium-btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

/* 📺 Dummy Ad Banner (Bottom of Screen) */
.ad-banner-wrapper {
    width: 100%;
    max-width: 360px;
    margin: 15px auto 5px auto;
    background-color: #fff;
    border: 3px double #e1005f;
    padding: 4px;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-family: var(--font-pixel);
}

.ad-label {
    font-size: 8px;
    color: #888;
    letter-spacing: 1px;
    text-align: left;
}

.ad-content {
    background-color: #000;
    border: 1px solid #333;
    overflow: hidden;
}

.ad-link {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    padding: 6px 8px;
    font-size: 10px;
    white-space: nowrap;
}

.ad-flash-text {
    color: #ff00ff;
    font-weight: bold;
    animation: flash-red-yellow 0.6s infinite steps(2);
}

.ad-main-text {
    color: #00ffff;
    margin: 0 4px;
    font-weight: bold;
}

.ad-action-text {
    color: #ffff00;
    font-weight: bold;
    animation: bounce-horizontal 0.8s infinite ease-in-out;
}

/* 💎 Modal overlays & dialog box styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: linear-gradient(135deg, #ffffff 0%, #fff0f5 100%);
    border: 6px solid var(--phone-color);
    border-radius: 20px;
    width: 310px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5), inset 0 2px 4px #fff;
    overflow: hidden;
    font-family: var(--font-pixel);
    text-align: center;
}

.modal-header {
    background: var(--phone-accent);
    color: white;
    padding: 8px;
    font-weight: bold;
    font-size: 12px;
    letter-spacing: 1px;
    border-bottom: 2px solid #5a0d25;
}

.modal-body {
    padding: 20px;
}

.modal-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
    animation: bounce-slow 1.5s infinite;
}

.modal-body h4 {
    color: var(--phone-accent);
    margin-bottom: 8px;
    font-size: 14px;
}

.modal-body p {
    font-size: 11px;
    color: #555;
    line-height: 1.5;
}

.modal-notice {
    font-size: 8px !important;
    color: #999 !important;
    margin-top: 10px;
}

.modal-footer {
    padding: 0 20px 20px 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.modal-btn {
    font-family: var(--font-pixel);
    padding: 8px 18px;
    border-radius: 20px;
    border: 2px solid #fff;
    cursor: pointer;
    font-weight: bold;
    font-size: 11px;
    box-shadow: 0 4px 0 rgba(0,0,0,0.15);
    transition: transform 0.05s;
}

.modal-btn:active {
    transform: translateY(2px);
    box-shadow: none;
}

.confirm-btn {
    background: linear-gradient(to bottom, #ffd54f, #ffb300);
    color: #333;
    border-color: #ffb300;
}

.cancel-btn {
    background: linear-gradient(to bottom, #e0e0e0, #bdbdbd);
    color: #555;
    border-color: #bdbdbd;
}

/* Interstitial Ad Box style */
.ad-modal-box {
    border-color: #e1005f;
    width: 320px;
}

.ad-countdown {
    font-size: 12px;
    font-weight: bold;
    color: #e1005f;
    margin-bottom: 12px;
}

.ad-interstitial-content {
    background-color: #0f1519;
    border: 3px double #e1005f;
    padding: 15px;
    margin: 10px 0;
    border-radius: 12px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
}

.ad-game-banner {
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ad-game-title {
    color: #ffff00;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(255,255,0,0.6);
}

.ad-game-desc {
    font-size: 9px;
    color: #e0f2f1;
    line-height: 1.4;
}

.ad-game-chars {
    font-size: 1.5rem;
    animation: bounce-slow 1.2s infinite;
}

.ad-game-action {
    background-color: #ff00ff;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid white;
    animation: pulse-slow 1s infinite alternate;
    cursor: pointer;
}

/* Premium activation hiding logic */
body.premium-active #ad-banner {
    display: none !important;
}

body.premium-active #screen-btn-premium {
    display: none !important;
}

body.premium-active #btn-buy-premium {
    background: #e0e0e0 !important;
    color: #888 !important;
    border-color: #ccc !important;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none !important;
}

/* Animations */
@keyframes flash-red-yellow {
    0%, 100% { color: #ff00ff; }
    50% { color: #ffff00; }
}

@keyframes bounce-horizontal {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(4px); }
}

@keyframes pulse-slow {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

/* ⛶ Fullscreen Expand Button on Cellphone Screen */
.screen-expand-btn {
    position: absolute;
    bottom: 30px; /* Above the guide bar (which has height 24px) */
    right: 8px;
    background: rgba(0, 0, 0, 0.65);
    border: 1.5px solid #00ffff;
    color: #00ffff;
    font-size: 11px;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    cursor: pointer;
    z-index: 15;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 5px rgba(0, 255, 255, 0.4);
    transition: all 0.15s ease-in-out;
}

.screen-expand-btn:active {
    transform: scale(0.9);
    background: var(--phone-accent);
    color: #fff;
    border-color: #fff;
}

/* 📱 Fullscreen Editor Overlay */
.fullscreen-editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(12, 17, 24, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 900;
    display: none; /* JS toggles 'flex' */
    flex-direction: column;
    color: #fff;
    font-family: var(--font-pixel);
}

.fullscreen-editor-overlay.active {
    display: flex;
}

/* Header */
.fullscreen-editor-overlay .editor-header {
    height: 50px;
    background: linear-gradient(to bottom, #1e293b, #0f172a);
    border-bottom: 2px solid var(--phone-accent);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.fullscreen-editor-overlay .editor-title {
    color: #ff99ff;
    font-weight: bold;
    font-size: 14px;
    letter-spacing: 1px;
    text-shadow: 0 0 8px rgba(255, 153, 255, 0.5);
}

.fullscreen-editor-overlay .editor-close-btn {
    background: #ff5e97;
    border: 2px solid #fff;
    color: #fff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-family: var(--font-pixel);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.fullscreen-editor-overlay .editor-close-btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

/* Canvas Container */
.fullscreen-editor-overlay .editor-canvas-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    background-color: #05070a;
    position: relative;
    overflow: hidden;
}

.fullscreen-editor-overlay #editor-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 3px solid #ff1493;
    box-shadow: 0 0 20px rgba(255, 20, 147, 0.4);
}

/* Scanlines overlay inside editor */
.fullscreen-editor-overlay .editor-scanlines {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: repeating-linear-gradient(
        rgba(0, 0, 0, 0.08) 0px,
        rgba(0, 0, 0, 0.08) 1px,
        transparent 2px,
        transparent 4px
    );
    pointer-events: none;
}

/* Control Panel */
.fullscreen-editor-overlay .editor-controls-panel {
    background: linear-gradient(to top, #0f172a 0%, #1e293b 100%);
    border-top: 2px solid var(--phone-color);
    padding: 16px 20px 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.5);
}

.fullscreen-editor-overlay .editor-control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fullscreen-editor-overlay .editor-control-group label {
    font-size: 12px;
    color: #00ffff;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
}

.fullscreen-editor-overlay .editor-control-group input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 10px;
    border-radius: 5px;
    background: #334155;
    outline: none;
}

.fullscreen-editor-overlay .editor-control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ff1493;
    border: 2px solid #fff;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(255, 20, 147, 0.8);
}

/* Presets Row */
.fullscreen-editor-overlay .editor-presets-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-top: 4px;
}

.fullscreen-editor-overlay .editor-preset-btn {
    background: #1e293b;
    border: 2px solid #475569;
    color: #94a3b8;
    border-radius: 8px;
    padding: 8px 4px;
    font-family: var(--font-pixel);
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.fullscreen-editor-overlay .editor-preset-btn.active {
    background: #ff1493;
    border-color: #fff;
    color: #fff;
    box-shadow: 0 0 10px rgba(255, 20, 147, 0.6);
}

/* Actions Row */
.fullscreen-editor-overlay .editor-actions-row {
    margin-top: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.fullscreen-editor-overlay .editor-quality-btn {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 2px solid #475569;
    color: #00ffff;
    padding: 10px;
    font-family: var(--font-pixel);
    font-size: 11px;
    font-weight: bold;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: all 0.1s ease-in-out;
    text-align: center;
    white-space: nowrap;
}

.fullscreen-editor-overlay .editor-quality-btn:active {
    transform: translateY(2px);
    box-shadow: none;
}

.fullscreen-editor-overlay .editor-action-btn {
    background: linear-gradient(135deg, #ffd54f 0%, #ffb300 100%);
    border: 2px solid #fff;
    color: #222;
    padding: 10px;
    font-family: var(--font-pixel);
    font-size: 13px;
    font-weight: bold;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.1s;
    text-align: center;
}

.fullscreen-editor-overlay .editor-action-btn:active {
    transform: translateY(2px);
    box-shadow: none;
}

/* ==========================================================================
   🌐 Web版限定セクション (アコーディオン・広告・PWA案内)
   ========================================================================== */

/* アプリ版（Capacitor起動）のときはWeb用コンテナを完全に非表示 */
body.is-capacitor .web-only-container,
body.is-capacitor .pwa-toast-container {
    display: none !important;
}

.web-only-container {
    width: 100%;
    max-width: 480px;
    margin: 20px auto 40px auto;
    padding: 0 10px;
    box-sizing: border-box;
}

/* アコーディオン・紹介セクション */
.intro-accordion {
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid var(--phone-color);
    border-radius: 16px;
    box-shadow: 4px 4px 0px rgba(255, 105, 180, 0.2);
    overflow: hidden;
    margin-bottom: 25px;
    font-family: 'DotGothic16', sans-serif;
}

.accordion-header {
    width: 100%;
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    color: #fff;
    border: none;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    font-weight: bold;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    outline: none;
}

.accordion-header:hover {
    background: linear-gradient(135deg, #ff85c2 0%, #ff33a3 100%);
}

.accordion-icon {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.intro-accordion.open .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease-out;
    background-color: #fff;
}

.accordion-inner {
    padding: 16px;
    font-size: 13px;
    line-height: 1.6;
    color: #333;
}

.accordion-inner h3 {
    font-size: 14px;
    color: var(--phone-accent);
    margin-top: 15px;
    margin-bottom: 6px;
    border-left: 4px solid var(--phone-color);
    padding-left: 8px;
}

.accordion-inner h3:first-child {
    margin-top: 0;
}

.accordion-inner p {
    margin-bottom: 10px;
}

.accordion-inner ul {
    margin-left: 18px;
    margin-bottom: 12px;
}

.accordion-inner li {
    margin-bottom: 6px;
}

.accordion-inner .dev-note {
    font-size: 11px;
    color: #777;
    margin-top: 15px;
    text-align: right;
    border-top: 1px dotted #ccc;
    padding-top: 8px;
}

/* 広告表示エリア */
.web-ad-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
}

.web-ad-label {
    font-family: 'DotGothic16', sans-serif;
    font-size: 10px;
    color: #999;
    margin-bottom: 4px;
    letter-spacing: 2px;
}

.admax-wrapper {
    min-height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* PWAインストール案内トースト */
.pwa-toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-120px);
    width: 90%;
    max-width: 440px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pwa-toast-container.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.pwa-toast-content {
    background: rgba(31, 41, 55, 0.95);
    backdrop-filter: blur(8px);
    border: 2px solid #ff69b4;
    border-radius: 16px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    color: #fff;
}

.pwa-toast-emoji {
    font-size: 24px;
    margin-right: 12px;
}

.pwa-toast-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    font-family: 'DotGothic16', sans-serif;
}

.pwa-toast-text strong {
    font-size: 13px;
    color: #ff69b4;
    margin-bottom: 2px;
}

.pwa-toast-text span {
    font-size: 11px;
    color: #d1d5db;
    line-height: 1.4;
}

.pwa-toast-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
    transition: color 0.2s;
}

.pwa-toast-close:hover {
    color: #fff;
}

/* PC用・スマホ用広告の出し分け（レスポンシブ） */
@media (min-width: 768px) {
    /* PC表示のとき: スマホ用を非表示、PC用を表示 */
    .ad-mobile-only {
        display: none !important;
    }
    .ad-desktop-only {
        display: flex !important;
    }
}

@media (max-width: 767px) {
    /* スマホ表示のとき: PC用を非表示、スマホ用を表示 */
    .ad-mobile-only {
        display: flex !important;
    }
    .ad-desktop-only {
        display: none !important;
    }
}
