:root {
    --phone-scale: 1;
    --phone-height: 844px;
    --bottom-offset: 0px;
    --mobile-bottom-gap: 0px;

    --lower-ui-shift: 5px;
}


/* ブラウザ画面全体 */
html,
body {
    width: 100%;
    height: 100%;

    margin: 0;
    padding: 0;

    overflow: hidden;
    overscroll-behavior: none;

    background: #ffffff;

    touch-action: manipulation;
}


/* スマホブラウザで画面全体が動かないようにする */
body {
    position: fixed;
    inset: 0;

    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        "Helvetica Neue",
        "Hiragino Sans",
        "Hiragino Kaku Gothic ProN",
        "Yu Gothic",
        sans-serif;

    -webkit-text-size-adjust: 100%;
}


/* 390px幅を基準にしたプロトタイプ全体 */
.phone {
    position: absolute;

    left: 50%;
    top: auto;
    bottom: 0;

    width: 390px;
    height: var(--phone-height);

    transform:
        translateX(-50%)
        scale(var(--phone-scale));

    transform-origin: bottom center;

    overflow: hidden;
    background: #ffffff;

    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}


/* 現在の入力画面へ入る前に表示する開始画面 */
.start-screen {
    position: absolute;
    inset: 0;

    z-index: 1000;

    overflow: hidden;
    background: #FFFFFF;

    opacity: 1;
    pointer-events: auto;
    touch-action: none;
}


.start-screen.is-finished {
    display: none;
}


/*
 * 「はじめる」・送信ボタン・注釈を一つの塊として、
 * ブラウザごとの実表示領域の中央へ置く。
 */
.start-content {
    position: absolute;
    left: 50%;
    top: 50%;

    width: 100%;
    height: 323.1px;

    transform: translate(-50%, -50%);
}


/* 塊の先頭へ「はじめる」を置く */
.start-copy {
    position: absolute;
    left: 50%;
    top: 12px;

    width: max-content;

    color: #444444;
    font-family: "Inter", sans-serif;
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0.10em;
    text-align: center;
    white-space: nowrap;

    transform: translate(-50%, -50%);
    transform-origin: center;
}


.start-copy-text {
    display: inline-block;

    text-decoration-line: underline;
    text-decoration-color: #00A9FF;
    text-decoration-thickness: 2px;
    text-decoration-skip-ink: none;
    text-underline-offset: -1px;
}


/* 入力確定と同時に、カーソルと青い下線を消す */
.start-copy.is-confirmed
.start-copy-text {
    text-decoration: none;
}


/* 入力欄と同じ仕様で点滅するカーソル */
.start-copy-cursor {
    position: absolute;
    left: calc(100% + 1px);
    top: 50%;

    width: 2px;
    height: 24px;

    background: #00A9FF;

    opacity: 1;
    transform: translateY(-50%);

    animation:
        input-cursor-blink 1s
        steps(1, end) infinite;
}


.start-copy-cursor.is-hidden {
    opacity: 0;
    animation: none;
}


/* 送信完了時、「はじめる」を加速させながら上へ飛ばす */
.start-copy.is-flying {
    animation:
        startCopyFly 0.3s linear
        forwards;
}


@keyframes startCopyFly {
    0% {
        opacity: 1;
        transform:
            translate(-50%, -50%)
            translateY(0);

        animation-timing-function:
            cubic-bezier(0.2, 0.7, 0.3, 1);
    }

    14% {
        opacity: 1;
        transform:
            translate(-50%, -50%)
            translateY(6px);

        animation-timing-function:
            cubic-bezier(0.72, 0, 1, 0.42);
    }

    100% {
        opacity: 0;
        transform:
            translate(-50%, -50%)
            translateY(-1000px);
    }
}


/*
 * 既存の70×109pxの送信ボタンと同じ比率で、
 * 横幅135pxに拡大した開始ボタン。
 */
.start-button {
    --core-scale: 0;
    --core-opacity: 0;
    --halo-scale: 0;
    --halo-opacity: 0;
    --surface-opacity: 0;

    position: absolute;
    left: 50%;
    top: 175px;

    width: 135px;
    height: 210.21px;

    padding: 0;
    border: 0;
    border-radius: 19.29px;

    appearance: none;
    -webkit-appearance: none;

    background: #43A7FF;

    opacity: 0;
    transform:
        translate(-50%, -50%)
        scale(0.985);

    overflow: hidden;
    isolation: isolate;

    pointer-events: none;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;

    transition:
        opacity 2s ease-in-out,
        transform 2s
            cubic-bezier(0.22, 1, 0.36, 1);
}


.start-button.is-visible {
    opacity: 1;
    transform:
        translate(-50%, -50%)
        scale(1);

    pointer-events: auto;
}


.start-button:disabled {
    cursor: default;
}


/*
 * 3色を4:4:2で配置し、小さな色の島を散らして、
 * 全体をまばらに移動・回転させる。
 */
