:root {
    --chalk-white: #ffffff;
    --chalk-yellow: #fffbe6;
    --chalk-blue: #e6f7ff;
    --chalkboard-green: #2b4a3a;
    --chalkboard-border: #4a3321; /* Wood frame */
    --text-main: #ffffff;
    --text-dim: #cfd8dc;
    --font-rounded: 'M PLUS Rounded 1c', sans-serif;
}

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

body {
    background-color: #1a1a1a;
    color: var(--text-main);
    font-family: var(--font-rounded);
    min-height: 100vh;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Chalkboard Frame (Wood Texture) */
.chalkboard-frame {
    background-color: var(--chalkboard-border);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 0, 0, 0.5);
    max-width: 900px;
    width: 100%;
    border: 8px solid #5d4037;
    position: relative;
}

.chalkboard-frame::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 10%;
    right: 10%;
    height: 12px;
    background: #3e2723;
    border-radius: 4px;
}

.chalkboard-inner {
    background-color: var(--chalkboard-green);
    background-image: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.05) 0%, transparent 80%);
    border-radius: 4px;
    padding: 2rem;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

.main-visual {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
}

.hero-img {
    max-width: 400px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    /* 周りをふんわりと透過させて背景に馴染ませる */
    -webkit-mask-image: radial-gradient(circle, black 60%, transparent 100%);
    mask-image: radial-gradient(circle, black 60%, transparent 100%);
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--chalk-white);
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.1rem;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--chalk-yellow);
    margin-top: 0.5rem;
}

/* Category Chips (Magnet style) */
.category-section {
    margin-bottom: 2.5rem;
}

.category-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.chip {
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    border: 2px dashed rgba(255, 255, 255, 0.4);
    background: transparent;
    color: var(--chalk-white);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.chip:hover {
    background: rgba(255, 255, 255, 0.1);
    border-style: solid;
}

.chip.active {
    background: var(--chalk-white);
    color: var(--chalkboard-green);
    border-style: solid;
    box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.2);
    transform: rotate(-2deg);
}

/* Card Section */
.display-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
}

.card-container {
    width: 100%;
}

.card {
    border: 3px solid var(--chalk-white);
    border-radius: 8px;
    padding: 2.5rem 2rem;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Hand-drawn effect for card */
.card::after {
    content: '';
    position: absolute;
    top: -5px; left: -5px; right: -5px; bottom: -5px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    pointer-events: none;
}

.category-label {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--chalk-yellow);
    background: rgba(0, 0, 0, 0.1);
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    margin-bottom: 1rem;
    border: 1px solid var(--chalk-yellow);
}

.theme-text {
    font-size: 1.6rem;
    line-height: 1.6;
    font-weight: 400;
    color: var(--chalk-white);
}

/* Actions */
.actions {
    width: 100%;
    display: flex;
    justify-content: center;
}

.btn-chalk {
    position: relative;
    padding: 1.2rem 4rem;
    border-radius: 8px;
    border: none;
    background: #ffd54f; /* Yellow chalk/magnet color */
    color: #4e342e; /* Dark wood color for text */
    font-size: 1.5rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 8px 0px #bf9b30, 0 15px 25px rgba(0, 0, 0, 0.4);
    transition: all 0.1s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.btn-chalk::before {
    content: '👆';
    margin-right: 10px;
    font-size: 1.2rem;
}

.btn-chalk:hover {
    transform: translateY(2px);
    box-shadow: 0 6px 0px #bf9b30, 0 10px 20px rgba(0, 0, 0, 0.4);
    background: #ffeb3b;
}

.btn-chalk:active {
    transform: translateY(8px);
    box-shadow: 0 0px 0px #bf9b30, 0 5px 10px rgba(0, 0, 0, 0.2);
}

/* Animation for theme update (Chalkboard style) */
.card {
    position: relative;
    overflow: hidden;
}

/* Eraser Tool Styling */
.eraser {
    position: absolute;
    top: 5%;
    left: -80px;
    width: 60px;
    height: 90%;
    background: #5d4037;
    border-radius: 4px;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 0 15px rgba(0,0,0,0.5), 
                inset 5px 0 10px rgba(0,0,0,0.3);
    border-left: 10px solid #3e2723;
}

/* Eraser wiping animation */
.erasing .eraser {
    opacity: 1;
    animation: eraser-move 0.8s linear forwards;
}

.erasing .card-content {
    animation: erase-clip 0.8s linear forwards;
}

@keyframes eraser-move {
    0% { left: -80px; }
    100% { left: 110%; }
}

/* clip-path physically removes the text as eraser passes */
@keyframes erase-clip {
    0% { clip-path: inset(0 0 0 0); }
    100% { clip-path: inset(0 0 0 100%); }
}

/* === Chalk character-by-character writing === */
.chalk-char {
    display: inline-block;
    opacity: 0;
    filter: blur(6px);
    transform: translateY(4px) rotate(0deg);
    animation: chalk-stroke 0.15s ease-out forwards;
}

@keyframes chalk-stroke {
    0% {
        opacity: 0;
        filter: blur(6px);
        transform: translateY(4px) scaleX(0.7);
    }
    50% {
        opacity: 0.7;
        filter: blur(2px);
        transform: translateY(-1px) scaleX(1.05);
    }
    100% {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0) scaleX(1);
    }
}

/* Chalk dust particle effect on category label */
.chalk-label-appear {
    animation: label-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
}

@keyframes label-pop {
    0% { opacity: 0; transform: scale(0.5) rotate(-5deg); }
    70% { opacity: 1; transform: scale(1.1) rotate(1deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* Footer Section */
.about-section {
    max-width: 600px;
    margin: 3rem auto 1.5rem;
    padding: 1.5rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.15);
    text-align: center;
}

.about-section p {
    font-size: 0.8rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 300;
}

footer {
    padding: 1rem 0 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
}

footer a {
    color: inherit;
    text-decoration: underline;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--chalk-yellow);
}

/* Responsive */
@media (max-width: 600px) {
    .chalkboard-frame { padding: 0.5rem; border: 4px solid #5d4037; }
    .chalkboard-inner { padding: 1rem; }
    .logo h1 { font-size: 1.8rem; }
    .theme-text { font-size: 1.3rem; }
    .btn-chalk { width: 100%; }
}
