/* ---- Base ---- */
body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    color: #ddd;
    overflow-x: hidden;
    background: #111;
    min-height: 100%;
}

#scale-host {
    position: relative;
    overflow: hidden;
    width: 100%;
}

#app {
    position: relative;
    /* Natural size set by config.game.w/h via game.js + touch.js */
    background: #222;
    font-size: 14px;
    box-shadow: 5px 5px 10px -5px #000;
    border-radius: 5px;
    overflow: hidden;
}

/* ---- Logo ---- */
#logo {
    pointer-events: none;
    position: relative;
    z-index: 2;
    padding: 0.8% 0;
    width: 100%;
    text-align: center;
}

#logo img {
    transition: all 0.5s ease;
    width: 10%;
}

#logo.play-status img {
    width: 6%;
}

/* ---- Container / scenes ---- */
#container,
#container > div {
    width: 100%;
    height: 100%;
}

#container > div {
    padding-top: 8%;
    visibility: hidden;
    text-align: center;
    opacity: 0;
}

#container > div.action {
    visibility: visible;
    opacity: 1;
    transition: all 0.2s ease;
}

/* ---- Start scene ---- */
#start-btn p:nth-child(2) {
    display: none;
}
#start-btn:disabled p:nth-child(1) {
    display: none;
}
#start-btn:disabled p:nth-child(2) {
    display: block;
}

/* ---- Play scene ---- */
#play {
    background: url('../img/background-1.jpg');
    background-size: 100% 100%;
}

#canvas {
    z-index: 3;
    pointer-events: none;
}

.content {
    width: 100%;
    height: 100%;
}

.content .header {
    user-select: none;
    display: flex;
    justify-content: space-between;
}

.content .header ul {
    width: 45%;
    height: 50px;
    font-size: 20px;
}

.content .header li img {
    width: 30px;
    height: 30px;
    margin-right: 5px;
}

.content .header ul,
.content .header ul li {
    display: flex;
    align-items: center;
    justify-content: space-around;
}

.content .header .option img {
    cursor: pointer;
}

.content .header .option img:nth-child(2) {
    display: none;
}

.content .header .option li:active {
    opacity: 0.5;
}

.content .header .option li.active img:nth-child(1) {
    display: none;
}

.content .header .option li.active img:nth-child(2) {
    display: block;
}

/* ---- Over scene ---- */
#over .message {
    margin-left: 29%;
    width: 71%;
    display: flex;
}

#over .message img {
    width: 30px;
    height: 30px;
}

#over .message span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 70px;
    width: 20%;
}

#over .message span:nth-last-child(1) {
    width: 60%;
    padding-left: 4%;
    justify-content: space-between;
}

#over input {
    border: none;
    border-radius: 3px;
    box-sizing: border-box;
    text-align: center;
    font-size: 1rem;
    width: 35%;
    margin: 0 auto;
    height: 30px;
}

/* ---- Rank scene ---- */
table {
    height: 80%;
    overflow: hidden;
}

/* ---- Touch controls (outside #app, below scaled canvas) ---- */
#touch-controls {
    width: 100%;
    flex-direction: column;
    align-items: center;
    padding: 8px 0 12px;
    gap: 8px;
    background: #0a0a0a;
    /* display is toggled by touch.js */
}

.touch-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.touch-btn {
    background: rgba(255, 255, 255, 0.10);
    border: 2px solid rgba(255, 255, 255, 0.30);
    border-radius: 50%;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #eee;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    cursor: pointer;
    transition: background 0.08s;
    -webkit-tap-highlight-color: transparent;
}

.touch-btn.pressed,
.touch-btn:active {
    background: rgba(255, 100, 40, 0.45);
    border-color: rgba(255, 130, 50, 0.8);
}

.touch-fire-btn {
    width: 90px;
    height: 90px;
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 2px;
    background: rgba(200, 40, 10, 0.25);
    border-color: rgba(255, 80, 30, 0.65);
    border-radius: 50%;
}

/* ---- Desktop layout fallback ---- */
@media (min-width: 601px) {
    body {
        align-items: center;
    }
    #app {
        margin: 10px auto;
    }
}
