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

:root {
    --ink: #0d0d0d;
    --ink-soft: #161616;
    --paper: #f5f0e8;
    --paper-dim: #c8c2b4;
    --vermillion: #d94f38;
    --vermillion-dim: #a33b28;
    --en-font: "Jost", sans-serif;
    --ja-font: "Noto Sans JP", sans-serif;
    --mono-font: monospace;

    --toggle-surface: #161616;
    --toggle-border: #2a2a2a;
    --toggle-ink: #f5f0e8;
    --toggle-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);

    --atamadaka-color: rgba(217, 79, 56, 0.9);
    --heiban-color: var(--paper);
    --nakadaka-color: rgba(210, 165, 70, 0.9);
    --odaka-color: rgba(100, 185, 120, 0.9);
    --kifuku-color: rgba(160, 120, 200, 0.85);

    --logo-mark-fill: #000;
}

html[data-theme="dark"] {
    --logo-mark-fill: #fff;
}

html[data-theme="light"] {
    --ink: #f5f0e8;
    --ink-soft: #f0ece4;
    --paper: #1a1410;
    --paper-dim: #231e1a;

    --toggle-surface: #faf7f2;
    --toggle-border: #ddd8ce;
    --toggle-ink: #1a1410;
    --toggle-shadow: 0 10px 24px rgba(26, 20, 16, 0.12);

    --atamadaka-color: rgba(200, 60, 40, 0.9);
    --heiban-color: rgba(90, 80, 65, 0.85);
    --nakadaka-color: rgba(185, 130, 20, 0.9);
    --odaka-color: rgba(50, 145, 80, 0.9);
    --kifuku-color: rgba(130, 85, 185, 0.85);

    --logo-mark-fill: #000;
}

html,
body {
    height: 100%;
    background: var(--ink);
    color: var(--paper);
    font-family: var(--en-font);
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    opacity: 0.035;
    pointer-events: none;
    z-index: 100;
}

/* Shared pitch rendering */

.pitch-drop {
    text-align: center;
    position: relative;
    background-image:
        linear-gradient(red, red),
        linear-gradient(red, red);
    background-size:
        60% 1.5px,
        1.5px 20%;
    background-position:
        top right,
        top right;
    background-repeat: no-repeat;
}

rt .pitch-drop {
    background-size: 75% 1.3px, 1.3px 40%;
}

.devoiced,
.devoice-alt {
    text-align: center;
    position: relative;
}

.devoiced::after,
.devoice-alt::before {
    content: "";
    position: absolute;
    top: 2px;
    left: -0.15em;
    width: 1.3em;
    height: 1.3em;
    border: 1px dashed currentColor;
    border-radius: 50%;
    box-sizing: border-box;
    white-space: pre;
    word-wrap: break-word;
}

.single-mora.devoiced::after,
.single-mora.devoice-alt::before {
    left: 0.3em;
}

.Atamadaka:hover {
    color: var(--atamadaka-color);
}

.Heiban:hover {
    color: var(--heiban-color);
}

.Nakadaka:hover {
    color: var(--nakadaka-color);
}

.Odaka:hover {
    color: var(--odaka-color);
}

.Kifuku:hover {
    color: var(--kifuku-color);
}

.word {
    display: inline-block;
    white-space: nowrap;
    vertical-align: bottom;
}

.word.rules_applied {
    border-bottom: none;
    padding-bottom: 0;
    box-shadow: none;
    background-image: linear-gradient(rgba(217, 79, 56, 0.45), rgba(217, 79, 56, 0.45));
    background-repeat: no-repeat;
    background-size: calc(100% - 9px) 2.5px;
    background-position: center 85%;
}

.word:hover {
    cursor: pointer;
    font-weight: 600;
}

.akusento-render-target .rules_applied {
    background-image: none !important;
    box-shadow: none !important;
    border-bottom: none !important;
}

/* Page shell */

.rule-left {
    position: fixed;
    top: 0;
    left: 64px;
    width: 1px;
    height: 100vh;
    background: linear-gradient(
        to bottom,
        transparent,
        var(--vermillion) 30%,
        var(--vermillion) 70%,
        transparent
    );
    opacity: 0.25;
}

.page {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    max-width: 1100px;
    margin: 0 auto;
}

/* Header */

header {
    padding: 52px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    opacity: 0;
    animation: fade-up 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
}

.header-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    flex-wrap: nowrap;
}

.site-nav {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.header-link {
    font-family: var(--en-font);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--paper-dim);
    text-decoration: none;
    border-bottom: 1px solid #2a2a2a;
    padding: 12px 16px;
    transition:
        color 0.2s ease,
        border-color 0.2s ease,
        transform 0.15s ease;
}

.header-link:hover {
    color: var(--paper);
    border-color: var(--vermillion);
    transform: translateY(-1px);
}

.header-link:active {
    transform: translateY(0);
}

