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

:root {
    --blue: #1a56db;
    --blue-light: #3b82f6;
    --blue-bg: #eff6ff;
    --red: #dc2626;
    --red-bg: #fef2f2;
    --yellow: #f59e0b;
    --yellow-bg: #fffbeb;
    --green: #16a34a;
    --green-bg: #f0fdf4;
    --white: #fff;
    --gray50: #f9fafb;
    --gray100: #f3f4f6;
    --gray200: #e5e7eb;
    --gray300: #d1d5db;
    --gray500: #6b7280;
    --gray700: #374151;
    --gray900: #111827;
    --shadow: 0 4px 24px rgba(0, 0, 0, .08);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, .12);
    --radius: 16px;
    --radius-sm: 10px;
}

body {
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    font-size: 17px;
    line-height: 1.7;
    color: var(--gray900);
    background: linear-gradient(135deg, #eff6ff 0%, #fefce8 50%, #fff 100%);
    min-height: 100vh;
    padding-top: 60px
}

/* ===== Site Header ===== */
.site-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(0, 0, 0, .06);
    box-shadow: 0 1px 8px rgba(0, 0, 0, .04)
}

.header-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--gray900);
    font-weight: 800;
    font-size: .95rem;
    transition: opacity .2s
}

.header-logo:hover {
    opacity: .7
}

.header-logo img {
    width: 40px;
    height: 40px;
    border-radius: 50%
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 4px
}

.header-nav a {
    padding: 6px 14px;
    border-radius: 20px;
    color: var(--gray700);
    text-decoration: none;
    font-size: .85rem;
    font-weight: 600;
    transition: all .2s;
    white-space: nowrap
}

.header-nav a:hover {
    background: var(--blue-bg);
    color: var(--blue)
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background .2s
}

.hamburger:hover {
    background: var(--gray100)
}

.hamburger span {
    display: block;
    height: 2px;
    background: var(--gray700);
    border-radius: 2px;
    transition: all .3s
}

.hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg)
}

.hamburger.active span:nth-child(2) {
    opacity: 0
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg)
}

@media(max-width:640px) {
    .hamburger {
        display: flex
    }

    .header-nav {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(255, 255, 255, .95);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--gray200);
        padding: 8px 16px 16px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, .08)
    }

    .header-nav.open {
        display: flex;
        animation: fadeIn .2s ease
    }

    .header-nav a {
        padding: 12px 16px;
        border-radius: var(--radius-sm);
        font-size: .95rem;
        width: 100%
    }

    .header-nav a:hover {
        background: var(--blue-bg)
    }
}

/* ===== Hero Banner ===== */
.hero-banner {
    margin: -16px -16px 20px;
    overflow: hidden;
    border-radius: 0 0 var(--radius) var(--radius)
}

.hero-banner img {
    width: 100%;
    height: auto;
    display: block
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px
}

section {
    display: none;
    animation: fadeIn .4s ease
}

section.active {
    display: block
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

@keyframes popIn {
    0% {
        transform: scale(.8);
        opacity: 0
    }

    60% {
        transform: scale(1.05)
    }

    100% {
        transform: scale(1);
        opacity: 1
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0)
    }

    20%,
    60% {
        transform: translateX(-6px)
    }

    40%,
    80% {
        transform: translateX(6px)
    }
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, .6)
}

.card-glass {
    background: rgba(255, 255, 255, .75);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, .5)
}

h1 {
    font-size: clamp(1.6rem, 5vw, 2.2rem);
    font-weight: 800;
    text-align: center;
    background: linear-gradient(135deg, var(--blue), var(--blue-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    line-height: 1.3;
    margin-bottom: 8px
}

h2 {
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    font-weight: 700;
    color: var(--gray900);
    margin: 28px 0 14px;
    padding-left: 14px;
    border-left: 4px solid var(--blue)
}

h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray700);
    margin: 18px 0 10px
}

.subtitle {
    text-align: center;
    color: var(--gray500);
    font-size: .95rem;
    margin-bottom: 24px
}

.badge-new {
    display: inline-block;
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 6px;
    vertical-align: middle
}

.btn {
    display: block;
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    text-align: center;
    text-decoration: none
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue), var(--blue-light));
    color: #fff;
    box-shadow: 0 4px 14px rgba(26, 86, 219, .3)
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 86, 219, .4)
}

