body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    color: #eee;
    background-color: #000;
    overflow: hidden;
}

#ui-toggle {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 60;
    padding: .5rem .8rem;
    border: none;
    border-radius: .35rem;
    background: #2b2b2b;
    color: #eee;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
#ui-toggle:hover { background:#3a3a3a; }

#fs-toggle {
    position: fixed;
    top: 14px;
    right: 110px;
    z-index: 60;
    padding: .5rem .8rem;
    border: none;
    border-radius: .35rem;
    background: #2b2b2b;
    color: #eee;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
#fs-toggle:hover { background:#3a3a3a; }

#settings-scrim {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 65; display: none;
}

.main-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

#settings-panel {
    width: 250px;
    padding: 1rem;
    box-sizing: border-box;
    background-color: #1a1a1a;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    border-right: 1px solid #333;
    max-height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#settings-panel h2 {
    margin-top: 0;
    text-align: center;
    border-bottom: 1px solid #333;
    padding-bottom: 0.5rem;
    margin-bottom: 0;
}

.setting {
    display: flex;
    flex-direction: column;
}

.setting-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    border-top: 1px solid #333;
    padding-top: 1.5rem;
}

.setting-buttons button {
    padding: 0.7em 1em;
    border-radius: .3em;
    background-color: #007bff;
    color: #eee;
    cursor: pointer;
    transition: background-color 0.2s;
    border: none;
    font-size: 0.9em;
    font-weight: 500;
}

.setting-buttons button:hover {
    background-color: #0056b3;
}

.setting label {
    margin-bottom: 0.5rem;
    color: #ccc;
    font-weight: 500;
}

.setting > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting span {
    font-family: monospace;
    font-size: 0.9em;
    background-color: #2c2c2c;
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 3em;
    text-align: right;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    flex-grow: 1;
    height: 8px;
    background: #444;
    border-radius: 5px;
    outline: none;
    opacity: 0.7;
    transition: opacity .2s;
    cursor: pointer;
}

input[type="range"]:hover {
    opacity: 1;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #007bff;
    cursor: pointer;
    border-radius: 50%;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #007bff;
    cursor: pointer;
    border-radius: 50%;
}

@media (max-width: 768px) {
  #settings-panel {
      position: fixed; left: 0; top: 0; bottom: 0;
      width: 80vw; max-width: 320px;
      transform: translateX(-100%);
      transition: transform .3s ease;
      z-index: 70;
  }
  body.settings-open #settings-panel { transform: translateX(0); }
  body.settings-open #settings-scrim { display: block; }
  .main-container { overflow: hidden; }
}

#container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    height: 100vh;
    padding: 1rem;
    box-sizing: border-box;
    position: relative; /* For joystick positioning */
}

#info {
    text-align: center;
    margin-bottom: 1rem;
}

h1 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

p {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: #aaa;
}

input[type="file"] {
    margin-top: 1rem;
    color: #ccc;
}
/* Style for file input button */
input[type="file"]::file-selector-button {
    border: 1px solid #555;
    padding: .5em .8em;
    border-radius: .3em;
    background-color: #333;
    color: #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

input[type="file"]::file-selector-button:hover {
    background-color: #444;
}

#scene-canvas {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 80vh;
    display: block;
    border-radius: 8px;
    background-color: #000;
}

#joystick-container {
    position: absolute;
    bottom: 30px;
    left: 30px;
    width: 150px;
    height: 150px;
    display: none; /* Hidden by default */
}

#release-banner {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    letter-spacing: 0.2px;
    font-size: 0.95rem;
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
    z-index: 40;
    opacity: 1;
    display: block;
    transition: opacity 1s ease;
    pointer-events: none;
}

#goal-banner {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    background: #ffd400;
    color: #000;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    letter-spacing: 0.2px;
    font-size: 0.95rem;
    box-shadow: 0 6px 18px rgba(0,0,0,0.3);
    z-index: 40;
    transition: transform .6s ease;
    pointer-events: none;
}
#goal-banner.show {
    transform: translateX(-50%) translateY(0);
}

.ai-gen { display:flex; gap:.5rem; margin-top: .8rem; }
.ai-gen input { flex:1; padding:.5rem .6rem; border-radius:.3rem; border:1px solid #444; background:#1b1b1b; color:#eee; }
.ai-gen button { padding:.55rem .9rem; border-radius:.3rem; border:none; background:#0a84ff; color:#fff; cursor:pointer; }
.ai-gen button:disabled { opacity:.6; cursor:not-allowed; }

#ai-loading { position:absolute; inset:auto 50% 50% auto; transform:translate(50%,50%); background:#000c; color:#fff;
 padding:.7rem 1rem; border-radius:.5rem; display:none; z-index:50; box-shadow:0 8px 24px #0008; }

/* Hide non-essential UI when toggled */
body.ui-hidden #settings-panel { display: none; }
body.ui-hidden #release-banner,
body.ui-hidden #goal-banner,
body.ui-hidden #info { display: none; }

#survival-border {
    position: absolute;
    inset: 0;
    border: 6px solid rgba(255,255,255,0.25);
    pointer-events: none;
    border-radius: 10px;
    display: none;
}

.ai-scale { display:flex; gap:.5rem; margin-top:.5rem; }
.ai-scale input { flex:1; padding:.5rem .6rem; border-radius:.3rem; border:1px solid #444; background:#1b1b1b; color:#eee; }
.ai-scale button { padding:.55rem .9rem; border-radius:.3rem; border:none; background:#0a84ff; color:#fff; cursor:pointer; }
#ai-scale-loading { position:absolute; right:14px; bottom:14px; background:#000c; color:#fff; padding:.5rem .7rem; border-radius:.4rem; display:none; z-index:50; }