/* Table Tennis Workout — viewport-adaptive canvas */

@media screen and (max-height: 640px) {
    #ttwPlayShell .container.container-single {
        padding-top: 3px !important;
    }
}

#ttwPlayShell.game-worlds-play-shell {
    min-height: 0;
    box-sizing: border-box;
}

#ttwPlayShell.game-worlds-play-shell:not([data-casual-sized]) {
    height: 0;
    min-height: 0;
    max-height: none;
    overflow: hidden;
}

#ttwPlayShell .casual-outer-shell {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.game-worlds-body #ttwPlayShell #gamebox.ttw-gamebox,
#ttwPlayShell #gamebox.ttw-gamebox {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    flex-direction: row;
    align-items: stretch;
    width: 100%;
    height: 100%;
    min-height: 0;
    min-width: 0;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
    font-size: 18px;
    color: #fff;
    background-color: #faf8ef;
}

#ttwPlayShell .header {
    position: relative;
    flex: 0 0 120px;
    width: 120px;
    padding: 8px 5px;
    float: none;
    box-sizing: border-box;
    overflow: auto;
}

#ttwPlayShell .controlButton {
    width: 120px;
    float: none;
    text-align: center;
    cursor: pointer;
}

#ttwPlayShell .grade {
    height: auto;
    margin-bottom: 5px;
}

#ttwPlayShell .newGrade {
    display: block;
    width: 120px;
    padding: 5px 0;
    margin: 0 auto 5px;
    font-size: 16px;
    float: none;
    box-sizing: border-box;
}

#ttwPlayShell .bgDefault {
    border: 1px solid #fabe6e;
    background-color: #fabe6e;
    border-radius: 4px;
}

#ttwPlayShell .bgClick {
    border: 1px solid #bbada0;
    background-color: #bbada0;
    border-radius: 4px;
}

#ttwPlayShell .easy,
#ttwPlayShell .medium,
#ttwPlayShell .hard {
    float: none;
    margin-bottom: 5px;
}

#ttwPlayShell .pauseAndNew {
    height: auto;
}

#ttwPlayShell .pauseAndNew > span {
    display: block;
    width: 120px;
    padding: 5px;
    margin: 2px auto;
    font-size: 16px;
    border: 1px solid #02a4ad;
    background-color: #02a4ad;
    border-radius: 4px;
    float: none;
    box-sizing: border-box;
}

#ttwPlayShell .ttw-playfield {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    min-width: 0;
    width: 100%;
    overflow: hidden;
    background-color: #2c3e50;
}

#ttwPlayShell .ttw-start-overlay {
    display: flex;
    position: absolute;
    inset: 0;
    z-index: 6;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: transparent;
    pointer-events: none;
    font-family: "DM Sans", system-ui, sans-serif;
}

#ttwPlayShell .ttw-start-overlay[hidden] {
    display: none;
}

#ttwPlayShell .ttw-start-panel {
    pointer-events: auto;
    width: min(100%, 300px);
    margin-top: 2rem;
    padding: 22px 20px;
    text-align: center;
    border-radius: 16px;
    border: 1px solid rgba(56, 189, 248, 0.28);
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow:
        0 20px 48px rgba(2, 6, 23, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#ttwPlayShell .ttw-start-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
    padding: 11px 18px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
    background: linear-gradient(135deg, #7dd3fc 0%, #38bdf8 45%, #0ea5e9 100%);
    box-shadow: 0 4px 18px rgba(14, 165, 233, 0.35);
}

#ttwPlayShell .ttw-start-btn:hover {
    filter: brightness(1.05);
}

#ttwPlayShell .ttw-start-btn:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 2px;
}

#ttwPlayShell #canvas {
    display: block;
    margin: 0;
    max-width: 100%;
    max-height: 100%;
}

#ttwPlayShell #voiceImg {
    position: static;
    display: block;
    left: auto;
    top: auto;
    width: 40px;
    height: 40px;
    margin: 16px auto 0;
    cursor: pointer;
    z-index: 2;
}

#ttwPlayShell #gameover {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    text-align: center;
    background-color: rgba(22, 28, 28, 0.95);
    z-index: 3;
}

#ttwPlayShell #gameover #msg {
    font-family: Arial, sans-serif;
    font-size: 26px;
    color: grey;
    margin: min(160px, 22vh) auto 0;
}

#ttwPlayShell #gameover #scoreGameOver {
    font-family: Arial, sans-serif;
    font-size: 24px;
    color: #bbb;
    margin: 20px auto 30px;
    font-weight: bold;
}

#ttwPlayShell #restartbtn {
    display: block;
    margin: 16px auto;
    width: 120px;
    padding: 6px;
    background-color: #00BB00;
    font-family: Arial, sans-serif;
    font-size: 24px;
    color: red;
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
}
