/* 対戦開始エフェクト */
body {
    margin: 0;
    height: 100%;
    overflow-x: hidden;
    font-family: sans-serif;
    transition: 0.5s;
}

.vsBoom-stage {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    pointer-events: none;
    z-index: 9999
}

.vsBoom-text {
    font-size: clamp(48px, 12vw, 140px);
    font-weight: 900;
    color: #fff;
    letter-spacing: 0.04em;
    transform-origin: center;
    filter: drop-shadow(0 6px 18px rgba(255, 80, 30, 0.25));
    position: relative;
    padding: 200px;
    display: none
}

.vsBoom-text::before {
    content: "";
    position: absolute;
    inset: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 20vmin;
    height: 20vmin;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 220, 140, 0.95) 0%, rgba(255, 130, 60, 0.6) 35%, rgba(255, 80, 30, 0.12) 60%, transparent 70%);
    z-index: -2
}

.vsBoom-text::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 2px;
    height: 2px;
    transform: translate(-50%, -50%) scale(0);
    background: transparent;
    box-shadow: 0 -140px currentColor, 0 140px currentColor, 140px 0 currentColor, -140px 0 currentColor, 100px -100px currentColor, -100px -100px currentColor, 100px 100px currentColor, -100px 100px currentColor;
    color: rgba(255, 200, 80, 0.95);
    z-index: -1;
    border-radius: 1px;
    opacity: 0
}

.vsBoom-sparks span {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgba(255, 210, 130, 0.95);
    opacity: 0;
    filter: blur(0.6px)
}

@keyframes vsBoom-popShrink {
    0% {
        transform: scale(0.2) rotate(-720deg);
        opacity: 0;
        filter: blur(6px)
    }

    50% {
        transform: scale(1.6) rotate(4deg);
        opacity: 1;
        filter: blur(0)
    }

    100% {
        transform: scale(1) rotate(0deg)
    }
}

@keyframes vsBoom-flash {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1
    }

    20% {
        transform: translate(-50%, -50%) scale(1.6);
        opacity: 0.9
    }

    100% {
        transform: translate(-50%, -50%) scale(2.2);
        opacity: 0
    }
}

@keyframes vsBoom-rays {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1
    }

    30% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1
    }

    100% {
        transform: translate(-50%, -50%) scale(1.18);
        opacity: 0
    }
}

@keyframes vsBoom-sparkMove {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1
    }

    100% {
        transform: translate(var(--vsdx), var(--vsdy)) scale(0.9);
        opacity: 0
    }
}

.vsBoom-stage.animate .vsBoom-text::before {
    animation: vsBoom-flash 600ms ease-out 400ms forwards
}

.vsBoom-stage.animate .vsBoom-text::after {
    animation: vsBoom-rays 600ms cubic-bezier(0.2, 0.9, 0.3, 1) 420ms forwards
}

.vsBoom-stage.animate .vsBoom-sparks span {
    animation: vsBoom-sparkMove 700ms cubic-bezier(0.15, 0.9, 0.3, 1) 420ms forwards
}

.vsBoom-text.show {
    display: block;
    animation: vsBoom-popShrink 800ms cubic-bezier(0.2, 0.9, 0.3, 1) forwards
}

.match-user-card-container {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: left;
    overflow: hidden
}

.match-user-card {
    position: absolute;
    background: #333;
    color: white;
    font-family: "Stick", sans-serif;
    width: 50%;
    height: 100%;
    font-size: 2rem;
    justify-content: center;
    align-items: center;
    display: none;
    text-align: center;

}

.match-user-card.left {
    clip-path: polygon(0 0, 100% 0, 90% 100%, 0 100%);
    animation: MatchUserCardLeft 0.5s forwards;
    display: flex
}

.match-user-card.right {
    clip-path: polygon(10% 0, 100% 0, 100% 100%, 0 100%);
    animation: MatchUserCardRight 0.5s forwards;
    display: flex
}

