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

body {
    font-family: "Yuji Syuku", serif;
    background: #2d1b0e;
    color: #f5e6d0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* タイトル画面 */
#title-screen {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(180deg, #1a0f06 0%, #3d2514 50%, #2d1b0e 100%);
    z-index: 100;
}

#title-content {
    text-align: center;
    padding: 20px;
}

#title-image-container {
    margin-bottom: 16px;
}

#title-image {
    max-width: 90%;
    max-height: 40vh;
    border-radius: 8px;
    border: 2px solid rgba(232, 193, 112, 0.3);
}

#subtitle {
    font-size: 1.1rem;
    color: #c9a96e;
    margin-bottom: 8px;
}

#rule-hint {
    font-size: 0.8rem;
    color: #8a7050;
    margin-bottom: 16px;
    line-height: 1.6;
}

#start-area {
    margin-bottom: 8px;
}

button {
    font-family: "Yuji Syuku", serif;
    font-size: 1.3rem;
    padding: 14px 48px;
    border: 2px solid #e8c170;
    border-radius: 8px;
    background: rgba(232, 193, 112, 0.15);
    color: #e8c170;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover, button:active {
    background: rgba(232, 193, 112, 0.3);
}

#char-select {
    margin-bottom: 8px;
}

#select-label {
    font-size: 1rem;
    color: #c9a96e;
    margin-bottom: 12px;
}

#char-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.char-button {
    font-size: 1.3rem;
    padding: 14px 36px;
}

#copyright {
    margin-top: 32px;
    font-size: 0.8rem;
    color: #8a7050;
}

/* ゲーム画面 */
#game-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #2d1b0e;
    z-index: 50;
}

#hud {
    width: 100%;
    max-width: 480px;
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#score-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
}

.score-label {
    min-width: 80px;
}

.player-tag {
    font-size: 0.7rem;
    color: #a08860;
}

.score-label strong {
    font-size: 1.3rem;
    color: #e8c170;
}

#turn-indicator {
    font-size: 0.95rem;
    padding: 4px 16px;
    border-radius: 20px;
    background: rgba(232, 193, 112, 0.2);
    color: #e8c170;
    transition: all 0.3s;
}

#turn-indicator.cpu-turn {
    background: rgba(180, 80, 80, 0.25);
    color: #e89090;
}

#remaining {
    text-align: center;
    font-size: 0.85rem;
    color: #a08860;
}

/* 盤面 */
#board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 2px;
    padding: 4px 8px;
    max-width: 480px;
    width: 100%;
    flex: 1;
    min-height: 0;
}

.card {
    perspective: 600px;
    cursor: pointer;
    transition: transform 0.1s;
}

.card:active {
    transform: scale(0.95);
}

.card.matched {
    visibility: hidden;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.5s;
    transform-style: preserve-3d;
}

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

.card-front, .card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* 裏面（草履画像そのまま） */
.card-back {
    background: none;
}

.zori-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 表面（草履の裏に武将名） */
.card-front {
    background: none;
    transform: rotateY(180deg);
    color: #2d1b0e;
    text-align: center;
}

.card-front .zori-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(1.3) saturate(0.6);
}

.card-front .busho-label {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card-front .busho-name {
    font-size: min(1.5rem, 5vw);
    font-weight: bold;
    line-height: 1.3;
    color: #2d1b0e;
    text-shadow: 0 0 6px rgba(245, 230, 208, 0.9);
}

.card.nobunaga .card-front .zori-bg {
    filter: brightness(1.5) saturate(0.4) sepia(0.3);
}

.card.nobunaga .card-front .busho-name {
    color: #8B0000;
}

/* メッセージ */
#message-area {
    min-height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    color: #e8c170;
    padding: 8px;
    text-align: center;
}

/* 結果画面 */
#result-screen {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    z-index: 200;
}

#result-content {
    text-align: center;
    padding: 32px;
    background: linear-gradient(180deg, #3d2514, #2d1b0e);
    border: 2px solid #e8c170;
    border-radius: 16px;
    max-width: 360px;
    width: 90%;
}

#result-title {
    font-size: 2rem;
    color: #e8c170;
    margin-bottom: 16px;
}

#result-detail {
    font-size: 1rem;
    margin-bottom: 20px;
    line-height: 1.6;
}

#result-scores {
    font-size: 1.2rem;
    margin-bottom: 24px;
    line-height: 2;
}

#result-scores .winner {
    color: #e8c170;
    font-size: 1.4rem;
}