.start-button-ambient {
    position: absolute;
    inset: -42%;

    z-index: 0;

    background:
        radial-gradient(
            ellipse farthest-corner at center,
            rgba(
                23,
                99,
                174,
                var(--surface-opacity)
            ) 0%,
            rgba(
                67,
                167,
                255,
                var(--surface-opacity)
            ) 50%,
            rgba(67, 167, 255, 0) 82%
        ),
        radial-gradient(
            circle at 14% 22%,
            rgba(40, 141, 236, 0.96) 0% 7%,
            rgba(40, 141, 236, 0) 23%
        ),
        radial-gradient(
            circle at 84% 73%,
            rgba(40, 141, 236, 0.92) 0% 8%,
            rgba(40, 141, 236, 0) 25%
        ),
        radial-gradient(
            circle at 48% 12%,
            rgba(67, 167, 255, 0.95) 0% 8%,
            rgba(67, 167, 255, 0) 24%
        ),
        radial-gradient(
            circle at 23% 66%,
            rgba(67, 167, 255, 0.94) 0% 9%,
            rgba(67, 167, 255, 0) 26%
        ),
        radial-gradient(
            circle at 74% 43%,
            rgba(67, 167, 255, 0.92) 0% 8%,
            rgba(67, 167, 255, 0) 25%
        ),
        radial-gradient(
            circle at 51% 89%,
            rgba(67, 167, 255, 0.90) 0% 7%,
            rgba(67, 167, 255, 0) 23%
        ),
        radial-gradient(
            circle at 29% 38%,
            rgba(107, 186, 255, 0.98) 0% 9%,
            rgba(107, 186, 255, 0) 26%
        ),
        radial-gradient(
            circle at 68% 20%,
            rgba(107, 186, 255, 0.96) 0% 8%,
            rgba(107, 186, 255, 0) 24%
        ),
        radial-gradient(
            circle at 81% 88%,
            rgba(107, 186, 255, 0.95) 0% 9%,
            rgba(107, 186, 255, 0) 26%
        ),
        radial-gradient(
            circle at 10% 88%,
            rgba(107, 186, 255, 0.93) 0% 8%,
            rgba(107, 186, 255, 0) 25%
        ),
        conic-gradient(
            from 18deg,
            #43A7FF 0% 40%,
            #6BBAFF 40% 80%,
            #288DEC 80% 100%
        );

    filter: blur(13px) saturate(1.04);

    transform-origin: center;

    animation:
        startButtonAmbientDrift 7.2s
        ease-in-out infinite alternate;

    transition: opacity 0.18s ease;

    pointer-events: none;
}


@keyframes startButtonAmbientDrift {
    0% {
        transform:
            translate(-7%, -4%)
            rotate(-11deg)
            scale(1.03);
    }

    21% {
        transform:
            translate(6%, -7%)
            rotate(23deg)
            scale(1.11);
    }

    47% {
        transform:
            translate(-3%, 5%)
            rotate(58deg)
            scale(1.05);
    }

    73% {
        transform:
            translate(7%, 3%)
            rotate(91deg)
            scale(1.13);
    }

    100% {
        transform:
            translate(-6%, 7%)
            rotate(131deg)
            scale(1.08);
    }
}


.start-button.is-holding
.start-button-ambient {
    animation-play-state: paused;
}


/* 長押し完了と同時に、青い状態のままボタン全体を消す */
.start-button.is-completed {
    opacity: 0;
    pointer-events: none;

    transition:
        opacity 1s ease-in-out;
}


/* 長押し中、既存送信ボタンと同じ中心の濃い滲みを広げる */
.start-button::before {
    content: "";

    position: absolute;
    left: 50%;
    top: 50%;

    z-index: 1;

    width: 310px;
    height: 400px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle at 43% 43%,
            rgba(23, 99, 174, 0.96) 0%,
            rgba(23, 99, 174, 0.78) 24%,
            rgba(23, 99, 174, 0.50) 47%,
            rgba(23, 99, 174, 0.23) 67%,
            rgba(23, 99, 174, 0.07) 80%,
            rgba(23, 99, 174, 0) 92%
        ),
        radial-gradient(
            circle at 59% 53%,
            rgba(23, 99, 174, 0.58) 0%,
            rgba(23, 99, 174, 0.30) 35%,
            rgba(23, 99, 174, 0.09) 61%,
            rgba(23, 99, 174, 0) 84%
        ),
        radial-gradient(
            circle at 47% 67%,
            rgba(23, 99, 174, 0.38) 0%,
            rgba(23, 99, 174, 0.15) 42%,
            rgba(23, 99, 174, 0) 80%
        );

    filter: blur(30px);

    opacity: var(--core-opacity);

    transform:
        translate(-50%, -50%)
        scale(var(--core-scale))
        rotate(-3deg);

    transform-origin: center;
    pointer-events: none;
}


/* 中心より少し遅れて広がる外側の滲み */
.start-button::after {
    content: "";

    position: absolute;
    left: 50%;
    top: 50%;

    z-index: 1;

    width: 430px;
    height: 520px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle at 40% 42%,
            rgba(23, 99, 174, 0.16) 0%,
            rgba(23, 99, 174, 0.08) 30%,
            rgba(23, 99, 174, 0.025) 48%,
            rgba(23, 99, 174, 0) 66%
        ),
        radial-gradient(
            circle at 63% 46%,
            rgba(23, 99, 174, 0.15) 0%,
            rgba(23, 99, 174, 0.07) 31%,
            rgba(23, 99, 174, 0.02) 50%,
            rgba(23, 99, 174, 0) 68%
        ),
        radial-gradient(
            circle at 50% 72%,
            rgba(23, 99, 174, 0.10) 0%,
            rgba(23, 99, 174, 0.04) 34%,
            rgba(23, 99, 174, 0) 64%
        );

    filter: blur(46px);

    opacity: var(--halo-opacity);

    transform:
        translate(-50%, -50%)
        scale(var(--halo-scale))
        rotate(4deg);

    transform-origin: center;
    pointer-events: none;
}


.start-button-icon {
    position: absolute;
    left: 50%;
    top: 50%;

    z-index: 2;

    width: 42.43px;
    height: 34.71px;

    transform: translate(-50%, -50%);

    pointer-events: none;
}


.start-button-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}