.user-name-label {
    cursor: pointer;
}

@keyframes MatchUserCardLeft {
    0% {
        left: -50%
    }

    100% {
        left: 0%
    }
}

@keyframes MatchUserCardRight {
    0% {
        left: 100%
    }

    100% {
        left: 50%
    }
}

.match-start-dialog {
    clip-path: polygon(0 2%, 98% 0, 100% 98%, 2% 100%);
    position: absolute;
    background-color: #ccc;
    color: black;
    width: 400px;
    height: 250px;
    font-family: "Stick", sans-serif;
    font-weight: 400;
    font-style: normal;
    font-size: 2rem;
    justify-content: center;
    align-items: center;
    display: none;
    z-index: 1
}

.match-start-dialog.show {
    display: flex;
    animation: MatchStartDialogShow 0.25s ease-in forwards
}

.match-start-dialog.hide {
    display: flex;
    animation: MatchStartDialogHide 0.25s ease-in forwards
}

@keyframes MatchStartDialogShow {
    0% {
        top: calc(50% - 150px);
        left: calc(50% - 200px);
        opacity: 0
    }

    100% {
        top: calc(50% - 125px);
        left: calc(50% - 200px);
        opacity: 1
    }
}

@keyframes MatchStartDialogHide {
    0% {
        top: calc(50% - 125px);
        left: calc(50% - 200px);
        opacity: 1
    }

    100% {
        top: calc(50% - 100px);
        left: calc(50% - 200px);
        opacity: 0
    }
}

.fixed-background-in-div {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000
}

.fixed-background-in-div.show {
    display: block;
    animation: FadeInBackground 3s ease-in forwards
}

@keyframes FadeInBackground {
    0% {
        opacity: 0
    }

    10% {
        opacity: 0.5
    }

    90% {
        opacity: 0.5
    }

    100% {
        opacity: 1
    }
}

.notification-banner {
    display: none;
    position: fixed;
    top: 20px;
    transform: translateX(100%);
    background-color: #4caf50;
    color: white;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    align-items: center;
    z-index: 1000;
    max-width: 300px;
}

.notification-banner.show {
    display: block;
    animation: slideInFromRight 0.5s ease forwards;
}

.notification-banner.hidden {
    animation: slideOutToRight 0.5s ease forwards;
}

.notification-banner p {
    margin: 0;
    flex-grow: 1;
}

.close-button {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    margin-left: 15px;
}

.close-button:hover {
    color: #f0f0f0;
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        right: 20px;
    }

    to {
        transform: translateX(0);
        right: 20px;
    }
}

@keyframes slideOutToRight {
    from {
        transform: translateX(0);
        right: 20px;
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        right: 20px;
        opacity: 0;
    }
}

p.message-text {
    margin: 10px;
}

.progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 10px;
    background-color: #4caf50;
    display: none;
}

.progress-fill {
    height: 100%;
    width: 100%;
    background-color: #fffb00;
    transition: width 1s linear;
    display: none;
}

#myNotificationBanner::after {
    font-family: 'Russo One', sans-serif;
    content: "R";
    position: absolute;
    top: 0;
    right: 10px;
    width: 65px;
    height: 65px;
    pointer-events: none;
    font-size: 65px;
    opacity: 0.3;
    text-align: right;
}

@keyframes slideOutToRight {
    from {
        transform: translateX(0);
        right: 20px;
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        right: 20px;
        opacity: 0;
    }
}

@keyframes slideOutToLeft {
    from {
        transform: translateX(0);
        left: 20px;
        opacity: 1;
    }

    to {
        transform: translateX(-100%);
        left: 20px;
        opacity: 0;
    }
}

.slideOutToLeft {
    animation: slideOutToLeft 0.5s ease forwards;
    clip-path: polygon(10% 0, 100% 0, 100% 100%, 0 100%);
    display: flex;
}

