/* src/styling/styles.css */

:root {
    --bg-dark: #121212;
    --bg-panel: #1e1e1e;
    --accent: #00d2ff;
    --accent-hover: #33e0ff;
    --danger: #ff4444;
    --success: #00cc66;
    --warning: #ffcc00;
    --purple: #aa00ff;
    --text-main: #ffffff;
    --text-dim: #aaaaaa;
    --teigu-color: #00ff88;
    --official-color: #55aaff;
    --user-color: #888888;
    --demon: #b30000;
    --discord: #5865f2;
}

* {
    box-sizing: border-box;
}
body {
    margin: 0;
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    user-select: none;
    overflow: hidden;
}

#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #111;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
#title-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}
#game-logo {
    font-size: 80px;
    font-weight: 900;
    color: white;
    text-shadow:
        4px 4px 0 #000,
        0 0 20px rgba(0, 0, 0, 0.8);
    margin-bottom: 40px;
    letter-spacing: 5px;
    font-style: italic;
    z-index: 1;
}
#btn-start-game {
    background: var(--success);
    color: black;
    border: 2px solid white;
    padding: 15px 50px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    transition: 0.2s;
    z-index: 1;
}
#btn-start-game:hover {
    transform: scale(1.05);
    background: #33ff99;
}

#discord-promo {
    position: absolute;
    bottom: 30px;
    text-align: center;
    z-index: 1;
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border: 2px solid #333;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
#discord-promo p {
    margin: 0;
    color: #ccc;
    font-size: 13px;
    font-weight: bold;
    text-shadow: 1px 1px 0 #000;
    max-width: 300px;
    line-height: 1.4;
}
#btn-discord {
    background: var(--discord);
    border: 1px solid white;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    font-weight: bold;
    border-radius: 4px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}
#btn-discord:hover {
    background: #4752c4;
    transform: scale(1.05);
}
#btn-discord svg {
    width: 20px;
    height: 20px;
    fill: white;
}

#btn-restore-title {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: transparent;
    color: #555;
    border: none;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    z-index: 10;
}
#btn-restore-title:hover {
    color: #888;
}

#btn-coffee {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background-color: #ffdd00;
    color: #000;
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
    z-index: 201;
    border: 2px solid white;
    font-size: 14px;
}
#btn-coffee:hover {
    transform: scale(1.05);
}
#btn-coffee svg {
    width: 18px;
    height: 18px;
    fill: #000;
}

#app-container {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100vh;
    overflow-y: auto;
}

#game-wrapper {
    position: relative;
    margin-top: 20px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
    border: 4px solid #333;
    border-radius: 4px;
    flex-shrink: 0;
    background: #000;
    width: 960px;
    height: 540px;
    max-width: 100vw;
    max-height: 100vh;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-wrapper.fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    max-width: none;
    max-height: none;
}

#game-wrapper.maximized {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    z-index: 100;
}

canvas {
    display: block;
    background: linear-gradient(to bottom, #005c97, #363795);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#fps-counter {
    position: absolute;
    top: 5px;
    left: 5px;
    color: lime;
    font-weight: bold;
    font-family: monospace;
    font-size: 12px;
    pointer-events: none;
    text-shadow: 1px 1px 0 #000;
    z-index: 10;
}

#hud-right {
    position: absolute;
    top: 10px;
    right: 15px;
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 5px;
    pointer-events: none;
    z-index: 10;
}

#attempt-counter {
    color: white;
    font-weight: bold;
    font-size: 16px;
    text-shadow: 1px 1px 0 #000;
}
#testmode-label {
    display: none;
    color: var(--warning);
    font-weight: bold;
    font-size: 14px;
    text-shadow: 1px 1px 0 #000;
    letter-spacing: 1px;
}
#testmode-run {
    display: none;
    color: white;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 1px 1px 0 #000;
}

#percentage-label {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-weight: bold;
    font-size: 20px;
    pointer-events: none;
    text-shadow: 1px 1px 0 #000;
    z-index: 10;
}

#btn-fullscreen {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid white;
    color: white;
    font-size: 16px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: 0.2s;
    z-index: 20;
}
#btn-fullscreen:hover {
    background: rgba(255, 255, 255, 0.2);
}

.overlay-screen {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 30;
    backdrop-filter: blur(2px);
}