.header-link.is-active,
.header-link[aria-current="page"] {
    color: var(--paper);
    border-color: var(--vermillion);
}

.header-link:focus-visible {
    outline: 1px solid var(--vermillion);
    outline-offset: 4px;
}

/* Logo */

.logo-jp {
    font-family: var(--en-title-font, "Jost", sans-serif);
    font-optical-sizing: auto;
    font-size: var(--logo-size, 2.25rem);
    font-weight: 400;
    letter-spacing: 0.03em;
    color: var(--logo-color, currentColor);
    display: inline-flex;
    align-items: center;
}

.logo-svg {
    display: block;
    height: 2.25rem;
    width: auto;
}

.logo-svg use {
    stroke: none;
}

.logo-svg .logo-dot,
.logo-svg .logo-o-dot,
.logo-svg .logo-flat {
    fill: var(--vermillion);
}

.logo-svg .logo-o-dot {
    transform-box: fill-box;
    transform-origin: center;
    animation: logo-o-dot-pulse 2.8s ease-in-out infinite;
}

.logo-svg .logo-drop,
.logo-svg .logo-akusento-font {
    fill: var(--logo-mark-fill, #000);
}

.logo-sep {
    width: 24px;
    height: 1px;
    background: var(--vermillion);
    display: inline-block;
    vertical-align: middle;
    margin-bottom: 2px;
}

.logo-en {
    font-family: var(--en-font);
    font-size: 0.7rem;
    font-weight: 300;
    color: var(--paper-dim);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

@keyframes logo-o-dot-pulse {
    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.65);
    }
}

/* Main landing layout */

main {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: auto auto;
    column-gap: 80px;
    align-items: start;
    padding: 40px 0 72px;
}

.main-left {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.main-right {
    grid-column: 2;
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 8px;
}

/* Status */

.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--en-font);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--vermillion);
    margin-bottom: 40px;
    opacity: 0;
    animation: fade-up 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.25s forwards;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--vermillion);
    animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(0.7);
    }
}

/* Headline */

h1 {
    font-family: var(--en-font);
    font-size: clamp(2.8rem, 4vw, 4.5rem);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.01em;
    color: var(--paper);
    margin-bottom: 12px;
    opacity: 0;
    animation: fade-up 1s cubic-bezier(0.22, 1, 0.36, 1) 0.35s forwards;
}

h1 span {
    color: var(--vermillion);
}

.subtitle-jp {
    font-family: var(--ja-font);
    font-size: clamp(1.4rem, 2vw, 2.25rem);
    font-weight: 400;
    color: var(--paper-dim);
    letter-spacing: 0.08em;
    line-height: 2;
    margin-bottom: 48px;
    opacity: 0;
    animation: fade-up 1s cubic-bezier(0.22, 1, 0.36, 1) 0.45s forwards;
}

/* Applied rules panel */

.rules-panel {
    max-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding: 0 18px;
    border: 1px solid transparent;
    background: var(--ink-soft);
    color: var(--paper-dim);
    font-family: var(--en-font);
    letter-spacing: 0.02em;
    opacity: 0;
    overflow: hidden;
    transition:
        opacity 0.35s ease,
        max-height 0.35s ease,
        margin 0.35s ease,
        padding 0.35s ease,
        border-color 0.35s ease;
}

.rules-panel.is-visible {
    max-height: 200px;
    margin-top: -28px;
    margin-bottom: 40px;
    padding: 16px 18px;
    border-color: #2a2a2a;
    opacity: 1;
    animation: fade-up 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.rules-panel-title {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--vermillion);
    margin-bottom: 8px;
}

.rules-panel-body {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--paper);
}

/* Description */

.divider {
    width: 40px;
    height: 2px;
    background: var(--vermillion);
    margin-bottom: 36px;
    opacity: 0;
    animation: expand 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.55s forwards;
    transform-origin: left;
}

.description {
    font-family: var(--en-font);
    font-size: 1.2rem;
    font-weight: 300;
    line-height: 1.9;
    color: var(--paper-dim);
    max-width: 100%;
    margin-bottom: 48px;
    opacity: 0;
    animation: fade-up 1s cubic-bezier(0.22, 1, 0.36, 1) 0.6s forwards;
}

.description em {
    font-style: normal;
    color: var(--paper);
    font-weight: 400;
}

/* Feature list */

.features {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 72px;
    opacity: 0;
    animation: fade-up 1s cubic-bezier(0.22, 1, 0.36, 1) 0.72s forwards;
}

.feature {
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.feature-index {
    font-family: var(--en-font);
    font-size: 1rem;
    color: var(--vermillion);
    letter-spacing: 0.1em;
    min-width: 28px;
}

.feature-text {
    font-family: var(--en-font);
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--paper-dim);
    letter-spacing: 0.02em;
}

.feature-text strong {
    color: var(--paper);
    font-weight: 400;
}

/* Landing route links */

