body {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: #1a1a2e;
    color: #333;
    overflow-x: hidden;
}

/* 背景のノイズ演出 */
.noise-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, #000000 4px);
    opacity: 0.08;
    pointer-events: none;
    z-index: 9999;
}

/* 上部の流れる文字 */
.marquee {
    white-space: nowrap;
    overflow: hidden;
    box-sizing: border-box;
}
.marquee span {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 15s linear infinite;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    text-shadow: 2px 2px 0 #000;
}
@keyframes marquee {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}

/* カードスタイル */
.card-container {
    perspective: 1000px;
}

.card {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.4s ease-in-out;
}

.card.flipped {
    transform: rotateY(180deg);
}

.card.matched {
    transform: rotateY(180deg);
    cursor: default;
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.card-back {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #4a5568;
}

/* トランプ風の模様 */
.card-back::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 2px solid #4a5568;
    border-radius: 4px;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 5px,
        rgba(255,255,255,0.03) 5px,
        rgba(255,255,255,0.03) 10px
    );
}

.card-back::after {
    content: "?";
    font-size: 2rem;
    font-weight: bold;
    color: #718096;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 1;
}

.card-front {
    transform: rotateY(180deg);
    background: white;
    display: flex;
    flex-direction: column;
}

.card-front img {
    width: 100%;
    height: 75%;
    object-fit: cover;
}

.card-front .title {
    flex: 1;
    padding: 4px;
    font-size: 0.65rem;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: center;
    background: #f7fafc;
}

/* マッチ時のエフェクト */
.card.matched .card-front {
    border: 3px solid #48bb78;
    animation: match-pulse 0.5s ease-out;
}

@keyframes match-pulse {
    0% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.05); }
    100% { transform: rotateY(180deg) scale(1); }
}

/* 不一致時の赤い点滅 */
.card.mismatch .card-front {
    border: 3px solid #f56565;
    animation: mismatch-shake 0.3s ease-out;
}

@keyframes mismatch-shake {
    0%, 100% { transform: rotateY(180deg) translateX(0); }
    25% { transform: rotateY(180deg) translateX(-3px); }
    75% { transform: rotateY(180deg) translateX(3px); }
}

/* タイマー */
.timer-bar {
    transition: width 1s linear;
}

.timer-danger {
    animation: timer-blink 0.5s infinite;
}

@keyframes timer-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* フェードイン */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
    animation: fade-in 0.8s ease-out forwards;
}

/* 点滅演出 */
.blink {
    animation: blinker 1.5s linear infinite;
}
@keyframes blinker {
    50% { opacity: 0; }
}

/* 進捗バーのパルスエフェクト */
.progress-pulse {
    animation: progress-pulse 2s ease-in-out infinite;
}
@keyframes progress-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* 操作ロック時のオーバーレイ */
.board-locked {
    pointer-events: none;
}

/* レスポンシブ調整 */
@media (max-width: 480px) {
    .card-back::after {
        font-size: 1.5rem;
    }
    .card-front .title {
        font-size: 0.55rem;
        padding: 2px;
    }
}

@media (max-width: 360px) {
    .card-back::after {
        font-size: 1.2rem;
    }
    .card-front .title {
        font-size: 0.5rem;
    }
}

/* モバイルのタップハイライトを無効化 */
button {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}
button:active {
    background-color: rgb(37, 99, 235) !important;
    outline: none !important;
}
.card {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}