.slideOutToRight {
    animation: slideOutToRight 0.5s ease forwards;
    clip-path: polygon(10% 0, 100% 0, 100% 100%, 0 100%);
    display: flex;
}

.fixed-background-in-div.hide {
    animation: FadeOutBackground 1s ease-in forwards;
}

@keyframes FadeOutBackground {
    0% {
        opacity: 1;
    }

    90% {
        opacity: 0.5;
    }

    100% {
        opacity: 0;
    }
}

.header {
    font-family: "Russo One", "Stick", "sans-serif";
    background: linear-gradient(to right, #2cb53ec9, #2ca00fa6);
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.match-making {
    position: absolute;
    width: 100%;
    margin: -10px -20px;
    height: 75px;
    background: linear-gradient(to right, #e15646, #c57a2b);
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    display: none;
}

.match-making.show {
    display: flex;
    animation: slideInFromTop 0.5s ease forwards;
}

@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

.search {
    height: min(3.5vw, 40px);
}

.header-title {
    font-size: min(3.5vw, 40px);
    font-weight: bold;
}

.header-title-span:hover {
    text-decoration: underline;
    cursor: pointer;
}

.login-button {
    background-color: #9183dd;
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.details {
    position: absolute;
    inset: 0;
    pointer-events: none;
    color: #111;
    font-family: 'Russo One', sans-serif;
    font-size: clamp(18px, 1.8vw, 30px);
}

.details-left {
    position: absolute;
    left: calc(50% - min(16vw, 240px));
    top: 35%;
    transform: translateX(-100%);
    text-align: left;
    width: min(22vw, 260px);
}

label#attack_type {
    position: static;
    display: block;
    min-height: 170px;
    margin-bottom: 28px;
    line-height: 1.05;
}

.left-label,
.status-label {
    display: block;
    position: static;
    transform: none;
    height: auto;
    margin-bottom: 6px;
    letter-spacing: 0.04em;
}

.metric-value {
    font-size: 1.8em;
    line-height: 1;
    letter-spacing: 0.02em;
}

.details-right {
    position: absolute;
    left: calc(50% + min(25vw, 350px));
    bottom: 24%;
    width: min(22vw, 260px);
    text-align: left;
}

canvas#tetris {
    height: 30%;
    position: absolute;
    top: 50%;
    left: 50%;
    /* ここを追加 */
    transform: translate(-50%, -50%);
    /* ここを追加 */
    z-index: -1;
}

canvas#tetris.show {
    animation: 1000ms cubic-bezier(0, 0.65, 0, 1.01) 0ms 1 normal forwards running zoomIn
}

body {
    background-color: #f5deb370;
}

#\#attack_type {
    color: yellowgreen;
    font-weight: bold;
    font-family: "Russo One", sans-serif;
    font-size: 3rem;
    -webkit-text-stroke: 0.5px black;
    animation: fadeOut 2s forwards;
    animation-fill-mode: both;
    text-align: center;
}

@media (max-width: 900px) {
    .details {
        font-size: clamp(14px, 2.8vw, 20px);
    }

    .details-left {
        left: calc(50% - 20vw);
        top: 28%;
        width: min(26vw, 180px);
    }

    .details-right {
        left: calc(50% + 22vw);
        bottom: 28%;
        width: min(26vw, 180px);
    }

    label#attack_type {
        min-height: 120px;
        margin-bottom: 14px;
    }

    #\#attack_type {
        font-size: 2rem;
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.tile-card {
    width: 90%;
    /* カード全体の幅 */
    height: 80px;
    /* カード全体の高さ */
    border-radius: 8px;
    /* 角を丸くする */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    /* 影を追加 */
    display: flex;
    /* 子要素を中央に配置するためにflexboxを使用 */
    align-items: center;
    /* 垂直方向中央揃え */
    justify-content: center;
    /* 水平方向中央揃え (コンテンツが少ない場合) */
    /* コンテンツがはみ出さないように */
    box-sizing: border-box;
    /* paddingとborderをwidth/heightに含める */
    margin: 10px auto;
}

