* { box-sizing: border-box; }
body {
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    font-family: 'Courier New', Courier, monospace;
}
.print-controls {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    z-index: 1000;
}
.print-controls button {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border: 1px solid #333;
    border-radius: 4px;
    background-color: #ffffff;
    color: #333;
}
.a4-page {
    width: 210mm;
    height: 297mm;
    margin: 80px auto 40px auto;
    background: white;
    padding: 6mm 4mm;
}
.map-grid {
    display: grid;
    grid-template-columns: repeat(2, 100mm);
    grid-template-rows: repeat(4, 71mm);
    gap: 2mm;
    width: 100%;
    height: 100%;
}
.map-card {
    width: 100mm;
    height: 71mm;
    border: 1px dashed #444;
    display: flex;
    flex-direction: row; 
    overflow: hidden;
    background-color: #fff;
}
.map-header {
    width: 32px;
    height: 100%;
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    font-weight: bold;
    color: #000;
    writing-mode: vertical-lr; 
    text-orientation: mixed;
    border-right: 1px dashed #555;
    padding: 8px 4px;
    background-color: #fcfcfc;
}
.map-container {
    flex: 1;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #ffffff;
}
canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
}
@media print {
    .print-controls { display: none; }
    body { background: none; }
    .a4-page { margin: 0; padding: 6mm 4mm; page-break-after: avoid; }
}