.landing-route-links {
    grid-column: 1;
    grid-row: 2;
    margin-top: 48px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    max-width: 620px;
    opacity: 0;
    animation: fade-up 1s cubic-bezier(0.22, 1, 0.36, 1) 0.82s forwards;
}

.landing-route-link {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 14px 18px;
    text-decoration: none;
    color: var(--paper-dim);
    border-top: 1px solid rgba(127, 127, 127, 0.22);
    padding-top: 18px;
}

.landing-route-link:hover .route-title {
    color: var(--vermillion);
}

.route-kicker {
    font-family: var(--en-font);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    color: var(--vermillion);
}

.route-title {
    display: block;
    font-family: var(--en-font);
    font-size: 1rem;
    color: var(--paper);
    transition: color 0.18s ease;
}

.route-copy {
    grid-column: 2;
    display: block;
    margin-top: -8px;
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--paper-dim);
}

/* Marketing claims */

.claims {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 40px;
    padding: 24px 0 24px 20px;
    border-left: 2px solid #2a2a2a;
    opacity: 0;
    animation: fade-up 1s cubic-bezier(0.22, 1, 0.36, 1) 0.65s forwards;
}

.claim {
    display: flex;
    gap: 10px;
    align-items: baseline;
}

.claim-mark {
    font-family: var(--en-font);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--vermillion);
    line-height: 1;
    flex-shrink: 0;
    margin-top: 1px;
}

.claim-text {
    font-family: var(--en-font);
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--paper-dim);
    line-height: 1.55;
    letter-spacing: 0.01em;
    font-style: italic;
}

/* Footer */

footer {
    padding: 32px 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    opacity: 0;
    animation: fade-up 1s cubic-bezier(0.22, 1, 0.36, 1) 0.95s forwards;
}

.footer-copy {
    font-family: var(--en-font);
    font-size: 0.85rem;
    color: #5d5d5d;
    letter-spacing: 0.08em;
}

.footer-email {
    font-size: 0.85rem;
    color: #5d5d5d;
    letter-spacing: 0.08em;
    text-decoration: none;
    transition: color 0.15s;
}

.footer-github svg {
    fill: #5d5d5d;
}

.footer-stack {
    display: flex;
    gap: 20px;
    align-items: center;
}

.footer-links {
    display: inline-flex;
    align-items: center;
    gap: 18px;
}

.stack-tag {
    font-family: var(--en-font);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    color: #2e2e2e;
    text-transform: uppercase;
}

/* Decorative kanji */

.deco-kanji {
    position: fixed;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--en-font);
    font-size: clamp(200px, 28vw, 340px);
    font-weight: 800;
    color: transparent;
    -webkit-text-stroke: 1px #1e1e1e;
    line-height: 1;
    pointer-events: none;
    user-select: none;
    opacity: 0;
    animation: fade-in 1.4s ease 1s forwards;
}

/* Animations */

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

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

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes expand {
    from {
        transform: scaleX(0);
        opacity: 0;
    }

    to {
        transform: scaleX(1);
        opacity: 1;
    }
}

/* Mobile */

@media (max-width: 720px) {
    .page {
        padding: 0 28px;
    }

    .rule-left {
        left: 18px;
    }

    .deco-kanji {
        display: none;
    }

    header {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 24px;
    }

    .logo-jp {
        flex: 1 1 100%;
        min-width: 0;
    }

    .logo-svg {
        max-width: min(100%, 300px);
        height: auto;
    }

    .header-actions {
        width: 100%;
        min-width: 0;
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: flex-end;
        gap: 10px;
    }

    .site-nav {
        width: auto;
        min-width: 0;
        flex: 0 1 auto;
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 8px;
    }

    .theme-toggle {
        flex: 0 0 auto;
    }

    .header-link {
        padding: 10px 8px;
        font-size: 0.55rem;
        letter-spacing: 0.11em;
        white-space: nowrap;
    }

    main {
        display: flex;
        flex-direction: column;
        padding: 56px 0 48px;
        row-gap: 0;
    }

    .main-left {
        order: 1;
        margin-bottom: 40px;
    }

    .main-right {
        order: 2;
        padding-top: 0;
    }

    .landing-route-links {
        order: 3;
        grid-column: auto;
        grid-row: auto;
        margin-top: 42px;
        max-width: none;
    }

    .landing-route-link {
        grid-template-columns: 34px 1fr;
    }

    .description {
        font-size: 1.08rem;
    }

    .feature-text {
        font-size: 1.05rem;
    }

    .notify-row {
        flex-direction: column;
    }

    .notify-input {
        border-right: 1px solid #2a2a2a;
        border-bottom: none;
    }

    .notify-btn {
        padding: 14px;
    }

    footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

@media (max-width: 390px) {
    .header-actions {
        justify-content: flex-start;
        gap: 8px;
    }

    .site-nav {
        gap: 6px;
    }

    .header-link {
        padding: 9px 6px;
        font-size: 0.5rem;
        letter-spacing: 0.09em;
    }
}