* {
    box-sizing: border-box
}

html {
    scroll-behavior: smooth
}

footer {
    margin: 16px 0;
    text-align: center;
}

.bottom-ad {
    margin: 16px 0;
    text-align: center;
}

:root {
    --bg: #fff;
    --surface: #f4fbf6;
    --text: #171717;
    --muted: #666;
    --line: #9dcfad;
    --accent: #187a3d;
    --accent-text: #fff;
    --w: 75%
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif
}

body.dark {
    --bg: #151515;
    --surface: #19251d;
    --text: #f7f7f7;
    --muted: #b1c7b8;
    --line: #417653;
    --accent: #58c77d;
    --accent-text: #102016
}

body.wide {
    --w: 100%
}

body.narrow {
    --w: 50%
}

header {
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 14px;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line)
}

header h1 {
    grid-column: 2;
    margin: 0;
    font-size: clamp(14px, 3vw, 18px);
    text-align: center
}

header h1 a {
    color: inherit;
    text-decoration: none;
    font-weight: 900;
    letter-spacing: .08em
}

header .header-links {
    grid-column: 1;
    justify-self: start;
    display: flex;
    gap: 8px
}

header .home,
header .shop {
    width: 40px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--accent);
    text-decoration: none;
    font-weight: 700
}

header .shop {
    cursor: pointer
}

header>div {
    grid-column: 3;
    justify-self: end;
    display: flex;
    gap: 8px
}

header svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round
}

button,
select,
input,
textarea {
    font: inherit
}

header button {
    height: 36px;
    min-width: 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--accent);
    font-weight: 700
}

.head {
    width: min(100% - 28px, 900px);
    margin: 16px auto 4px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
    gap: 20px
}

.head>div {
    grid-column: 2;
    text-align: center
}

.head .page-count {
    grid-column: 3;
    justify-self: end
}

.head small {
    color: var(--muted)
}

h1 {
    margin: 0;
    font-size: clamp(24px, 4vw, 36px)
}

.page-count {
    color: var(--muted);
    font-weight: 700;
    white-space: nowrap
}

nav {
    width: min(100% - 28px, 900px);
    margin: 18px auto;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px
}

nav a,
nav span,
nav button {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    font-weight: 700
}

nav a,
nav button {
    color: var(--accent)
}

nav span {
    opacity: .3
}

nav button.unavailable-next {
    position: relative;
    color: var(--text);
    opacity: .3;
    cursor: pointer
}

nav button.unavailable-next:hover,
nav button.unavailable-next:focus-visible {
    opacity: 1
}

nav button.unavailable-next:hover::after,
nav button.unavailable-next:focus-visible::after {
    content: attr(data-message);
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    z-index: 1;
    width: max-content;
    max-width: min(280px, 75vw);
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 3px 12px #0003;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    white-space: pre-line;
    pointer-events: none
}

.next-episode-dialog p {
    margin: 24px 0 8px;
    line-height: 1.8;
    text-align: center;
    white-space: normal
}

.share-actions {
    width: min(100% - 28px, 900px);
    margin: -6px auto 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px
}

.share-actions button,
.share-actions a {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--accent);
    border-radius: 9px;
    background: var(--accent);
    color: var(--accent-text);
    text-decoration: none;
    font-weight: 700;
    cursor: pointer
}

.share-actions a {
    border-color: #111;
    background: #111;
    color: #fff
}

.reader {
    width: min(100% - 28px, 900px);
    margin-inline: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg);
    overflow: hidden
}

.reader>img {
    display: block;
    width: var(--w);
    height: auto;
    background: #fff;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none
}

.image-author {
    width: var(--w);
    margin: 8px 0 0;
    color: var(--text);
    font-size: 14px;
    text-align: center
}

.reader img[hidden] {
    display: none
}

#contentBlockerNotice {
    width: var(--w);
    min-height: min(70vh, 900px);
    margin: 0;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
    font-weight: 800;
    text-align: center
}

#contentBlockerNotice[hidden] {
    display: none
}

#contentBlockerNotice a {
    display: grid;
    color: #187a3d;
    justify-items: center
}

#contentBlockerNotice img {
    display: block;
    width: min(100%, 360px);
    height: auto
}

#adBlockBait {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    pointer-events: none
}

#commentList {
    margin-top: 24px;
    text-align: center;
}

.comments {
    width: min(100% - 28px, 900px);
    margin: 24px auto 16px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 0 0 24px
}

.comments h2 {
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between
}

.comments h2 b {
    font-size: 14px;
    color: var(--muted);
    background: var(--surface);
    padding: 4px 8px;
    border-radius: 99px
}

.comments form {
    margin-top: 24px;
    padding: 15px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 12px
}

.comments input,
.comments select,
.comments textarea {
    width: 100%;
    display: block;
    margin-bottom: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text)
}

.comments textarea {
    min-height: 80px;
    resize: vertical
}

.comments form div {
    display: flex;
    align-items: center;
    justify-content: space-between
}

.comments form button {
    padding: 10px 18px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-text);
    font-weight: 800
}

.item {
    padding: 13px 14px;
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface)
}

.meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px
}

.comment-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #080;
    color: #fff;
    font-size: 11px;
    font-weight: 700
}

.text {
    white-space: pre-wrap;
    word-break: break-word
}

#modal,
.modal {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: #000b;
    display: grid;
    place-items: center;
    padding: 20px
}

#modal[hidden],
.modal[hidden] {
    display: none
}

.dialog {
    width: min(600px, 100%);
    max-height: 64vh;
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 17px
}

.dialogHead {
    display: flex;
    justify-content: space-between;
    align-items: center
}

.dialogHead h2 {
    margin: 0
}

.latest-link {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 14px;
    border-radius: 9px;
    background: var(--accent);
    color: var(--accent-text);
    text-decoration: none;
    font-weight: 800
}

.latest-link:hover {
    filter: brightness(.92)
}

.latest-link:focus-visible {
    outline: 3px solid #73b98a;
    outline-offset: 2px
}

.dialogHead button {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    font-size: 28px;
    line-height: 1;
    cursor: pointer
}

.shop-dialog {
    max-width: 520px
}

.shop-list {
    display: grid;
    gap: 10px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none
}

.shop-list a {
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg);
    color: var(--accent);
    text-decoration: none;
    font-weight: 700
}

.shop-list a::after {
    content: "↗";
    margin-left: auto;
    padding-left: 12px
}

.shop-list a:hover {
    background: color-mix(in srgb, var(--surface) 65%, var(--accent) 10%)
}

.shop-list a:focus-visible,
.dialogHead button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px
}

.grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 7px;
    margin-top: 14px
}

.grid a {
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    color: #fff;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: 50%;
    background: #187a3d;
    font-weight: 800
}

.grid a.current {
    border-color: var(--surface);
    background: #0f5f2e;
    box-shadow: 0 0 0 3px #73b98a;
    font-weight: 900
}

.grid a:hover {
    background: #0f682f
}

.grid a:focus-visible {
    outline: 3px solid #73b98a;
    outline-offset: 2px
}

.empty {
    text-align: center;
    padding: 100px 20px
}

@media(max-width:700px) {
    .head {
        grid-template-columns: 1fr auto 1fr
    }

    nav {
        font-size: 13px
    }

    .reader>img {
        width: var(--w)
    }

    .grid {
        grid-template-columns: repeat(5, 1fr)
    }
}
