/**
 * Game Fonts
 */
@font-face {
    font-family: "Gill Sans MT Ext Condensed Bold";
    font-style: normal;
    font-weight: normal;
    src: local("Gill Sans MT Ext Condensed Bold"), url("../fonts/glsnecb.ttf") format("truetype");
}



/**
 * Main Styles
 */
html, body {
    margin: 0;
    padding: 0;
    border: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: transparent;
    font-size: 15px;
}
html, body, input {
    color: black;
    font-family: "Gill Sans MT Ext Condensed Bold";
    text-shadow: #333 0.1em 0.1em 0.1em;
}

a {
    color: #333;
    text-shadow: #666 0.05em 0.05em 0.05em;
    text-decoration: none;
    outline: none;
    font-size: 3em
}
a:hover {
    color: black;
    text-shadow: #333 0.05em 0.05em 0.05em;
}

input {
    color: #333;
    text-shadow: #666 0.05em 0.05em 0.05em;
}



/**
 * Modes Display
 */
.playing .board {
    cursor: none;
}
.playing .messages {
    display: none;
}

.playing .board .ship,
.playing .board .ball,
.playing .board .tail div,
.playing .bricks {
    display: block;
}

.mainScreen .main,
.paused     .pause,
.gameOver   .input,
.highScores .high,
.help       .controls {
    display: block;
}



/**
 * Game Design
 */
#container {
    position: absolute;
    top: 50%;
    bottom: 50%;
    left: 50%;
    right: 50%;
    width: 25em;
    height: 36em;
    margin-top: -18.2em;
    margin-left: -12.7em;
    border: 0.2em solid #121212;
    box-shadow: inset 1em 0 #272727, inset -1em 0 #272727,
                inset 0 1em #272727, inset 0 -1em #BEBEBE;
    background-color: white;
    z-index: 3;
}



/**
 * Messages Panel
 */
.messages {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    cursor: pointer;
    z-index: 100;
}
    .messages .bg {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        background-color: black;
        opacity: 0.2;
    }
    .messages .text {
        position: absolute;
        top: 4em;
        left: 0;
        right: 0;
        height: 8em;
        background-color: black;
        opacity: 0.8;
    }

    .messages .text h2 {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        margin: 0;
        font-size: 6em;
        font-variant: small-caps;
        font-weight: normal;
        text-align: center;
        color: white;
    }
    .messages .text p {
        position: absolute;
        top: 5.5em;
        left: 0;
        right: 0;
        text-align: center;
        color: white;
        font-family: Verdana, Arial, Helvetica, sans-serif;
    }



/**
 * Mains Screen / Pause
 */
.main {
    display: none;
}
.main ul {
    top: 14em;
}
.pause {
    display: none;
    top: 16em;
}

.main ul, .pause {
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    margin: 0;
    padding: 0;
    list-style: none;
}
    .main li:nth-last-child(2) { padding-top: 1.5em;  }
    .main li:last-child        { padding-left: 4.5em; }



/**
 * Game Over
 */
.input {
    display: none;
    position: absolute;
    top: 18em;
    left: 0;
    right: 0;
    text-align: center;
}
    .input input {
        width: 5em;
        padding-left: 0.2em;
        border: 0.08em solid #333;
        background: none;
        border-radius: 5px;
        font-size: 3em;
    }
    .input input:focus { outline: none; }
    .input input::-webkit-input-placeholder {
        color: #666;
        text-shadow: none;
    }
    .input input:-moz-placeholder {
        color: #666;
        text-shadow: none;
    }

.restart {
    position: absolute;
    top: 2.5em;
    left: 0;
    right: 0;
    text-align: center;
}



/**
 * High Scores
 */
.high { display: none; }
.high .links {
    position: absolute;
    bottom: 0.5em;
    left: 0;
    right: 0;
    height: 4em;
    text-align: center;
}
    .high .links ul {
        margin: 0;
        padding: 0;
        list-style: none;
    }
    .high .links li {
        display: inline-block;
        padding-right: 0.6em;
        padding-left: 0.6em;
    }