.btn-primary:active {
    transform: translateY(0)
}

.btn-secondary {
    background: var(--gray100);
    color: var(--gray700);
    margin-top: 10px
}

.btn-secondary:hover {
    background: var(--gray200)
}

.btn-danger {
    background: linear-gradient(135deg, var(--red), #ef4444);
    color: #fff
}

.btn-hard {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    color: #fff;
    box-shadow: 0 4px 14px rgba(124, 58, 237, .3)
}

.btn-hard:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, .4)
}

.choice-btn {
    display: block;
    width: 100%;
    padding: 14px 18px;
    margin-bottom: 10px;
    border: 2px solid var(--gray200);
    border-radius: var(--radius-sm);
    background: var(--white);
    font-size: 1rem;
    cursor: pointer;
    text-align: left;
    transition: all .15s;
    line-height: 1.5
}

.choice-btn:hover:not(.locked) {
    border-color: var(--blue-light);
    background: var(--blue-bg);
    transform: translateX(4px)
}

.choice-btn.correct {
    border-color: var(--green);
    background: var(--green-bg);
    animation: popIn .3s
}

.choice-btn.wrong {
    border-color: var(--red);
    background: var(--red-bg);
    animation: shake .4s
}

.choice-btn.locked {
    cursor: default;
    opacity: .7
}

.choice-btn.locked.correct {
    opacity: 1
}

.choice-btn.locked.wrong {
    opacity: 1
}

.choice-btn.reveal {
    border-color: var(--green);
    background: var(--green-bg);
    opacity: 1
}

.progress-bar {
    height: 8px;
    background: var(--gray200);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--blue-light));
    border-radius: 4px;
    transition: width .4s ease
}

.stats {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap
}

.stat {
    flex: 1;
    min-width: 80px;
    padding: 10px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: .85rem
}

.stat-label {
    color: var(--gray500);
    font-size: .75rem
}

.stat-value {
    font-weight: 800;
    font-size: 1.2rem
}

.stat-correct {
    background: var(--green-bg);
    color: var(--green)
}

.stat-penalty {
    background: var(--red-bg);
    color: var(--red)
}

.stat-q {
    background: var(--blue-bg);
    color: var(--blue)
}

.emoji-icon {
    font-size: 2.5rem;
    text-align: center;
    margin: 12px 0
}

.question-text {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.6;
    margin-bottom: 20px
}

.feedback {
    padding: 20px;
    border-radius: var(--radius-sm);
    margin: 16px 0;
    animation: popIn .3s
}

.feedback-correct {
    background: var(--green-bg);
    border: 2px solid var(--green)
}

.feedback-wrong {
    background: var(--red-bg);
    border: 2px solid var(--red)
}

.feedback h3 {
    margin-top: 0
}

.penalty-big {
    font-size: clamp(2rem, 8vw, 3.5rem);
    font-weight: 900;
    text-align: center;
    background: linear-gradient(135deg, var(--red), #f97316);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: countUp .6s ease;
    margin: 16px 0
}

.result-score {
    font-size: clamp(3rem, 10vw, 5rem);
    font-weight: 900;
    text-align: center;
    background: linear-gradient(135deg, var(--blue), var(--green));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: countUp .8s ease
}

.accordion {
    border: 1px solid var(--gray200);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    overflow: hidden
}

.accordion-header {
    padding: 14px 18px;
    background: var(--white);
    cursor: pointer;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background .2s
}

.accordion-header:hover {
    background: var(--gray50)
}

.accordion-header::after {
    content: '▼';
    font-size: .7rem;
    transition: transform .3s;
    color: var(--gray500)
}

.accordion.open .accordion-header::after {
    transform: rotate(180deg)
}

.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
    background: var(--gray50)
}

.accordion.open .accordion-body {
    max-height: 2000px
}

.accordion-content {
    padding: 14px 18px;
    font-size: .95rem;
    line-height: 1.8
}

.faq-item {
    margin-bottom: 8px
}

.mode-select {
    display: flex;
    gap: 12px;
    margin: 20px 0
}

.mode-select .btn {
    flex: 1
}

.cat-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0
}

