body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background: linear-gradient(to bottom, #121212, #1e1e1e);
    color: #f1f1f1;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background-color: #1f1f1f;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: box-shadow 0.3s ease;
    animation-delay: 0.3s;
}
.container:hover {
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.5);
}

h1, h3 {
    text-align: center;
    color: #ffffff;
    margin-bottom: 30px;
}

.controls {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

button {
    padding: 10px 18px;
    background: linear-gradient(to right, #26a69a, #00796b);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    transition: background 0.3s, transform 0.15s ease-in-out, box-shadow 0.3s;
}

button:hover {
    background: linear-gradient(to right, #2bbbad, #004d40);
    transform: scale(1.05);
}

button:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(255, 255, 255, 0.1) inset;
}

button:focus {
    outline: 2px solid #00bfa5;
    outline-offset: 2px;
}

button:disabled {
    background-color: #555;
    cursor: not-allowed;
    box-shadow: none;
}

button.active-btn {
    background: linear-gradient(to right, #ff7043, #d84315); /* 橘紅色系 */
    box-shadow: 0 2px 8px rgba(255, 112, 67, 0.4);
  }
  

#canvas-container {
    position: relative;
    width: 100%;
    height: 500px;
    border: 1px solid #444;
    border-radius: 8px;
    background-color: #2c2c2c;
    overflow: hidden;
}

canvas {
    display: block;
}

.legend,
.instructions,
.queue-visualization {
    margin-top: 25px;
    padding: 15px;
    border: 1px solid #444;
    border-radius: 8px;
    background-color: #2a2a2a;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}
.legend-color {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border-radius: 50%;
    border: 1px solid #888;
}

.queue {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
}

.queue-node {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #FF9800;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.empty-queue {
    font-style: italic;
    color: #aaa;
    margin: 10px 0;
}

.layout {
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
    opacity: 0;
    animation: fadeInUp 0.9s ease-out forwards;
    animation-delay: 0.5s;
}

.sidebar {
    width: 200px;
    background-color: #263238;
    border-radius: 12px;
    padding: 20px;
    border-right: 2px solid #37474f;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.sidebar .btn-group {
    flex-direction: column;
}
.sidebar .btn-group button {
    width: 100%;
}

.container {
    flex-grow: 1;
    max-width: none;
    margin: 0;
    padding: 30px;
    overflow-y: auto;
}

.header {
    width: 100%;
    padding: 30px 0;
    border-radius: 12px;
    text-align: center;
    background: linear-gradient(to right, #37474f, #263238);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    opacity: 0;
    animation: fadeInUp 0.9s ease-out forwards;
}

.header h1 {
    margin: 0;
    font-size: 32px;
    color: #ffffff;
}
.global-instruction {
    max-width: 960px;
    margin: 20px auto;
    padding: 25px 30px;
    border-radius: 16px;
    background: rgba(42, 42, 42, 0.85);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    color: #e0f2f1;
    font-size: 15px;
    line-height: 1.7;
    opacity: 0;
    animation: fadeInUp 0.9s ease-out forwards;
}

.global-instruction h3 {
    text-align: left;
    font-size: 20px;
    margin-bottom: 15px;
    color: #80cbc4;
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-title {
    font-size: 20px;
}

.global-instruction ul {
    list-style: none;
    padding-left: 0;
}

.global-instruction li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 14px;
}

.global-instruction li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 7px;
    width: 10px;
    height: 10px;
    background-color: #26a69a;
    border-radius: 50%;
    box-shadow: 0 0 3px rgba(38, 166, 154, 0.6);
}

.instructions.global-instruction strong {
    color: #26a69a;
    font-weight: bold;
}

#graph-canvas {
    background-image: url("DSA_GOD.jpeg");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

@keyframes fadeInUp {
    0% {
      opacity: 0;
      transform: translateY(40px) scale(0.98);
    }
    100% {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
}