/* ボタン下辺から30px下へ置く長押し案内 */
.start-button-note {
    position: absolute;
    left: 50%;
    top: 310.1px;

    width: max-content;

    color: #1975CC;
    font-family: "Inter", sans-serif;
    font-size: 12px;
    font-weight: 400;
    line-height: 13px;
    letter-spacing: 0.10em;
    text-align: center;
    white-space: nowrap;

    opacity: 0;
    transform:
        translateX(-50%)
        translateY(2px);

    transition:
        opacity 0.6s ease,
        transform 0.6s
            cubic-bezier(0.22, 1, 0.36, 1);

    pointer-events: none;
}


.start-button-note.is-visible {
    opacity: 1;
    transform:
        translateX(-50%)
        translateY(0);
}


.start-screen.is-revealing-app {
    pointer-events: none;

    animation:
        startScreenReveal 1s
        ease-in-out forwards;
}


@keyframes startScreenReveal {
    0%,
    55% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}


/*
 * スマホでは横幅をぴったり合わせ、
 * 実際に見えている画面の上端・下端へそろえる
 */

html.is-mobile-layout {
    --mobile-bottom-gap: 0px;
}

/* ホーム画面からアプリ表示で開いた場合 */
@media (display-mode: standalone) {
    html.is-mobile-layout {
        --mobile-bottom-gap: 0px;
    }
}

html.is-mobile-layout .phone {
    top: 0;
    bottom: auto;

    transform:
        translateX(-50%)
        scale(var(--phone-scale));

    transform-origin: top center;
}

/* 通常のボタンではダブルタップ拡大を発生させない */
button {
    font-family: inherit;

    touch-action: manipulation;

    -webkit-tap-highlight-color: transparent;
}