.tile-content {
    padding: 15px;
    /* コンテンツの内側の余白 */
    text-align: left;
    /* テキストを中央揃え */
    width: 80%;
    color: #333;
    /* テキストの色 */
    font-family: "Russo One", sans-serif;
    /* フォントの指定 */
}

.tile-content h3 {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 3em;
}

.Ultra {
    background-color: #a85432;
    /* カードの背景色 */
}

.Forty-Line {
    background-color: #45a156;
    /* カードの背景色 */
}

.Marathon {
    background-color: #cfd457;
    /* カードの背景色 */
}

.Infinity {
    background-color: #8b5cf6;
    /* カードの背景色 */
}

.VirtualBattle {
    background-color: #a58700;
    /* カードの背景色 */
}

.Watch {
    background-color: #327ea8;
    /* カードの背景色 */
}

.Discord {
    background-color: #4f62cf;
    display: none;
    /* カードの背景色 */
}

.Watch:disabled {
    background-color: #20516b;
    /* カードの背景色 */
}

.Setting {
    background-color: #797979;
    /* カードの背景色 */
}

.tile-card-container {
    /* margin: 0 auto; */
    width: 45%;
}

.title {
    padding: 15px;
    /* コンテンツの内側の余白 */
    text-align: left;
    /* テキストを中央揃え */
    color: #333;
    /* テキストの色 */
    font-family: "Russo One", sans-serif;
    /* フォントの指定 */
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 3em;
    text-align: center;
}

.wipe-in-box {
    position: absolute;
    left: 0px;
    top: calc(50% - 40px);
    font-family: "Russo One", sans-serif;
    font-size: 2.5em;
    width: 100%;
    height: 40px;
    color: white;
    padding: 50px 0;
    text-align: center;
    justify-content: center;
    align-items: center;

    /* 初期状態では非表示 */
    clip-path: inset(0 50% 0 50%);
    /* 左右から中央に50%ずつクリップ */
    opacity: 0;
    /* アニメーション開始前に一瞬表示されるのを防ぐ */
    background-color: #4CAF50;
}

.boxWipein {
    animation: boxWipeIn 5s forwards ease-out;
    /* 2秒かけてアニメーション、終了状態を保持 */
}

/* アニメーション開始と同時に不透明にする */
.wipe-in-box.is-animated {
    opacity: 1;
}

@keyframes boxWipeIn {
    0% {
        clip-path: inset(0 50% 0 50%);
        /* 左右から中央に50%ずつクリップ */
        opacity: 0;
        /* ボックスの背景色 */
        height: 40px;
    }

    1% {
        /* ほぼ0%の時点でopacityを1にする */
        opacity: 1;
        /* ボックスの背景色 */
        height: 40px;
    }

    8% {
        clip-path: inset(0 10% 0 10%);
        /* 全体を表示 */
        opacity: 1;
        /* ボックスの背景色 */
        height: 40px;
    }

    72% {
        clip-path: inset(0 0% 0 0%);
        /* 全体を表示 */
        opacity: 1;
        color: #FFFFFF;
        /* ボックスの背景色 */
        top: calc(50% - 40px);
        height: 40px;
    }

    80% {
        clip-path: inset(0 0% 0 0%);
        /* 全体を表示 */
        opacity: 1;
        /* ボックスの背景色 */
        color: rgba(0, 0, 0, 0);
        top: 0px;
        height: calc(100% - 100px);
    }

    100% {
        clip-path: inset(0 0% 0 0%);
        /* 全体を表示 */
        opacity: 0;
        /* ボックスの背景色 */
        color: #ffffff00;
        top: 0px;
        height: calc(100% - 100px);
    }
}


