*{
  box-sizing:border-box;
}

body{
  margin:0;
  padding:30px;
  background:#d7d7d7;
  font-family:"Times New Roman", serif;
}

.file-input{
  display:none;
}

.has-edit-hint{
  position:relative;
}

.edit-hint{
  position:absolute;
  right:-12px;
  top:-12px;
  width:24px;
  height:24px;
  border:1px solid #0b73ff;
  border-radius:50%;
  background:#0b73ff;
  color:white;
  display:flex;
  align-items:center;
  justify-content:center;
  font-family:Arial,sans-serif;
  font-size:14px;
  font-style:normal;
  font-weight:bold;
  line-height:1;
  z-index:1200;
  cursor:help;
  box-shadow:0 2px 8px rgba(0,0,0,0.22);
}

.edit-hint::after{
  content:attr(data-hint);
  position:absolute;
  left:50%;
  bottom:calc(100% + 8px);
  transform:translateX(-50%);
  width:max-content;
  max-width:220px;
  padding:7px 9px;
  border-radius:6px;
  background:#111;
  color:white;
  font-size:12px;
  font-weight:normal;
  line-height:1.25;
  text-align:center;
  opacity:0;
  pointer-events:none;
  transition:opacity 0.15s ease;
}

.edit-hint:hover::after,
.edit-hint:focus-visible::after{
  opacity:1;
}

body.hide-edit-hints .edit-hint,
.has-edit-hint:focus .edit-hint,
.has-edit-hint:focus-within .edit-hint{
  display:none;
}

.menu-toggle{
  display:none;
}

.document-controls{
  position:fixed;
  top:16px;
  right:16px;
  width:min(360px, calc(100vw - 32px));
  padding:12px;
  border:1px solid #bbb;
  border-radius:10px;
  background:rgba(255,255,255,0.96);
  box-shadow:0 8px 24px rgba(0,0,0,0.18);
  font-family:Arial,sans-serif;
  z-index:2000;
}

.hint-toggle{
  display:flex;
  align-items:center;
  gap:8px;
  width:100%;
  min-height:36px;
  margin-bottom:10px;
  padding:7px 10px;
  border:0;
  border-radius:6px;
  background:#f2f2f2;
  font-size:14px;
  cursor:pointer;
}

.hint-toggle input{
  width:16px;
  height:16px;
  margin:0;
}

.print-controls{
  width:min(800px, 100%);
  margin:0 auto;
  font-family:Arial,sans-serif;
  text-align:center;
}

.print-button{
  min-height:44px;
  padding:0 18px;
  border:0;
  border-radius:8px;
  background:#111;
  color:white;
  cursor:pointer;
  font-family:Arial,sans-serif;
  font-size:15px;
  font-weight:bold;
}

.language-controls{
  padding:12px 14px;
  background:#fff;
  border:1px solid #bbb;
  border-radius:8px;
}

.language-controls summary{
  cursor:pointer;
  font-size:15px;
  font-weight:bold;
}

.language-options{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(130px, 1fr));
  gap:10px 14px;
  margin-top:12px;
}

.language-options label{
  display:flex;
  align-items:center;
  gap:7px;
  min-height:32px;
  font-size:14px;
}

.language-options input{
  width:16px;
  height:16px;
  margin:0;
}

.booklet{
  width:800px;
  margin:0 auto;
  display:flex;
  flex-direction:column;
  gap:40px;
}

.page{
  width:800px;
  min-height:1120px;
  background:white;
  padding:0;
  position:relative;
  box-shadow:0 0 15px rgba(0,0,0,0.2);
  overflow:visible;
}

.page-inner{
  width:800px;
  min-height:1120px;
  padding:40px;
  position:relative;
}

.sample-watermark{
  position:absolute;
  top:45%;
  left:50%;
  transform:translate(-50%,-50%) rotate(-30deg);
  font-size:110px;
  color:rgba(255,0,0,0.06);
  font-weight:bold;
  letter-spacing:10px;
  pointer-events:none;
  user-select:none;
}

/* PAGE 1 */

.top-center{
  text-align:center;
}

.small-title{
  font-size:18px;
  font-weight:bold;
}

