:root {
    --cor-fundo: #e0e8f0;
    --azul-intermediario: #436F9C;
    --azul-forte: #15477c;
    --amarelo: #eeda53;
    --texto-claro: #f0f0f0;
    --texto-escuro: #0d1b2a;
    --sombra: rgba(0, 0, 0, 0.15);
    --verde-fosforo: #3dff94;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--cor-fundo);
    color: var(--texto-escuro);
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 600px;
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 24px var(--sombra);
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    max-width: 250px;
    margin-bottom: 1rem;
}

h1 {
    font-size: 1.5rem;
    color: var(--azul-forte);
    font-weight: 500;
}

.input-group {
    margin-bottom: 2rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--azul-intermediario);
    font-weight: 500;
}

#resistance-input {
    width: 100%;
    padding: 1rem;
    font-family: 'Roboto Mono', monospace;
    font-size: 2.5rem;
    text-align: center;
    background-color: #1a1a1a;
    color: var(--verde-fosforo);
    border: 2px solid var(--azul-intermediario);
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#resistance-input:focus {
    border-color: var(--amarelo);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5), 0 0 15px var(--amarelo);
}

#results-container h2, .canvas-container h2 {
    font-size: 1.2rem;
    color: var(--azul-forte);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #ccc;
}

.legend {
    font-size: 0.9rem;
    color: #666;
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.legend span {
    font-weight: bold;
    color: var(--azul-forte);
}

#results-list {
    list-style: none;
    margin-bottom: 2rem;
}

#results-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    font-family: 'Roboto Mono', monospace;
    font-size: 1.1rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s, background-color 0.2s;
    box-shadow: 0 2px 4px var(--sombra);
}

#results-list li:hover {
    transform: translateY(-2px);
    background-color: #fff;
}

#results-list li.selected {
    border-color: var(--azul-forte);
    background-color: #e9f1f8;
    font-weight: 500;
}

.canvas-container {
    text-align: center;
}

#resistor-canvas {
    max-width: 100%;
    height: auto;
    background: #fdfdfd;
    border-radius: 8px;
    border: 1px solid #ddd;
}

@media (max-width: 640px) {
    body { padding: 1rem 0.5rem; }
    .container { padding: 1.5rem; border-radius: 0; }
    h1 { font-size: 1.2rem; }
    #resistance-input { font-size: 1.5rem; }
    #results-list li { font-size: 1rem; }
}

.pwa-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--azul-forte);
    color: var(--texto-claro);
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    z-index: 1000;
    max-width: 90%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.pwa-install-prompt.show {
    opacity: 1;
    visibility: visible;
}

.pwa-install-prompt-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: center;
}

.pwa-install-prompt p {
    margin: 0;
    font-size: 0.95rem;
    flex-grow: 1;
}

.pwa-install-btn {
    background-color: var(--amarelo);
    color: var(--azul-forte);
    border: none;
    padding: 10px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
    width: 100%;
    max-width: 200px;
}

.pwa-install-btn:hover {
    background-color: #e0c94a;
}

.pwa-install-close-btn {
    background: none;
    border: none;
    color: var(--texto-claro);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
    position: absolute;
    top: 5px;
    right: 5px;
}