@keyframes FloatIn {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.result {
    font-family: "Russo One", sans-serif;
    margin: 0 auto;
    width: 100%;
    display: none;
}

.FloatIn {
    animation: FloatIn 0.3s forwards;
}

.slider-container {
    width: 80%;
    /* スライダーの幅 */
    max-width: 400px;
}

.slider {
    appearance: none;
    /* デフォルトのスタイルを無効にする */
    width: 100%;
    height: 10px;
    /* スライダーバーの高さ */
    background: #d3d3d3;
    /* スライダーバーの背景色 */
    outline: none;
    /* フォーカス時のアウトラインを削除 */
    opacity: 0.7;
    /* 不透明度 */
    -webkit-transition: 0.2s;
    /* ホバー時のトランジション */
    transition: opacity 0.2s;
    border-radius: 5px;
    /* 角を丸くする */
}

.slider:hover {
    opacity: 1;
    /* ホバー時に不透明度を上げる */
}

/* スライダーのつまみのスタイル */
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    /* つまみの幅 */
    height: 20px;
    /* つまみの高さ */
    border-radius: 50%;
    /* 円形にする */
    background: #4caf50;
    /* つまみの色 */
    cursor: pointer;
    /* カーソルをポインターにする */
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4caf50;
    cursor: pointer;
}

.slider-value {
    margin-top: 10px;
    font-weight: bold;
    text-align: center;
}

.setting-dialog {
    width: min(92vw, 1290px);
    max-height: 85vh;
    padding: 0;
    border: none;
    border-radius: 20px;
    background: var(--surface-bg, rgba(14, 23, 41, 0.85));
    border: 1px solid var(--surface-border, rgba(255, 255, 255, 0.14));
    box-shadow: var(--glow-shadow, 0 20px 45px rgba(6, 12, 30, 0.35));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-bright, #eef7ff);
    font-family: inherit;
    overflow: hidden;
    flex-direction: column;
}

.setting-dialog[open] {
    display: flex;
}

.setting-dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.setting-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.setting-dialog-header .title {
    margin: 0;
    font-size: 2rem;
    color: #ecf8ff;
    text-shadow: 0 5px 14px rgba(0, 0, 0, 0.45);
}