.overlay-title {
    font-size: 40px;
    font-weight: 900;
    color: white;
    text-shadow: 2px 2px 0 #000;
    margin-bottom: 5px;
    text-transform: uppercase;
}
.overlay-subtitle {
    font-size: 16px;
    color: var(--accent);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.overlay-text {
    font-size: 18px;
    color: var(--success);
    margin-bottom: 20px;
}
.overlay-text.fail {
    color: var(--warning);
}

#btn-start-level-play {
    padding: 15px 50px;
    font-size: 24px;
    background-color: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--success);
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 50px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}
#btn-start-level-play:before {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 15px solid var(--success);
}
#btn-start-level-play:hover {
    transform: scale(1.1);
    background-color: var(--success);
    color: black;
}
#btn-start-level-play:hover:before {
    border-left-color: black;
}
#btn-start-level-play:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

#btn-next-level {
    display: none;
    background: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjMiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBvbHlsaW5lIHBvaW50cz0iMTMgMTcgMTggMTIgMTMgNyIvPjxwb2x5bGluZSBwb2ludHM9IjYgMTcgMTEgMTIgNiA3Ii8+PC9zdmc+")
        no-repeat center right 10px;
    padding-right: 40px;
    background-color: var(--official-color);
    border-color: white;
}

#song-warning {
    display: none;
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 68, 68, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 25;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
}

#btn-pause-float {
    position: absolute;
    top: 10px;
    right: 10px;
    display: none;
}

#main-ui {
    width: 100%;
    max-width: 960px;
    margin-top: 15px;
    margin-bottom: 50px;
    background-color: var(--bg-panel);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.tabs {
    display: flex;
    background: #2a2a2a;
    border-bottom: 2px solid #333;
}
.tab-btn {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.2s;
    border-bottom: 3px solid transparent;
}
.tab-btn:hover {
    background: #333;
    color: white;
}
.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: #252525;
}
.tab-btn.disabled {
    color: #444;
    pointer-events: none;
    text-decoration: line-through;
}

.panel {
    display: none;
    padding: 20px;
    min-height: 140px;
}
.panel.active {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sub-tabs {
    display: flex;
    gap: 5px;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
    margin-bottom: 10px;
}
.sub-tab-btn {
    background: transparent;
    border: none;
    color: #888;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
}
.sub-tab-btn.active {
    background: #333;
    color: white;
}
.tool-group {
    display: none;
    gap: 10px;
    flex-wrap: wrap;
}
.tool-group.active {
    display: flex;
}

.controls-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

button.ui-btn {
    background: #333;
    border: 1px solid #555;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.2s;
}
button.ui-btn:hover {
    background: #444;
    border-color: #777;
}
button.ui-btn.primary {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}
button.ui-btn.danger {
    border-color: var(--danger);
    color: var(--danger);
}
button.ui-btn.danger:hover {
    background: var(--danger);
    color: white;
}
button.ui-btn.tool-btn.active {
    background: var(--success);
    border-color: var(--success);
    color: black;
}
#btn-end.active {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}
#btn-delete {
    color: white;
    border-color: #ff4444;
}
#btn-delete.active {
    background: #ff4444;
    color: white;
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.4);
}
button.ui-btn.filter-active {
    background: var(--success);
    border-color: var(--success);
    color: black;
}
button.ui-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#btn-select-tool {
    color: #aaaaff;
    border-color: #aaaaff;
}
#btn-select-tool.active {
    background: #aaaaff;
    color: black;
}

#btn-portal-ship {
    color: #ff00ff;
    border-color: #ff00ff;
}
#btn-portal-cube {
    color: #00ff00;
    border-color: #00ff00;
}
#btn-portal-gravity-yellow {
    color: #ffe600;
    border-color: #ffe600;
}
#btn-portal-gravity-blue {
    color: #0088ff;
    border-color: #0088ff;
}
#btn-orb-yellow {
    color: #ffe600;
    border-color: #ffe600;
}