.sub-title{
  margin-top:5px;
  font-size:14px;
  font-weight:bold;
}

.main-title{
  margin-top:60px;
  text-align:center;
  font-size:72px;
  font-weight:bold;
  line-height:1;
}

.convention{
  margin-top:22px;
  text-align:center;
  font-size:18px;
  font-weight:bold;
  line-height:1.4;
}

.fee-box{
  position:absolute;
  top:25px;
  right:25px;
  width:120px;
  height:120px;
  border:3px solid black;
  text-align:center;
  padding-top:12px;
  font-family:Arial,sans-serif;
}

.fee-title{
  font-size:28px;
  font-weight:bold;
}

.fee-price{
  margin-top:14px;
  font-size:28px;
  font-weight:bold;
}

.issued{
  margin-top:90px;
  text-align:center;
  font-size:24px;
  font-weight:bold;
  line-height:1.6;
}

.date-row{
  margin-top:40px;
  display:flex;
  align-items:center;
  gap:20px;
  font-size:26px;
}

.date-line{
  flex:1;
  border-bottom:2px solid black;
  padding-bottom:0;
  min-height:46px;
  line-height:1.25;
}

#dateDisplay{
  text-align:center;
  font-family:cursive;
  font-size:32px;
}

.editable-field{
  cursor:text;
  outline:none;
}

.editable-field:focus{
  background:rgba(255,245,180,0.45);
}

.important{
  margin-top:110px;
  text-align:center;
  font-size:28px;
  font-weight:bold;
  line-height:1.4;
}

.seal{
  width:280px;
  height:280px;
  border:10px double black;
  border-radius:50%;
  margin:55px auto 0;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  font-size:24px;
  font-weight:bold;
  line-height:1.4;
}

.seal img{
  width:319px;
  height:319px;
  object-fit:contain;
  display:block;
}

.authority-sign{
  margin-top:70px;
  text-align:center;
}

.fake-signature{
  font-size:34px;
  font-family:"Times New Roman", serif;
  font-weight:bold;
  line-height:1.1;
}

.auth-label{
  max-width:620px;
  margin:10px auto 0;
  font-size:22px;
  font-weight:bold;
  line-height:1.3;
}

.serial{
  margin-top:90px;
  text-align:center;
  font-size:64px;
  font-family:Arial,sans-serif;
  font-weight:bold;
}

/* PAGE 2 */

.small-top{
  display:flex;
  justify-content:space-between;
}

.driver-title{
  font-size:18px;
  font-weight:bold;
}

.driver-right{
  text-align:right;
  font-size:15px;
  line-height:1.7;
}

.section-title{
  margin-top:24px;
  font-size:18px;
  font-weight:bold;
}

.vehicle-table{
  margin-top:10px;
  border:2px solid #555;
}

.vehicle-row{
  display:grid;
  grid-template-columns:1fr 55px;
  border-bottom:2px solid #555;
  min-height:120px;
}

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

.vehicle-text{
  border-right:2px solid #555;
  padding:10px;
  font-size:13px;
  line-height:1.45;
}

.vehicle-code{
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:28px;
}

.legal{
  margin-top:22px;
  font-size:13px;
  line-height:1.5;
  text-align:justify;
}

.bottom-section{
  margin-top:24px;
  border:2px solid #333;
  display:grid;
  grid-template-columns:2fr 1fr;
  min-height:245px;
}

.bottom-left{
  border-right:2px solid #333;
  display:flex;
  flex-direction:column;
}

.exclusion-content{
  flex:1;
  padding:8px 12px;
  border-bottom:2px solid #333;
}

.exclusion-title{
  text-align:center;
  font-size:16px;
  font-weight:bold;
  margin-bottom:6px;
}

.exclusion-text{
  font-size:15px;
  font-weight:bold;
  line-height:1.4;
}

.dotted-line{
  border-bottom:2px dotted #333;
  height:16px;
}

.stamp-and-fields{
  margin-top:22px;
  display:grid;
  grid-template-columns:100px 1fr;
  gap:14px;
  align-items:center;
}

.small-round-stamp{
  width:82px;
  height:82px;
  border:3px solid #333;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  font-size:13px;
  font-weight:bold;
  line-height:1.15;
}