.cat-tag {
    padding: 6px 14px;
    border-radius: 20px;
    border: 2px solid var(--gray200);
    background: var(--white);
    cursor: pointer;
    font-size: .85rem;
    font-weight: 600;
    transition: all .2s
}

.cat-tag:hover,
.cat-tag.active {
    border-color: var(--blue);
    background: var(--blue-bg);
    color: var(--blue)
}

.notice {
    background: var(--yellow-bg);
    border: 1px solid var(--yellow);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: .85rem;
    line-height: 1.6;
    margin: 16px 0
}

.notice::before {
    content: '⚠️ ';
    font-size: 1rem
}

.legal-note {
    background: var(--gray50);
    border-left: 3px solid var(--gray300);
    padding: 10px 14px;
    font-size: .85rem;
    color: var(--gray500);
    margin: 10px 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0
}

.img-fallback {
    width: 100%;
    max-width: 480px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    overflow: hidden
}

.weak-cat {
    display: inline-block;
    padding: 4px 12px;
    margin: 4px;
    border-radius: 20px;
    background: var(--red-bg);
    color: var(--red);
    font-size: .85rem;
    font-weight: 600
}

.highscore {
    text-align: center;
    color: var(--yellow);
    font-size: .9rem;
    margin-top: 8px
}

.timer {
    color: var(--gray500);
    font-size: .8rem;
    text-align: right
}

.hard-badge {
    display: inline-block;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 6px
}

.section-nav {
    display: flex;
    gap: 8px;
    margin: 16px 0;
    flex-wrap: wrap;
    justify-content: center
}

.section-nav a {
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--white);
    border: 1px solid var(--gray200);
    color: var(--gray700);
    text-decoration: none;
    font-size: .85rem;
    font-weight: 600;
    transition: all .2s
}

.section-nav a:hover,
.section-nav a.active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue)
}

.review-item {
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border: 1px solid var(--gray200)
}

.review-item.review-wrong {
    border-color: var(--red);
    background: var(--red-bg)
}

.review-item.review-correct {
    border-color: var(--green);
    background: var(--green-bg)
}

footer {
    text-align: center;
    padding: 40px 16px 32px;
    color: var(--gray500);
    font-size: .8rem;
    line-height: 1.8;
    border-top: 1px solid var(--gray200);
    margin-top: 20px
}

.footer-inner {
    max-width: 720px;
    margin: 0 auto
}

.footer-logo {
    display: inline-block;
    margin-bottom: 8px;
    transition: opacity .2s
}

.footer-logo:hover {
    opacity: .7
}

.footer-logo img {
    width: 56px;
    height: 56px;
    border-radius: 50%
}

.footer-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray700);
    margin-bottom: 8px
}

.footer-note {
    font-size: .75rem;
    color: var(--gray500);
    margin-bottom: 4px
}

.footer-copy {
    font-size: .7rem;
    color: var(--gray300);
    margin-top: 16px
}

@media(max-width:480px) {
    .container {
        padding: 10px
    }

    .card {
        padding: 18px
    }

    .stats {
        gap: 6px
    }

    .stat {
        padding: 8px
    }

    .choice-btn {
        padding: 12px 14px;
        font-size: .95rem
    }
}

/* ===== Article Pages ===== */
.breadcrumb {
    padding: 12px 0;
    font-size: .85rem;
    color: var(--gray500)
}

.breadcrumb a {
    color: var(--blue);
    text-decoration: none
}

.breadcrumb a:hover {
    text-decoration: underline
}

.article-page {
    animation: fadeIn .4s ease
}

.article-header-card {
    text-align: center
}

.article-title {
    font-size: clamp(1.3rem, 4.5vw, 1.8rem);
    line-height: 1.4;
    margin: 12px 0 16px
}

.article-category-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    background: var(--blue-bg);
    color: var(--blue);
    font-size: .8rem;
    font-weight: 600;
    margin-bottom: 8px
}

.article-meta {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: .85rem;
    color: var(--gray500)
}

.penalty-amount {
    color: var(--red);
    font-weight: 700
}

.article-hero {
    margin: -28px -28px 24px;
    overflow: hidden;
    border-radius: var(--radius) var(--radius) 0 0
}

