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

:root {
    --bg-color: #ffffff;
    --card-bg: #ffffff;
    --text-color: #000000;
    --text-secondary: #666666;
    --border-color: #cccccc;
    --border-hover: #999999;
    --accent-color: #333333;
    --success-color: #000000;
}

body {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
}

.container {
    width: 780px;
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

main {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 30px;
    align-items: start;
}

@media (max-width: 700px) {
    main {
        grid-template-columns: 1fr;
    }

    .container {
        width: 100%;
        padding: 15px;
    }

    .results-section {
        width: 100%;
    }
}

.drawing-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.canvas-container {
    position: relative;
    width: 300px;
    height: 300px;
    background: var(--card-bg);
    border-radius: 0;
    border: 1px solid #000000;
    overflow: hidden;
}

#drawCanvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}

.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.canvas-overlay span {
    color: var(--text-secondary);
    font-size: 1.2rem;
    opacity: 0.5;
}

.canvas-overlay.hidden {
    opacity: 0;
}

.controls {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.btn {
    padding: 10px 24px;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid var(--accent-color);
    border-radius: 0;
    cursor: pointer;
    background-color: var(--card-bg);
    color: var(--text-color);
}

.btn:hover {
    border-color: var(--text-color);
}

.btn:active {
    background-color: var(--bg-color);
}

.btn-secondary {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
}

.results-section {
    background: var(--card-bg);
    border-radius: 0;
    padding: 20px;
    border: 1px solid var(--border-color);
    min-height: 340px;
    overflow: hidden;
}

.results-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-color);
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.placeholder {
    color: var(--text-secondary);
    text-align: center;
    padding: 40px 20px;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 10px;
    background: var(--card-bg);
    border-radius: 0;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.result-item:hover {
    background: var(--card-bg);
}

.result-item.copied {
    background: var(--card-bg);
}

.result-symbol {
    font-size: 1.2rem;
    width: 50px;
    flex-shrink: 0;
    text-align: center;
    transform: scale(0.7);
    transform-origin: center;
}

.result-symbol.symbol-fallback {
    font-family: inherit;
    font-size: 0.75rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.result-info {
    flex: 1;
    min-width: 0;
}

.result-command {
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-command.long {
    transform: scale(0.75);
    transform-origin: left center;
    overflow: visible;
    text-overflow: clip;
}

.result-package {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.result-score {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.copy-hint {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0;
}

.result-item:hover .copy-hint {
    opacity: 1;
}

.show-more-btn {
    width: 100%;
    margin-top: 12px;
    padding: 8px 16px;
    font-size: 0.9rem;
}

footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer a {
    color: var(--text-color);
    text-decoration: underline;
}

footer a:hover {
    text-decoration: none;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 2px solid var(--border-color);
    border-top-color: var(--text-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    margin-top: 16px;
    color: var(--text-secondary);
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-color);
    color: white;
    padding: 12px 24px;
    border-radius: 0;
    font-size: 0.9rem;
    font-family: inherit;
    opacity: 0;
    z-index: 1001;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
