:root {
    --bg-color: #f8f9fa;
    --card-yellow: #ffeb3b;
    --card-blue: #03a9f4;
    --btn-green: #4caf50;
    --btn-gray: #757575;
    --text-main: #333;
}

body {
    font-family: 'Hiragino Sans', 'Meiryo', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 { font-size: 1.4rem; margin-bottom: 5px; }
p.subtitle { font-size: 0.8rem; color: #666; margin-bottom: 20px; }

/* カードエリア */
.card-container {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    width: 100%;
    justify-content: center;
}

.card-wrapper { text-align: center; flex: 1; max-width: 140px; }
.card-label { font-size: 0.85rem; font-weight: bold; margin-bottom: 8px; }

.card {
    aspect-ratio: 2/3;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border: 2px solid rgba(0,0,0,0.05);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-num { background-color: var(--card-yellow); }
.card-task { background-color: var(--card-blue); color: white; font-size: 1rem; padding: 10px; text-align: center; }

/* ボタン */
.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    align-items: center;
    margin-bottom: 30px;
}

button {
    width: 80%;
    max-width: 250px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent; /* スマホのタップ時ハイライト消去 */
}

button:active { transform: scale(0.98); opacity: 0.9; }

.btn-draw { background-color: var(--btn-green); }
.btn-reset { background-color: var(--btn-gray); font-size: 0.9rem; width: 60%; }

/* ルール一覧 */
.rule-section { width: 100%; max-width: 500px; }
.rule-section h2 { font-size: 1.1rem; border-left: 5px solid var(--card-blue); padding-left: 10px; margin-bottom: 15px; }

.rule-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.rule-cell {
    background: white;
    padding: 10px;
    border-radius: 8px;
    min-height: 45px;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-left: 4px solid #ddd;
    transition: all 0.3s ease;
}

.rule-cell.active { border-left-color: var(--card-blue); background-color: #e3f2fd; }
.rule-num { font-weight: bold; margin-right: 10px; color: #888; width: 20px; }
.rule-text { color: #333; }

@media (min-width: 480px) {
    .rule-grid { grid-template-columns: repeat(3, 1fr); }
}