.setting-dialog-header .close-btn {
    background: transparent;
    border: none;
    color: var(--text-bright, #eef7ff);
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.2s, color 0.2s;
    font-weight: bold;
    padding: 0;
    margin: 0;
}

.setting-dialog-header .close-btn:hover {
    transform: scale(1.1);
    color: #ff5e5e;
}

.setting-content {
    padding: 24px 30px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.setting-content::-webkit-scrollbar {
    width: 8px;
}

.setting-content::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.setting-section {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: fit-content;
}

.setting-section-title {
    margin: 0 0 10px 0;
    font-size: 1.3rem;
    color: #92c5ff;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
    font-family: inherit;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    padding: 8px 0;
    width: 100%;
}

.setting-row .toggle_button {
    margin: 0;
    width: 50px;
    height: 25px;
}

.setting-row .toggle_label {
    margin-left: 0;
}

.setting-section .slider-container {
    width: 100%;
    max-width: none;
    margin: 4px 0;
}

.setting-section .slider-value {
    margin-top: 5px;
}

.setting-action-btn {
    width: 100%;
    padding: 12px;
    background: rgba(96, 165, 250, 0.15);
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: var(--text-bright, #fff);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.setting-action-btn:hover {
    background: rgba(96, 165, 250, 0.3);
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.2);
    transform: translateY(-2px);
}

.file-input {
    width: calc(100% - 22px);
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-bright, #fff);
    margin-bottom: 15px;
}

.file-input::file-selector-button {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    background: var(--accent, #60a5fa);
    color: #000;
    font-weight: bold;
    cursor: pointer;
    margin-right: 12px;
    transition: background 0.2s;
}

.file-input::file-selector-button:hover {
    background: #93c5fd;
}

dialog.login {
    background-color: #292929;
    color: #fff;
    padding: 40px;
}

.center {
    margin: 0 auto;
}

.long-button {
    width: 200px;
    /* ボタンの幅を200pxに設定 */
    padding: 15px 30px;
    /* 上下左右のパディングを調整 */
    background-color: #4CAF50;
    /* 背景色 */
    color: white;
    /* 文字色 */
    border: none;
    /* ボーダーをなくす */
    border-radius: 8px;
    /* 角を丸くする */
    font-size: 18px;
    /* フォントサイズ */
    cursor: pointer;
    /* マウスオーバー時にカーソルをポインターにする */
    text-align: center;
    /* テキストを中央揃えにする */
    display: block;
    /* ブロック要素にして幅が反映されるようにする */
}

/* ホバー時のスタイル */
.long-button:hover {
    background-color: #45a049;
}

/* アクティブ時のスタイル (クリック時) */
.long-button:active {
    background-color: #3e8e41;
}

.request {
    position: absolute;
    bottom: 10px;
    left: calc(50% - 100px);
    display: none;
}

#chart-container {
    width: calc(50% - 40px);
    height: 40%;
    position: absolute;
    margin: 20px;
    left: 50%;
}

.toggle_input {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    opacity: 0;
    cursor: pointer;
}

.toggle_label {
    width: 50px;
    height: 25px;
    background: #ccc;
    position: relative;
    display: inline-block;
    border-radius: 40px;
    transition: 0.4s;
    box-sizing: border-box;
    margin-left: 10px;
}

.toggle_label:after {
    content: "";
    position: absolute;
    width: 25px;
    height: 25px;
    border-radius: 100%;
    left: 0;
    top: 0;
    z-index: 2;
    background: #fff;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
    transition: 0.4s;
}

.toggle_input:checked+.toggle_label {
    background-color: #4BD865;
}

.toggle_input:checked+.toggle_label:after {
    left: 25px;
}

.toggle_button {
    display: flex;
    position: relative;
    width: fit-content;
    height: 35px;
    margin: auto;
}


.challange-container {
    position: absolute;
    top: 50%;
    width: 250px;
    display: none;
    background-color: #ffffff88;
    flex-wrap: wrap;
    font-size: 20px;
    font-family: 'Russo One';
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0px 0px 10px #ffffff88;
}

.challange-container.show {
    display: flex;
    animation: SlideInFromRight 0.6s ease-out forwards;
}

.challange-container.hide {
    display: flex;
    animation: SlideOutToRight 0.6s ease-in forwards;
}

.challange-result {
    font-family: "Russo One", sans-serif;
    width: 200px;
    text-align: center;
}

@keyframes SlideInFromRight {
    0% {
        right: -250px;
    }

    100% {
        right: 0;
    }
}

@keyframes SlideOutToRight {
    0% {
        right: 0;
    }

    100% {
        right: -250px;
    }
}

img.challange-win {
    height: 40px;
    margin: 5px;
    transform: rotate(5deg);
}

img.challange-lose {
    height: 25px;
    margin: 5px;
}

.log {
    display: none;
    bottom: 0px;
    background-color: #00000050;
    color: white;
    width: 100%;
    height: 50px;
    overflow-y: scroll;
}

.footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    text-align: center;
}

.footer>a {
    color: #686868;
    font-size: 12px;
}



canvas.battle-start {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
}

p.battle-start {
    display: none;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 10em;
    margin: 0;
    font-family: "Bowlby One", sans-serif;
    text-shadow: 10px 10px 0px blue;
    color: white;
    -webkit-text-stroke: 0px white;
}

p.ready {
    display: none;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 4em;
    margin: 0;
    font-family: "Bowlby One", sans-serif;
    text-shadow: 4px 4px 0px blue;
    color: white;
    -webkit-text-stroke: 0px white;
}

@keyframes zoomIn {
    0% {
        height: 30%;
    }

    100% {
        height: 80%;
    }
}

:root {
    --size: 64px;
    --gap: 16px;
    --bg: #0f172a;
    --muted: #94a3b8;
    --accent: #60a5fa;
    --active-glow: 0 8px 20px rgba(96, 165, 250, 0.25);
}

.gear-row {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.gear {
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    /* background: linear-gradient(180deg,#0b1220 0%, #121826 100%); */
    border: 2px solid rgba(255, 255, 255, 0.06);
    display: grid;
    place-items: center;
    cursor: pointer;
    user-select: none;
    transition: transform .12s, box-shadow .12s, border-color .12s;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.gear:hover {
    transform: translateY(-4px) scale(1.03);
}

.gear.active {
    color: white;
    border-color: var(--accent);
    box-shadow: var(--active-glow);
    transform: translateY(-6px) scale(1.06);
    /* background: linear-gradient(180deg,#123b6b 0%, #0b2a4d 100%); */
}

select {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #334155;
    /* background: #0f172a; */
    color: #000000;
    font-size: 14px;
}

#floating-iframe {
    position: fixed;
    bottom: 20px;
    /* 下から20px */
    right: 20px;
    /* 右から20px */
    width: 300px;
    height: 200px;
    border: 2px solid #ccc;
    border-radius: 8px;
    background: white;
    z-index: 9999;
    /* 一番前に表示 */
}

@keyframes slideOutToTop {
    0% {
        transform: none;
        opacity: 1;
    }

    100% {
        transform: translateY(-100%);
        opacity: 0;
    }
}

.match-user-card::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 150px;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: -1;
    /* 背景側に送る */
}


#timer-label {
    position: fixed;
    top: 20px;
    font-size: 2rem;
    font-weight: bold;
    color: white;
    background: black;
    padding: 2px 5px;
    border-radius: 2px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    z-index: 9999;
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
}



