@import url('https://fonts.googleapis.com/css2?family=Mochiy+Pop+One&family=Noto+Sans+JP:wght@400;700&display=swap');

body {
    font-family: 'Mochiy Pop One', 'Noto Sans JP', sans-serif;
    /* X内蔵ブラウザでも確実に中央に配置されるよう調整 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 15px 0;
    background: linear-gradient(135deg, #d79944, #e8c59c, #8c4a32);
    animation: gradient 12s ease infinite;
    background-size: 400% 400%;
    position: relative;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* 背景の絵文字 */
body::before {
    content: '🌰 🍶 🌰';
    position: absolute;
    top: 5%;
    left: 2%;
    font-size: 2em;
    color: rgba(255, 255, 255, 0.3);
    transform: rotate(-15deg);
}

body::after {
    content: '🍶 🌰 🍶';
    position: absolute;
    bottom: 5%;
    right: 2%;
    font-size: 2em;
    color: rgba(255, 255, 255, 0.3);
    transform: rotate(15deg);
}

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* コンテナが画面からはみ出したり左に寄ったりしないよう max-width と margin を調整 */
.container {
    text-align: center;
    background: rgba(255, 253, 247, 0.96);
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 92%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    border: 4px solid #8c4a32;
    margin: 0 auto; /* 確実に中央配置にする */
}

h1 {
    margin: 0 0 15px 0;
    color: #8c4a32;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    font-size: 1.4em;
    line-height: 1.3;
}

h1 span {
    font-size: 0.75em;
    color: #d79944;
}

.input-area {
    margin-bottom: 15px;
}

.draw-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.button-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    position: relative;
    z-index: 10;
}

button {
    padding: 12px 20px;
    background: linear-gradient(45deg, #d79944, #e07a5f);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.05em;
    font-family: inherit;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s, box-shadow 0.3s;
    min-height: 44px;
}

button:hover:not(:disabled) {
    transform: scale(1.03);
    box-shadow: 0 6px 12px rgba(224, 122, 95, 0.4);
}

button:disabled {
    background: #cccccc;
    cursor: not-allowed;
    box-shadow: none;
}

.result {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.prizes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 5px;
    box-sizing: border-box;
}

/* 個々の賞品カード */
.prize-card {
    position: relative;
    background: #fff;
    border: 2px solid #e8c59c;
    border-radius: 10px;
    padding: 8px;
    width: 110px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-wrapper {
    position: relative;
    width: 85px;
    height: 85px;
    margin-bottom: 5px;
}

.prize-card img {
    width: 85px;
    height: 85px;
    object-fit: contain;
    border-radius: 6px;
}

.prize-card p {
    margin: 0;
    font-size: 0.75em;
    color: #4a3b32;
    word-break: break-all;
    line-height: 1.2;
}

.count-badge {
    position: absolute;
    bottom: 0px;
    right: 0px;
    background: #e07a5f;
    color: white;
    font-size: 0.75em;
    font-weight: bold;
    padding: 1px 5px;
    border-radius: 5px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.4);
    z-index: 2;
}

.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: center;
    z-index: 1000;
}

.modal-content {
    background: #fffdf7;
    border: 3px solid #8c4a32;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-sizing: border-box;
}

.modal-content h2 {
    color: #8c4a32;
    font-size: 1.2em;
    margin-top: 0;
}

#modal-results {
    overflow-y: auto;
    flex-grow: 1;
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    color: #8c4a32;
}

.close:hover {
    color: #e07a5f;
}