.article-hero-img {
    width: 100%;
    height: auto;
    display: block
}

.article-body {
    font-size: 1rem;
    line-height: 1.9
}

.article-body h2 {
    font-size: 1.2rem;
    margin: 28px 0 12px
}

.article-body h3 {
    font-size: 1.05rem;
    margin: 20px 0 8px
}

.article-body p {
    margin-bottom: 16px
}

.article-body ul,
.article-body ol {
    margin: 12px 0 16px 20px
}

.article-body li {
    margin-bottom: 6px
}

.article-body .highlight-box {
    background: var(--yellow-bg);
    border: 1px solid var(--yellow);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 16px 0
}

.article-body .penalty-box {
    background: var(--red-bg);
    border: 1px solid var(--red);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 16px 0;
    text-align: center
}

.article-body .penalty-box .penalty-amount {
    font-size: 1.8rem;
    display: block;
    margin-top: 4px
}

.article-body .law-reference {
    background: var(--gray50);
    border-left: 3px solid var(--blue);
    padding: 12px 16px;
    margin: 16px 0;
    font-size: .9rem;
    color: var(--gray700);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0
}

.article-quiz-box {
    background: var(--blue-bg);
    border: 2px solid var(--blue);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin: 24px 0
}

.article-quiz-box h3 {
    color: var(--blue);
    margin-top: 0
}

.source-list {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--gray200)
}

.source-list h3 {
    font-size: .9rem;
    color: var(--gray500);
    margin-top: 0
}

.source-list ul {
    list-style: none;
    padding: 0
}

.source-list li {
    margin-bottom: 6px;
    font-size: .85rem
}

.source-list a {
    color: var(--blue);
    text-decoration: none
}

.source-list a:hover {
    text-decoration: underline
}

.related-articles {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.related-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--gray200);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--gray900);
    transition: all .2s
}

.related-card:hover {
    border-color: var(--blue-light);
    background: var(--blue-bg);
    transform: translateX(4px)
}

.related-emoji {
    font-size: 1.5rem
}

.related-title {
    flex: 1;
    font-size: .9rem;
    font-weight: 600
}

.related-penalty {
    font-size: .8rem;
    color: var(--red);
    font-weight: 700
}

/* ===== Category Page ===== */
.category-page-title {
    font-size: clamp(1.3rem, 4.5vw, 1.7rem);
    text-align: center
}

.category-article-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px
}

.category-article-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    text-decoration: none;
    color: var(--gray900);
    transition: all .2s;
    cursor: pointer
}

.category-article-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg)
}

.category-article-img {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: var(--radius-sm);
    overflow: hidden
}

.category-article-img img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.category-article-info {
    flex: 1;
    min-width: 0
}

.category-article-info h3 {
    font-size: .95rem;
    margin: 4px 0 6px;
    line-height: 1.4
}

.category-article-badge {
    font-size: .75rem;
    color: var(--gray500)
}

.category-article-preview {
    font-size: .8rem;
    color: var(--gray500);
    line-height: 1.5;
    margin-bottom: 4px
}

/* ===== Nav Grids ===== */
.article-nav {
    margin: 16px 0;
    padding: 16px;
    background: var(--gray50);
    border-radius: var(--radius-sm)
}

.cat-nav-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px
}

.cat-nav-link {
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--gray200);
    background: var(--white);
    color: var(--gray700);
    text-decoration: none;
    font-size: .8rem;
    font-weight: 600;
    transition: all .2s
}

.cat-nav-link:hover,
.cat-nav-link.active {
    border-color: var(--blue);
    background: var(--blue-bg);
    color: var(--blue)
}

/* ===== Footer Nav ===== */
.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 12px
}

.footer-nav a {
    color: var(--gray500);
    text-decoration: none;
    font-size: .75rem;
    padding: 2px 8px;
    border-radius: 10px;
    transition: all .2s
}

.footer-nav a:hover {
    color: var(--blue);
    background: var(--blue-bg)
}

@media(max-width:480px) {
    .article-hero {
        margin: -18px -18px 16px
    }

    .category-article-card {
        padding: 12px
    }

    .category-article-img {
        width: 80px;
        height: 80px
    }

    .article-meta {
        flex-direction: column;
        gap: 4px
    }
}
