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

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

body {
    font-family: 'Press Start 2P', cursive;
    background: #e8d8a0;
    background-image: 
        url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAwIiBoZWlnaHQ9IjYwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZGVmcz48cGF0dGVybiBpZD0iZ3JpZCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiBwYXR0ZXJuVW5pdHM9InVzZXJTcGFjZU9uVXNlIj48cmVjdCB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIGZpbGw9IiNlOGQ4YTAiLz48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMiIgaGVpZ2h0PSI0MCIgZmlsbD0iI2QwYjg4MCIvPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSI0MCIgaGVpZ2h0PSIyIiBmaWxsPSIjZDBiODgwIi8+PC9wYXR0ZXJuPjwvZGVmcz48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJ1cmwoI2dyaWQpIi8+PC9zdmc+'),
        repeating-linear-gradient(0deg, transparent, transparent 4px, rgba(0,0,0,.03) 4px, rgba(0,0,0,.03) 8px);
    min-height: 100vh;
    padding: 20px;
    image-rendering: pixelated;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(180deg, transparent 0%, transparent 60%, #90c050 60%, #90c050 65%, #509040 65%, #509040 70%, #284028 70%),
        radial-gradient(circle at 20% 80%, #f08030 0%, #f08030 3%, transparent 3%),
        radial-gradient(circle at 25% 82%, #f08030 0%, #f08030 2%, transparent 2%),
        radial-gradient(circle at 22% 85%, #f08030 0%, #f08030 2.5%, transparent 2.5%),
        radial-gradient(circle at 80% 75%, #d84028 0%, #d84028 4%, transparent 4%),
        radial-gradient(circle at 85% 77%, #d84028 0%, #d84028 3%, transparent 3%);
    background-color: #78c0f0;
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
}

body > * {
    position: relative;
    z-index: 1;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: #f8f0d8;
    border: 8px solid #b83820;
    border-radius: 0;
    box-shadow: 
        0 0 0 4px #f08030,
        8px 8px 0 0 rgba(0,0,0,0.3);
    overflow: hidden;
}

.header {
    background: #d84028;
    background-image: linear-gradient(135deg, #f08030 0%, #d84028 50%, #c02018 100%);
    color: #fff8d0;
    padding: 20px;
    text-align: center;
    border-bottom: 8px solid #f0c040;
    position: relative;
}

.header::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
    background: #f0c040;
    border: 4px solid #b83820;
    border-radius: 50%;
    box-shadow: inset 0 0 0 4px #d84028;
}

h1 {
    font-size: 1.5em;
    margin-bottom: 15px;
    text-shadow: 3px 3px 0 #b83820;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 0.5em;
    color: #fff8d0;
    text-shadow: 2px 2px 0 #b83820;
}

.content {
    padding: 30px;
    background: #f8f0d8;
}

.tip-box {
    background: #f0c040;
    border: 4px solid #b83820;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 4px 4px 0 0 rgba(0,0,0,0.2);
    text-align: center;
}

.tip-box p {
    margin: 0;
    color: #b83820;
    font-size: 0.6em;
    line-height: 1.8;
    font-weight: bold;
}

.upload-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.upload-box {
    border: 4px solid #b83820;
    background: white;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 4px 4px 0 0 rgba(0,0,0,0.2);
}

.upload-box:hover {
    background: #f08030;
    color: white;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 0 rgba(0,0,0,0.2);
}

.upload-box h3 {
    color: #b83820;
    margin-bottom: 15px;
    font-size: 0.6em;
}

.upload-box:hover h3 {
    color: white;
}

.upload-box p {
    font-size: 0.5em;
    color: #b83820;
}

.upload-box:hover p {
    color: white;
}

.upload-box input {
    display: none;
}

.upload-box.has-file {
    border-color: #509040;
    background: #90c050;
    color: white;
}

.upload-box.has-file h3,
.upload-box.has-file p {
    color: white;
}

button {
    width: 100%;
    padding: 15px;
    font-size: 0.8em;
    font-weight: bold;
    color: white;
    background: #d84028;
    border: 4px solid #b83820;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 4px 4px 0 0 rgba(0,0,0,0.2);
    font-family: 'Press Start 2P', cursive;
    text-transform: uppercase;
}

button:hover {
    background: #f08030;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 0 rgba(0,0,0,0.2);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: 4px 4px 0 0 rgba(0,0,0,0.2);
}

.progress-section {
    display: none;
    margin-top: 30px;
}

.progress-section.active {
    display: block;
}

.progress-bar {
    width: 100%;
    height: 40px;
    background: #b83820;
    border: 4px solid #901810;
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: #f08030;
    width: 0%;
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.6em;
}

.progress-message {
    text-align: center;
    color: #b83820;
    font-size: 0.6em;
    margin-bottom: 10px;
    line-height: 1.5;
}

.results {
    display: none;
    margin-top: 30px;
}

.results.active {
    display: block;
}

.grade-display {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border: 4px solid #b83820;
    box-shadow: 4px 4px 0 0 rgba(0,0,0,0.2);
}

.grade-number {
    font-size: 3em;
    font-weight: bold;
    color: #d84028;
    margin-bottom: 15px;
    text-shadow: 3px 3px 0 #f0c040;
}

.grade-name {
    font-size: 0.7em;
    color: #b83820;
    line-height: 1.5;
}

.card-info {
    background: white;
    padding: 20px;
    border: 4px solid #4080f0;
    margin-bottom: 20px;
    box-shadow: 4px 4px 0 0 rgba(0,0,0,0.2);
    font-size: 0.6em;
    line-height: 1.8;
}

.card-info h3 {
    color: #4080f0;
    margin-bottom: 15px;
    font-size: 1em;
}

.card-info p {
    margin: 10px 0;
    color: #b83820;
}

.pricing-section {
    background: white;
    padding: 20px;
    border: 4px solid #f0c040;
    margin-bottom: 20px;
    box-shadow: 4px 4px 0 0 rgba(0,0,0,0.2);
    font-size: 0.6em;
    line-height: 1.8;
}

.pricing-section h3 {
    color: #d84028;
    margin-bottom: 15px;
    font-size: 1em;
}

.price-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 2px solid #b83820;
}

.price-row:last-child {
    border-bottom: none;
}

.price-label {
    font-weight: bold;
    color: #b83820;
}

.price-value {
    color: #509040;
    font-weight: bold;
}

.price-value.profit-positive {
    color: #509040;
}

.explanation-section {
    background: white;
    padding: 20px;
    border: 4px solid #b83820;
    margin-bottom: 20px;
    box-shadow: 4px 4px 0 0 rgba(0,0,0,0.2);
    font-size: 0.55em;
    line-height: 2;
}

.explanation-section h3 {
    color: #d84028;
    margin-bottom: 15px;
    font-size: 1em;
}

.explanation-text {
    color: #b83820;
}

.breakdown {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.criterion {
    background: white;
    padding: 15px;
    border: 4px solid #b83820;
    box-shadow: 4px 4px 0 0 rgba(0,0,0,0.2);
    font-size: 0.6em;
    line-height: 1.8;
}

.criterion-name {
    font-weight: bold;
    color: #4080f0;
    margin-bottom: 8px;
}

.criterion-grade {
    font-size: 1.3em;
    color: #d84028;
    margin-bottom: 5px;
}

.error {
    display: none;
    padding: 20px;
    background: #d84028;
    color: white;
    border: 4px solid #b83820;
    margin-top: 20px;
    box-shadow: 4px 4px 0 0 rgba(0,0,0,0.2);
    font-size: 0.6em;
    line-height: 1.8;
}

a {
    color: #4080f0;
    text-decoration: none;
}

a:hover {
    color: #d84028;
}

.price-value.profit-negative {
    color: #d84028;
}

.explanation-text {
    color: #b83820;
    white-space: pre-wrap;
}

.explanation-text strong {
    color: #4080f0;
    display: block;
    margin-top: 10px;
    margin-bottom: 5px;
}