.scores {
    position: absolute;
    top: 6.25em;
    left: 2em;
    right: 2em;
    bottom: 2.5em;
    font-size: 2em;
}
.high .highScore {
    float: left;
    clear: both;
    width: 100%;
}
    .hsName  { float: left; }
    .hsScore { float: right; }

.none {
    position: absolute;
    display: none;
    top: 6em;
    left: 0;
    right: 0;
    bottom: 0;
    text-align: center;
    font-size: 3em
}



/**
 * Help Controls
 */
.controls {
    display: none;
}
.controls ol {
    font-size: 2.2em;
    margin: 5.4em 0.3em 0 0.8em;
    text-shadow: none;
    padding: 0;
    list-style-position: inside;
}
.controls a {
    position: absolute;
    top: 10.5em;
    left: 6.8em;
}



/**
 * Audio Button
 */
.audio {
    position: absolute;
    bottom: 2.5em;
    left: 8em;
    cursor: pointer;
}
.audio .triangle {
    position: absolute;
    bottom: 0.2em;
    left: 0.2em;
    border: 1em solid transparent;
    border-right-color: #333;
}
    .audio .triangle:after {
        content: "";
        position: absolute;
        top: -0.8em;
        left: -1.2em;
        border: 1em solid transparent;
        border-right-color: #666;
        z-index: -1;
    }
    .audio:hover .triangle       { border-right-color: black; }
    .audio:hover .triangle:after { border-right-color: #333; }

.audio .box {
    position: absolute;
    bottom: 0.9em;
    left: 1.1em;
    height: 0.6em;
    width: 0.5em;
    background-color: #333;
}
    .audio .box:after {
        content: "";
        position: absolute;
        top: 0.2em;
        left: -0.2em;
        height: 0.6em;
        width: 0.5em;
        background-color: #666;
        z-index: -1;
    }
    .audio:hover .box       { background-color: black; }
    .audio:hover .box:after { background-color: #333; }

.waves {
    position: absolute;
    bottom: 0;
    left: 2em;
}
    .waves div {
        position: absolute;
        left: 0;
        background-color: #333;
        border-radius: 0 20em 20em 0;
    }
    .waves div:nth-child(1) {
        bottom: 0.3em;
        width:  1.8em;
        height: 1.8em;
    }
    .waves div:nth-child(2) {
        bottom: 0.5em;
        width:  1.4em;
        height: 1.4em;
    }
    .waves div:nth-child(3) {
        bottom: 0.7em;
        width:  1em;
        height: 1em;
    }
    .waves div:nth-child(4) {
        bottom: 0.9em;
        width:  0.6em;
        height: 0.6em;
    }

    .audio:hover .waves div {
        background-color: black;
    }
    .waves div:before {
        content: "";
        position: absolute;
        left: 0;
        bottom: 0;
        right: 0.1em;
        top: 0;
        background-color: #CCC;
        border-radius: 0 20em 20em 0;
    }



/**
 * Board Design
 */
@keyframes fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.count {
    position: absolute;
    top: 0.16em;
    left: 0.04em;
    right: 0.04em;
    color: rgba(0, 0, 0, 0.2);
    font-size: 25em;
    text-align: center;
    line-height: normal;
    text-shadow: none;
}
.bricks {
    display: none;
    position: absolute;
    top: 1em;
    left: 1em;
    bottom: 1em;
    right: 1em;
}
    .bricks.fade {
        animation: fade 1s;
    }
    .bricks div {
        position: absolute;
        height: 2.5em;
        width: 4.6em;
        box-shadow: inset 0 0 0 1.5em #121212;
        border: 0.4em solid transparent;
        box-sizing: border-box;
        transition: all .3s;
    }

.board {
    position: absolute;
    top: 1em;
    left: 1em;
    bottom: 1em;
    right: 1em;
}
    .ship {
        position: absolute;
        display: none;
        width: 5em;
        height: 1.5em;
        background-color: #121212;
        border-radius: 0.5em;
    }

    .ball, .tail div {
        position: absolute;
        display: none;
        border-radius: 10em;
        width: 3em;
        height: 3em;
        box-shadow: inset 0 0 0 1.5em #121212;
        box-sizing: border-box;
    }

    .tail div:nth-child(1) {
        border: 0.1em solid transparent;
        opacity: 0.95;
    }
    .tail div:nth-child(2) {
        border: 0.2em solid transparent;
        opacity: 0.90;
    }
    .tail div:nth-child(3) {
        border: 0.3em solid transparent;
        opacity: 0.85;
    }
    .tail div:nth-child(4) {
        border: 0.4em solid transparent;
        opacity: 0.80;
    }
    .tail div:nth-child(5) {
        border: 0.5em solid transparent;
        opacity: 0.75;
    }
    .tail div:nth-child(6) {
        border: 0.6em solid transparent;
        opacity: 0.70;
    }
    .tail div:nth-child(7) {
        border: 0.7em solid transparent;
        opacity: 0.65;
    }
    .tail div:nth-child(8) {
        border: 0.8em solid transparent;
        opacity: 0.6;
    }
    .tail div:nth-child(9) {
        border: 0.9em solid transparent;
        opacity: 0.55;
    }
    .tail div:nth-child(10) {
        border: 1em solid transparent;
        opacity: 0.5;
    }
    .tail div:nth-child(11) {
        border: 1.1em solid transparent;
        opacity: 0.45;
    }
    .tail div:nth-child(12) {
        border: 1.2em solid transparent;
        opacity: 0.4;
    }
    .tail div:nth-child(13) {
        border: 1.3em solid transparent;
        opacity: 0.3;
    }
    .tail div:nth-child(14) {
        border: 1.4em solid transparent;
        opacity: 0.2;
    }
    .tail div:nth-child(15) {
        border: 1.5em solid transparent;
        opacity: 0.1;
    }

/* 中文游戏工具栏与响应式布局 */
:root { --game-scale: 1; --ui-bg: rgba(29, 15, 51, .94); --ui-border: #7042a0; --ui-text: #fff4d5; --ui-accent: #ffd45e; }
* { box-sizing: border-box; }
html, body { overflow: auto; min-height: 100%; background: #120d1b; color: var(--ui-text); font-family: "Microsoft YaHei", "PingFang SC", sans-serif; text-shadow: none; }
body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 82px 18px 76px; transition: background .25s, color .25s; }
#container { position: relative; inset: auto; flex: 0 0 auto; width: 25em; height: 36em; margin: 0; transform: scale(var(--game-scale)); transform-origin: center; border: .3em solid #29202f; box-shadow: 0 18px 70px rgba(0,0,0,.48), inset 1em 0 #272727, inset -1em 0 #272727, inset 0 1em #272727, inset 0 -1em #bebebe; }
.toolbar { position: fixed; z-index: 300; display: flex; gap: 8px; padding: 8px; border: 1px solid var(--ui-border); border-radius: 20px; background: var(--ui-bg); box-shadow: 0 10px 36px rgba(0,0,0,.35); backdrop-filter: blur(14px); }
.toolbar-top { top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); }
.toolbar button, .toolbar-button, .settings-card button { border: 1px solid #8152b1; border-radius: 12px; background: #351858; color: var(--ui-text); font: 600 15px/1.2 "Microsoft YaHei", sans-serif; cursor: pointer; transition: transform .15s, background .15s, border-color .15s; }
.toolbar button { min-width: 76px; min-height: 48px; padding: 7px 12px; display: flex; align-items: center; justify-content: center; gap: 7px; }
.toolbar button:hover, .toolbar-button:hover, .settings-card button:hover { transform: translateY(-2px); background: #51237d; }
.toolbar button.active { background: var(--ui-accent); border-color: #ffe9a2; color: #342448; }
.icon { font-size: 19px; }
.toolbar-button { position: fixed; z-index: 300; min-height: 48px; padding: 10px 18px; display: flex; align-items: center; gap: 8px; box-shadow: 0 8px 28px rgba(0,0,0,.32); }
.restart-button { top: 18px; left: 20px; background: var(--ui-accent); color: #322346; border-color: #ffe5a0; }
.settings-button { bottom: max(16px, env(safe-area-inset-bottom)); left: 20px; }
.sound-button { bottom: max(16px, env(safe-area-inset-bottom)); right: 20px; }
body.dark-mode { background: #080912; --ui-bg: rgba(15, 20, 39, .95); --ui-border: #445b9d; --ui-text: #e9edff; --ui-accent: #96aaff; }
body.dark-mode #container { background-color: #151827; border-color: #3b466a; box-shadow: 0 18px 70px rgba(0,0,0,.65), inset 1em 0 #23283d, inset -1em 0 #23283d, inset 0 1em #23283d, inset 0 -1em #555d78; }
body.dark-mode .count { color: rgba(210,220,255,.16); }
body.dark-mode .ship, body.dark-mode .ball, body.dark-mode .tail div { background-color: #d8e0ff; box-shadow: inset 0 0 0 1.5em #d8e0ff; }
.messages { cursor: default; }
.messages .text { top: 3em; }
.messages .text h2 { font-family: "Microsoft YaHei", sans-serif; font-size: 4em; font-weight: 700; }
.messages .text p { top: 5.2em; font-size: 1em; }
.messages .bg { opacity: .24; }
.main ul { top: 13em; }
.main li:nth-last-child(2) { padding-top: .7em; }
.main li:last-child { padding-left: 0; }
.messages a { color: #25202b; font-size: 2.6em; text-shadow: none; }
.messages a:hover { color: #80521d; }
.pause { top: 15em; }
.input { top: 16em; }
.input input { font-family: "Microsoft YaHei", sans-serif; font-size: 1.8em; }
.input a { font-size: 2em; }
.high .links li { padding: 0 .35em; }
.high .links a { font-size: 1.7em; }
.scores { font-family: "Microsoft YaHei", sans-serif; font-size: 1.3em; }
.none { font-family: "Microsoft YaHei", sans-serif; font-size: 1.8em; }
.controls ol { margin: 12em .8em 0; font: 1.1em/1.8 "Microsoft YaHei", sans-serif; }
.controls a { top: auto; left: 0; right: 0; bottom: .8em; text-align: center; }
.settings-panel { position: fixed; z-index: 500; inset: 0; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(8,5,14,.72); backdrop-filter: blur(8px); }
.settings-panel.open { display: flex; }
.settings-card { position: relative; width: min(420px, 100%); padding: 28px; border: 1px solid var(--ui-border); border-radius: 20px; background: var(--ui-bg); box-shadow: 0 20px 70px rgba(0,0,0,.5); font: 15px/1.7 "Microsoft YaHei", sans-serif; }
.settings-card h2 { margin: 0 0 18px; color: var(--ui-accent); }
.settings-card p { margin: 8px 0; }
.settings-card button { padding: 10px 12px; }
.settings-close { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; font-size: 24px !important; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
@media (max-width: 620px) {
 body { padding: 86px 8px 72px; }
 .toolbar { gap: 4px; padding: 5px; border-radius: 15px; }
 .toolbar button { min-width: 52px; min-height: 44px; padding: 5px 7px; gap: 3px; font-size: 12px; }
 .toolbar button .icon { font-size: 16px; }
 .restart-button { top: 70px; left: 50%; transform: translateX(-50%); min-height: 38px; padding: 7px 12px; }
 #container { font-size: clamp(11px, 3.8vw, 15px); }
 .settings-button { left: 10px; }
 .sound-button { right: 10px; }
}
@media (max-width: 390px) { .toolbar button { min-width: 45px; padding: 4px; } .toolbar .label { font-size: 11px; } }
