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

body {
    font-family: 'Hiragino Sans', 'Meiryo', sans-serif;
    background: linear-gradient(135deg, #1a0a0a 0%, #2d1810 50%, #1a0f05 100%);
    min-height: 100vh;
    color: #f5e6d3;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    max-width: 400px;
    width: 100%;
    padding: 15px;
}

header {
    text-align: center;
    margin-bottom: 15px;
}

h1 {
    font-size: 2rem;
    background: linear-gradient(90deg, #ffd700, #ff6347, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

.subtitle {
    color: #a89080;
    font-size: 0.9rem;
    margin-top: 5px;
}

/* ゲーム情報 */
.game-info {
    display: flex;
    justify-content: space-around;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.info-item {
    text-align: center;
}

.info-label {
    display: block;
    font-size: 0.75rem;
    color: #a89080;
}

.info-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffd700;
}

#timer {
    color: #ff6347;
}

#combo {
    color: #4ecdc4;
}

/* ゲームボード */
.game-board {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    padding: 10px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    min-height: 320px;
}

/* タイル */
.tile {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    user-select: none;
    position: relative;
}

.tile:hover:not(.empty):not(.matched) {
    transform: scale(1.1);
    z-index: 10;
}

.tile.selected {
    transform: scale(1.15);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    z-index: 20;
}

.tile.matched {
    animation: matchPop 0.4s ease-out forwards;
}

@keyframes matchPop {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); }
    100% { transform: scale(0); opacity: 0; }
}

.tile.empty {
    visibility: hidden;
}

/* 四神タイル色 */
.tile.seiryu {
    background: linear-gradient(145deg, #1e90ff, #0066cc);
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.3), 0 3px 10px rgba(30, 144, 255, 0.4);
}

.tile.suzaku {
    background: linear-gradient(145deg, #ff4500, #cc0000);
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.3), 0 3px 10px rgba(255, 69, 0, 0.4);
}

.tile.byakko {
    background: linear-gradient(145deg, #f5f5f5, #c0c0c0);
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2), 0 3px 10px rgba(245, 245, 245, 0.4);
    color: #333;
}

.tile.genbu {
    background: linear-gradient(145deg, #2f4f4f, #1a2f2f);
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.3), 0 3px 10px rgba(47, 79, 79, 0.4);
}

.tile.kirin {
    background: linear-gradient(145deg, #ffd700, #daa520);
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2), 0 3px 10px rgba(255, 215, 0, 0.5);
    color: #4a3000;
}

.tile.houou {
    background: linear-gradient(145deg, #ff69b4, #ff1493);
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.3), 0 3px 10px rgba(255, 105, 180, 0.4);
}

/* 接続線 */
.connection-line {
    position: absolute;
    background: linear-gradient(90deg, #ffd700, #ff6347);
    height: 4px;
    transform-origin: left center;
    pointer-events: none;
    z-index: 100;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

/* コントロール */
.controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.control-btn {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.start-btn {
    background: linear-gradient(145deg, #ffd700, #daa520);
    color: #333;
}

.shuffle-btn {
    background: linear-gradient(145deg, #4ecdc4, #26a69a);
    color: #fff;
}

.share-btn {
    background: linear-gradient(145deg, #1da1f2, #0d8ecf);
    color: #fff;
}

/* 結果パネル */
.result-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, #2d1810, #1a0f05);
    border: 2px solid #ffd700;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    z-index: 1000;
    min-width: 280px;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.3);
}

.result-panel h2 {
    color: #ffd700;
    margin-bottom: 15px;
}

.result-score {
    font-size: 2.5rem;
    font-weight: bold;
    color: #ff6347;
    margin-bottom: 10px;
}

.result-detail {
    color: #a89080;
    margin-bottom: 20px;
}

.result-buttons {
    display: flex;
    gap: 10px;
}

.result-buttons .control-btn {
    flex: 1;
}

/* エフェクト */
.effect-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 500;
}

.score-popup {
    position: absolute;
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    animation: scoreFloat 1s ease-out forwards;
}

.combo-popup {
    position: absolute;
    font-size: 2rem;
    font-weight: bold;
    background: linear-gradient(90deg, #ff6347, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: comboBounce 0.8s ease-out forwards;
}

@keyframes scoreFloat {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-60px) scale(1.3); }
}

@keyframes comboBounce {
    0% { opacity: 1; transform: scale(0.5); }
    50% { transform: scale(1.5); }
    100% { opacity: 0; transform: scale(1); }
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: particleFly 0.6s ease-out forwards;
}

@keyframes particleFly {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0); }
}

/* レスポンシブ */
@media (max-width: 400px) {
    .container { padding: 10px; }
    h1 { font-size: 1.6rem; }
    .tile { font-size: 1.4rem; }
    .game-board { gap: 3px; padding: 8px; }
}