#music-list-container.collapsed {
    transform: translateX(-330px);
}

#music-list-container>div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid black;
    font-family: 'Russo One', sans-serif;
    letter-spacing: 2px;
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 5px;
    padding-bottom: 5px;
}

#collapse-btn {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    font-weight: bold;
    padding: 0;
    margin-left: 10px;
}

#collapse-btn:hover {
    opacity: 0.7;
}

#music-list {
    margin: 0;
    padding: 0;
    list-style-type: none;
    max-height: 300px;
    overflow-y: auto;
}

#music-list::-webkit-scrollbar {
    width: 6px;
}

#music-list::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

#music-list li {
    padding: 10px 15px;
    margin-bottom: 8px;
    margin-right: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 1rem;
    color: var(--text-bright, #eef7ff);
}

#music-list li::before {
    content: "🎵";
    margin-right: 12px;
    font-size: 1.1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

#music-list li:hover {
    background: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.4);
    transform: translateX(4px);
}

#music-list li:hover::before {
    opacity: 1;
}

#music-list li.playing {
    background: rgba(96, 165, 250, 0.25);
    border-color: var(--accent, #60a5fa);
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.3);
    font-weight: bold;
}

#music-list li.playing::before {
    content: "▶️";
    opacity: 1;
}

#audioList {
    display: none;
}

#music-title {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 5px;
    position: fixed;
    right: 20px;
    bottom: 20px;
}

.rank {
    margin-left: 15%;
}

.title-cover {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000000bb;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    gap: 20px;
    border: 0;
    border: 3px black solid;
    z-index: 2;
}

dialog.title-cover[open] {
    display: flex;
}

dialog.title-cover::backdrop {
    display: none;
}

.title-cover.hide {
    animation: title_close 0.5s;
}

.title-text {
    font-size: 4em;
    font-family: 'Russo One', "Stick", sans-serif;
}

div.title-username {
    font-size: 1em;
}

@keyframes title_close {
    from {
        transform: none;
    }

    to {
        transform: translateY(-100%);
    }
}


.save_replay {
    text-align: center;
    display: block;
    color: white;
}

