:root {
    --bg-start: #110014;
    --bg-end: #570b8e;
    --text-color: #E0E0FF;
    --pack-bg: rgba(81, 81, 81, 0.215);
    --pack-border: #ffffff;
    --level-highlight: #00d5ff;
}

scroll-container::-webkit-scrollbar {
    display: none;
}

body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%);
    transition: --bg-start 1.5s ease, --bg-end 1.5s ease;
    color: var(--text-color);
    font-family: 'Press Start 2P', monospace;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

@property --bg-start {
  syntax: '<color>';
  inherits: true;
  initial-value: #110014;
}

@property --bg-end {
  syntax: '<color>';
  inherits: true;
  initial-value: #570b8e;
}

.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out;
    padding: 20px;
    box-sizing: border-box;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

#title-screen {
    cursor: pointer;
}

.game-title {
    font-size: 48px;
    text-shadow: 4px 4px 0 #000;
}

.start-text {
    font-size: 16px;
    margin-top: 30px;
    animation: blink 1s steps(1, end) infinite;
}

.warning {
    position: absolute;
    font-size: 11px;
    background-color: #00000046;
    margin-top: 500px;
    padding-top: 6px;
    padding-bottom: 6px;
    left: 0;
    width: 100%;
    text-align: center;
    animation: blink 1s steps(1, end) infinite;
}

@keyframes blink {
    from, to { opacity: 1; }
    50% { opacity: 0.5; }
}

#pack-select-screen {
    position: absolute; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    transform: translateY(-100vh); 
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1); 
    display: flex; 
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    scrollbar-width: none;
    -ms-overflow-style: none;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    padding-bottom: 100px;
    -webkit-mask-image: linear-gradient(to bottom, 
        black 0%, 
        black 85%, 
        transparent 100%
    );
    mask-image: linear-gradient(to bottom, 
        black 0%, 
        black 85%, 
        transparent 100%
    );
    mask-attachment: fixed;
    -webkit-mask-attachment: fixed;
}

#pack-select-screen > * {
    flex-shrink: 0; 
}

#pack-select-screen::-webkit-scrollbar {
    display: none;
}

#level-select-container {
    width: 100vw;
    max-width: none;
    background: none;
    padding-left: 50px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100vh; 
    overflow-y: auto;
    box-sizing: border-box;
    padding-bottom: 80px;
}

#level-select-container > * {
    flex-shrink: 0;
}

#pack-select-screen.active {
    transform: translateY(0); 
}

.section-title {
    font-size: 24px;
    margin-bottom: 40px;
    text-shadow: 2px 2px 0 #000;
}

#pack-list {
    width: 80%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-shrink: 0;
}

.pack-card {
    background-color: var(--pack-bg);
    border: 3px solid var(--pack-border);
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.pack-card:hover {
    transform: scale(1.02);
    box-shadow: 0 0 4px var(--pack-border);
}

.pack-name {
    font-size: 18px;
    margin: 0;
}

.pack-description {
    font-size: 10px;
    opacity: 0.8;
    margin-top: 10px;
    line-height: 1.5;
}

.pack-difficulty {
    position: absolute;
    bottom: 10px;
    right: 15px;
    font-size: 14px;
    color: gold;
    margin-top: 5px;
}

.difficulty-star {
    width: 15px;
    height: 15px;
    margin: 0 1px;
    image-rendering: pixelated;
}

#level-list-screen {
    justify-content: flex-start;
    align-items: flex-start;
    padding: 50px;
}

#current-pack-title {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
}

#level-select-container::-webkit-scrollbar {
    display: none;
}

.level-list-item {
    display: flex;
    align-items: center;
    background-color: var(--pack-bg);
    border: 2px solid var(--pack-border);
    border-radius: 4px;
    padding: 10px;
    cursor: pointer;
    transition: transform 0.2s ease-out, background-color 0.2s;
    transform: translateX(0);
    width: 50vw;
    max-width: 600px;
}

.level-list-item:hover {
    transform: translateX(20px); 
    background-color: rgba(160, 32, 240, 0.2); 
    border-color: var(--level-highlight);
}

.level-list-item.keyboard-selected { 
    transform: translateX(20px);
    background-color: rgba(160, 32, 240, 0.4);
    border-color: var(--level-highlight);
}

.level-list-info {
    flex-grow: 1;
    padding-left: 15px;
}

.level-name-text {
    font-size: 14px;
    margin: 0;
}