.field-line{
  display:grid;
  grid-template-columns:55px 1fr;
  align-items:center;
  margin-bottom:6px;
  font-size:15px;
  font-weight:bold;
}

.field-line span:last-child{
  border-bottom:2px dotted #333;
  height:16px;
}

.signature-label{
  text-align:center;
  font-size:15px;
  font-weight:bold;
  margin-top:2px;
}

.bottom-note-box{
  min-height:62px;
  padding:10px 12px;
  font-size:15px;
  font-weight:bold;
  line-height:1.35;
}

.bottom-right{
  padding:10px;
  text-align:center;
  font-size:16px;
  font-weight:bold;
}

/* PAGE 3 */

.line-row{
  display:flex;
  align-items:center;
  margin-bottom:16px;
}

.line-number{
  width:25px;
  font-size:18px;
}

.line{
  flex:1;
  border-bottom:1px dotted #999;
  min-height:28px;
  display:flex;
  align-items:center;
  padding-left:10px;
  font-size:26px;
}

.middle{
  margin-top:35px;
  display:flex;
  gap:30px;
}

.stamp-column{
  width:130px;
  border:2px solid #777;
  overflow:visible;
}

.stamp-cell{
  position:relative;
  height:145px;
  border-bottom:2px solid #777;
  overflow:visible;
}

.stamp-cell:last-child{
  border-bottom:none;
}

.stamp-letter{
  position:absolute;
  left:8px;
  top:8px;
  font-size:28px;
  font-family:Arial,sans-serif;
}

.stamp-circle{
  width:108px;
  height:108px;
  border:2px solid #777;
  border-radius:50%;
  position:absolute;
  left:10px;
  top:32px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  text-align:center;
  font-size:15px;
  line-height:1.15;
  color:#555;
  background:white;
  overflow:visible;
}

.stamp-toggle{
  position:absolute;
  right:-82px;
  top:50%;
  transform:translateY(-50%);
  display:flex;
  align-items:center;
  justify-content:center;
  gap:5px;
  min-width:42px;
  min-height:38px;
  padding:6px 8px;
  border:1px solid #777;
  border-radius:6px;
  background:white;
  color:#111;
  font-family:Arial,sans-serif;
  font-size:13px;
  line-height:1;
  cursor:pointer;
  z-index:1002;
}

.stamp-toggle input{
  width:18px;
  height:18px;
  margin:0;
}

.stamp-upload-button{
  position:absolute;
  inset:18px;
  border:1px dashed #777;
  border-radius:50%;
  background:rgba(255,255,255,0.88);
  color:#222;
  cursor:pointer;
  font-family:Arial,sans-serif;
  font-size:12px;
  line-height:1.2;
  z-index:1000;
}

.stamp-circle.has-stamp.is-selected .stamp-upload-button{
  opacity:0;
}

.stamp-circle.has-stamp.is-selected:hover .stamp-upload-button,
.stamp-circle.has-stamp.is-selected:focus-within .stamp-upload-button{
  opacity:1;
}

.stamp-overlay{
  position:absolute;
  width:168%;
  height:168%;
  left:-34%;
  top:-34%;
  object-fit:contain;
  display:none;
  pointer-events:none;
  z-index:999;
  opacity:0.95;
  mix-blend-mode:multiply;
  transform:rotate(-7deg);
}

#stamp-a{
  left:-40%;
  top:-31%;
  transform:rotate(-10deg) scale(1.02);
}

#stamp-b{
  left:-30%;
  top:-37%;
  transform:rotate(-5deg) scale(0.98);
}

#stamp-c{
  left:-37%;
  top:-33%;
  transform:rotate(4deg) scale(1.04);
}

#stamp-d{
  left:-32%;
  top:-39%;
  transform:rotate(-13deg) scale(1);
}

#stamp-e{
  left:-39%;
  top:-35%;
  transform:rotate(7deg) scale(0.97);
}

.stamp-circle.has-stamp.is-selected .stamp-overlay{
  display:block;
}

.photo-area{
  flex:1;
  position:relative;
}

.photo{
  width:340px;
  height:430px;
  object-fit:cover;
  border:1px solid #ccc;
  display:block;
  margin:auto;
  background:#efefef;
}