/* ===== design refresh ===== */
:root {
    --surface-bg: rgba(14, 23, 41, 0.8);
    --surface-border: rgba(255, 255, 255, 0.14);
    --text-bright: #eef7ff;
    --glow-shadow: 0 20px 45px rgba(6, 12, 30, 0.35);
}

.header-title-span {
    letter-spacing: 0.04em;
}

.point,
.rank,
.user-name-label {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.tile-card-container {
    /* width: min(560px, 92%); */
    margin: 34px auto 0 20px;
    padding: 22px;
    border-radius: 18px;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    box-shadow: var(--glow-shadow);
}

.title {
    color: #ecf8ff;
    margin-bottom: 18px;
    font-size: clamp(2rem, 5vw, 2.8rem);
    text-shadow: 0 5px 14px rgba(0, 0, 0, 0.45);
}

.tile-card {
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 12px 24px rgba(8, 13, 35, 0.26);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.tile-card:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.015);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.32);
    filter: saturate(1.1);
}

.tile-content,
.tile-content h3 {
    color: #f6fbff;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.result {
    width: min(1080px, 95%);
    margin: 20px auto;
    grid-template-columns: minmax(340px, 1fr) minmax(260px, 360px);
    gap: 20px;
    align-items: start;
}

.result-preview,
.result-summary {
    padding: 20px;
    border-radius: 16px;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    box-shadow: var(--glow-shadow);
}

.result-preview video {
    width: 100%;
    max-width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.result-table {
    margin: 0 auto 12px;
    font-size: 1.1em;
    color: white;
}

.result-action {
    width: 120px;
    display: block;
    margin: 8px auto;
    padding: 8px 0;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: rgba(50, 97, 214, 0.8);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.reBattle {
    display: none;
}

.result-action:hover {
    background: rgba(72, 121, 244, 0.95);
}

@media (max-width: 900px) {
    .header {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    .result {
        grid-template-columns: 1fr;
    }

    .tile-content h3 {
        font-size: clamp(1.5rem, 8vw, 2.2rem);
    }
}

/* ===== Key Config Dialog ===== */
.keyconfig {
    width: min(92vw, 600px);
    max-height: 85vh;
    padding: 0;
    border: none;
    border-radius: 20px;
    background: var(--surface-bg, rgba(14, 23, 41, 0.85));
    border: 1px solid var(--surface-border, rgba(255, 255, 255, 0.14));
    box-shadow: var(--glow-shadow, 0 20px 45px rgba(6, 12, 30, 0.35));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-bright, #eef7ff);
    overflow: hidden;
    flex-direction: column;
}

.keyconfig[open] {
    display: flex;
}

.keyconfig::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.keyconfig-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.keyconfig-header .title {
    margin: 0;
    font-size: 1.8rem;
    color: #ecf8ff;
    text-shadow: 0 5px 14px rgba(0, 0, 0, 0.45);
}

.keyconfig-header .close-btn {
    background: transparent;
    border: none;
    color: var(--text-bright, #eef7ff);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.2s, color 0.2s;
    font-weight: bold;
}

.keyconfig-header .close-btn:hover {
    transform: scale(1.1);
    color: #ff5e5e;
}

.keyconfig-content {
    padding: 24px 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.keyconfig-section {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px;
}

.keyconfig-section-title {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
    color: #92c5ff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 6px;
}

.keyconfig-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.keyconfig-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.keyconfig-row span {
    font-size: 0.95rem;
    opacity: 0.9;
}

.key-capture-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    padding: 6px 12px;
    min-width: 80px;
    font-family: 'Russo One', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.key-capture-btn:hover:not(:disabled) {
    background: rgba(96, 165, 250, 0.2);
    border-color: rgba(96, 165, 250, 0.5);
}

.key-capture-btn.capturing {
    background: rgba(255, 165, 0, 0.3);
    border-color: orange;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from {
        opacity: 0.6;
    }

    to {
        opacity: 1;
    }
}

@media (max-width: 500px) {
    .keyconfig-grid {
        grid-template-columns: 1fr;
    }
}
