/* --- 変数定義 --- */
:root {
    --primary-color: #ff6b6b;
    --secondary-color: #feca57;
    --background-grad: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    --font-family: 'M PLUS Rounded 1c', sans-serif;
    --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-strong: 0 8px 15px rgba(0, 0, 0, 0.15);
}

/* --- 基本リセットと設定 --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--background-grad);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 40px 20px;
    color: #333;
}

main {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 30px 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-strong);
    backdrop-filter: blur(5px);
    text-align: center;
    width: 100%;
    max-width: 500px;
}

/* --- ガチャ本体 --- */
h1 {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--primary-color);
    text-shadow: 2px 2px 0px #fff, 4px 4px 0px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.result-box {
    width: 200px;
    height: 200px;
    border: 5px solid var(--secondary-color);
    border-radius: 25px;
    margin: 20px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 100px;
    font-weight: 900;
    background-color: #fff;
    box-shadow: var(--shadow-light);
    transition: all 0.3s ease;
}

.result-box.is-animating {
    opacity: 0.7;
    filter: blur(2px);
    transform: scale(1.05);
}

.codepoint-box {
    height: 1.5em;
    margin-bottom: 0;
    color: #555;
    font-family: "Courier New", Courier, monospace;
    font-size: 1.2rem;
    font-weight: bold;
    background-color: #f0f0f0;
    padding: 5px 10px;
    border-radius: 8px;
    display: inline-block;
}

.button-container {
    margin-top: 25px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

#draw-button {
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 50px;
    box-shadow: var(--shadow-light);
    transition: all 0.2s ease-in-out;
    text-transform: uppercase;
}

#draw-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: var(--shadow-strong);
}

#draw-button:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: var(--shadow-light);
}

#draw-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.share-button {
    padding: 15px 25px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    color: #fff;
    background-color: #3498db;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    box-shadow: var(--shadow-light);
    font-family: var(--font-family);
}

.share-button:hover:not(.x-button) {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: var(--shadow-strong);
}

.share-button.x-button {
    background-color: #000000;
}

.share-button.x-button:hover {
    background-color: #333;
    transform: translateY(-2px);
    box-shadow: var(--shadow-strong);
}

.share-button i {
    margin-right: 8px;
}

#comment{
    margin-top: 20px;
    font-size: 0.85rem;
    color: #555;
    background-color: rgba(255, 255, 255, 0.5);
    padding: 12px 15px;
    border-radius: 10px;
    line-height: 1.6;
    max-width: 90%;
    margin: 20px auto 0 auto;
}

/* --- 履歴セクション --- */
.history-section {
    margin-top: 40px;
    width: 100%;
}

.history-section h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #555;
    text-align: center;
    margin-bottom: 15px;
}

#history-list {
    list-style: none;
    padding: 8px;
    max-height: 300px;
    overflow-y: auto;
    border-radius: 15px;
    background-color: rgba(255, 255, 255, 0.7);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

#history-list li {
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
    border-radius: 10px;
}

#history-list li:last-child {
    border-bottom: none;
}

#history-list li:hover {
    background-color: #fff9e6;
}

.history-char {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.history-code {
    font-family: "Courier New", Courier, monospace;
    color: #888;
    background-color: #f5f5f5;
    padding: 3px 8px;
    border-radius: 5px;
}