:root {
    --paper: #f6f1ea;
    --paper-2: #efe7dd;
    --ink: rgba(23, 20, 18, 0.94);
    --muted: rgba(23, 20, 18, 0.66);
    --dim: rgba(23, 20, 18, 0.52);
    --line: rgba(23, 20, 18, 0.14);
    --line-2: rgba(23, 20, 18, 0.09);
    --accent: #c65a3c;
    --accent-2: #e0a15a;
    --radius: 22px;
}

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

@font-face {
    font-family: "YOU7N Japanese";
    src: url("fonts/japanese.otf") format("opentype");
    font-display: swap;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: "CMU Serif", "Noto Serif SC", ui-serif, Georgia, "Times New Roman", serif;
    letter-spacing: 0.008em;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: transparent;
    opacity: 1;
}

body::after {
    content: "";
    position: fixed;
    inset: -40px;
    pointer-events: none;
    background-image: radial-gradient(rgba(23, 20, 18, 0.04) 0.6px, transparent 0.6px);
    background-size: 14px 14px;
    opacity: 0.13;
    transform: rotate(-1deg);
}

.page {
    min-height: 100%;
    width: min(860px, calc(100% - 44px));
    margin: 0 auto;
    padding: 56px 0 48px;
}

.hero {
    position: relative;
    padding: 0 0 22px;
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}

.hero::before {
    content: none;
}

.hero > * {
    position: relative;
    z-index: 1;
}

