body {
    font-family: "MS Gothic", sans-serif;
    margin: 0;
    padding: 20px;
    background: #f5f5f5;
    color: #000;
    font-size: 15px;
}
.container {
    max-width: 210mm;
    margin: 0 auto;
    background: #fff;
    padding: 20mm;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    min-height: 297mm;
    box-sizing: border-box;
}
.header {
    text-align: center;
    margin-bottom: 20px;
}
input {
    -webkit-box-shadow: 0 0 0 1000px white inset !important;
    -webkit-text-fill-color: #000 !important;
}
.header h1 {
    font-size: 20px;
    font-weight: bold;
    margin: 0;
    letter-spacing: 6px;
    border: 2px solid #000;
    padding: 10px 20px;
    display: inline-block;
}
.date-line {
    text-align: right;
    margin-bottom: 20px;
    font-size: 12px;
}
.main-content {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}
.left-section {
    flex: 1;
}
.photo-section {
    width: 90px;
    height: 120px;
    border: 1px solid #000;
    position: relative;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
}
.photo-section img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-placeholder {
    text-align: center;
    font-size: 10px;
    line-height: 1.2;
    color: #666;
    padding: 5px;
}
.photo-section input[type="file"] {
    display: none;
}
.name-row {
    display: flex;
    align-items: flex-end;
    margin-bottom: 15px;
    border-bottom: 1px solid #000;
    padding-bottom: 10px;
}
.name-left {
    flex: 1;
}
.furigana-row {
    font-size: 10px;
    margin-bottom: 5px;
}
.furigana-input {
    border: none;
    border-bottom: 1px solid #ccc;
    background: transparent;
    font-size: 10px;
    padding: 2px;
    width: 100%;
}
.name-input {
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: bold;
    padding: 5px 0;
    width: 100%;
}
.age-section {
    margin-left: 20px;
    font-size: 12px;
    white-space: nowrap;
}
.age-input {
    border: none;
    border-bottom: 1px solid #ccc;
    background: transparent;
    width: 30px;
    text-align: center;
    font-size: 12px;
}
.info-table {
    width: 100%;
    border-collapse: separate;
    margin-bottom: 30px;
    border-spacing: 0;
}
.info-table td {
    border: 0.5px solid #000;
    padding: 8px;
    vertical-align: middle;
}
.info-table tr td:nth-child(1) {
    width: 18%;
}
.info-table tr td:nth-child(2) {
    width: 82%;
}
.info-label {
    background: #f8f8f8;
    font-weight: bold;
    text-align: center;
    font-size: 11px;
}
.info-content {
    background: #fff;
}
.info-content input,
.info-content select {
    border: none;
    background: transparent;
    width: 100%;
    font-size: 11px;
    padding: 2px;
}
.birthdate-section {
    display: flex;
    align-items: center;
    gap: 10px;
}
.gender-section {
    display: flex;
    gap: 20px;
    align-items: center;
}
.gender-option {
    display: flex;
    align-items: center;
    gap: 5px;
}
.section-title {
    background: #fff;
    color: #000;
    text-align: center;
    font-weight: bold;
    padding: 8px;
    margin-bottom: 0;
    font-size: 12px;
}
.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}
.history-table td {
    border: 1px solid #000;
    padding: 8px;
    vertical-align: middle;
}
.history-table tr td:nth-child(1) {
    width: 18%;
}
.history-table tr td:nth-child(2) {
    width: 67%;
}
.history-table tr td:nth-child(3) {
    width: 15%;
}
.date-col {
    width: 15%;
    text-align: center;
}
.date-col input {
    border: none;
    background: transparent;
    width: 100%;
    text-align: center;
    font-size: 11px;
}
.description-col textarea {
    border: none;
    background: transparent;
    width: 100%;
    height: 40px;
    resize: none;
    font-size: 11px;
    line-height: 1.4;
}
.motivation-section {
    margin-bottom: 30px;
}
.motivation-box {
    border: 2px solid #000;
    min-height: 150px;
    padding: 15px;
    font-size: 16px;
    line-height: 1.6;
    position: relative; /* for placeholder positioning */
}
.motivation-div {
    border: none;
    background: transparent;
    width: 100%;
    height: 120px;
    resize: none;
    font-size: 16px;
    line-height: 1.6;
}
/* Placeholder for contenteditable motivation-box */
.motivation-box[contenteditable].show-ph::before {
    content: attr(data-placeholder);
    color: #999;
    position: absolute;
    left: 15px;
    top: 15px;
    right: 15px;
    pointer-events: none;
    white-space: pre-wrap;
}
.btn {
    background: #007bff;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    margin-right: 10px;
    margin-bottom: 10px;
}
.btn:hover {
    background: #0056b3;
}
.btn-add {
    background: #28a745;
    font-size: 10px;
    padding: 5px 10px;
}
.btn-remove {
    background: #dc3545;
    font-size: 10px;
    padding: 3px 8px;
}
.controls {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}
.contact-label {
    font-size: 10px;
    color: #666;
    margin-bottom: 5px;
}
.note-text {
    font-size: 9px;
    color: #666;
    margin-top: 5px;
}
/* Language toolbar (hidden on print) */
.toolbar {
    background: transparent;
    color: #000;
    font-size: 12px;
}
input:focus,
textarea:focus,
select:focus {
    outline: 1px solid #007bff;
}
@media print {
    @page {
        margin: 0;
        size: A4;
    }
    body {
        background: #fff;
        padding: 0;
        font-size: 11px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .container {
        box-shadow: none;
        padding: 10mm;
        max-width: none;
        margin: 0;
    }
    .controls {
        display: none;
    }
    .toolbar {
        display: none;
    }
    .btn {
        display: none;
    }
    .photo-section {
        cursor: default;
    }
    /* Keep borders visible when an element is split across pages */
    .motivation-box {
        /* Try not to split across pages if there is room */
        break-inside: avoid-page;
        page-break-inside: avoid;
        /* When a split is unavoidable, clone border/padding on fragments */
        -webkit-box-decoration-break: clone;
        box-decoration-break: clone;
    }
    /* Keep section title with its content on the same page */
    .section-title {
        break-after: avoid-page; /* modern */
        page-break-after: avoid; /* legacy */
    }
    /* Also ask the UA not to break inside the section wrapper */
    .motivation-section {
        break-inside: avoid-page;
        page-break-inside: avoid;
    }
    /* And for the common pattern: title immediately followed by box */
    .section-title + .motivation-box {
        break-inside: avoid-page;
        page-break-inside: avoid;
    }
    /* Do not print placeholder hint text */
    .motivation-box.show-ph::before {
        content: none !important;
    }
}
#p::-webkit-file-upload-button {
    display: none;
}

/* Firefox */
#p::file-selector-button {
    display: none;
}

.or_date {
    border: none;
    background: transparent;
    font-size: 18px;
    text-align: center;
    font-weight: bold;
}