#icon-editor-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
#editor-canvas {
    border: 1px solid #555;
    cursor: crosshair;
    background-image:
        linear-gradient(45deg, #222 25%, transparent 25%),
        linear-gradient(-45deg, #222 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #222 75%),
        linear-gradient(-45deg, transparent 75%, #222 75%);
    background-size: 20px 20px;
}
.palette {
    display: grid;
    grid-template-columns: repeat(2, 30px);
    gap: 5px;
}
.color-swatch {
    width: 30px;
    height: 30px;
    border: 2px solid #555;
    cursor: pointer;
    border-radius: 4px;
}
.color-swatch.active {
    border-color: white;
    box-shadow: 0 0 5px white;
}

#presets-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 5px;
    width: 140px;
    border-left: 1px solid #444;
    padding-left: 10px;
}
#presets-list button {
    width: 100%;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
}

#level-display-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
}
.level-card {
    background: #252525;
    padding: 10px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #333;
}
.level-card.selected {
    border-color: var(--success);
    background: #1a2a1a;
}
.level-card.completed {
    border: 2px solid var(--success);
    box-shadow: 0 0 5px rgba(0, 204, 102, 0.3);
    background: #1a3320;
}
.level-btn-row {
    display: flex;
    gap: 5px;
}

.level-card.demon {
    border: 1px solid var(--demon);
    background: #2a0a0a;
}
.level-card.demon.completed {
    border: 2px solid var(--success);
    background: #1a3320;
}
.demon-rank {
    color: var(--danger);
    font-size: 1.2em;
    font-weight: bold;
    margin-right: 10px;
}

.level-card.challenge {
    border: 1px solid var(--purple);
    background: #1a0a2a;
}
.level-card.challenge.completed {
    border: 2px solid var(--success);
    background: #1a3320;
}
.challenge-rank {
    color: var(--purple);
    font-size: 1.2em;
    font-weight: bold;
    margin-right: 10px;
}

.completed-mark {
    color: var(--success);
    margin-left: 8px;
    font-weight: bold;
}
.level-credits {
    font-size: 0.8em;
    color: #888;
    display: block;
    margin-top: 2px;
}

.auth-teigu {
    color: var(--teigu-color);
    text-shadow: 0 0 5px rgba(0, 255, 136, 0.3);
    font-weight: bold;
}
.auth-official {
    color: var(--official-color);
}
.auth-user {
    color: var(--user-color);
}
.alleged-mark {
    color: #888;
    font-size: 0.8em;
    margin-left: 2px;
    vertical-align: super;
}
.verified-badge {
    color: var(--teigu-color);
    margin-left: 4px;
    font-size: 1.1em;
}

#status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    background: #333;
    color: #888;
}
.st-green {
    background-color: var(--success) !important;
    color: black !important;
}
.st-red {
    background-color: var(--danger) !important;
    color: white !important;
}

.shortcut-hint {
    font-size: 10px;
    color: #666;
    margin-left: 5px;
}
input[type="text"],
input[type="number"] {
    background: #111;
    border: 1px solid #444;
    color: white;
    padding: 5px;
    font-family: inherit;
    font-size: 12px;
    border-radius: 3px;
    width: 150px;
}
input[type="text"]:disabled {
    background: #222;
    color: #555;
    border-color: #333;
}

#custom-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100;
    justify-content: center;
    align-items: center;
}
.modal-content {
    background: var(--bg-panel);
    border: 1px solid #555;
    padding: 20px;
    border-radius: 8px;
    width: 400px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}
.modal-title {
    font-weight: bold;
    font-size: 14px;
    color: var(--accent);
    text-transform: uppercase;
}
.modal-input {
    background: #111;
    border: 1px solid #444;
    color: white;
    padding: 8px;
    font-family: monospace;
    font-size: 12px;
    resize: vertical;
    min-height: 40px;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

#login-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.login-content {
    background: var(--bg-panel);
    border: 1px solid #555;
    padding: 30px;
    border-radius: 8px;
    width: 400px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

.login-title {
    font-weight: bold;
    font-size: 18px;
    color: var(--accent);
    text-transform: uppercase;
    text-align: center;
}

.login-input {
    background: #111;
    border: 1px solid #444;
    color: white;
    padding: 10px;
    font-family: inherit;
    font-size: 14px;
    border-radius: 4px;
}

.login-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.login-btn,
.register-btn {
    flex: 1;
    background: var(--accent);
    border: none;
    color: black;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 4px;
    transition: 0.2s;
}

.login-btn:hover,
.register-btn:hover {
    background: var(--accent-hover);
}

.login-btn:disabled,
.register-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.login-error {
    color: var(--danger);
    font-size: 12px;
    text-align: center;
}
