html, body {
    padding: 0;
    margin: 0;
}

body.home-page {
    overflow: hidden;
    width: 100%;
    height: 100%;
}

#overlays {
    display: none;
    position: absolute;
    left: 0; right: 0; top: 0; bottom: 0;
    background-image: url('../img/background_V3.png');
    background-size: cover;
    background-position: center;
    z-index: 200;
    align-items: center;
    justify-content: center;
}

#overlays.ingame {
    background-image: none;
    background-color: transparent;
}

#connecting {
    display: none;
    position: absolute;
    left: 0; right: 0; top: 0; bottom: 0;
    z-index: 100;
    background-color: rgba(0,0,0,0.5);
}

#connecting-content {
    width: 350px;
    background-color: #fff;
    margin: 100px auto;
    border-radius: 15px;
    padding: 5px 15px;
}

#canvas {
    position: absolute;
    left: 0; right: 0; top: 0; bottom: 0;
    width: 100%;
    height: 100%;
}

#helloDialog {
    width: 380px;
    background-color: #fff;
    margin: 0;
    border-radius: 15px;
    padding: 5px 15px;
    position: relative; /* bukan absolute */
    top: auto;
    left: auto;
    transform: none;
    min-height: 520px;
    transition: min-height 0.2s ease;
}

#helloDialog.settings-open {
    min-height: 550px;
    transition: min-height 0.2s ease;
}

#dialogWrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: block; /* bukan flex */
    width: 380px;   /* sama dengan lebar helloDialog */
}

#friendPanel {
    display: none;
    width: 320px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    position: absolute;
    top: 0;
    left: calc(380px + 10px);
    overflow: hidden;
    padding: 0;
    min-height: 400px;  /* ← tambah ini */
}

#friendPanelHeader {
    background: #ffffff;
    color: rgb(0, 0, 0);
    padding: 10px 14px;
    font-size: 18px;
    border-bottom: 2px solid #eee;
}

#friendPanelHeader strong {
    font-weight: bold;
}

#friendPanelList {
    padding: 0;
    max-height: 350px;
    overflow-y: auto;
    border-top: 1px solid #eee;
}

.friend-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    gap: 10px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #eee;
}

.friend-item:hover {
    background: #f5f5f5;
}

.friend-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 15px;
    flex-shrink: 0;
}

.friend-name {
    flex: 1;
    font-size: 14px;
    color: #222;
}

.friend-guild {
    font-size: 11px;
    color: #888;
    margin-right: 4px;
}

.friend-invite-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #aaa;
    font-size: 16px;
    padding: 0;
    transition: color 0.15s;
}

.friend-invite-btn:hover {
    color: #337ab7;
}

#friendPanelFooter {
    border-top: 1px solid #eee;
    text-align: center;
    padding: 10px;
    font-size: 13px;
    color: #337ab7;
    cursor: pointer;
}

#friendPanelFooter:hover {
    background: #f5f5f5;
}

#footer {
    position: absolute;
    bottom: 15px;
    left: 0;
    width: 380px; /* ganti right:0 jadi width fixed sesuai lebar helloDialog */
    text-align: center;
}

#chat_textbox {
    transition: all .5s ease-in-out;
    position: absolute;
    z-index: 1;
    bottom: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: 0px;
    outline: none;
    color: #fff;
    height: 30px;
    text-indent: 12px;
    left: 10px;
    width: 300px;
}

#chat_textbox:focus {
    background: rgba(0,0,0,.5);
}

#play-btn {
    flex: 1;
    float: none;
}

.btn-friend {
    width: 40px;
    flex-shrink: 0;
    float: none;
}

.btn-settings {
    width: 40px;
    flex-shrink: 0;
    float: none;
}

.btn-row {
    display: flex;
    gap: 2px;
    align-items: center;
    margin-bottom: 6px;
}

.mode-btn {
    padding: 5px 14px;
    border: 2px solid #ccc;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s;
}
.mode-btn:hover { border-color: #337ab7; }
.mode-btn.active { background: white; border-color: #337ab7; }

.server-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

#spectate-btn {
    flex-shrink: 0;
    width: 30%;
    margin-top: 0;
}

#xpSection {
    position: absolute;
    bottom: 35px;
    left: 15px;
    width: 350px; /* ganti right:15px jadi width fixed */
}

#settings label {
    margin-right: 10px;
}

.checkbox label {
    margin-right: 10px;
}

.loader {
    border: 6px solid #f3f3f3;
    border-top: 6px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
}

.center {
    display: table;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}