.photo[src=""]{
  visibility:hidden;
}

.photo-upload-button{
  position:absolute;
  top:0;
  left:50%;
  width:340px;
  height:430px;
  transform:translateX(-50%);
  border:1px dashed #888;
  background:#efefef;
  color:#222;
  cursor:pointer;
  font-family:Arial,sans-serif;
  font-size:18px;
}

.photo-area.has-photo .photo-upload-button{
  height:auto;
  top:12px;
  width:auto;
  padding:8px 12px;
  border-style:solid;
  background:rgba(255,255,255,0.9);
  font-size:13px;
  opacity:0;
}

.photo-area.has-photo:hover .photo-upload-button,
.photo-area.has-photo:focus-within .photo-upload-button{
  opacity:1;
}

.holder-sign{
  margin-top:30px;
  border-bottom:1px dotted #777;
  height:60px;
  position:relative;
}

.holder-sign-text{
  position:absolute;
  left:50%;
  top:-5px;
  width:100%;
  transform:translateX(-50%);
  text-align:center;
  font-size:42px;
  font-family:cursive;
}

.holder-label{
  text-align:center;
  margin-top:8px;
  font-size:20px;
}

.exclusions{
  margin-top:50px;
  text-align:center;
}

.exclusions h3{
  font-size:36px;
  margin-bottom:4px;
}

.grid{
  margin-top:35px;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:24px 60px;
}

.exclude-line{
  border-bottom:1px dotted #777;
  height:30px;
  font-size:24px;
  text-align:left;
}

@page{
  margin:0.25in;
}

@media print{
  html,
  body{
    margin:0;
    background:white;
    padding:0;
    display:block;
  }

  .file-input,
  .hint-toggle,
  .edit-hint,
  .menu-toggle,
  .document-controls,
  .print-controls,
  .photo-upload-button,
  .stamp-toggle,
  .stamp-upload-button{
    display:none;
  }

  .booklet{
    width:7.25in;
    margin:0;
    display:block;
    gap:0;
  }

  .page{
    width:7.25in;
    height:10in;
    min-height:10in;
    margin:0 auto;
    padding:0;
    box-shadow:none;
    overflow:hidden;
    break-after:page;
    break-inside:avoid;
    page-break-after:always;
    page-break-inside:avoid;
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact;
  }

  .page-inner{
    width:800px;
    min-height:1120px;
    padding:40px;
    margin-left:calc((696px - (800px * var(--print-scale, 0.65))) / 2);
    transform:scale(var(--print-scale, 0.65));
    transform-origin:top left;
  }

  @supports (zoom:1){
    .page-inner{
      zoom:var(--print-scale, 0.65);
      transform:none;
    }
  }

  .page:last-child{
    break-after:auto;
    page-break-after:auto;
  }
}

@supports (zoom:1){
  @media print{
    .page-inner{
      zoom:var(--print-scale, 0.65);
      transform:none;
    }
  }
}

@media screen and (max-width:1180px){
  body{
    display:block;
    padding:16px;
  }
}

@media screen and (max-width:860px){
  body{
    overflow-x:hidden;
  }

  .menu-toggle{
    position:fixed;
    top:12px;
    right:12px;
    z-index:2100;
    display:block;
    min-height:42px;
    padding:0 14px;
    border:0;
    border-radius:8px;
    background:#111;
    color:white;
    font-family:Arial,sans-serif;
    font-size:14px;
    font-weight:bold;
    cursor:pointer;
    box-shadow:0 5px 18px rgba(0,0,0,0.25);
  }

  .document-controls{
    top:0;
    right:0;
    bottom:0;
    width:min(340px, 88vw);
    max-width:none;
    padding:64px 14px 14px;
    border-radius:0;
    overflow:auto;
    transform:translateX(100%);
    transition:transform 0.2s ease;
  }

  body.menu-open .document-controls{
    transform:translateX(0);
  }

  .print-button{
    width:100%;
  }

  .booklet{
    width:800px;
    margin:0;
    overflow:visible;
    align-items:flex-start;
    zoom:var(--mobile-booklet-scale, 1);
  }
}

@media screen and (max-width:520px){
  body{
    padding:10px;
  }
}