.hero__kicker {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

.hero__mark {
    color: var(--ink);
    font-weight: 650;
}

.hero__slash {
    color: var(--dim);
}

.hero__muted {
    color: var(--muted);
}

.hero__hello {
    margin-top: 18px;
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    font-weight: 650;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.02;
    letter-spacing: -0.04em;
}

.hero__hello.is-rtl {
    flex-direction: row-reverse;
}

.typewriter {
    display: inline-block;
    min-height: 1.05em;
}

.typewriter.lang-zh {
    font-family: "STZhongsong", "Songti SC", "Noto Serif SC", ui-serif, Georgia, serif;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.typewriter.lang-ja {
    font-family: "YOU7N Japanese", "Hiragino Mincho ProN", "Yu Mincho", "Source Han Serif JP", ui-serif, Georgia, serif;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.typewriter.lang-rtl {
    direction: rtl;
    unicode-bidi: isolate;
    text-align: right;
}

.cursor {
    width: 10px;
    height: 0.95em;
    border-radius: 4px;
    background: rgba(198, 90, 60, 0.72);
    box-shadow: 0 0 0 1px rgba(198, 90, 60, 0.12);
    transform: translateY(3px);
    animation: cursorBlink 0.78s steps(1, end) infinite;
}

.hero__ipa {
    margin-top: 14px;
    font-family: "Charis SIL", "CMU Serif", "Noto Serif SC", ui-serif, Georgia, "Times New Roman", serif;
    font-size: 13px;
    letter-spacing: 0.015em;
    color: var(--muted);
    min-height: 1.35em;
    max-width: 60ch;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.hero__copy {
    margin-top: 18px;
    display: grid;
    gap: 8px;
}

.hero__tagline {
    font-size: 18px;
    color: var(--ink);
    font-weight: 560;
    letter-spacing: -0.01em;
}

.hero__sub {
    font-size: 14px;
    color: var(--muted);
}

.hero__quick {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pill {
    text-decoration: none;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 252, 247, 0.55);
    transition: border-color 180ms ease, background 180ms ease;
}

.pill:hover {
    border-color: rgba(23, 20, 18, 0.22);
    background: rgba(255, 252, 247, 0.68);
}

.pill:focus-visible {
    outline: 3px solid rgba(198, 90, 60, 0.18);
    outline-offset: 2px;
}

.panel {
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 22px 0 0;
}

.panel__head {
    display: grid;
    gap: 6px;
    margin-bottom: 18px;
    padding-bottom: 6px;
}

.panel__title {
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 17px;
    margin: 0;
}

.cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    border-top: 1px solid var(--line);
}

.card {
    grid-column: span 1;
    position: relative;
    text-decoration: none;
    color: var(--ink);
    padding: 16px 14px;
    border-radius: 0;
    border: 0;
    background: transparent;
    overflow: hidden;
    transition: color 160ms ease;
}

.card:hover {
    background: rgba(23, 20, 18, 0.04);
}

.card > * {
    position: relative;
    z-index: 1;
}

.card:focus-visible {
    outline: 3px solid rgba(198, 90, 60, 0.18);
    outline-offset: 2px;
}

.card__row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    gap: 12px;
}

.card__title {
    font-weight: 640;
    letter-spacing: -0.02em;
    text-transform: none;
    font-size: 16px;
}

.card__tag {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
}

.card__foot {
    margin-top: 10px;
    font-size: 12px;
    color: rgba(23, 20, 18, 0.55);
    letter-spacing: 0.02em;
}

.card + .card {
    border-top: 1px solid var(--line-2);
}

.footer {
    margin-top: 6px;
    padding: 28px 0 0;
    display: grid;
    gap: 12px;
    justify-items: center;
}

.footer__social {
    display: flex;
    gap: 18px;
    align-items: center;
}

.social-icon {
    font-size: 22px;
    color: rgba(23, 20, 18, 0.68);
    text-decoration: none;
    transition: color 180ms ease;
}

.social-icon:hover {
    color: rgba(23, 20, 18, 0.9);
}

.social-icon:focus-visible {
    outline: 3px solid rgba(198, 90, 60, 0.25);
    outline-offset: 2px;
    border-radius: 10px;
}

.footer__legal {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: rgba(23, 20, 18, 0.58);
}

.no-style {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid rgba(23, 20, 18, 0.22);
    padding-bottom: 1px;
    transition: border-color 180ms ease, color 180ms ease;
}

.no-style:hover {
    color: rgba(23, 20, 18, 0.86);
    border-color: rgba(198, 90, 60, 0.5);
}

.pill--button {
    font: inherit;
    cursor: pointer;
}

.tool__title {
    margin-top: 18px;
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 650;
    letter-spacing: -0.03em;
}

.tool--jp .tool__title {
    font-family: "YOU7N Japanese", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
}

.tool__subtitle {
    margin-top: 8px;
    color: var(--muted);
    font-size: 14px;
}

.tool-panel {
    padding-top: 26px;
}

.tool-grid {
    display: grid;
    gap: 14px;
    border-top: 1px solid var(--line);
    padding-top: 18px;
}

.field {
    display: grid;
    gap: 8px;
}

.field__label {
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.tool-grid textarea {
    width: 100%;
    resize: vertical;
    min-height: 120px;
    padding: 12px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 252, 247, 0.55);
    color: var(--ink);
    font-family: "Charis SIL", "CMU Serif", "Noto Serif SC", ui-serif, Georgia, "Times New Roman", serif;
    font-size: 15px;
    line-height: 1.5;
}

.tool--jp #kanaInput,
.tool--jp #kanaInput::placeholder,
.tool--jp #RomajiOutput::placeholder,
.tool--jp #IPAoutput::placeholder {
    font-family: "YOU7N Japanese", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
}

.tool-grid textarea:focus-visible {
    outline: 3px solid rgba(198, 90, 60, 0.18);
    outline-offset: 2px;
}

.tool-grid textarea[readonly] {
    background: rgba(255, 252, 247, 0.42);
}

.tool-actions {
    display: flex;
    justify-content: flex-start;
    padding: 4px 0;
}

.tool-action {
    min-width: 120px;
    justify-content: center;
}

.output-row {
    display: grid;
    gap: 14px;
}

@keyframes cursorBlink {
    0%,
    52% {
        opacity: 1;
    }
    53%,
    100% {
        opacity: 0;
    }
}

@media (min-width: 820px) {
    .page {
        padding-top: 72px;
    }

    .output-row {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0ms !important;
        animation-duration: 0ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}