.level-preview-canvas {
    background-color: rgba(0, 0, 0, 0); 
    width: 64px;
    height: 64px;
}

.back-button {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    padding: 10px 15px;
    background-color: var(--pack-bg);
    border: 2px solid var(--pack-border);
    color: var(--text-color);
    cursor: pointer;
    text-shadow: 1px 1px #000;
    transition: transform 0.1s, background-color 0.1s;
    white-space: nowrap;
    position: static;
    margin-top: -25px;
}

.back-button:hover {
    transform: scale(1.05);
    background-color: rgba(160, 32, 240, 0.2);
}

#game-screen {
    width: 1300px;
    height: 1000px;
    background-color: #11111100;
    margin-top: 10%;
    transition: transform 0.4s ease-in-out;
    position: relative;
    overflow: hidden;
}

.slide-push-left {
    transform: translateX(-100vw);
}

.slide-pull-left {
    transform: translateX(100vw);
}

.no-transition {
    transition: none;
}

.slide-exit-right {
    transform: translateX(100vw);
    transition: transform 0.8s ease-in-out;
}

.back-button-top {
    position: absolute; 
    top: 75px; 
    left: 10px;
    z-index: 100;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    padding: 10px 15px;
    background-color: var(--pack-bg);
    border: 2px solid var(--pack-border);
    color: var(--text-color);
    cursor: pointer;
    text-shadow: 1px 1px #000;
    transition: transform 0.1s, background-color 0.1s;
    white-space: nowrap;
}

.back-button-top:hover {
    background-color: var(--pack-border);
    transform: scale(1.05);
}






#completion-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 50%;
  margin-top: 13.5%;
  margin-left: 25%;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 100;
  padding: 20px;
  box-sizing: border-box;
  border: 15px solid white;
}

#completion-card::before,
#completion-card::after {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  pointer-events: none;
}

#completion-card::before {
  top: 0;
  left: 0;

  background:
    linear-gradient(#fff 0 0) left top / 30px 15px no-repeat,
    linear-gradient(#fff 0 0) left top / 15px 30px no-repeat;

  box-shadow:
    calc(100% - 30px) calc(100% - 30px) 0 0 #fff;
}

#completion-card::after {
  top: 0;
  right: 0;

  background:
    linear-gradient(#fff 0 0) right top / 30px 15px no-repeat,
    linear-gradient(#fff 0 0) right top / 15px 30px no-repeat;

  box-shadow:
    calc(-100% + 30px) calc(100% - 30px) 0 0 #fff;
}

#completion-card h4 {
    font-size: 30px;
    text-transform: uppercase;
    justify-self: center;
    animation: rainbowCycle 5s linear infinite, wobble 2s ease-in-out infinite alternate;
    transform: rotate(0.5deg);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    margin-top: 15%;
    white-space: nowrap;
}

.completion-buttons {
    display: flex;
    gap: 100px;
    margin-top: 200px;
    justify-self: center;
}

#completion-card button {
  image-rendering: pixelated;
  width: 80px;
  height: 80px;

  border-radius: 0;

  background: transparent;
  cursor: pointer;

  display: flex;
  justify-content: center;
  align-items: center;

  box-shadow:
    0 0 0 4px #fff,
    4px 4px 0 4px #000;

  transition: transform 0.1s;
}


#completion-card button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

#completion-card button img {
    width: 48px; 
    height: 48px;
}

@keyframes wobble {
    0% { transform: rotate(1.5deg); }
    100% { transform: rotate(-0.5deg); }
}

@keyframes rainbowCycle {
    0% { color: rgb(255, 102, 102); }
    16% { color: rgb(255, 255, 102); }
    33% { color: rgb(102, 255, 102); }
    50% { color: rgb(102, 255, 255); }
    66% { color: rgb(102, 102, 255); }
    83% { color: rgb(255, 102, 255); }
    100% { color: rgb(255, 102, 102); }
}







#level-name-container {
    position: absolute;
    display: flex;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    z-index: 100;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-size: 15px;
    animation: float 2.5s ease-in-out infinite;
    white-space: nowrap;
}

@keyframes float {
    0% {
        transform: translate(-50%, 0);
        text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4); 
    }
    50% {
        transform: translate(-50%, -7px); 
        text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.6); 
    }
    100% {
        transform: translate(-50%, 0);
        text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4); 
    }
}

#action-icons-container {
    position: absolute;
    bottom: 210px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 30px;
    z-index: 10;
}

