* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a1a;
    color: #e0e0e0;
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.control-panel {
    background-color: #252525;
    padding: 15px 20px;
    border-bottom: 2px solid #3a3a3a;
    overflow: visible;
    position: relative;
    z-index: 10;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

h1 {
    font-size: 20px;
    margin: 0;
    color: #ff6b35;
}

.help-button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #3a3a3a;
    border: 2px solid #4a4a4a;
    color: #ff6b35;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.help-button:hover {
    background-color: #ff6b35;
    color: white;
    border-color: #ff6b35;
    transform: scale(1.1);
}

.help-icon {
    line-height: 1;
}

.input-row {
    display: flex;
    gap: 30px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.section-label {
    font-size: 12px;
    color: #b0b0b0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 10px;
    font-weight: 600;
}

.input-section {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

label {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

select {
    padding: 5px 10px;
    background-color: #1a1a1a;
    border: 1px solid #3a3a3a;
    color: #e0e0e0;
    border-radius: 4px;
    font-size: 13px;
    width: 100px;
}

input[type="number"] {
    padding: 6px 10px;
    background-color: #1a1a1a;
    border: 1px solid #3a3a3a;
    color: #e0e0e0;
    border-radius: 4px;
    font-size: 13px;
    width: 80px;
}

input[type="text"] {
    padding: 6px 10px;
    background-color: #1a1a1a;
    border: 1px solid #3a3a3a;
    color: #e0e0e0;
    border-radius: 4px;
    font-size: 13px;
    width: 80px;
}

select:focus,
input[type="number"]:focus,
input[type="text"]:focus {
    outline: none;
    border-color: #ff6b35;
}

button {
    padding: 6px 14px;
    background-color: #ff6b35;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #e85a28;
}

button:active {
    transform: translateY(1px);
}

#clear-points {
    background-color: #3a3a3a;
}

#clear-points:hover {
    background-color: #4a4a4a;
}

.canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

#graph {
    background-color: #2a2a2a;
    border: 2px solid #3a3a3a;
    border-radius: 8px;
}

/* Compass */
.compass-container {
    position: absolute;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.compass {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 3px solid #3a3a3a;
    border-radius: 50%;
    position: relative;
    cursor: grab;
    transition: transform 0.05s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.compass:active {
    cursor: grabbing;
}

.compass-needle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3px;
    height: 28px;
    background: linear-gradient(to bottom, #ff6b35 0%, #ff6b35 50%, #888 50%, #888 100%);
    transform: translate(-50%, -50%);
    transform-origin: center center;
    border-radius: 2px;
}

.compass-needle::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 8px solid #ff6b35;
}

.compass-label {
    position: absolute;
    font-size: 11px;
    font-weight: bold;
    color: #b0b0b0;
    user-select: none;
}

.compass-n {
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    color: #ff6b35;
}

.compass-e {
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.compass-s {
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.compass-w {
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.compass-angle {
    background-color: #1a1a1a;
    border: 1px solid #3a3a3a;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    color: #ff6b35;
    font-weight: bold;
}

/* Lists Container */
.lists-container {
    margin-top: 8px;
    display: flex;
    gap: 10px;
}

.list-section {
    flex: 1;
    min-width: 0;
    position: relative;
}

.list-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #1a1a1a;
    padding: 8px 12px;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #b0b0b0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1000;
}

.list-toggle:hover {
    background-color: #2a2a2a;
}

.toggle-icon {
    transition: transform 0.2s;
}

.list-toggle.expanded .toggle-icon {
    transform: rotate(180deg);
}

.item-list {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 1001;
    background-color: #252525;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 300px;
    overflow-y: auto;
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
    scrollbar-width: thin;
    scrollbar-color: #ff6b35 #1a1a1a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.item-list::-webkit-scrollbar {
    width: 6px;
}

.item-list::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.item-list::-webkit-scrollbar-thumb {
    background: #ff6b35;
    border-radius: 3px;
}

.item-list::-webkit-scrollbar-thumb:hover {
    background: #e85a28;
}

.item-list.collapsed {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    max-height: 0;
    padding: 0;
    border: none;
    overflow: hidden;
}

.target-item,
.cannon-item {
    background-color: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.target-name,
.cannon-name {
    font-weight: 600;
    color: #4ecdc4;
    min-width: 50px;
}

.target-pos,
.cannon-pos {
    color: #b0b0b0;
    min-width: 70px;
    font-size: 11px;
}

.target-settings,
.cannon-settings {
    flex: 1;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.target-settings-item,
.cannon-settings-item {
    display: inline-block;
    margin-right: 12px;
}

.target-settings-label,
.cannon-settings-label {
    color: #888;
    font-size: 10px;
}

.target-settings-value,
.cannon-settings-value {
    color: #ff6b35;
    font-weight: 600;
}

.target-actions,
.cannon-actions {
    display: flex;
    gap: 4px;
}

.target-btn,
.cannon-btn {
    padding: 3px 8px;
    font-size: 11px;
    background-color: #3a3a3a;
}

.target-btn:hover,
.cannon-btn:hover {
    background-color: #4a4a4a;
}

.target-btn.remove,
.cannon-btn.remove {
    background-color: #e74c3c;
}

.target-btn.remove:hover,
.cannon-btn.remove:hover {
    background-color: #c0392b;
}

.no-targets {
    color: #888;
    font-style: italic;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #252525;
    border: 2px solid #3a3a3a;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background-color: #1a1a1a;
    padding: 15px 20px;
    border-bottom: 2px solid #3a3a3a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 18px;
    color: #ff6b35;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: #b0b0b0;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background-color: #3a3a3a;
    color: #ff6b35;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    color: #e0e0e0;
}

.modal-body section {
    margin-bottom: 20px;
}

.modal-body section:last-child {
    margin-bottom: 0;
}

.modal-body h3 {
    font-size: 16px;
    color: #ff6b35;
    margin-bottom: 10px;
    border-bottom: 1px solid #3a3a3a;
    padding-bottom: 5px;
}

.modal-body p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.modal-body ul {
    list-style: none;
    padding-left: 0;
}

.modal-body li {
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
    line-height: 1.5;
}

.modal-body li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #ff6b35;
}

.modal-body strong {
    color: #4ecdc4;
}