/* 入力欄の全文を消去する丸いボタン */
.clear-text-button {
    position: absolute;
    z-index: 20;

    left: 332px;
    top: 457px;

    transform:
    translateY(
        calc(
            var(--bottom-offset) -
            var(--mobile-bottom-gap) +
            var(--lower-ui-shift)
        )
    );

    width: 50px;
    height: 50px;
    box-sizing: border-box;

    padding: 0;
    margin: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    text-align: center;

    border: none;
    border-radius: 50%;

    background: rgba(255, 255, 255, 0.80);

-webkit-backdrop-filter: blur(8px);
backdrop-filter: blur(8px);

    box-shadow:
    0 0 16px rgba(0, 0, 0, 0.08);

    appearance: none;
    -webkit-appearance: none;

    cursor: pointer;

    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* 全文消去ボタンを押している間 */
.clear-text-button:active {
    background: rgba(232, 232, 232, 0.80);
}

/* 丸いボタン内の×アイコン */
.clear-text-icon {
    display: block;

    width: 18.4px;
    height: 18.4px;

    flex: 0 0 auto;

    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

/* 入力欄 */
.text-area {
    position: absolute;
    z-index: 21;
    left: 8px;
    top: 457px;

    transform:
    translateY(
        calc(
            var(--bottom-offset) -
            var(--mobile-bottom-gap) +
            var(--lower-ui-shift)
        )
    );

    width: 315px;
    height: 50px;

    box-sizing: border-box;
    padding: 0 15px;
    margin: 0;

    display: flex;
    align-items: center;

    border: none;
    border-radius: 23px;

    background: rgba(255, 255, 255, 0.80);
-webkit-backdrop-filter: blur(8px);
backdrop-filter: blur(8px);

    box-shadow:
    0 0 16px rgba(0, 0, 0, 0.08);

    overflow-x: auto;
    overflow-y: hidden;

    scrollbar-width: none;
    pointer-events: auto;
    touch-action: pan-x;
    cursor: text;
    user-select: none;
    -webkit-user-select: none;
}


/* スクロールバーを非表示 */
.text-area::-webkit-scrollbar {
    display: none;
}


/* 入力欄内の文字全体 */
.text-content {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;

    white-space: nowrap;

    color: #000000;
    font-family: "Inter", sans-serif;
    font-size: 17px;
    font-weight: 400;
    line-height: 1;
}


/* 入力前に表示する案内文字 */
.placeholder-text {
    color: #727272;
}


/* 確定済みの文字 */
.confirmed-text {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;

    color: #000000;

    /*
     * 半角スペースを省略せず、
     * 入力されたままの幅で表示する
     */
    white-space: pre;
}


.confirmed-before,
.confirmed-after {
    white-space: pre;
}


/* 現在入力中の文字を、カーソルの前後に分けて表示する */
.composing-text {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;

    color: #000000;
    white-space: pre;
}


/* 入力中部分の青い下線 */
.composing-before,
.composing-after {
    white-space: pre;

    text-decoration-line: underline;
    text-decoration-color: #00A9FF;
    text-decoration-thickness: 2px;
    text-decoration-skip-ink: none;
    text-underline-offset: -1px;
}


/* タッチした位置へ移動できる青いカーソル */
.confirmed-cursor,
.input-cursor,
.text-content::before {
    content: "";

    flex: 0 0 auto;
    width: 2px;
    height: 20px;

    background: #00A9FF;
    pointer-events: none;

    animation:
        input-cursor-blink 1s steps(1, end) infinite;
}


.confirmed-cursor,
.input-cursor {
    display: block;
    margin: 0 1px;
}


.confirmed-cursor[hidden],
.input-cursor[hidden] {
    display: none;
}


/* 入力前だけ、案内文字の左側へカーソルを表示する */
.text-content::before {
    display: none;
    margin-right: 1px;
}


.text-content:has(
    .placeholder-text:not([hidden])
)::before {
    display: block;
}


/* 入力前は実体カーソルを隠す */
.text-content:has(
    .placeholder-text:not([hidden])
) .input-cursor {
    display: none;
}


.text-content:has(
    .placeholder-text:not([hidden])
) .confirmed-cursor {
    display: none;
}


/* カーソルの点滅 */
@keyframes input-cursor-blink {
    0%,
    49% {
        opacity: 1;
    }

    50%,
    100% {
        opacity: 0;
    }
}

/* 入力前に表示する案内文字 */
.text-area::placeholder {
    color: #727272;
    opacity: 1;
}

/* キーボードの操作エリア */
.keyboard {
    position: absolute;

    left: 0;
    top: 0;

    width: 390px;
    height: 844px;

    transform:
    translateY(
        calc(
            var(--bottom-offset) -
            var(--mobile-bottom-gap) +
            var(--lower-ui-shift)
        )
    );

    z-index: 20;
    pointer-events: none;
}

/* キーボード内の操作ボタンは通常どおり押せる */
.keyboard button {
    pointer-events: auto;
}

/* キーボード全体のグレー背景 */
.keyboard-background {
    position: absolute;

    left: 0;
    top: 520px;

    width: 390px;
    height:
    calc(
        324px -
        var(--lower-ui-shift)
    );
    box-sizing: border-box;

    border: none;
    border-radius: 25px 25px 24px 24px;

    background: rgba(226, 228, 231, 0.80);
    -webkit-backdrop-filter: blur(8px);
backdrop-filter: blur(8px);

    /*
     * 装飾背景なので、
     * クリックやタップを一切受け取らない
     */
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* 入力中の青いアンダーライン */
.text-area.is-composing {
    text-decoration-line: underline;
    text-decoration-color: #00A9FF;
    text-decoration-thickness: 2px;
    text-decoration-skip-ink: none;
    text-underline-offset: -1px;
}

/* 透明キー共通 */
/* 透明キー共通 */
.key {
    position: absolute;
    width: 70px;
    height: 51px;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    border: none;
    border-radius: 10px;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

/* キーボード下部の反応しない装飾アイコン */
.keyboard-bottom-icon {
    position: absolute;

    display: block;

    pointer-events: none;
    user-select: none;

    /*
     * スマートフォンで長押ししても、
     * 選択や操作の反応を出さない
     */
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}


/* 左下の地球アイコン */
.globe-icon {
    left: 35px;
    top: 789.5px;

    width: 26px;
    height: 26.5px;
}


/* 右下のマイクアイコン */
.microphone-icon {
    left: 334px;
    top: 787px;

    width: 17px;
    height: 28px;
}

/* 左側の反応しない装飾キー */
.decorative-key {
    position: absolute;

    left: 8px;

    width: 70px;
    height: 51px;
    box-sizing: border-box;

    display: flex;
    align-items: center;
    justify-content: center;

    border: none;
    border-radius: 10px;

    background: #D6D6D6;

    color: #000000;
    font-family: "Inter", sans-serif;
    font-size: 17px;
    font-weight: 400;
    line-height: 1;
    text-align: center;

    /*
     * 装飾なので、
     * クリック・タップを一切受け取らない
     */
    pointer-events: none;
    user-select: none;
}


/* 1つ目：123 */
.decorative-key-numbers {
    top: 543px;
}


/* 2つ目：ABC */
.decorative-key-alphabet {
    top: 601px;
}


/* 3つ目：あいう */
.decorative-key-kana {
    top: 659px;
}


/* 4つ目：絵文字 */
.decorative-key-emoji {
    top: 717px;
}


/* 絵文字アイコン */
.decorative-emoji-icon {
    display: block;

    width: 22px;
    height: 22px;

    pointer-events: none;
}

/* 1段目 */
.key[data-group="a"] {
    left: 84px;
    top: 543px;
}

.key[data-group="ka"] {
    left: 160px;
    top: 543px;
}

.key[data-group="sa"] {
    left: 236px;
    top: 543px;
}


/* 2段目 */
.key[data-group="ta"] {
    left: 84px;
    top: 601px;
}

.key[data-group="na"] {
    left: 160px;
    top: 601px;
}

.key[data-group="ha"] {
    left: 236px;
    top: 601px;
}


/* 3段目 */
.key[data-group="ma"] {
    left: 84px;
    top: 659px;
}

.key[data-group="ya"] {
    left: 160px;
    top: 659px;
}

.key[data-group="ra"] {
    left: 236px;
    top: 659px;
}


/* 4段目 */
.key[data-action="convert"] {
    left: 84px;
    top: 717px;
}

.key[data-group="wa"] {
    left: 160px;
    top: 717px;
}

.key[data-group="symbol"] {
    left: 236px;
    top: 717px;
}

/* あ行からわ行までのかなキー */
.key[data-group]:not([data-group="symbol"]) {
    display: flex;
    align-items: center;
    justify-content: center;

    background: #FFFFFF;

    color: #000000;
    font-family: "Inter", sans-serif;
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
    text-align: center;

    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

/* 濁点キー・句読点キーの白いボタン */
.key[data-action="convert"],
.key[data-group="symbol"] {
    background: #FFFFFF;

    -webkit-tap-highlight-color: transparent;
}


/* 全かな・句読点キーをフリック操作として扱う */
.key[data-group] {
    touch-action: none;
}


/* 濁点キーのSVG */
.convert-key-icon {
    position: absolute;

    left: 20px;
    top: 15px;

    width: 29px;
    height: 22.29px;

    display: block;

    pointer-events: none;
    user-select: none;
}


/* 句読点キーのSVG */
.symbol-key-icon {
    position: absolute;

    left: 23px;
    top: 28px;

    width: 22.99px;
    height: 6.71px;

    display: block;

    pointer-events: none;
    user-select: none;
}


/* 押している間の背景色 */
.key[data-action="convert"]:active,
.key[data-group="symbol"]:active {
    background: #E8E8E8;
}


/* 濁点キー・句読点キーを押している間 */
.key[data-action="convert"]:active,
.key[data-group="symbol"]:active {
    background: #E8E8E8;
}

/* 削除キー・空白キー共通 */
.utility-key {
    position: absolute;

    width: 70px;
    height: 51px;

    box-sizing: border-box;
    padding: 0;
    margin: 0;

    display: flex;
    justify-content: center;
    align-items: center;

    border: none;
    border-radius: 10px;

    background: #FFFFFF;

    appearance: none;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;

    cursor: pointer;
    touch-action: manipulation;

    z-index: 30;
}


/* 削除キー・空白キーを押している間 */
.utility-key:active,
.utility-key.is-pressed {
    background: #E8E8E8;
}


/* 削除キー */
.delete-key {
    left: 312px;
    top: 543px;
}


/* 削除アイコン */
.delete-icon {
    position: absolute;
    left: 22px;
    top: 15px;

    width: 24px;
    height: 20px;

    display: block;

    pointer-events: none;
    user-select: none;
}


/* 押下用アイコンは通常時に隠す */
.delete-icon-pressed {
    display: none;
}


/* 押している間は通常アイコンを隠す */
.delete-key:active .delete-icon-default,
.delete-key.is-pressed .delete-icon-default {
    display: none;
}


/* 押している間は押下用アイコンを表示する */
.delete-key:active .delete-icon-pressed,
.delete-key.is-pressed .delete-icon-pressed {
    display: block;
}


/* 空白キー */
.space-key {
    left: 312px;
    top: 601px;

    color: #000000;
    font-family: "Inter", sans-serif;
    font-size: 17px;
    font-weight: 400;
    line-height: 1;
    text-align: center;
}

/* かな選択中の画面全体 */
.popup {
    position: absolute;
    inset: 0;
    width: 390px;
    height: var(--phone-height);
    display: none;
    background: transparent;
    z-index: 300;
}


/* かな選択中の画面全体 */
.popup {
    position: absolute;
    inset: 0;
    width: 390px;
    height: var(--phone-height);
    display: none;
    background: transparent;
    z-index: 300;
}


/* キーボード領域だけに重ねる黒10％の背景 */
.popup::before {
    content: "";

    position: absolute;
    left: 0;
    top: 520px;

    transform:
        translateY(
            calc(
                var(--bottom-offset) -
                var(--mobile-bottom-gap) +
                var(--lower-ui-shift)
            )
        );

    width: 390px;
    height:
    calc(
        324px -
        var(--lower-ui-shift)
    );

    border-radius: 25px;
    background: rgba(0, 0, 0, 0.10);

    pointer-events: none;
    z-index: 0;
}


/* ポップアップの文字ボタン共通 */
.popup .kana {
    position: absolute;

    transform:
    translateY(
        calc(
            var(--bottom-offset) -
            var(--mobile-bottom-gap) +
            var(--lower-ui-shift)
        )
    );

    width: 70px;
    height: 51px;

    padding: 0;
    margin: 0;

    box-sizing: border-box;

    display: none;
    align-items: center;
    justify-content: center;

    border: none;

    background: #ffffff;
    color: #000000;

    font-size: 22px;

    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        "Helvetica Neue",
        "Hiragino Sans",
        "Hiragino Kaku Gothic ProN",
        "Yu Gothic",
        sans-serif;

    font-weight: 400;
    line-height: 1;

    appearance: none;
    -webkit-appearance: none;

    touch-action: manipulation;

    z-index: 1;
}


/* フリック中はポップアップを表示専用にする */
.popup.is-flick-mode {
    pointer-events: none;
}


/* 素早いフリックでは、十字用の暗い背景を表示しない */
.popup.is-quick-flick-mode::before {
    display: none;
}


/*
 * 素早いフリック中だけ、押し始めた元キーを
 * 削除キー・空白キーの押下時と同じ色にする。
 * 通常のかなキー指定より詳細度を高くし、確実に反映する。
 */
.key[data-group].is-pressed,
.key[data-group].is-quick-flick-source {
    background: #E8E8E8;
}


/* 単独表示の候補は四隅を同じ角丸にする */
.popup .kana.is-quick-flick-candidate {
    border-radius: 10px;
}


/* フリック中に選ばれている文字 */
.popup .kana.is-flick-selected {
    background: #E8E8E8;
}


/* 確定・送信ボタン */
.action-button {
    --core-scale: 0;
    --core-opacity: 0;
    --halo-scale: 0;
    --halo-opacity: 0;
    --surface-opacity: 0;

    position: absolute;
    left: 312px;
    top: 660px;

    transform:
    translateY(
        calc(
            var(--bottom-offset) -
            var(--mobile-bottom-gap) +
            var(--lower-ui-shift)
        )
    );

    width: 70px;
    height: 109px;
    border: none;
    border-radius: 10px;
    background: #ffffff;
    color: #333333;
    font-size: 16px;
    z-index: 200;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
    isolation: isolate;
}

/* 確定ボタン内の文字 */
.action-button-label {
    display: block;
}


/* 送信アイコン */
.action-button-icon {
    position: absolute;

    /*
     * SVG内に約1pxの透明な余白があるため、
     * 見える矢印部分がX24・Y46になる位置
     */
    left: 23px;
    top: 45px;

    width: 22px;
    height: 18px;

    display: none;
    pointer-events: none;
}


/* SVGの余計な隙間をなくす */
.action-button-icon svg {
    display: block;
    width: 22px;
    height: 18px;
}


/* 送信可能な状態では「確定」を隠す */
.action-button.is-confirmed
.action-button-label {
    display: none;
}


/* 送信可能な状態ではアイコンを表示する */
.action-button.is-confirmed
.action-button-icon {
    display: block;
}

/* 確定後の送信ボタン */
.action-button.is-confirmed {
    background: #43A7FF;
    color: #ffffff;
}


/*
 * 長押しの最終段階だけ、
 * ボタン全体を指定のグラデーションへ近づける
 */
.action-button.is-confirmed.is-holding {
    background:
        radial-gradient(
            ellipse farthest-corner at center,
            rgba(23, 99, 174, var(--surface-opacity)) 0%,
            rgba(67, 167, 255, var(--surface-opacity)) 50%
        ),
        #43A7FF;
}

/*
 * 指先に近い中心の温度
 */
.action-button.is-confirmed::before {
    content: "";

    position: absolute;

    left: 50%;
    top: 50%;

    width: 135px;
    height: 175px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle at 43% 43%,
            rgba(23, 99, 174, 0.96) 0%,
            rgba(23, 99, 174, 0.78) 24%,
            rgba(23, 99, 174, 0.50) 47%,
            rgba(23, 99, 174, 0.23) 67%,
            rgba(23, 99, 174, 0.07) 80%,
            rgba(23, 99, 174, 0) 92%
        ),
        radial-gradient(
            circle at 59% 53%,
            rgba(23, 99, 174, 0.58) 0%,
            rgba(23, 99, 174, 0.30) 35%,
            rgba(23, 99, 174, 0.09) 61%,
            rgba(23, 99, 174, 0) 84%
        ),
        radial-gradient(
            circle at 47% 67%,
            rgba(23, 99, 174, 0.38) 0%,
            rgba(23, 99, 174, 0.15) 42%,
            rgba(23, 99, 174, 0) 80%
        );

    filter: blur(22px);

    opacity: var(--core-opacity);

    transform:
        translate(-50%, -50%)
        scale(var(--core-scale))
        rotate(-3deg);

    transform-origin: center;

    pointer-events: none;

    z-index: -1;
}


/*
 * 中心から少し遅れて広がる柔らかい滲み
 * 中心の濃さは保ちながら、
 * 外側20％に届く濃い色を弱める
 */
.action-button.is-confirmed::after {
    content: "";

    position: absolute;

    left: 50%;
    top: 50%;

    width: 178px;
    height: 210px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle at 40% 42%,
            rgba(23, 99, 174, 0.16) 0%,
            rgba(23, 99, 174, 0.08) 30%,
            rgba(23, 99, 174, 0.025) 48%,
            rgba(23, 99, 174, 0) 66%
        ),
        radial-gradient(
            circle at 63% 46%,
            rgba(23, 99, 174, 0.15) 0%,
            rgba(23, 99, 174, 0.07) 31%,
            rgba(23, 99, 174, 0.02) 50%,
            rgba(23, 99, 174, 0) 68%
        ),
        radial-gradient(
            circle at 50% 72%,
            rgba(23, 99, 174, 0.10) 0%,
            rgba(23, 99, 174, 0.04) 34%,
            rgba(23, 99, 174, 0) 64%
        );

    filter: blur(34px);

    opacity: var(--halo-opacity);

    transform:
        translate(-50%, -50%)
        scale(var(--halo-scale))
        rotate(4deg);

    transform-origin: center;

    pointer-events: none;

    z-index: -1;
}


/* 送信後メッセージ全体のレイヤー */
.messages-layer {
    position: absolute;

    left: 0;
    right: 0;
    top: 0;
    bottom: 0;

    box-sizing: border-box;

    /*
     * 通常時の最新の吹き出しは、
     * これまでどおり入力欄の上で止める
     *
     * スクロールした吹き出しだけが、
     * この余白部分へ流れ込む
     */
    padding-bottom:
        calc(
            427px +
            var(--mobile-bottom-gap)
        );

    overflow-x: hidden;
    overflow-y: auto;

    pointer-events: auto;
    touch-action: pan-y;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;

    overflow-anchor: none;
    scroll-behavior: auto;

    scrollbar-width: none;

    /*
     * 入力欄とキーボードより後ろ
     */
    z-index: 10;
}


/* スクロールバーを非表示 */
.messages-layer::-webkit-scrollbar {
    display: none;
}


/* 送信済みメッセージを積み上げる領域 */
.messages-stack {
    min-height: 100%;

    box-sizing: border-box;
    padding-left: 13px;
    padding-right: 18px;

    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;

    gap: 15px;
}


/* 送信後の吹き出し */
.sent-message {
    flex: 0 0 auto;

    width: max-content;
    min-width: 48px;
    max-width: 300px;
    min-height: 48px;

    padding: 13.5px 15px;
    box-sizing: border-box;

    /*
     * 吹き出し自体を通常のブロックとして扱い、
     * 複数行時も文章領域が内側いっぱいまで使えるようにする
     */
    display: block;

    border-radius: 20px;
    background: #33A0FF;

    opacity: 0;
    transition:
        opacity 0.5s ease;
}


/* 吹き出し内の文章ブロック */
.sent-message-text {
    display: block;

    /*
     * 親の内容幅をそのまま使用する。
     * fit-contentによる複数行時の早い折り返しを防ぐ
     */
    width: auto;
    max-width: none;

    color: #FFFFFF;
    font-family: "Inter", sans-serif;
    font-size: 16px;
    line-height: 21px;

    text-align: left;

    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    line-break: strict;
}


/*
 * 複数行の吹き出しだけ、
 * 最終行以外のわずかな余りを文字間へ均等に分配する。
 * これにより、折り返した行の右側だけが広く見える状態を防ぐ。
 * 最終行は通常どおり左揃えのままにする。
 */
.sent-message.is-multiline .sent-message-text {
    text-align: justify;
    text-align-last: left;
    text-justify: inter-character;
}


.sent-message.is-visible {
    opacity: 1;
}


/* 導入画面で送った「はじめる」だけ、下から素早く送り込む */
.sent-message.sent-message--opening {
    transform:
        translateY(58px)
        scale(0.98);

    filter: blur(1.5px);

    transition:
        opacity 0.2s ease-out,
        transform 0.34s
            cubic-bezier(0.2, 0.9, 0.24, 1),
        filter 0.24s ease-out;
}


.sent-message.sent-message--opening.is-visible {
    transform:
        translate(0, 0)
        scale(1);

    filter: blur(0);
}


/* 自由入力を促す左側の案内吹き出し */
.guide-message {
    align-self: flex-start;
    flex: 0 0 auto;

    width: max-content;
    min-width: 48px;
    max-width: 330px;
    min-height: 48px;

    padding: 13.5px 15px;
    box-sizing: border-box;

    display: block;

    border-radius: 20px;
    background: #7FC3FF;

    opacity: 0;
    transform: translateY(4px);

    transition:
        opacity 0.8s ease,
        transform 0.8s ease;
}


.guide-message-text {
    display: block;

    width: auto;
    max-width: none;

    color: #FFFFFF;
    font-family: "Inter", sans-serif;
    font-size: 16px;
    line-height: 21px;
    letter-spacing: 0.05em;

    text-align: left;

    white-space: pre-wrap;
    word-break: normal;
    overflow-wrap: break-word;
    line-break: strict;
}


/* 例文を開閉する2つ目の案内だけ、上下の余白を5px広げる */
.guide-message--examples {
    padding-top: 18.5px;
    padding-bottom: 18.5px;

    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}


.guide-message-heading,
.guide-message-list,
.guide-message-closing {
    display: block;
}


.guide-message-list {
    margin-top: 15px;
    margin-bottom: 0;

    display: block;
}


.guide-example-item {
    display: block;
}


.guide-example-item + .guide-example-item {
    margin-top: 5px;

    transition:
        margin-top 0.65s
        cubic-bezier(0.22, 1, 0.36, 1);
}


.guide-message--examples.is-examples-visible
    .guide-example-item
    + .guide-example-item {
    margin-top: 10px;
}


.guide-example-label {
    display: block;

    line-height: 26px;
    letter-spacing: 0.1em;
}


/*
 * 例文部分は0行から本来の高さへ展開し、
 * 高さ・透明度・位置を同時にゆっくり変化させる。
 */
.guide-example-detail {
    display: grid;
    grid-template-rows: 0fr;

    margin-top: 0;

    opacity: 0;
    transform: translateY(-3px);

    transition:
        grid-template-rows 0.65s
            cubic-bezier(0.22, 1, 0.36, 1),
        margin-top 0.65s
            cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.35s ease,
        transform 0.65s
            cubic-bezier(0.22, 1, 0.36, 1);
}


.guide-example-detail-inner {
    display: block;
    min-height: 0;
    overflow: hidden;

    color: #1975CC;
    font-size: 14px;
    line-height: 21px;
    letter-spacing: 0;
}


.guide-message--examples.is-examples-visible
    .guide-example-detail {
    grid-template-rows: 1fr;
    margin-top: 0;

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


/* 2つ目の案内吹き出しと、その外側に置く注釈 */
.guide-message-with-note {
    flex: 0 0 auto;
    align-self: flex-start;

    width: 330px;
    max-width: 100%;

    display: flex;
    flex-direction: column;
    align-items: flex-start;
}


.guide-message-note {
    display: block;

    margin-top: 8px;
    margin-left: 15px;
    padding: 0;

    color: #1975CC;
    border: 0;
    background: transparent;
    font-family: "Inter", sans-serif;
    font-size: 12px;
    line-height: 13px;
    text-align: left;

    white-space: nowrap;

    cursor: pointer;
    touch-action: manipulation;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}


.guide-message.is-visible {
    opacity: 1;
    transform: translateY(0);
}


/* かなキー・変換キーを押している間 */
.key:active {
    background: #E8E8E8;
}


/* ポップアップ内の文字キーを押している間 */
.kana:active {
    background: #E8E8E8;
}

/*
 * 下部UIの最終位置調整
 *
 * 現在の状態から、
 * キーボード：さらに下へ5px
 * 入力欄・全文消去：さらに下へ10px
 */


/*
 * キーボード全体
 *
 * 以前の5px移動に、さらに5pxを加え、
 * 基準位置から合計10px下へ移動
 */
.keyboard {
    transform:
        translateY(
            calc(
                var(--bottom-offset) -
                var(--mobile-bottom-gap) +
                10px
            )
        );
}


/*
 * グレー背景
 *
 * 現在の上端からさらに10px下げる。
 * キーボード親要素の追加移動が5pxあるため、
 * 背景自体をさらに5px下げる。
 *
 * 元の高さ324pxから合計15px短くし、
 * 下端は画面下端に維持する。
 */
.keyboard-background {
    transform: translateY(5px);
    height: 309px;
}


/*
 * 地球・マイクは現在の位置を維持
 *
 * キーボード全体に新しく加えた5px分だけ、
 * 子要素側で上へ戻して相殺する。
 */
.globe-icon,
.microphone-icon {
    transform: translateY(-5px);
}


/*
 * 入力欄
 *
 * 以前の5px移動に、さらに10pxを加え、
 * 基準位置から合計15px下へ移動
 */
.text-area {
    transform:
        translateY(
            calc(
                var(--bottom-offset) -
                var(--mobile-bottom-gap) +
                15px
            )
        );
}


/*
 * 全文消去ボタンも合計15px下へ移動
 */
.clear-text-button {
    transform:
        translateY(
            calc(
                var(--bottom-offset) -
                var(--mobile-bottom-gap) +
                15px
            )
        );
}


/*
 * 確定・送信ボタンは、
 * キーボードと同じく合計10px下へ移動
 */
.action-button {
    transform:
        translateY(
            calc(
                var(--bottom-offset) -
                var(--mobile-bottom-gap) +
                10px
            )
        );
}


/*
 * フリック時のポップアップ文字も、
 * キーと同じく合計10px下へ移動
 */
.popup .kana {
    transform:
        translateY(
            calc(
                var(--bottom-offset) -
                var(--mobile-bottom-gap) +
                10px
            )
        );
}


/*
 * フリック時の黒10％背景を、
 * 通常時のグレー背景と同じ位置・高さにする
 */
.popup::before {
    top: 520px;
    bottom: auto;

    transform:
        translateY(
            calc(
                var(--bottom-offset) -
                var(--mobile-bottom-gap) +
                15px
            )
        );

    height: 309px;
}


/*
 * 入力欄との上下間隔を10px狭めるため、
 * 最新の吹き出しの最下端を10px下げる
 */
.messages-layer {
    padding-bottom:
        calc(
            402px +
            var(--mobile-bottom-gap)
        );
}


/*
 * 入力欄より下のタッチが、
 * 背後の吹き出しスクロールへ届かないようにする。
 *
 * 透明なタッチ遮断領域なので見た目には影響せず、
 * backdrop-filterとも干渉しない。
 */
.lower-scroll-shield {
    position: absolute;

    left: 0;
    right: 0;
    top:
        calc(
            472px +
            var(--bottom-offset) -
            var(--mobile-bottom-gap)
        );

    bottom: 0;

    z-index: 15;

    background: transparent;

    pointer-events: auto;
    touch-action: none;

    user-select: none;
    -webkit-user-select: none;
}

/*
 * iPhone Safariで、
 * 送信ボタンのぼかしレイヤーの
 * 四角い描画境界が見えにくくなるようにする
 */
html.is-mobile-layout
.action-button.is-confirmed::before {
    width: 270px;
    height: 350px;

    background-size:
        50% 50%,
        50% 50%,
        50% 50%;

    background-position:
        center,
        center,
        center;

    background-repeat:
        no-repeat,
        no-repeat,
        no-repeat;
}


/*
 * 外側の柔らかい滲みにも、
 * 同じように透明な余白を追加する
 */
html.is-mobile-layout
.action-button.is-confirmed::after {
    width: 356px;
    height: 420px;

    background-size:
        50% 50%,
        50% 50%,
        50% 50%;

    background-position:
        center,
        center,
        center;

    background-repeat:
        no-repeat,
        no-repeat,
        no-repeat;
}

/*
 * 漢字変換候補欄を試すための仮レイアウト
 *
 * グレー背景と入力欄の位置・大きさは変えず、
 * 地球儀・マイクを置いていた下部余白へ
 * キー群を35px下げる。
 *
 * 数値と候補欄の見た目は、実機確認後にFigmaを基準として調整する。
 */
:root {
    --conversion-key-shift: 35px;
}


/* キーボード上部の漢字変換候補欄 */
.conversion-candidates {
    position: absolute;
    z-index: 40;

    left: 8px;
    top: 530px;

    width: 374px;
    height: 42px;
    box-sizing: border-box;

    overflow-x: auto;
    overflow-y: hidden;


    scrollbar-width: none;
    pointer-events: auto;
    touch-action: pan-x;
}


.conversion-candidates::-webkit-scrollbar {
    display: none;
}


.conversion-candidate-list {
    min-width: 100%;
    height: 100%;
    box-sizing: border-box;

    display: flex;
    align-items: stretch;
    gap: 23px;

    padding: 0 18px;
    white-space: nowrap;
}


/* JavaScriptで追加される変換候補 */
.conversion-candidate-button {
    flex: 0 0 auto;

    min-width: 0;
    height: 100%;
    box-sizing: border-box;

    padding: 0;
    margin: 0;

    display: flex;
    align-items: center;
    justify-content: flex-start;

    text-align: left;

    border: none;

    background: transparent;

    color: #000000;
    font-family: "Inter", sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1;

    appearance: none;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;

    cursor: pointer;
    touch-action: manipulation;
}


.conversion-candidate-button:active,
.conversion-candidate-button.is-pressed {
    background: rgba(232, 232, 232, 0.80);
}


/* Safariに古いJavaScriptが残った場合の表示崩れを防ぐ予備スタイル */
.conversion-candidate-reading {
    flex: 0 0 auto;

    min-width: 112px;
    height: 100%;
    box-sizing: border-box;

    padding: 0 18px;

    display: flex;
    align-items: center;
    justify-content: flex-start;

    text-align: left;

    color: #000000;
    font-family: "Inter", sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1;

    white-space: nowrap;
}


/* 既存のキー群を、下部の空きスペースへまとめて移動する */
.decorative-key,
.key,
.utility-key {
    transform:
        translateY(var(--conversion-key-shift));
}


/* 確定・送信ボタンも、かなキーと同じ距離だけ下げる */
.action-button {
    transform:
        translateY(
            calc(
                var(--bottom-offset) -
                var(--mobile-bottom-gap) +
                10px +
                var(--conversion-key-shift)
            )
        );
}


/* フリック中の十字ポップアップも、キーと同じ距離だけ下げる */
.popup .kana {
    transform:
        translateY(
            calc(
                var(--bottom-offset) -
                var(--mobile-bottom-gap) +
                10px +
                var(--conversion-key-shift)
            )
        );
}