.action-icon {
    width: 40px; 
    height: 40px;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.2s ease-in-out;
}

.action-icon.disabled {
    opacity: 0;
    cursor: default;
}

.action-icon:not(.disabled) {
    opacity: 0.5; 
}

.action-icon.used {
    opacity: 1.0; 
}

#pack-select-screen, 
#level-list-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#title-screen, 
#pack-select-screen {
    position: absolute; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.title-screen-out {
    transform: translateY(100vh); 
}

.pack-screen-start {
    transform: translateY(-100vh); 
}

#bg-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

.final-move-display{
    text-align: center;
    justify-self: center;
    position: absolute;
    font-family: 'Press Start 2P';
    font-size: 18px;
    margin-top: 30px;
}

.move-counter{
    justify-self: center;
    margin-top: 41.7%;
    position: absolute;
    margin-left: 83%;
    white-space: nowrap;
    overflow-x: visible;
    max-width: 50%;
}

#settings-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: none;
    cursor: pointer;
    z-index: 1000;
    padding: 10px;
    width: 24px;
    height: 24px;
    justify-items: center;
}

#settings-toggle img {
    width: 24px;
    height: 24px; 
    top: -1px;
    right: -2px;
    position: absolute;       
}

#settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#settings-overlay.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

#settings-window {
    background: var(--bg-start);
    border: 10px solid white;
    padding: 40px;
    width: 400px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.setting-item {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkmark-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    z-index: 10;
    pointer-events: none;
}

.danger-button {
    background: #890000;
    color: #ffffff;
    border: none;
    padding: 10px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    cursor: pointer;
    width: 100%;
}

.danger-button:hover {
    background: #ff0000;
    color: #000000;    
    animation: shake 0.3s;
    animation-iteration-count: infinite;
}

@keyframes shake {
    0% { transform: translate(1px, 1px)}
    10.5% { transform: translate(-1px, -2px)}
    21% { transform: translate(-3px, 0px)}
    31.5% { transform: translate(3px, 2px)}
    42% { transform: translate(1px, -1px)}
    52.5% { transform: translate(-1px, 2px)}
    63% { transform: translate(-3px, 1px)}
    73.5% { transform: translate(3px, 1px)}
    84% { transform: translate(-1px, -1px)}
    94.5% { transform: translate(1px, 2px)}
    100% { transform: translate(1px, -2px)}
}

.pack-header-stats {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.pack-stats-text {
    font-size: 10px;
    font-family: 'Press Start 2P', cursive;
    color: #00ff00;
    text-shadow: 1px 1px 0px #000;
}

.mini-progress-bg {
    width: 60px;
    height: 6px;
    background: #222;
    border: 1px solid #000;
    overflow: hidden;
    border-radius: 5px;
}

.mini-progress-fill {
    height: 100%;
    background: #00ff00;
    transition: width 0.3s ease;
}

.pack-card:has(.checkmark-icon) .mini-progress-fill,
.pack-card:has(.checkmark-icon) .pack-stats-text {
    background-color: #ffd700;
    color: #ffd700;
}

@keyframes rainbow-solid {
    0%   { background-color: #ff0000; }
    14%  { background-color: #ff8000; }
    28%  { background-color: #ffff00; }
    42%  { background-color: #00ff00; }
    57%  { background-color: #00ffff; }
    71%  { background-color: #0000ff; }
    85%  { background-color: #8000ff; }
    100% { background-color: #ff0000; }
}

.mini-progress-fill.is-complete {
    animation: rainbow-solid 3s linear infinite;
    border: none;
}

.pack-stats-text.is-complete {
    color: #fff;
    animation: rainbow-text 1s infinite;
}

@keyframes rainbow-text {
    0% { color: #ff0000; }
    33% { color: #0800ff; }
    66% { color: #00ff00; }
    100% { color: #ff0000; }
}

.editor-card {
    border: 2px dashed var(--level-highlight);
    background: rgba(160, 32, 240, 0.1);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.editor-card:hover {
    border-style: solid;
    border-color: #00ffff;
    background: #22002e;
    transform: translateY(-5px);
}

.editor-card .pack-name {
    color: var(--level-highlight);
}

.load-pack-card {
    border: 2px dashed #00ffcc;
    background: rgba(0, 255, 204, 0.05);
}

.load-pack-card:hover {
    border-style: solid;
    background: rgba(0, 255, 204, 0.15);
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.3);
}

.load-pack-card .pack-name {
    color: #00ffcc;
}