/* Page decorations */
.tool-container {
    position: relative;
    overflow: hidden;
}

.mace-decoration {
    position: absolute;
    top: 20px;
    left: -20px;
    width: 80px;
    height: 80px;
    background: linear-gradient(45deg, #8B4513, #A0522D, #8B4513);
    border: 2px solid #654321;
    transform: rotate(-15deg);
    opacity: 0.8;
    z-index: 0;
    display: none; /* 在大屏幕上才显示 */
    border-radius: 4px;
}

.mace-decoration::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 60px;
    background: #654321;
    border-radius: 2px;
}

.anvil-decoration {
    position: absolute;
    bottom: 30px;
    right: -15px;
    width: 70px;
    height: 50px;
    background: linear-gradient(45deg, #2F2F2F, #4A4A4A, #2F2F2F);
    border: 2px solid #1A1A1A;
    transform: rotate(10deg);
    opacity: 0.8;
    z-index: 0;
    display: none; /* 在大屏幕上才显示 */
    border-radius: 2px;
    animation: anvil-glow 3s ease-in-out infinite alternate;
}

@keyframes anvil-glow {
    from {
        box-shadow: 0 0 10px #4A4A4A;
    }
    to {
        box-shadow: 0 0 20px #4A4A4A, 0 0 30px #2F2F2F;
    }
}

/* Calculator Container */
.calculator-container {
    position: relative;
    background: var(--minecraft-panel);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
    border: 2px solid var(--minecraft-secondary);
    z-index: 1;
    border-radius: 2px;
}

.calculator-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAEklEQVQImWNgYGD4z8DAwMAAADgDAKdD8tMAAAAASUVORK5CYII=');
    background-size: 2px 2px;
    opacity: 0.05;
    z-index: -1;
}

.calculator-container h2 {
    color: var(--minecraft-green);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--minecraft-secondary);
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
    text-align: center;
}

/* Calculation Sections */
.calculation-section {
    background: rgba(0, 0, 0, 0.25);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--minecraft-secondary);
    border-radius: 6px;
    position: relative;
    border-left: 4px solid #FF6B35;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.calculation-section:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.reverse-section {
    border-left: 4px solid #4CAF50;
}

.reverse-section:hover {
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

.calculation-section h3 {
    color: #E0E0E0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    align-items: end;
    margin-bottom: 1.5rem;
}

.input-grid .calculate-btn {
    grid-column: 1 / -1;
    justify-self: center;
    max-width: 300px;
    width: 100%;
}

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

.input-group label {
    font-weight: bold;
    color: #E0E0E0;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    min-height: 2.2rem;
    display: flex;
    align-items: center;
}

.input-group input,
.input-group select {
    padding: 0.75rem;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--minecraft-secondary);
    color: white;
    font-family: 'Noto Sans Mono', monospace;
    border-radius: 2px;
    font-size: 1rem;
    height: 3rem;
    box-sizing: border-box;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--minecraft-green);
    box-shadow: 0 0 0 2px rgba(68, 189, 50, 0.2);
}

.input-group small {
    color: #AAAAAA;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    min-height: 1.2rem;
    display: block;
}

.calculate-btn {
    height: fit-content;
    padding: 0.75rem 1.5rem;
    white-space: nowrap;
}

/* Result Display */
.result-display {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border: 1px solid var(--minecraft-secondary);
    border-radius: 2px;
    margin-top: 1rem;
}

.result-display h4 {
    color: var(--minecraft-green);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.damage-breakdown,
.height-breakdown {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1fr;
}

.damage-item,
.height-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Noto Sans Mono', monospace;
    font-size: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.damage-item:hover,
.height-item:hover {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.total-damage {
    border: 2px solid var(--minecraft-green);
    background: rgba(68, 189, 50, 0.1);
    font-weight: bold;
    font-size: 1.1rem;
}

.damage-label,
.height-label {
    color: #AAAAAA;
    font-weight: bold;
}

.damage-item span:not(.damage-label),
.height-item span:not(.height-label) {
    color: var(--minecraft-green);
    font-weight: bold;
    min-width: 80px;
    text-align: right;
}

.total-damage span:not(.damage-label) {
    color: #FFFFFF;
    font-size: 1.2rem;
}

/* Info Section */
.info-section {
    background: var(--minecraft-panel);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
    border: 2px solid var(--minecraft-secondary);
    position: relative;
    z-index: 1;
    border-radius: 2px;
}

.info-section h2 {
    color: var(--minecraft-green);
    margin-bottom: 1.5rem;
    text-align: center;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.info-card {
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border: 1px solid var(--minecraft-secondary);
    border-radius: 4px;
}

.info-card h3 {
    color: #E0E0E0;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.info-card p {
    color: #AAAAAA;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.info-card ul {
    color: #AAAAAA;
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.info-card li {
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.formula {
    background: rgba(68, 189, 50, 0.1);
    padding: 1rem;
    border-left: 4px solid var(--minecraft-green);
    border-radius: 2px;
    font-family: 'Noto Sans Mono', monospace;
    color: #E0E0E0;
}

.formula strong {
    color: var(--minecraft-green);
}

/* Examples Section */
.examples-section {
    background: var(--minecraft-panel);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
    border: 2px solid var(--minecraft-secondary);
    position: relative;
    z-index: 1;
    border-radius: 2px;
}

.examples-section h2 {
    color: var(--minecraft-green);
    margin-bottom: 1.5rem;
    text-align: center;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

.examples-table {
    overflow-x: auto;
}

.examples-table table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid var(--minecraft-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.examples-table th,
.examples-table td {
    padding: 1rem 1.25rem;
    text-align: center;
    border-bottom: 1px solid var(--minecraft-secondary);
    font-family: 'Noto Sans Mono', monospace;
}

.examples-table th:first-child,
.examples-table td:first-child {
    text-align: left;
}

.examples-table th:last-child,
.examples-table td:last-child {
    text-align: right;
}

.examples-table th {
    background: rgba(68, 189, 50, 0.2);
    color: var(--minecraft-green);
    font-weight: bold;
}

.examples-table td {
    color: #E0E0E0;
}

.examples-table tbody tr {
    transition: background-color 0.2s;
    cursor: pointer;
}

.examples-table tbody tr:hover {
    background: rgba(68, 189, 50, 0.15);
    transform: scale(1.01);
}

.examples-table tbody tr:active {
    background: rgba(68, 189, 50, 0.25);
}

/* Animation for results */
.show-result {
    animation: slideIn 0.3s ease-out;
}

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

/* Responsive Design */
@media (max-width: 1200px) {
    .mace-decoration,
    .anvil-decoration {
        display: block;
    }
}

@media (max-width: 768px) {
    .input-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .calculate-btn {
        width: 100%;
        margin-top: 1rem;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .damage-item,
    .height-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .damage-item span:not(.damage-label),
    .height-item span:not(.height-label) {
        text-align: left;
    }
    
    .examples-table {
        font-size: 0.9rem;
    }
    
    .examples-table th,
    .examples-table td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .calculator-container,
    .info-section,
    .examples-section {
        padding: 1rem;
    }
    
    .calculation-section {
        padding: 1rem;
    }
    
    .examples-table th,
    .examples-table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
}