/* Global Styles */
:root {
    color-scheme: light;
    --bg-color: #2F3130;
    --side-bg: #1F2120;
    --text-primary: #ECEBE4;
    --text-secondary: #909490;
    --ticket-bg: #C3B69A;
    /* Warm old cardboard */
    --ticket-black: #403C3B;
    /* Wash-out black */
    --ticket-red: #78271C;
    /* Dark aged red */
    --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-ticket-ch: "ZhaohuaMinA", "朝華標題A", "Huiwen-MinchoGBK", serif;
    --font-ticket-tw: "ZhaohuaTypeWriter Light", "朝華打字機", monospace, serif;
    --font-ticket-en: 'Cardo', 'Playfair Display', serif;
    --font-idcard-lishu: "DFSTDLI", "Huiwen-fangsong", serif;
    --font-idcard-zhengkai: "Huiwen-zhengkai", serif;
    --font-idcard-writing-print: "ZhaohuaTypeWriter Light", "朝華打字機", monospace, serif;
    --font-idcard-writing-hand1: "default_font_family", "ZhaohuaTypeWriter Light", "朝華打字機", serif;
    --font-idcard-writing-hand2: "YuSiYuanYanHuangTi", "ZhaohuaTypeWriter Light", "朝華打字機", serif;
    --font-passport-heading: "CooperZhengKai", "Huiwen-zhengkai", serif;
    --font-passport-writing-print: "ZhaohuaTypeWriter Light", "朝華打字機", monospace, serif;
    --font-passport-writing-hand1: "YuSiYuanYanHuangTi", "ZhaohuaTypeWriter Light", "朝華打字機", serif;
    --font-passport-writing-hand2: "default_font_family", "ZhaohuaTypeWriter Light", "朝華打字機", serif;
    --font-regcard-decor: "Huiwen-fangsong", "Huiwen-MinchoGBK", serif;
    --dynamic-bg: none;
    --noise-bg: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.8' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.18'/%3E%3C/svg%3E");
    --ink-bleed-filter: url(#ink-bleed);
    --ink-bleed-letter-filter: url(#ink-bleed) blur(0.5px);
}

:root[data-ink-bleed="off"] {
    --ink-bleed-filter: none;
    --ink-bleed-letter-filter: blur(0.5px);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-ui);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

body.entry-open {
    overflow: hidden;
}

/* Layout */
.entry-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background:
        radial-gradient(circle at top, rgba(198, 167, 104, 0.16), transparent 34%),
        rgba(18, 18, 17, 0.78);
    backdrop-filter: blur(8px);
}

.entry-overlay.is-hidden {
    display: none;
}

.entry-overlay-panel {
    width: min(760px, 100%);
    padding: 34px 30px 30px;
    border: 1px solid rgba(202, 177, 118, 0.38);
    background:
        linear-gradient(180deg, rgba(44, 35, 27, 0.98), rgba(27, 23, 20, 0.98)),
        var(--noise-bg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.entry-overlay-kicker {
    margin-bottom: 10px;
    color: rgba(223, 205, 168, 0.78);
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.entry-overlay-panel h1 {
    margin-bottom: 10px;
    color: #f1ebdc;
    font-size: 34px;
    font-family: var(--font-ticket-ch);
    font-weight: 600;
    letter-spacing: 2px;
}

.entry-overlay-panel p {
    margin-bottom: 24px;
    color: rgba(235, 230, 216, 0.72);
    font-size: 14px;
    line-height: 1.7;
}

.entry-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.entry-choice {
    min-width: 0;
    padding: 18px 16px;
    border: 1px solid rgba(202, 177, 118, 0.28);
    background: linear-gradient(180deg, rgba(255, 248, 233, 0.06), rgba(255, 248, 233, 0.02));
    color: #f1ebdc;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    text-align: left;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.entry-choice:hover,
.entry-choice.is-active {
    transform: translateY(-1px);
    border-color: rgba(186, 117, 67, 0.9);
    background: linear-gradient(180deg, rgba(186, 117, 67, 0.14), rgba(255, 248, 233, 0.05));
}

.entry-choice-ch {
    font-size: 18px;
    font-family: var(--font-ticket-ch);
    letter-spacing: 1px;
}

.entry-choice-en {
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.78;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.editor-sidebar {
    width: 380px;
    background-color: var(--side-bg);
    padding: 40px 30px;
    height: 100%;
    overflow-y: auto;
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.doc-switcher {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 30px;
}

.doc-btn {
    min-width: 0;
    min-height: 70px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.doc-btn .ch,
.doc-btn .en {
    text-align: center;
    line-height: 1.2;
}

.doc-btn .ch {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
}

.doc-btn .en {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.8;
}

.doc-btn.active {
    background: rgba(120, 39, 28, 0.1);
    color: var(--ticket-red);
    border-color: var(--ticket-red);
}

.doc-btn:hover:not(.active) {
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.editor-sidebar header {
    margin-bottom: 40px;
}

.editor-sidebar h1 {
    font-size: 24px;
    font-weight: 300;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.editor-sidebar h1 span {
    font-weight: 700;
    color: var(--ticket-red);
    font-family: var(--font-ticket-en);
    font-style: italic;
}

.editor-sidebar p {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

#editor-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-group.half {
    flex: 1;
}

.form-group.third {
    flex: 1;
}

.idc-edit-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.idc-edit-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.03);
}

.idc-edit-card-title {
    font-size: 10px;
    color: var(--ticket-red);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 700;
}

.history-edit-entry.is-hidden {
    display: none;
}

.idc-add-row-btn {
    align-self: flex-start;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: transparent;
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 11px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.idc-add-row-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.28);
}

.idc-add-row-btn[hidden] {
    display: none;
}

#history-edit-list .form-row {
    gap: 8px;
}

#history-edit-list .form-group.third {
    flex: 0 0 calc((100% - 16px) / 3);
    min-width: 0;
}

#history-edit-list .form-group.third input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 13px;
}

.idc-photo-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.idc-photo-tools input[type="file"] {
    flex: 1;
    min-width: 0;
}

.idc-photo-clear-btn {
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: transparent;
    color: var(--text-primary);
    padding: 7px 10px;
    font-size: 10px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.idc-photo-clear-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.28);
}

label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    font-weight: 600;
}

input,
select {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 0;
    font-size: 15px;
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.3s ease;
}

select {
    color: var(--text-primary);
    background-color: var(--side-bg);
}

input:focus,
select:focus {
    outline: none;
    border-bottom-color: var(--ticket-red);
}

.form-actions {
    margin-top: 20px;
    position: sticky;
    bottom: 0;
    padding: 15px 0;
    background: var(--side-bg);
    z-index: 5;
    display: flex;
    gap: 10px;
}

.btn-primary,
.btn-secondary {
    background-color: var(--ticket-red);
    color: white;
    border: none;
    padding: 16px 24px;
    flex: 1;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-primary:hover {
    background-color: #632017;
}

.btn-secondary {
    background: transparent;
    color: var(--ticket-red);
    border: 1.5px solid rgba(133, 41, 29, 0.7);
}

.btn-secondary:hover {
    background: rgba(133, 41, 29, 0.08);
}

.preview-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #3A3D3C 0%, var(--bg-color) 100%);
    padding: 40px;
    overflow: auto;
}

.ticket-canvas-wrapper {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: max-content;
    box-shadow: 0 25px 40px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease;
}

.ticket-canvas-wrapper > * {
    flex: 0 0 auto;
}

.ticket-canvas-wrapper:hover {
    transform: translateY(-5px);
}

/* Common Ticket Reset */
.inactive-ticket {
    display: none !important;
}

/* -------------------------------------------
   GRAND THEATRE TICKET WITH STUB
   ------------------------------------------- */
.grand-ticket {
    background-color: var(--ticket-bg);
    width: 650px;
    min-width: 650px;
    max-width: 650px;
    flex: 0 0 650px;
    min-height: 450px;
    position: relative;
    background-image: var(--noise-bg), var(--dynamic-bg);
    background-size: auto, cover;
    background-position: center;
    /* Left perforated straight edge */
    -webkit-mask-image: radial-gradient(circle at 100% 8px, transparent 3px, black 4px);
    -webkit-mask-size: 100% 16px;
    -webkit-mask-position: right;
    -webkit-mask-repeat: repeat-y;
}

.grand-content {
    display: flex;
    height: 100%;
    filter: var(--ink-bleed-filter);
    color: var(--ticket-black);
    text-shadow: 0.5px 0.5px 0.5px rgba(0, 0, 0, 0.3);
}

.text-red {
    color: var(--ticket-red);
    text-shadow: 0.5px 0.5px 1px rgba(120, 39, 28, 0.4);
}

/* Main Section */
.grand-main {
    flex: 1;
    padding: 25px 35px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.grand-header-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    font-family: var(--font-ticket-en);
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 10px;
}

.g-no {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.g-no .text-red {
    font-family: var(--font-ticket-tw);
    font-size: 26px;
}

.grand-title-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
}

.g-hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 35px;
}

.g-line {
    height: 2.5px;
    background: var(--ticket-black);
    width: 100%;
}

.g-title-en {
    font-family: 'Times New Roman', serif;
    font-size: 32px;
    font-weight: 900;
    letter-spacing: 2px;
    text-align: center;
    white-space: nowrap;
}

.g-title-ch {
    font-family: 'ZhaohuaMinA', var(--font-ticket-ch);
    font-size: 38px;
    font-weight: bold;
    letter-spacing: 8px;
    margin-top: 5px;
    padding-bottom: 2px;
    border-bottom: 4px double var(--ticket-black);
    text-align: center;
    width: auto;
    display: inline-block;
}

.g-admit {
    font-family: 'Times New Roman', serif;
    font-size: 30px;
    font-weight: 900;
    letter-spacing: 4px;
    margin-top: 15px;
    margin-bottom: 5px;
}

.g-notice-en {
    font-family: 'Arial', 'Helvetica', sans-serif;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
    text-align: center;
    line-height: 1.4;
}

.g-notice-ch {
    font-family: var(--font-ticket-tw);
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 6px;
    margin-top: 8px;
    margin-bottom: 12px;
}

.g-bearer-ch {
    font-family: var(--font-ticket-ch);
    font-size: 20px;
    align-self: center;
    margin-bottom: auto;
    /* Pushes footer to bottom */
}

.g-footer-row {
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 15px;
    font-family: 'Times New Roman', serif;
    margin-top: 15px;
    line-height: 1;
}

.g-level-en {
    font-size: 32px;
    font-weight: 900;
}

.g-price-val {
    font-size: 65px;
    font-weight: normal;
    margin-left: -5px;
    line-height: 0.8;
}

.g-price-unit {
    font-size: 24px;
    font-weight: 900;
}

.g-levelch-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-left: auto;
    gap: 6px;
}

.g-l-line {
    font-family: var(--font-ticket-ch);
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 3px;
}

/* Stub Section */
.grand-stub {
    width: 130px;
    padding: 25px 15px;
    border-left: 2px dashed rgba(64, 60, 59, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    /* Simulated tear holes over the dashed line */
    background-image: radial-gradient(circle at left center, #2F3130 5px, transparent 6px);
    background-size: 100% 20px;
    background-position: -6px 0;
    background-repeat: repeat-y;
}

.g-stub-no {
    font-family: var(--font-ticket-en);
    font-weight: bold;
    font-size: 14px;
    width: 100%;
    text-align: left;
}

.g-stub-num {
    font-family: var(--font-ticket-tw);
    font-size: 24px;
    text-align: center;
    margin-bottom: 20px;
    width: 100%;
}

.g-stub-title {
    font-family: 'Times New Roman', serif;
    font-size: 16px;
    font-weight: 900;
    text-align: center;
    line-height: 1.1;
    margin-bottom: 30px;
}

.g-stub-seat {
    text-align: center;
    font-family: 'Times New Roman', serif;
    font-weight: bold;
    font-size: 14px;
    line-height: 1.2;
}

.g-stub-title-ch {
    writing-mode: vertical-rl;
    font-family: 'ZhaohuaMinA', var(--font-ticket-ch);
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 5px;
    margin-top: 25px;
    display: inline-block;
    text-shadow: none;
}

.grand-ticket-ltr {
    flex: 0 0 650px;
    min-width: 650px;
    max-width: 650px;
    -webkit-mask-image: radial-gradient(circle at 0 8px, transparent 3px, black 4px);
    -webkit-mask-position: left;
}

.grand-ticket-ltr .grand-content {
    flex-direction: row-reverse;
}

.grand-ticket-ltr .grand-main {
    padding: 25px 32px 25px 38px;
}

.grand-ticket-ltr .grand-stub {
    border-left: 2px dashed rgba(64, 60, 59, 0.4);
    border-right: none;
    background-image: radial-gradient(circle at left center, #2F3130 5px, transparent 6px);
    background-position: -6px 0;
}

.grand-ticket-ltr .g-stub-no {
    text-align: right;
}

.grand-ticket-ltr .g-stub-title-ch {
    writing-mode: vertical-lr;
    text-orientation: upright;
    letter-spacing: 4px;
    margin-top: 18px;
}

.grand-ticket-ltr .g-title-ch {
    margin-right: 0;
    letter-spacing: 6px;
}

.grand-ticket-ltr .g-movie-block-ltr {
    margin-top: 15px;
    text-align: center;
    line-height: 1.2;
}

.grand-ticket-ltr .g-movie-ch-ltr {
    font-family: var(--font-ticket-ch);
    font-size: 26px;
    font-weight: bold;
    letter-spacing: 3px;
}

.grand-ticket-ltr .g-movie-en-ltr {
    font-family: var(--font-ticket-en);
    font-size: 16px;
    font-weight: bold;
    margin-top: 2px;
}

.grand-ticket-ltr .g-notice-ch,
.grand-ticket-ltr .g-bearer-ch,
.grand-ticket-ltr .g-l-line {
    letter-spacing: 3px;
    text-align: center;
}

.grand-ticket-ltr .g-footer-row {
    justify-content: space-between;
    gap: 20px;
}

.grand-ticket-ltr .g-levelch-box {
    margin-left: 0;
    align-items: flex-start;
}

.grand-ticket-ltr .g-price-cluster {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-left: auto;
}

.grand-ticket.grand-ticket-ltr .ticket-stamp {
    top: 138px;
    right: 38px;
    left: auto;
    transform: rotate(-8deg);
}


/* -------------------------------------------
   WING ON THEATRE VERTICAL TICKET
   ------------------------------------------- */
.vertical-ticket {
    background-color: var(--ticket-bg);
    width: 250px;
    min-width: 250px;
    max-width: 250px;
    flex: 0 0 250px;
    min-height: 660px;
    position: relative;
    overflow: hidden;
    padding-bottom: 20px;
    background-image: var(--noise-bg), var(--dynamic-bg);
    background-size: auto, cover;
    background-position: center;
    clip-path: polygon(0% 1%, 2% 0%, 98% 0%, 100% 1%, 100% 99%, 98% 100%, 2% 100%, 0% 99%);
}

.vertical-ticket .bg-letter {
    position: absolute;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 160px;
    font-family: 'Playfair Display', Georgia, serif;
    font-style: normal;
    font-weight: 700;
    color: var(--ticket-red);
    opacity: 0.35;
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: multiply;
    filter: var(--ink-bleed-letter-filter);
}

.vertical-ticket .ticket-content {
    position: relative;
    z-index: 2;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: 100%;
    filter: var(--ink-bleed-filter);
    color: var(--ticket-black);
}

.vertical-ticket .border-horiz {
    height: 2.5px;
    background-color: var(--ticket-black);
    width: 100%;
    margin: 8px 0;
    mix-blend-mode: multiply;
}

.vertical-ticket .border-horiz.thick {
    height: 4.5px;
}

.vertical-ticket .section-row {
    font-family: var(--font-ticket-ch);
    text-align: center;
    padding: 4px 0;
    line-height: 1.2;
    font-size: 18px;
    mix-blend-mode: multiply;
    font-weight: bold;
    text-shadow: 0.5px 0.5px 0.5px rgba(0, 0, 0, 0.3);
}

.vertical-ticket .spacing-wide {
    letter-spacing: 5px;
}

.vertical-ticket .bold-en {
    font-family: var(--font-ticket-en);
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 1px;
}

.vertical-ticket .section-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 5px;
}

.vertical-ticket .venue-texts {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.vertical-ticket .main-image-wrapper {
    width: 130px;
    height: 160px;
    margin-top: 10px;
    margin-bottom: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.vertical-ticket .main-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
    filter: grayscale(1) contrast(3) brightness(0.6);
}

.vertical-ticket .title-ch {
    font-family: var(--font-ticket-ch);
    font-size: 26px;
    letter-spacing: 6px;
    margin-right: -6px;
    margin-bottom: 2px;
    mix-blend-mode: multiply;
    font-weight: bold;
    text-shadow: 0.5px 0.5px 1px rgba(0, 0, 0, 0.4);
}

.vertical-ticket .title-en {
    font-family: var(--font-ticket-tw);
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 2px;
    margin-right: -2px;
    mix-blend-mode: multiply;
    text-shadow: 0.5px 0.5px 1px rgba(0, 0, 0, 0.4);
}

.vertical-ticket .section-split {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    height: 60px;
}

.vertical-ticket .split-left {
    flex: 1;
    border-right: 2px solid var(--ticket-black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-family: var(--font-ticket-ch);
    letter-spacing: 2px;
    font-weight: bold;
}

.vertical-ticket .split-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: var(--font-ticket-tw);
    font-size: 16px;
    line-height: 1.1;
    font-weight: 900;
    letter-spacing: 1px;
}

.vertical-ticket .seat-row {
    font-family: var(--font-ticket-en);
    font-size: 34px;
    font-weight: 900;
    letter-spacing: 3px;
    padding: 10px 0;
}

.vertical-ticket .inline-rtl {
    display: inline-flex;
    flex-direction: row-reverse;
    align-items: center;
}

.vertical-ticket .inline-ltr {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
}

.vertical-ticket .gap {
    display: inline-block;
    width: 25px;
}

.vertical-ticket-ltr .bg-letter {
    left: auto;
    right: 18px;
    transform: none;
    font-size: 150px;
    opacity: 0.28;
}

.vertical-ticket-ltr {
    flex: 0 0 250px;
    min-width: 250px;
    max-width: 250px;
}

.vertical-ticket-ltr .title-ch {
    margin-right: 0;
    letter-spacing: 4px;
}

.vertical-ticket-ltr .section-row-ltr {
    letter-spacing: 3px;
}

.vertical-ticket-ltr .split-left-ltr {
    flex: 1;
    border-right: 2px solid var(--ticket-black);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: var(--font-ticket-tw);
    font-size: 16px;
    line-height: 1.1;
    font-weight: 900;
    letter-spacing: 1px;
}

.vertical-ticket-ltr .split-right-ltr {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-family: var(--font-ticket-ch);
    letter-spacing: 4px;
    font-weight: bold;
}

.vertical-ticket.vertical-ticket-ltr .ticket-stamp {
    left: auto;
    right: 24px;
    top: 245px;
    transform: rotate(8deg);
}


/* -------------------------------------------
   CATHAY THEATRE HORIZONTAL TICKET
   ------------------------------------------- */
.cathay-ticket {
    background-color: var(--ticket-bg);
    width: 440px;
    min-width: 440px;
    max-width: 440px;
    flex: 0 0 440px;
    min-height: 410px;
    padding: 20px 25px;
    position: relative;
    background-image: var(--noise-bg), var(--dynamic-bg);
    background-size: auto, cover;
    background-position: center;
    -webkit-mask-image: radial-gradient(circle at 0px 10px, transparent 4px, black 5px), radial-gradient(circle at 100% 10px, transparent 4px, black 5px);
    -webkit-mask-size: 51% 20px, 51% 20px;
    -webkit-mask-position: left, right;
    -webkit-mask-repeat: repeat-y;
}

.cathay-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    filter: var(--ink-bleed-filter);
    color: var(--ticket-black);
    text-shadow: 0.5px 0.5px 0.5px rgba(0, 0, 0, 0.3);
}

.cathay-header-row {
    margin-bottom: 5px;
    margin-left: 10px;
    font-family: 'Times New Roman', serif;
    font-weight: bold;
}

.cathay-no-text {
    font-size: 20px;
    margin-right: 5px;
    mix-blend-mode: multiply;
}

.cathay-no-val {
    font-size: 23px;
    font-family: var(--font-ticket-tw);
    font-weight: normal;
    mix-blend-mode: multiply;
}

.cathay-main-box {
    border: 2px solid var(--ticket-black);
    mix-blend-mode: multiply;
    display: flex;
    flex: 1;
}

.cathay-vtext {
    writing-mode: vertical-rl;
    font-family: var(--font-ticket-tw);
    font-size: 16px;
    letter-spacing: 5px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
}

.cathay-vtext-l {
    border-right: 2px solid var(--ticket-black);
}

/* -------------------------------------------
   REPUBLIC OF CHINA ID CARD
   ------------------------------------------- */
.idcard-ticket {
    width: 680px;
    min-width: 680px;
    max-width: 680px;
    height: 480px;
    min-height: 480px;
    max-height: 480px;
    background-color: var(--ticket-bg);
    background-image: var(--noise-bg), var(--dynamic-bg);
    background-size: auto, cover;
    background-position: center;
    display: flex;
    flex: 0 0 auto;
    padding: 20px 25px;
    box-sizing: border-box;
    border-radius: 2px;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.15);
    filter: var(--ink-bleed-filter);
    color: var(--ticket-black);
}

.idc-divider {
    width: 2px;
    height: 100%;
    margin: 0 15px;
    background: linear-gradient(to bottom, rgba(64, 60, 59, 0) 5%, rgba(64, 60, 59, 0.4) 50%, rgba(64, 60, 59, 0) 95%);
    border-left: 1px dotted rgba(64, 60, 59, 0.2);
}

.idc-page {
    width: calc(50% - 15px);
    height: 100%;
    position: relative;
    border: 1px solid var(--ticket-black);
    padding: 5px;
    display: flex;
    flex-direction: column;
}

.idc-pg-label {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-ticket-ch);
    font-size: 14px;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 5px;
    font-weight: bold;
    color: var(--ticket-black);
    text-shadow: 0.5px 0.5px 0px rgba(0, 0, 0, 0.2);
}

.idc-left-page .idc-pg-label {
    left: -22px;
}

.idc-right-page .idc-pg-label {
    right: -22px;
}

.idc-lp-inner,
.idc-rp-inner {
    border: 1px solid var(--ticket-black);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Left Page (Page 4) */
.idc-lp-inner {
    border-left: none;
    border-right: none;
    border-top: none;
    border-bottom: none;
}

.idc-lp-row {
    display: flex;
    border: 1px solid var(--ticket-black);
    margin-bottom: 2px;
}

.idc-lp-r1 {
    height: 35%;
}

.idc-lp-r2 {
    height: 30%;
}

.idc-lp-r3 {
    height: 35%;
    margin-bottom: 0;
}

.idc-lp-side-label {
    width: 32px;
    border-right: 1.5px solid var(--ticket-black);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 8px;
    font-weight: bold;
}

.idc-lp-content-box {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.idc-lp-gridhead {
    display: flex;
    border-bottom: 1.5px solid var(--ticket-black);
    font-size: 14px;
    font-weight: bold;
}

.idc-lp-gridhead>div {
    text-align: center;
    padding: 3px 0;
}

.il-c1,
.il-c2,
.il-c3,
.il-c4,
.il-c5 {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Compact handwriting inside left-page grid cells */
.idc-lp-gridbody .idc-handwriting {
    font-size: 11px;
    letter-spacing: 0;
    word-break: break-all;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 1px;
}

.il-c1 {
    flex: 1.5;
    border-right: 1.5px solid var(--ticket-black);
}

.il-c2 {
    flex: 1;
    border-right: 1.5px solid var(--ticket-black);
}

.il-c3 {
    flex: 1;
    border-right: 1.5px solid var(--ticket-black);
}

.il-c4 {
    flex: 1;
    border-right: 1.5px solid var(--ticket-black);
}

.il-c5 {
    flex: 1.5;
}

.idc-lp-gridbody {
    display: flex;
    flex: 1;
    border-bottom: 1.5px solid var(--ticket-black);
}

.idc-lp-gridbody:last-child {
    border-bottom: none;
}

.il-m1 {
    flex: 2;
    border-right: 1.5px solid var(--ticket-black);
    display: flex;
    justify-content: center;
}

.il-m2 {
    flex: 1.5;
    display: flex;
    justify-content: center;
}

.idc-uline {
    border-bottom: 1px solid var(--ticket-black);
    display: inline-block;
    min-width: 40px;
    text-align: center;
    line-height: 1.2;
}

.p-notice {
    padding: 5px 6px;
    font-size: 11px;
    line-height: 1.3;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}

.idc-notice-item {
    display: flex;
    gap: 4px;
}

/* Right Page (Page 1) */
.idc-rp-inner {
    border-color: var(--ticket-black);
    border-width: 1px;
    padding: 20px 15px 10px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.idc-rp-top {
    text-align: center;
    margin-bottom: 14px;
    position: relative;
    z-index: 2;
}

.idc-t-1 {
    font-size: 16px;
    letter-spacing: 10px;
    margin-bottom: 12px;
}

.idc-t-2 {
    font-size: 30px;
    letter-spacing: 5px;
    margin-bottom: 12px;
    white-space: nowrap;
}

.idc-t-3 {
    text-align: center;
    font-size: 25px;
    letter-spacing: 6px;
    margin-bottom: 4px;
}

.idc-rp-form {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    font-size: 12px;
    font-weight: bold;
    padding: 0 4px;
    flex: 1;
    position: relative;
    z-index: 2;
}

.idc-cover-stamp {
    position: absolute;
    top: 150px;
    left: 50%;
    width: 228px;
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: multiply;
    opacity: 0.3;
    transform: translateX(-50%);
    transform-origin: center center;
    filter: invert(25%) sepia(42%) saturate(640%) hue-rotate(340deg) brightness(0.64) contrast(1.01) blur(0.26px);
}

.idcard-ticket[data-stamp-enabled="no"] .idc-cover-stamp {
    display: none;
}

.idc-f-line {
    display: flex;
    align-items: flex-end;
    white-space: nowrap;
    min-height: 22px;
}

/* Ruled line: full-width bottom border on each form row */
.idc-f-ruled {
    border-bottom: 1px solid var(--ticket-black);
    padding-bottom: 3px;
    margin-bottom: 5px;
}

/* Two-char label: each char in its own span with fixed width for alignment */
.f-lbl-w {
    display: inline-block;
    width: 1.5em;
    text-align: center;
    margin-right: 0;
}

/* Fill remaining space on ruled lines */
.idc-f-fill {
    flex: 1;
}

.f-lbl {
    margin-right: 3px;
}

.f-center {
    justify-content: center;
}

.f-w-sm {
    min-width: 35px;
}

.f-w-md {
    min-width: 55px;
}

.f-w-lg {
    min-width: 140px;
}

.idc-zht-a {
    font-family: var(--font-ticket-ch);
    font-weight: bold;
}

.idc-zhengkai {
    font-family: var(--font-idcard-zhengkai);
    font-weight: bold;
}

.idc-lishu {
    font-family: var(--font-idcard-lishu);
}

.idc-handwriting {
    font-family: var(--font-ticket-tw);
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 2px;
    text-shadow: none;
    color: var(--idcard-writing-color, black);
    mix-blend-mode: multiply;
}

.idcard-ticket {
    --idcard-writing-font: var(--font-idcard-writing-print);
    --idcard-writing-weight: 900;
    --idcard-writing-color: var(--ticket-black);
}

.idcard-ticket[data-write-font="print"] {
    --idcard-writing-font: var(--font-idcard-writing-print);
    --idcard-writing-weight: 900;
}

.idcard-ticket[data-write-font="hand1"] {
    --idcard-writing-font: var(--font-idcard-writing-hand1);
    --idcard-writing-weight: 400;
}

.idcard-ticket[data-write-font="hand2"] {
    --idcard-writing-font: var(--font-idcard-writing-hand2);
    --idcard-writing-weight: 400;
}

.idcard-ticket[data-write-ink="black"] {
    --idcard-writing-color: var(--ticket-black);
}

.idcard-ticket[data-write-ink="inkblue"] {
    --idcard-writing-color: #2d4268;
}

.idcard-ticket .idc-handwriting {
    font-family: var(--idcard-writing-font);
    font-weight: var(--idcard-writing-weight);
}

.idc-rp-form .idc-handwriting {
    color: var(--idcard-writing-color);
}

.idc-ip3-layout .idc-handwriting,
.idc-ip2-layout .idc-handwriting {
    font-size: 12px;
    letter-spacing: 1px;
}

/* --- Spread wrapper --- */
.idc-spread {
    display: flex;
    width: 100%;
    height: 100%;
    justify-content: space-between;
    flex: 0 0 auto;
}

/* --- Page Toggle Buttons --- */
.idc-page-toggle { display: flex; gap: 4px; }
.idc-pg-btn {
    flex: 1; padding: 6px 0; border: 1.5px solid var(--ticket-red);
    background: transparent; color: var(--ticket-red); font-size: 12px;
    font-weight: 600; border-radius: 6px; cursor: pointer; transition: all 0.2s;
}
.idc-pg-btn.active { background: var(--ticket-red); color: #fff; }
.idc-pg-btn:hover:not(.active) { background: rgba(180,60,50,0.1); }
.fp-sel { flex:1; font-size:14px; padding:3px 0; text-align:center; border:1px solid #ccc; border-radius:4px; background:#fff; color:#111; }
.fp-sel option { color:#111; }

/* --- INNER PAGE (Pages 2 & 3) --- */
.idc-ip-inner { width:100%; height:100%; display:flex; flex-direction:column; border:1px solid var(--ticket-black); overflow:hidden; }

/* Inner page spread: rebuilt to use historical table-like vertical bands */
.idc-ip3-layout,
.idc-ip2-layout {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.idc-ip2-layout {
    display: grid;
    grid-template-rows: 172px 1fr;
}

.ip3-top,
.ip2-top {
    display: flex;
    border-bottom: 1.5px solid var(--ticket-black);
    min-height: 0;
}

.ip3-top { flex: 3.2; }
.ip2-top { flex: 3.05; height: 172px; }

.ip3-section,
.ip2-section {
    min-width: 0;
    display: flex;
    flex-direction: column;
    border-right: 1.5px solid var(--ticket-black);
}

.ip3-section:last-child,
.ip2-section:last-child { border-right: none; }

.ip3-edu-box { flex: 1.2; }
.ip3-job-box { flex: 1.2; }
.ip3-pub-box { flex: 1.45; }
.ip2-citizen-box { flex: 1.05; }
.ip2-family-box { flex: 1.95; }

.ip3-section-title {
    min-height: 30px;
    border-bottom: 1.5px solid var(--ticket-black);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px 4px;
    font-size: 11px;
    letter-spacing: 4px;
    white-space: nowrap;
}

.ip3-edu-bands,
.ip3-strip-group,
.ip3-pub-grid,
.ip2-strip-stack,
.ip2-family-grid,
.ip3-bottom,
.ip2-history-wrap,
.ip2-history-main,
.ip2-history-core {
    flex: 1;
    min-height: 0;
}

.ip3-edu-bands,
.ip3-strip-group,
.ip3-pub-values,
.ip2-family-grid,
.ip3-bottom,
.ip2-history-wrap,
.ip2-history-main,
.ip2-history-core {
    display: flex;
}

.ip3-edu-band,
.ip3-strip-value,
.ip3-pub-cert,
.ip2-family-value,
.ip2-history-value,
.ip2-history-dateval,
.ip3-traits-value {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    writing-mode: vertical-rl;
    text-orientation: upright;
    white-space: pre-wrap;
    word-break: break-all;
    overflow: hidden;
    line-height: 1.22;
}

.ip3-edu-band {
    flex: 1;
    padding: 6px 3px 6px 2px;
    border-right: 1px solid var(--ticket-black);
}

.ip3-edu-band:last-child { border-right: none; }

.ip3-strip-group,
.ip2-strip-stack,
.ip3-pub-grid,
.ip2-history-fields {
    display: flex;
    flex-direction: column;
}

.ip3-strip-pair,
.ip3-pub-row,
.ip2-strip-row,
.ip2-history-row {
    flex: 1;
    min-height: 0;
    display: flex;
    border-bottom: 1px solid var(--ticket-black);
}

.ip3-strip-pair:last-child,
.ip3-pub-row:last-child,
.ip2-strip-row:last-child,
.ip2-history-row:last-child { border-bottom: none; }

.ip3-strip-label,
.ip3-side-head,
.ip3-analysis-head,
.ip2-note-strip,
.ip2-history-side,
.ip2-history-label,
.ip2-history-head,
.ip2-family-key,
.ip3-fp-headcell,
.ip3-fp-rowlabel {
    writing-mode: vertical-rl;
    text-orientation: upright;
}

.ip3-strip-label,
.ip2-history-label {
    width: 24px;
    flex: 0 0 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--ticket-black);
    font-size: 10px;
    letter-spacing: 1px;
    padding: 2px 0;
}

.ip3-strip-label-long,
.ip2-history-label-long {
    font-size: 8px;
    letter-spacing: 0.5px;
}

.ip3-strip-value {
    flex: 1;
    padding: 6px 3px 6px 2px;
}

.ip3-job-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ip3-job-row {
    flex: 1;
    min-height: 0;
    display: flex;
    border-bottom: 1px solid var(--ticket-black);
}

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

.ip3-job-label {
    width: 24px;
    flex: 0 0 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--ticket-black);
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-size: 10px;
    letter-spacing: 1px;
    padding: 2px 0;
}

.ip3-job-cells {
    flex: 1;
    min-width: 0;
    display: flex;
}

.ip3-job-cell {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 6px 3px 6px 2px;
    border-right: 1px solid var(--ticket-black);
    writing-mode: vertical-rl;
    text-orientation: upright;
    white-space: pre-wrap;
    word-break: break-all;
    overflow: hidden;
    line-height: 1.22;
}

.ip3-job-cell:last-child { border-right: none; }

.ip3-pub-values {
    flex: 1;
}

.ip3-pub-values .ip3-strip-value {
    border-right: 1px solid var(--ticket-black);
}

.ip3-pub-values .ip3-strip-value:last-child { border-right: none; }

.ip3-pub-cert {
    flex: 1;
    padding: 6px 4px 6px 2px;
}

.ip3-traits-row {
    display: flex;
    min-height: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-bottom: 1.5px solid var(--ticket-black);
    overflow: hidden;
}

.ip3-traits-block,
.ip3-analysis-block {
    flex: 1;
    min-width: 0;
    display: flex;
}

.ip3-traits-block {
    border-right: 1.5px solid var(--ticket-black);
}

.ip3-side-head {
    width: 24px;
    flex: 0 0 24px;
    border-right: 1.5px solid var(--ticket-black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    letter-spacing: 3px;
    padding: 3px 0;
}

.ip3-traits-value {
    flex: 1;
    padding: 5px 5px 5px 3px;
}

.ip3-analysis-label {
    width: 28px;
    flex: 0 0 28px;
    border-right: 1.5px solid var(--ticket-black);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    font-size: 8px;
    letter-spacing: 0.5px;
    line-height: 1.05;
    padding: 2px 1px;
}

.ip3-analysis-label span { display: block; }

.ip3-analysis-value {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 5px 5px 5px 3px;
    writing-mode: vertical-rl;
    text-orientation: upright;
    white-space: pre-wrap;
    word-break: break-all;
    overflow: hidden;
    line-height: 1.22;
}

.ip3-bottom { flex: 2.05; }

.ip3-photo-box {
    flex: 0.96;
    min-width: 0;
    display: flex;
    border-right: 1.5px solid var(--ticket-black);
}

.ip3-photo-head {
    width: 26px;
    flex: 0 0 26px;
    font-size: 8px;
    line-height: 1.15;
    letter-spacing: 0.5px;
}

.ip-photo-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.025);
    touch-action: none;
    overscroll-behavior: contain;
}

.ip-photo-area:active { cursor: grabbing; }
.ip-photo-area img { position: absolute; max-width: none; max-height: none; user-select: none; pointer-events: none; }
.ip-photo-placeholder { font-size: 10px; color: #aaa; font-style: italic; }

.ip3-fp-box {
    flex: 1.08;
    min-width: 0;
    display: flex;
    position: relative;
}

.idc-fp-stamp {
    position: absolute;
    top: 12px;
    right: 10px;
    width: 118px;
    max-height: calc(100% - 24px);
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: multiply;
    opacity: 0.46;
    transform: rotate(-5deg);
    transform-origin: center center;
    filter: blur(0.14px) saturate(1) contrast(1.02);
}

.idcard-ticket[data-inner-stamp-enabled="no"] .idc-fp-stamp {
    display: none;
}

.ip3-note-strip {
    width: 22px;
    flex: 0 0 22px;
    border-left: 1.5px solid var(--ticket-black);
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-size: 8px;
    letter-spacing: 0.4px;
    line-height: 1.1;
    padding: 3px 0;
}

.ip3-fp-table {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 34px repeat(5, 1fr);
    grid-template-rows: 34px repeat(2, 1fr);
    position: relative;
    z-index: 1;
    background: transparent;
}

.ip3-fp-table > div {
    border-right: 1px solid var(--ticket-black);
    border-bottom: 1px solid var(--ticket-black);
}

.ip3-fp-table > div:nth-child(6n) { border-right: none; }
.ip3-fp-table > div:nth-last-child(-n + 6) { border-bottom: none; }

.ip3-fp-corner,
.ip3-fp-headcell,
.ip3-fp-rowlabel,
.ip3-fp-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
}

.ip3-fp-corner {
    position: relative;
    font-size: 8px;
    overflow: hidden;
}

.ip3-fp-corner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top right, transparent 48.5%, var(--ticket-black) 49.5%, var(--ticket-black) 50.5%, transparent 51.5%);
    pointer-events: none;
}

.ip3-fp-corner-top,
.ip3-fp-corner-bottom {
    position: absolute;
    display: flex;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 0.5px;
}

.ip3-fp-corner-top { top: 4px; right: 5px; }
.ip3-fp-corner-bottom { bottom: 4px; left: 5px; }

.ip3-fp-headcell {
    font-size: 8px;
    padding: 2px 0;
}

.ip3-fp-rowlabel {
    font-size: 9px;
    letter-spacing: 2px;
}

.ip3-fp-cell {
    font-size: 13px;
    font-weight: bold;
}

.ip2-strip-stack { display: flex; flex-direction: column; }

.ip2-family-table {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ip2-family-row {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 26px repeat(5, 1fr);
}

.ip2-family-row + .ip2-family-row {
    border-top: 1px solid var(--ticket-black);
}

.ip2-family-rowhead,
.ip2-family-cell {
    min-width: 0;
    border-right: 1px solid var(--ticket-black);
}

.ip2-family-rowhead:last-child,
.ip2-family-cell:last-child {
    border-right: none;
}

.ip2-family-rowhead {
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-size: 9px;
    letter-spacing: 1px;
    padding: 2px 0;
}

.ip2-family-cell {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    writing-mode: vertical-rl;
    text-orientation: upright;
    white-space: pre-wrap;
    word-break: break-all;
    overflow: hidden;
    line-height: 1.18;
    padding: 5px 2px 5px 1px;
}

.ip2-family-namecell {
    letter-spacing: 0.5px;
}

.ip2-history-wrap {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ip2-history-tophead {
    min-height: 24px;
    border-bottom: 1.5px solid var(--ticket-black);
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 6px;
    padding: 2px 0;
}

.ip2-history-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 46px 1fr;
    grid-template-rows: 1fr 0.5fr 0.5fr 0.5fr 1fr;
}

.ip2-history-headcell,
.ip2-history-datehead {
    grid-column: 1;
    border-right: 1px solid var(--ticket-black);
    border-bottom: 1px solid var(--ticket-black);
}

.ip2-history-headcell {
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 1px;
    padding: 2px 0;
}

.ip2-history-headcell-top {
    grid-row: 1;
}

.ip2-history-datehead {
    grid-row: 2 / span 3;
    display: grid;
    grid-template-columns: 23px 23px;
    grid-template-rows: repeat(3, 1fr);
}

.ip2-history-headcell-bottom {
    grid-row: 5;
    border-bottom: none;
}

.ip2-history-dateword {
    grid-column: 1;
    grid-row: 1 / span 3;
    border-right: 1px solid var(--ticket-black);
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 1px;
    padding: 2px 0;
}

.ip2-history-datecells {
    grid-column: 2;
    grid-row: 1 / span 3;
    display: grid;
    grid-template-rows: repeat(3, 1fr);
}

.ip2-history-datecells span {
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--ticket-black);
}

.ip2-history-datecells span:last-child {
    border-bottom: none;
}

.ip2-history-grid {
    grid-column: 2;
    grid-row: 1 / span 5;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: 1fr 0.5fr 0.5fr 0.5fr 1fr;
}

.ip2-history-fill {
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    writing-mode: vertical-rl;
    text-orientation: upright;
    white-space: pre-wrap;
    word-break: break-all;
    overflow: hidden;
    line-height: 1.18;
    padding: 5px 2px 5px 1px;
    border-right: 1px solid var(--ticket-black);
    border-bottom: 1px solid var(--ticket-black);
}

.ip2-history-fill:nth-child(5n) {
    border-right: none;
}

.ip2-history-fill:nth-last-child(-n + 5) {
    border-bottom: none;
}

.ip2-history-headcell-long {
    letter-spacing: 0.5px;
}

/* Inner page values: keep the current fixed grid, center content horizontally,
   and let long text wrap inside the existing cell size. */
.idc-ip-inner :is(
    .ip3-edu-band,
    .ip3-strip-value,
    .ip3-job-cell,
    .ip3-traits-value,
    .ip3-analysis-value,
    .ip2-family-cell,
    .ip2-history-fill
) {
    min-width: 0;
    min-height: 0;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-all;
    box-sizing: border-box;
    padding: 5px 1px;
}

.ip3-traits-value,
.ip3-analysis-value {
    display: flex;
    width: 0;
    height: 100%;
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 0 1px;
}

.ip3-traits-value > .idc-vcenter-text,
.ip3-analysis-value > .idc-vcenter-text {
    display: inline-block;
    height: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 4px 0;
    text-align: center;
    writing-mode: vertical-rl;
    text-orientation: upright;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-all;
    overflow: hidden;
    line-height: 1.18;
}

/* Unified table-head treatment for all inner-page heads except the fingerprint grid. */
.idc-ip-inner :is(
    .ip3-section-title,
    .ip3-job-label,
    .ip3-strip-label,
    .ip3-side-head,
    .ip3-analysis-label,
    .ip2-family-rowhead,
    .ip2-history-tophead,
    .ip2-history-headcell,
    .ip2-history-dateword,
    .ip2-history-datecells span
) {
    font-size: 10px;
    font-weight: 700;
    line-height: 1.08;
    box-sizing: border-box;
}

.idc-ip-inner :is(
    .ip3-job-label,
    .ip3-strip-label,
    .ip3-side-head,
    .ip2-family-rowhead,
    .ip2-history-headcell,
    .ip2-history-dateword,
    .ip2-history-datecells span
) {
    justify-content: space-evenly;
    align-items: center;
    text-align: center;
    padding: 2px 0;
}

.idc-ip-inner :is(.ip3-section-title, .ip2-history-tophead) {
    letter-spacing: 5px;
    padding: 2px 6px;
}

.ip3-analysis-label {
    justify-content: space-evenly;
    align-items: stretch;
    padding: 1px 0;
}

.ip3-analysis-label span {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
}

.cathay-vtext-r {
    border-left: 2px solid var(--ticket-black);
}

.cathay-center-col {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cathay-title-ch {
    font-family: var(--font-ticket-ch);
    font-size: 34px;
    font-weight: bold;
    text-align: center;
    letter-spacing: 12px;
    padding: 12px 0 5px 0;
    display: block;
}

.cathay-title-en {
    font-family: var(--font-ticket-en);
    font-size: 26px;
    text-align: center;
    font-weight: bold;
    letter-spacing: 1px;
}

.cathay-border-line {
    border-bottom: 2px solid var(--ticket-black);
    width: 100%;
}

.cathay-border-line.thin {
    border-bottom: 1px dashed var(--ticket-black);
}

.cathay-eng-notices {
    display: flex;
    font-family: 'Times New Roman', serif;
    font-size: 12px;
    font-weight: 500;
    height: 40px;
}

.c-en-l,
.c-en-r {
    flex: 1;
    text-align: center;
    line-height: 1.1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.c-en-vline {
    width: 2px;
    background-color: var(--ticket-black);
}

.cathay-inner-box {
    border: 2px solid var(--ticket-black);
    margin: 6px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.c-ib-row {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.lg-ch-row {
    font-family: var(--font-ticket-ch);
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 6px;
}

.seat-price-row {
    font-family: var(--font-ticket-en);
    font-size: 18px;
    font-weight: bold;
    justify-content: space-around;
    padding: 0 10px;
}

.seat-bold {
    font-size: 24px;
    font-weight: 900;
}

.tax-bearer-row {
    font-family: var(--font-ticket-en);
    font-size: 14px;
    font-weight: bold;
}

.c-ib-tbl {
    display: flex;
    width: 100%;
    height: 100%;
}

.c-ib-tbcl,
.c-ib-tbcr {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.c-ib-tbcvline {
    width: 1px;
    background-color: var(--ticket-black);
}

.c-ib-tbcl {
    font-family: var(--font-ticket-tw);
    letter-spacing: 2px;
    font-size: 15px;
}

.c-ib-tbcr {
    font-family: var(--font-ticket-tw);
    letter-spacing: 3px;
    font-size: 13px;
    font-weight: bold;
}

.sm-ch-row {
    font-family: var(--font-ticket-tw);
    font-size: 18px;
    letter-spacing: 6px;
    font-weight: bold;
}

.cathay-ticket-ltr .cathay-header-row {
    margin-left: 0;
    margin-right: 10px;
    text-align: right;
}

.cathay-ticket-ltr {
    flex: 0 0 440px;
    min-width: 440px;
    max-width: 440px;
}

.cathay-ticket-ltr .cathay-vtext {
    writing-mode: vertical-lr;
    text-orientation: upright;
    letter-spacing: 4px;
}

.cathay-ticket-ltr .cathay-title-ch-ltr,
.cathay-ticket-ltr .cathay-movie-ch-ltr,
.cathay-ticket-ltr .lg-ch-row,
.cathay-ticket-ltr .sm-ch-row {
    letter-spacing: 4px;
}

.cathay-ticket-ltr .cathay-movie-block-ltr {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 0;
}

.cathay-ticket-ltr .cathay-movie-ch-ltr {
    font-family: var(--font-ticket-ch);
    font-size: 22px;
    font-weight: bold;
}

.cathay-ticket-ltr .cathay-movie-en-ltr {
    font-family: var(--font-ticket-en);
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
    margin-top: 2px;
}

.cathay-ticket-ltr .c-ib-tbcl {
    letter-spacing: 1px;
}

.cathay-ticket.cathay-ticket-ltr .ticket-stamp {
    width: 102px;
    top: 116px;
    left: 54px;
    right: auto;
    transform: rotate(10deg);
}

/* -------------------------------------------
   NANKING THEATRE HORIZONTAL TICKET
   ------------------------------------------- */
.nanking-ticket {
    --font-ticket-ch: 'ZhaohuaMinA', 'Huiwen-mincho', serif;
    background-color: var(--ticket-bg);
    width: 700px;
    min-width: 700px;
    max-width: 700px;
    flex: 0 0 700px;
    height: 340px;
    min-height: 340px;
    max-height: 340px;
    position: relative;
    background-image: var(--noise-bg), var(--dynamic-bg);
    background-size: auto, cover;
    background-position: center;
    border-radius: 2px;
}

.nanking-content {
    display: flex;
    height: 100%;
    filter: var(--ink-bleed-filter);
    color: var(--ticket-black);
    text-shadow: 0.5px 0.5px 0.5px rgba(0, 0, 0, 0.3);
}

.nk-z {
    font-family: 'Times New Roman', serif;
    font-weight: bold;
}

/* Stub Section */
.nanking-stub {
    width: 170px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 2px dashed rgba(64, 60, 59, 0.5);
    padding: 15px 12px;
    mix-blend-mode: multiply;
}

.nk-stub-no {
    font-family: var(--font-ticket-tw);
    font-size: 22px;
    font-weight: 500;
    align-self: flex-start;
    margin-left: 5px;
    margin-bottom: 5px;
    text-shadow: none;
}

.nk-stub-venueCh {
    font-family: var(--font-ticket-ch);
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 4px;
    margin-bottom: 2px;
    margin-right: -4px;
}

.nk-stub-venueEn {
    font-family: 'Times New Roman', serif;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.nk-stub-featEn {
    font-family: 'Times New Roman', serif;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    line-height: 1.1;
    margin-bottom: 5px;
    transform: scaleY(0.9);
}

.nk-stub-featCh {
    font-family: var(--font-ticket-ch);
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 3px;
    margin-bottom: auto;
    margin-right: -3px;
}

.nk-stub-showEn {
    font-family: var(--font-ticket-en);
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 2px;
}

.nk-stub-showCh {
    font-family: var(--font-ticket-ch);
    font-size: 16px;
    font-weight: bold;
}

/* Main Section */
.nanking-main {
    flex: 1;
    padding: 15px 35px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    mix-blend-mode: multiply;
}

.nk-main-header {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    padding-right: 60px;
    margin-bottom: 5px;
}

.nk-main-no {
    font-family: var(--font-ticket-tw);
    font-size: 28px;
    letter-spacing: 2px;
    font-weight: 500;
    text-shadow: none;
}

.nk-main-banner {
    display: flex;
    align-items: stretch;
    width: 100%;
    margin: 10px 0;
    gap: 30px;
    justify-content: space-between;
}

.nk-banner-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.nk-side-en {
    font-family: var(--font-ticket-en);
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    line-height: 1.1;
}

.nk-side-ch {
    font-family: var(--font-ticket-ch);
    font-size: 18px;
    font-weight: bold;
    margin-top: 5px;
}

.nk-banner-center {
    flex: 1;
    display: flex;
    justify-content: center;
    position: relative;
}

.nk-banner-box {
    background-color: var(--ticket-black);
    color: var(--ticket-bg);
    padding: 10px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1.5px var(--ticket-bg), 0 0 0 3.5px var(--ticket-black), 0 0 0 5px var(--ticket-bg), 0 0 0 7px var(--ticket-black);
    margin: 8px 10px;
    text-shadow: none;
    width: 330px;
}

.nk-box-ch {
    font-family: var(--font-ticket-ch);
    font-size: 26px;
    font-weight: bold;
    letter-spacing: 20px;
    margin-right: -20px;
    text-shadow: none;
}

.nk-box-en {
    font-family: 'Arial', sans-serif;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 2px;
    transform: scaleY(1.3);
    margin-top: 8px;
    text-shadow: none;
}

.nk-main-featEn {
    font-family: 'Times New Roman', serif;
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 1.5px;
    margin-top: 15px;
    margin-bottom: 5px;
}

.nk-subline {
    width: 90%;
    height: 2px;
    background-color: var(--ticket-black);
    margin: 6px 0;
    opacity: 0.8;
}

.nk-main-featCh {
    font-family: var(--font-ticket-ch);
    font-size: 26px;
    font-weight: bold;
    letter-spacing: 30px;
    margin-right: -30px;
    margin-top: 5px;
    margin-bottom: 5px;
}

.nk-notice-1 {
    font-family: var(--font-ticket-ch);
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 12px;
    margin-top: 15px;
    margin-bottom: 12px;
    margin-right: -12px;
}

.nk-notice-2 {
    font-family: var(--font-ticket-tw);
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1.5px;
}

.nanking-ticket-ltr .nanking-content {
    flex-direction: row-reverse;
}

.nanking-ticket-ltr {
    flex: 0 0 700px;
    min-width: 700px;
    max-width: 700px;
    min-height: 340px;
    max-height: 340px;
}

.nanking-ticket-ltr .nanking-stub {
    border-right: none;
    border-left: 2px dashed rgba(64, 60, 59, 0.5);
}

.nanking-ticket-ltr .nk-stub-no {
    align-self: flex-end;
    margin-left: 0;
    margin-right: 5px;
}

.nanking-ticket-ltr .nk-stub-venueCh,
.nanking-ticket-ltr .nk-stub-featCh,
.nanking-ticket-ltr .nk-stub-showCh,
.nanking-ticket-ltr .nk-side-ch,
.nanking-ticket-ltr .nk-box-ch,
.nanking-ticket-ltr .nk-main-featCh,
.nanking-ticket-ltr .nk-notice-1 {
    margin-right: 0;
    text-align: center;
}

.nanking-ticket-ltr .nk-stub-venueCh,
.nanking-ticket-ltr .nk-stub-featCh {
    letter-spacing: 3px;
}

.nanking-ticket-ltr .nk-box-ch {
    letter-spacing: 14px;
}

.nanking-ticket-ltr .nk-main-featCh {
    letter-spacing: 18px;
}

.nanking-ticket-ltr .nk-notice-1 {
    letter-spacing: 8px;
}

.nanking-ticket-ltr .nk-main-header {
    justify-content: flex-start;
    padding-right: 0;
    padding-left: 40px;
}

.nanking-ticket.nanking-ticket-ltr .ticket-stamp {
    width: 95px;
    top: 104px;
    left: 58px;
    right: auto;
    transform: rotate(11deg);
}

/* -------------------------------------------
   MAJESTIC THEATRE VERTICAL TICKET
   ------------------------------------------- */
.majestic-ticket {
    background-color: var(--ticket-bg);
    width: 260px;
    min-width: 260px;
    max-width: 260px;
    flex: 0 0 260px;
    min-height: 640px;
    position: relative;
    background-image: var(--noise-bg), var(--dynamic-bg);
    background-size: auto, cover;
    background-position: center;
    border: 2.5px solid var(--ticket-black);
    padding-bottom: 5px;
    margin: 10px;
}

.majestic-ticket::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    bottom: 3px;
    border: 1px solid var(--ticket-black);
    pointer-events: none;
    mix-blend-mode: multiply;
    filter: var(--ink-bleed-filter);
}

.majestic-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 8px;
    filter: var(--ink-bleed-filter);
    color: var(--ticket-black);
    text-shadow: 0.5px 0.5px 0.5px rgba(0, 0, 0, 0.3);
}

.m-block {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
    mix-blend-mode: multiply;
    padding-left: 5px;
    padding-right: 5px;
}

.mj-line {
    width: 100%;
    height: 1.5px;
    background-color: var(--ticket-black);
    mix-blend-mode: multiply;
}

.majestic-b1 {
    padding-top: 15px;
}

.mj-title-en {
    font-family: 'Times New Roman', Cardo, serif;
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 1px;
}

.majestic-b2 {
    flex-direction: row;
    justify-content: space-around;
    padding: 10px 20px;
}

.mj-num-lg {
    font-family: 'Times New Roman', serif;
    font-size: 42px;
    font-weight: bold;
}

.majestic-b3 {
    gap: 4px;
    padding: 12px 0;
}

.mj-ch-sm {
    font-family: var(--font-ticket-ch);
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 3px;
}

.majestic-b4 {
    flex-direction: row;
    padding: 8px 0;
}

.mj-vsplit {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mj-vsplit-line {
    width: 1.5px;
    align-self: stretch;
    background-color: var(--ticket-black);
    margin: -8px 0;
}

.mj-ch-md {
    font-family: var(--font-ticket-ch);
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 2px;
}

.majestic-b5 {
    flex-direction: row;
    align-items: stretch;
    justify-content: space-between;
    padding: 15px 0;
}

.mj-side-box {
    width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mj-vtext {
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-family: var(--font-ticket-ch);
    font-size: 15px;
    letter-spacing: 2px;
    font-weight: bold;
    line-height: 1;
    text-align: center;
}

.mj-center-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
}

.mj-title-ch {
    font-family: var(--font-ticket-ch);
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 6px;
    margin-right: -6px;
}

.mj-title-suben {
    font-family: 'Times New Roman', Cardo, serif;
    font-size: 18px;
    letter-spacing: 1.5px;
    font-weight: bold;
    transform: scaleY(1.1);
    margin-top: -4px;
    margin-bottom: 5px;
}

.mj-bottitle {
    font-family: 'Times New Roman', serif;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mj-movie-ch {
    font-family: var(--font-ticket-ch);
    font-size: 22px;
    font-weight: bold;
    letter-spacing: 6px;
    margin-right: -6px;
    margin-top: -3px;
}

.mj-movie-en {
    font-family: var(--font-ticket-en);
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
    margin-top: -5px;
    margin-bottom: 5px;
}

.majestic-b6 {
    flex-direction: row;
    padding: 8px 0;
}

.mj-enshow-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: 'Times New Roman', serif;
    font-size: 15px;
    font-weight: bold;
    line-height: 1.1;
}

.mj-en-md {
    font-family: 'Times New Roman', serif;
    font-size: 18px;
    font-weight: bold;
}

.majestic-b7 {
    flex-direction: row;
    justify-content: space-around;
    padding: 10px 20px;
}

.majestic-b8 {
    gap: 4px;
    padding: 12px 0;
    padding-bottom: 15px;
}

.mj-date-en {
    font-family: 'Times New Roman', serif;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 1px;
}

.majestic-ticket-ltr .mj-vtext {
    writing-mode: vertical-lr;
    text-orientation: upright;
}

.majestic-ticket-ltr {
    flex: 0 0 260px;
    min-width: 260px;
    max-width: 260px;
}

.majestic-ticket-ltr .mj-title-ch,
.majestic-ticket-ltr .mj-movie-ch,
.majestic-ticket-ltr .mj-ch-sm,
.majestic-ticket-ltr .mj-ch-md {
    margin-right: 0;
}

.majestic-ticket-ltr .mj-title-ch {
    letter-spacing: 4px;
}

.majestic-ticket-ltr .mj-movie-ch,
.majestic-ticket-ltr .mj-ch-sm,
.majestic-ticket-ltr .mj-ch-md {
    letter-spacing: 3px;
}

.majestic-ticket.majestic-ticket-ltr .ticket-stamp {
    left: auto;
    right: 42px;
    bottom: 130px;
    transform: rotate(-15deg);
}

/* -------------------------------------------
   CHEN KWANG THEATRE VERTICAL TICKET
   ------------------------------------------- */
.chenkwang-ticket {
    background-color: var(--ticket-bg);
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    flex: 0 0 280px;
    min-height: 480px;
    position: relative;
    background-image: var(--noise-bg), var(--dynamic-bg);
    background-size: auto, cover;
    background-position: center;
    border-radius: 2px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    margin: 10px;
    padding: 10px;
}

.ck-border-box {
    border: 1.5px dashed var(--ticket-black);
    height: 100%;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    filter: var(--ink-bleed-filter);
    color: var(--ticket-black);
    box-sizing: border-box;
    text-shadow: 0.5px 0.5px 0.5px rgba(0, 0, 0, 0.3);
    position: relative;
}

.ck-border-box::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    bottom: 3px;
    border: 1px solid var(--ticket-black);
    pointer-events: none;
    mix-blend-mode: multiply;
}

.ck-header {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1.5px solid var(--ticket-black);
    margin-bottom: 8px;
    mix-blend-mode: multiply;
}

.ck-venue-ch {
    font-family: var(--font-ticket-ch);
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 8px;
    margin-right: -8px;
}

.ck-venue-en {
    font-family: 'Times New Roman', serif;
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 1px;
    margin-top: 5px;
    text-transform: uppercase;
}

.ck-movie-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1.5px solid var(--ticket-black);
    margin-bottom: 8px;
    mix-blend-mode: multiply;
}

.ck-movie-ch {
    font-family: var(--font-ticket-ch);
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 4px;
    margin-right: -4px;
    margin-top: -3px;
}

.ck-movie-en {
    font-family: var(--font-ticket-en);
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.ck-grid {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    border: 1.5px solid var(--ticket-black);
    border-left: none;
    border-right: none;
    padding: 4px 0;
    margin-bottom: 8px;
    mix-blend-mode: multiply;
}

.ck-side-left,
.ck-side-right {
    width: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-family: var(--font-ticket-tw);
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 2px;
}

.ck-side-left {
    border-right: 1.5px solid var(--ticket-black);
}

.ck-side-right {
    border-left: 1.5px solid var(--ticket-black);
}

.ck-center-block {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
}

.ck-center-top {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    padding: 4px 6px;
}

.ck-top-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.ck-level-en-multiline {
    font-family: 'Times New Roman', serif;
    font-size: 13px;
    font-weight: bold;
    line-height: 1.1;
    margin-bottom: 5px;
    text-align: center;
}

.ck-price-en {
    font-family: 'Times New Roman', serif;
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 1px;
    align-self: center;
}

.ck-top-right {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
}

.ck-ticket-num {
    font-family: 'Times New Roman', serif;
    font-size: 16px;
    font-weight: bold;
}

.ck-ticket-num span {
    font-size: 22px;
    font-style: italic;
    letter-spacing: 2px;
    margin-left: 2px;
}

.ck-center-mid {
    border-top: 1.5px solid var(--ticket-black);
    border-bottom: 1.5px solid var(--ticket-black);
    padding: 4px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ck-notice-en1 {
    font-family: 'Times New Roman', serif;
    font-size: 11px;
    font-weight: bold;
    word-spacing: 1px;
}

.ck-center-bot {
    padding: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ck-level-ch {
    font-family: var(--font-ticket-ch);
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 15px;
    margin-right: -15px;
}

.ck-price-ch {
    font-family: var(--font-ticket-ch);
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 8px;
    margin-right: -8px;
    margin-top: 2px;
}

.ck-footer-1 {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
    mix-blend-mode: multiply;
    border: 1.5px solid var(--ticket-black);
    padding: 8px 4px;
}

.ck-notice-en2 {
    font-family: 'Times New Roman', serif;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 5px;
}

.ck-line {
    width: 80%;
    height: 1.5px;
    background-color: var(--ticket-black);
    margin-bottom: 6px;
}

.ck-notice-ch {
    font-family: var(--font-ticket-tw);
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 6px;
    margin-right: -6px;
}

.ck-footer-2 {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    mix-blend-mode: multiply;
    margin-top: auto;
    padding-top: 5px;
}

.ck-tax-ch {
    font-family: var(--font-ticket-tw);
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 5px;
    margin-right: -5px;
    margin-bottom: 5px;
}

.ck-tax-en {
    font-family: 'Times New Roman', serif;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 2px;
}

.chenkwang-ticket-ltr .ck-side-left,
.chenkwang-ticket-ltr .ck-side-right {
    writing-mode: vertical-lr;
    text-orientation: upright;
}

.chenkwang-ticket-ltr {
    flex: 0 0 280px;
    min-width: 280px;
    max-width: 280px;
}

.chenkwang-ticket-ltr .ck-venue-ch,
.chenkwang-ticket-ltr .ck-movie-ch,
.chenkwang-ticket-ltr .ck-level-ch,
.chenkwang-ticket-ltr .ck-price-ch {
    margin-right: 0;
}

.chenkwang-ticket-ltr .ck-venue-ch {
    letter-spacing: 6px;
}

.chenkwang-ticket-ltr .ck-movie-ch {
    letter-spacing: 3px;
}

.chenkwang-ticket-ltr .ck-level-ch,
.chenkwang-ticket-ltr .ck-price-ch {
    letter-spacing: 6px;
}

.chenkwang-ticket-ltr .ck-notice-ch,
.chenkwang-ticket-ltr .ck-tax-ch {
    margin-right: 0;
    text-align: center;
    letter-spacing: 4px;
}

.chenkwang-ticket.chenkwang-ticket-ltr .ticket-stamp {
    width: 112px;
    top: 154px;
    left: 22px;
    right: auto;
    transform: rotate(9deg);
}

/* -------------------------------------------
   GLOBAL STAMP OVERLAY
   ------------------------------------------- */
.ticket-stamp {
    position: absolute;
    pointer-events: none;
    mix-blend-mode: multiply;
    z-index: 20;
    /* Simulating a classic faded red/indigo rubber stamp from a standard black PNG */
    filter: invert(20%) sepia(30%) saturate(150%) hue-rotate(320deg) opacity(0.8);
}

[data-ticket-stamp-enabled="no"] .ticket-stamp {
    display: none;
}

.grand-ticket .ticket-stamp {
    width: 120px;
    top: 110px;
    right: 50px;
    transform: rotate(-15deg);
}

.cathay-ticket .ticket-stamp {
    width: 100px;
    bottom: 30px;
    right: 60px;
    transform: rotate(12deg);
}

.vertical-ticket .ticket-stamp {
    width: 110px;
    top: 220px;
    left: 25px;
    transform: rotate(-8deg);
}

.nanking-ticket .ticket-stamp {
    width: 95px;
    top: 100px;
    right: 40px;
    transform: rotate(-22deg);
}

.majestic-ticket .ticket-stamp {
    width: 110px;
    bottom: 120px;
    left: 45px;
    transform: rotate(18deg);
}

.chenkwang-ticket .ticket-stamp {
    width: 115px;
    top: 160px;
    right: 25px;
    transform: rotate(-10deg);
}

/* -------------------------------------------
   OVERSEAS REGISTRATION CERTIFICATE
   ------------------------------------------- */
.regcard-ticket {
    --regcard-writing-font: var(--font-passport-writing-print);
    --regcard-writing-weight: 400;
    --regcard-writing-color: var(--ticket-black);
    width: 1000px;
    height: 690px;
    padding: 22px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1f1a14;
    position: relative;
}

.regcard-ticket[data-write-font="print"] {
    --regcard-writing-font: var(--font-passport-writing-print);
    --regcard-writing-weight: 400;
}

.regcard-ticket[data-write-font="hand1"] {
    --regcard-writing-font: var(--font-passport-writing-hand1);
    --regcard-writing-weight: 400;
}

.regcard-ticket[data-write-font="hand2"] {
    --regcard-writing-font: var(--font-passport-writing-hand2);
    --regcard-writing-weight: 400;
}

.regcard-ticket[data-write-ink="black"] {
    --regcard-writing-color: var(--ticket-black);
}

.regcard-ticket[data-write-ink="inkblue"] {
    --regcard-writing-color: #2d4268;
}

.regcard-spread {
    width: 100%;
    height: 100%;
    display: flex;
    gap: 14px;
}

.regcard-page {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
}

.regcard-page-inner {
    position: absolute;
    inset: 0;
    border: 2px solid rgba(56, 49, 39, 0.92);
    background: transparent;
    box-shadow: inset 0 0 0 3px rgba(58, 49, 39, 0.12);
    font-family: var(--font-regcard-decor);
}

.regcard-divider {
    width: 2px;
    margin: 16px 0;
    background: rgba(36, 28, 20, 0.86);
    flex: 0 0 2px;
}

.regcard-decor {
    font-family: var(--font-regcard-decor);
}

.regcard-writing {
    font-family: var(--regcard-writing-font);
    font-weight: var(--regcard-writing-weight);
    color: var(--regcard-writing-color);
}

.regcard-left-inner {
    padding: 18px 26px 18px 26px;
}

.regcard-left-date {
    position: absolute;
    left: 8px;
    top: 22px;
    writing-mode: vertical-rl;
    text-orientation: upright;
    color: var(--ticket-black);
    font-size: 18px;
    letter-spacing: 1px;
    line-height: 1.02;
}

.regcard-left-serial {
    position: absolute;
    top: 20px;
    right: 10px;
    writing-mode: vertical-rl;
    text-orientation: upright;
    display: flex;
    align-items: center;
    gap: 8px;
}

.regcard-left-serial-place {
    font-size: 22px;
    letter-spacing: 2px;
}

.regcard-left-serial-label {
    font-size: 18px;
    letter-spacing: 2px;
}

.regcard-left-serial-no {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 2px;
}

.regcard-photo-block {
    position: relative;
    width: 332px;
    margin: 12px auto 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
}

.regcard-photo-frame {
    width: 330px;
    height: 248px;
    padding: 12px;
    border: 1.5px solid rgba(62, 53, 43, 0.82);
    background: rgba(245, 237, 205, 0.66);
}

.regcard-photo-area {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: rgba(204, 194, 156, 0.42);
    touch-action: none;
    cursor: grab;
}

.regcard-photo-area img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform-origin: center center;
}

.regcard-photo-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(74, 64, 50, 0.78);
    font-size: 16px;
    letter-spacing: 3px;
}

.regcard-sign-box {
    position: relative;
    width: 100%;
    margin-top: 14px;
    padding-bottom: 10px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    letter-spacing: 6px;
}

.regcard-sign-box::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: rgba(61, 53, 43, 0.82);
}

.regcard-left-columns {
    position: absolute;
    left: 52px;
    right: 42px;
    top: 360px;
    bottom: auto;
    height: 252px;
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    justify-content: center;
    gap: 22px;
    z-index: 2;
    overflow: hidden;
}

.regcard-left-stamp {
    position: absolute;
    left: 22px;
    bottom: 34px;
    width: 168px;
    height: 168px;
    background: url("../2x/stamp id 3.png") center / contain no-repeat;
    opacity: 0.34;
    filter: sepia(0.22) saturate(0.82) contrast(1.02) brightness(0.94);
    mix-blend-mode: multiply;
    z-index: 1;
    pointer-events: none;
}

.regcard-ticket[data-stamp-enabled="no"] .regcard-left-stamp {
    display: none;
}

.regcard-vcol {
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-size: 20px;
    line-height: 1.03;
    letter-spacing: 1px;
    white-space: nowrap;
}

.regcard-left-columns .regcard-vcol {
    max-height: 100%;
}

.regcard-vcol-name {
    font-size: 30px;
    letter-spacing: 2px;
}

.regcard-vcol-fixed {
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

.regcard-vcol-tail {
    min-height: 0;
    align-self: flex-start;
    max-height: 100%;
    overflow: hidden;
}

.regcard-vcol-fill {
    font-size: 27px;
    letter-spacing: 2px;
}

.regcard-left-columns .regcard-vcol-fill {
    display: inline-block;
    max-height: 150px;
    overflow: hidden;
    white-space: normal;
    line-height: 0.98;
    font-size: clamp(17px, 1.95vw, 24px);
}

.regcard-left-columns .regcard-vcol-name {
    max-height: 160px;
    font-size: clamp(20px, 2.2vw, 28px);
}

.regcard-left-columns .regcard-vcol-consulate {
    display: inline-block;
    max-height: 100%;
    overflow: hidden;
    white-space: normal;
    line-height: 1.03;
    font-size: 20px;
    letter-spacing: 1px;
    font-family: var(--font-regcard-decor);
    color: var(--ticket-black);
}

.regcard-right-inner {
    padding: 12px;
}

.regcard-table {
    width: 100%;
    height: 100%;
    border: 1.5px solid rgba(60, 51, 40, 0.86);
    background: transparent;
    display: grid;
    grid-template-rows:
        38px
        72px
        54px
        58px
        minmax(44px, 1fr)
        minmax(44px, 1fr)
        minmax(44px, 1fr)
        minmax(48px, 1.05fr)
        minmax(50px, 1.1fr)
        minmax(50px, 1.1fr)
        118px;
}

.regcard-table-title {
    height: 38px;
    border-bottom: 1px solid rgba(66, 56, 44, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    letter-spacing: 18px;
    text-indent: 18px;
}

.regcard-row {
    display: grid;
    width: 100%;
    border-bottom: 1px solid rgba(66, 56, 44, 0.72);
    height: 100%;
}

.regcard-row > * {
    min-height: 44px;
    min-width: 0;
    border-right: 1px solid rgba(66, 56, 44, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 6px;
}

.regcard-row > *:last-child {
    border-right: none;
}

.regcard-row-name-block {
    grid-template-columns: 34px 44px minmax(118px, 1.12fr) 32px minmax(42px, 0.4fr) 32px minmax(36px, 0.34fr);
    grid-template-rows: repeat(2, minmax(0, 1fr));
    height: 100%;
}

.regcard-row-native {
    grid-template-columns: 78px 1fr 1fr;
}

.regcard-row-name-block > * {
    min-height: 35px;
    padding: 2px 3px;
    border-right: 1px solid rgba(66, 56, 44, 0.72);
}

.regcard-row-name-block > *:last-child,
.regcard-row-name-block > .regcard-name-en-fill {
    border-right: 1px solid rgba(66, 56, 44, 0.72);
}

.regcard-cell-span-2 {
    grid-row: span 2;
}

.regcard-cell-divider {
    border-bottom: 1px solid rgba(66, 56, 44, 0.72);
}

.regcard-row-name-block > .regcard-cell-right-edge {
    border-right: none;
}

.regcard-row-birth {
    grid-template-columns: 78px 102px 58px 1fr;
}

.regcard-row-basic {
    grid-template-columns: 78px 1fr;
}

.regcard-row-occupation {
    grid-template-columns: 78px 1fr 58px 1fr;
}

.regcard-row-family-block {
    grid-template-columns: 78px 112px 112px 1fr;
    grid-template-rows: 20px minmax(0, 1fr) 20px minmax(0, 1fr);
    height: 100%;
    overflow: hidden;
    position: relative;
}

.regcard-row-family-block::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: rgba(66, 56, 44, 0.72);
    pointer-events: none;
    z-index: 2;
}

.regcard-row-family-block > * {
    min-height: 0;
    min-width: 0;
    border-right: 1px solid rgba(66, 56, 44, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 6px;
}

.regcard-side-label,
.regcard-sub-label,
.regcard-family-head {
    font-size: 16px;
    letter-spacing: 2px;
    color: rgba(40, 33, 24, 0.9);
    white-space: nowrap;
}

.regcard-side-label:not(.regcard-vert-label),
.regcard-sub-label:not(.regcard-vert-label):not(.regcard-split-label),
.regcard-family-head:not(.regcard-family-vert) {
    padding-left: 4px;
    padding-right: 4px;
}

.regcard-justify-track {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    letter-spacing: 0;
    line-height: 1;
}

.regcard-justify-track > span {
    display: block;
    flex: 0 0 auto;
}

.regcard-vert-label {
    writing-mode: initial;
    text-orientation: mixed;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    letter-spacing: 0;
    line-height: 1;
    padding-top: 6px;
    padding-bottom: 6px;
}

.regcard-vert-label span {
    display: block;
}

.regcard-family-vert {
    writing-mode: vertical-rl;
    text-orientation: upright;
    justify-content: center;
    align-items: center;
    letter-spacing: 1px;
    line-height: 1.05;
    padding-top: 8px;
    padding-bottom: 8px;
}

.regcard-family-vert-group.regcard-family-vert,
.regcard-family-vert-single.regcard-family-vert {
    writing-mode: initial;
    text-orientation: mixed;
    letter-spacing: 0;
}

.regcard-family-vert-group {
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
    gap: 6px;
    padding: 6px 4px;
}

.regcard-family-vert-col {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    line-height: 1;
}

.regcard-family-vert-mid {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.regcard-family-vert-single {
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    line-height: 1;
}

.regcard-row-family-block > .regcard-family-right-edge {
    border-right: none;
}

.regcard-row-family-block > .regcard-section-start {
    border-top: 1px solid rgba(66, 56, 44, 0.72);
}

.regcard-row-family-block > .regcard-family-title-row {
    min-height: 20px;
    padding: 0 4px;
    font-size: 14px;
}

.regcard-split-label {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 2px;
    padding-left: 5px;
    padding-right: 5px;
    letter-spacing: 0;
}

.regcard-split-line {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    line-height: 1;
}

.regcard-side-label-empty {
    background: transparent;
}

.regcard-fill {
    justify-content: flex-start;
    text-align: left;
    font-size: 18px;
    line-height: 1.25;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: anywhere;
}

.regcard-fill-short {
    justify-content: center;
    text-align: center;
}

.regcard-birth-fill {
    gap: 4px;
    letter-spacing: 1px;
}

.regcard-ticket .regcard-row-basic:last-child,
.regcard-ticket .regcard-row-family-block:last-child {
    border-bottom: none;
}

/* -------------------------------------------
   REPUBLIC OF CHINA PASSPORT
   ------------------------------------------- */
.passport-ticket {
    --passport-writing-font: var(--font-passport-writing-print);
    --passport-writing-weight: 400;
    --passport-sign-en-font: "Great Vibes", "Times New Roman", cursive;
    width: 930px;
    min-width: 930px;
    max-width: 930px;
    height: 678px;
    min-height: 678px;
    max-height: 678px;
    background-color: #b9a779;
    background-image: var(--noise-bg), var(--dynamic-bg);
    background-size: auto, cover;
    background-position: center;
    display: flex;
    flex: 0 0 auto;
    padding: 22px 26px;
    border-radius: 2px;
    box-shadow: inset 0 0 22px rgba(63, 54, 47, 0.26);
    filter: var(--ink-bleed-filter);
    color: #3f362f;
    overflow: hidden;
}

.passport-ticket[data-write-font="print"] {
    --passport-writing-font: var(--font-passport-writing-print);
    --passport-writing-weight: 400;
}

.passport-ticket[data-write-font="hand1"] {
    --passport-writing-font: var(--font-passport-writing-hand1);
    --passport-writing-weight: 400;
}

.passport-ticket[data-write-font="hand2"] {
    --passport-writing-font: var(--font-passport-writing-hand2);
    --passport-writing-weight: 400;
}

.passport-ticket[data-sign-en-font="vibes"] {
    --passport-sign-en-font: "Great Vibes", "Times New Roman", cursive;
}

.passport-ticket[data-sign-en-font="allura"] {
    --passport-sign-en-font: "Allura", "Times New Roman", cursive;
}

.passport-ticket[data-sign-en-font="alex"] {
    --passport-sign-en-font: "Alex Brush", "Times New Roman", cursive;
}

.passport-spread {
    display: grid;
    grid-template-columns: 1fr 24px 1fr;
    width: 100%;
    height: 100%;
}

.passport-divider {
    align-self: stretch;
    background:
        linear-gradient(to right, rgba(61, 51, 40, 0.05), rgba(61, 51, 40, 0.18) 30%, rgba(32, 24, 18, 0.28) 52%, rgba(61, 51, 40, 0.18) 72%, rgba(61, 51, 40, 0.05));
}

.passport-page {
    position: relative;
    min-width: 0;
    height: 100%;
}

.passport-page-sheet {
    position: absolute;
    inset: 18px 14px 14px 14px;
}

.passport-right-page .passport-page-sheet {
    inset: 48px 22px 14px 10px;
}

.passport-left-sheet {
    position: absolute;
    inset: 18px 10px 14px 22px;
    display: flex;
    flex-direction: column;
    padding: 12px 10px 8px 26px;
}

.passport-right-sheet {
    display: flex;
    flex-direction: column;
    padding: 18px 18px 16px 18px;
    border: 1.5px solid rgba(151, 120, 54, 0.92);
    background:
        linear-gradient(180deg, rgba(245, 235, 183, 0.88), rgba(230, 217, 160, 0.92)),
        linear-gradient(135deg, rgba(161, 128, 56, 0.12), transparent 45%);
    box-shadow:
        inset 0 0 0 3px rgba(215, 191, 121, 0.52),
        inset 0 0 0 7px rgba(158, 126, 59, 0.18);
}

.passport-decor {
    font-family: var(--font-passport-heading);
    font-weight: 400;
}

.passport-writing {
    font-family: var(--passport-writing-font);
    font-weight: var(--passport-writing-weight);
    color: #2f2722;
}

.passport-photo-frame {
    width: 236px;
    height: 332px;
    margin: 8px 0 14px 34px;
    border: 1px solid rgba(104, 84, 55, 0.72);
    background: rgba(250, 244, 217, 0.62);
    padding: 10px;
    display: flex;
}

.passport-photo-area {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border: 1px solid rgba(75, 63, 48, 0.65);
    background:
        linear-gradient(180deg, rgba(92, 80, 68, 0.08), rgba(255, 255, 255, 0.12)),
        rgba(238, 229, 189, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    touch-action: none;
    overscroll-behavior: contain;
}

.passport-photo-area img {
    position: absolute;
    max-width: none;
    max-height: none;
    user-select: none;
    pointer-events: none;
    filter: grayscale(1) contrast(1.05) sepia(0.12);
}

.passport-photo-placeholder {
    font-family: var(--font-passport-heading);
    font-size: 16px;
    letter-spacing: 2px;
    color: rgba(63, 54, 47, 0.55);
    writing-mode: vertical-rl;
    text-orientation: upright;
}

.passport-left-lower {
    position: relative;
    display: flex;
    align-items: flex-start;
    margin-left: 64px;
}

.passport-stamp-slot {
    position: absolute;
    left: -108px;
    top: 14px;
    flex: 0 0 122px;
    width: 122px;
    height: 122px;
    border: none;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    isolation: isolate;
}

.passport-stamp-slot::before {
    content: "";
    position: absolute;
    inset: 7px;
    border: 1.5px solid rgba(24, 20, 16, 0.92);
    z-index: 0;
    pointer-events: none;
}

.passport-post-stamp,
.passport-left-stamp,
.passport-right-stamp {
    position: absolute;
    pointer-events: none;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

.passport-post-stamp {
    inset: -8px;
    z-index: 1;
    background-size: contain;
    opacity: 0.94;
    mix-blend-mode: normal;
    filter: sepia(0.18) saturate(0.86) contrast(0.95) brightness(0.96);
}

.passport-ticket[data-post-stamp="none"] .passport-post-stamp {
    display: none;
}

.passport-ticket[data-post-stamp="post1"] .passport-post-stamp {
    background-image: url("../2x/post1.png");
}

.passport-ticket[data-post-stamp="post2"] .passport-post-stamp {
    background-image: url("../2x/post2.png");
}

.passport-ticket[data-post-stamp="post3"] .passport-post-stamp {
    background-image: url("../2x/post3.png");
}

.passport-left-stamp,
.passport-right-stamp {
    z-index: 2;
    mix-blend-mode: multiply;
}

.passport-left-stamp {
    background-image: url("../2x/stamp id 3.png");
    opacity: 0.36;
    filter: sepia(0.22) saturate(0.82) contrast(1.02) brightness(0.94);
}

.passport-right-stamp {
    background-image: url("../2x/stamp id 2.png");
    opacity: 0.28;
    transform: none;
    filter: sepia(0.16) saturate(0.82) contrast(1.02) brightness(0.94);
}

.passport-ticket[data-left-stamp-enabled="no"] .passport-left-stamp,
.passport-ticket[data-right-stamp-enabled="no"] .passport-right-stamp {
    display: none;
}

.passport-left-form {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    gap: 3px;
    flex: 0 0 236px;
    width: 236px;
    max-width: 236px;
    min-height: 214px;
}

.passport-left-field {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    flex: 0 0 31px;
    min-height: 214px;
}

.passport-left-field-name {
    flex-basis: 33px;
}

.passport-left-field-appearance {
    flex-basis: 33px;
}

.passport-left-label,
.passport-left-value,
.passport-rcol-label,
.passport-rcol-static,
.passport-rcol-value,
.passport-side-note,
.passport-side-date,
.passport-side-fee,
.passport-sign-cn {
    writing-mode: vertical-rl;
    text-orientation: upright;
}

.passport-left-label {
    font-size: 17px;
    letter-spacing: 1.5px;
    color: rgba(61, 51, 40, 0.92);
}

.passport-left-value {
    flex: 1 1 auto;
    min-height: 0;
    font-size: 20px;
    line-height: 1.16;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: anywhere;
    text-align: center;
    padding-top: 0;
}

.passport-left-field:nth-child(2) .passport-left-value {
    padding-top: 6px;
}

.passport-left-field:nth-child(3) .passport-left-value {
    padding-top: 10px;
}

.passport-left-field:nth-child(4) .passport-left-value {
    padding-top: 8px;
}

.passport-left-field:nth-child(5) .passport-left-value {
    padding-top: 4px;
}

.passport-left-field:nth-child(6) .passport-left-value {
    padding-top: 6px;
    letter-spacing: 1px;
}

.passport-right-serial {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    letter-spacing: 2px;
    color: rgba(70, 58, 43, 0.72);
}

.passport-right-upper {
    position: relative;
    flex: 1;
    min-height: 0;
}

.passport-right-bodycols {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    gap: 9px;
    border-bottom: 1px solid rgba(82, 67, 45, 0.62);
    padding: 6px 4px 16px 0;
    margin-left: 94px;
    min-height: 100%;
}

.passport-rcol {
    min-width: 0;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 4px;
}

.passport-rcol-label,
.passport-rcol-static,
.passport-rcol-value {
    line-height: 1.12;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: anywhere;
}

.passport-rcol-label,
.passport-rcol-static {
    font-size: 16px;
    letter-spacing: 2px;
}

.passport-rcol-value {
    font-size: 23px;
}

.passport-rcol-title {
    padding-top: 4px;
}

.passport-rcol-title .passport-rcol-static {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: 7px;
    line-height: 0.92;
}

.passport-rcol-issue {
    padding-top: 66px;
}

.passport-rcol-name {
    padding-top: 34px;
}

.passport-rcol-name-value {
    font-size: 47px;
    letter-spacing: 4px;
    line-height: 0.96;
}

.passport-rcol-destination {
    padding-top: 24px;
}

.passport-rcol-transit {
    padding-top: 96px;
}

.passport-rcol-purpose {
    padding-top: 150px;
}

.passport-rcol-purpose .passport-rcol-value {
    font-size: 28px;
}

.passport-rcol-request {
    padding-top: 122px;
}

.passport-rcol-support {
    padding-top: 14px;
}

.passport-rcol-formal {
    font-size: 18px;
    color: rgba(61, 51, 40, 0.9);
}

.passport-rcol-closing {
    padding-top: 86px;
}

.passport-right-sidecols {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 18px;
    width: 88px;
}

.passport-side-note,
.passport-side-date,
.passport-side-fee {
    position: absolute;
    line-height: 1.14;
    color: rgba(61, 51, 40, 0.9);
}

.passport-side-date {
    top: 18px;
    left: 36px;
    font-size: 17px;
    letter-spacing: 3px;
}

.passport-side-note {
    top: 20px;
    left: 60px;
    font-size: 11px;
    letter-spacing: 1px;
}

.passport-side-fee {
    bottom: 18px;
    left: 12px;
    font-size: 11px;
    letter-spacing: 1px;
}

.passport-sign-box {
    border-top: 1px solid rgba(63, 54, 47, 0.72);
    padding-top: 10px;
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.passport-sign-note {
    font-size: 12px;
    letter-spacing: 1px;
    text-align: center;
    margin-bottom: 10px;
}

.passport-sign-cn {
    font-size: 34px;
    letter-spacing: 4px;
    line-height: 0.98;
    margin-bottom: 6px;
}

.passport-writing-latin {
    writing-mode: horizontal-tb;
    font-style: italic;
    letter-spacing: 1px;
}

.passport-sign-en {
    width: 100%;
    text-align: center;
    font-size: 41px;
    line-height: 1;
}

/* Passport right-page reset based on archival layout */
.passport-spread {
    grid-template-columns: 1fr 14px 1fr;
}

.passport-divider {
    position: relative;
    background: none;
}

.passport-divider::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1.5px;
    transform: translateX(-50%);
    background: rgba(24, 20, 16, 0.96);
}

.passport-right-serial {
    font-family: "ZhaohuaMinA", "朝華標題A", serif;
    top: 4px;
    right: 12px;
    left: auto;
    transform: none;
    text-align: right;
    font-weight: 700;
}

.passport-right-sheet {
    position: relative;
    display: grid;
    grid-template-rows: minmax(0, 1fr) 122px;
    padding: 18px 16px 10px 16px;
    overflow: hidden;
    background: none;
    background-color: transparent;
    border: none;
    box-shadow: none;
}

.passport-right-sheet::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("../2x/frame.png");
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 0;
}

.passport-right-sheet::after {
    display: none;
}

.passport-right-sheet > * {
    position: relative;
    z-index: 1;
}

.passport-right-upper {
    position: relative;
    min-height: 0;
    padding: 12px 2px 0 2px;
}

.passport-right-bodycols {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    height: 100%;
    min-height: 0;
    padding: 2px 2px 0 0;
    margin-left: 0;
    border-bottom: none;
    overflow: hidden;
}

.passport-rcol,
.passport-rmeta {
    position: relative;
    min-width: 0;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.passport-right-bodycols .passport-rcol > * {
    position: static;
}

.passport-rcol-label,
.passport-rcol-static,
.passport-rcol-value,
.passport-side-note,
.passport-side-fee {
    line-height: 1.12;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: anywhere;
}

.passport-rcol-label,
.passport-rcol-static,
.passport-side-note,
.passport-side-fee {
    font-size: 16px;
    letter-spacing: 2px;
    color: rgba(61, 51, 40, 0.96);
}

.passport-rcol-value {
    font-size: 24px;
    text-align: center;
}

.passport-rcol-ministry {
    flex: 0 0 50px;
    justify-content: space-between;
    padding: 4px 0 12px;
}

.passport-rcol-ministry-main {
    font-size: 42px;
    font-weight: 700;
    letter-spacing: 6px;
    line-height: 0.92;
}

.passport-rcol-ministry-tail {
    font-size: 20px;
    letter-spacing: 4px;
}

.passport-rcol-issue {
    flex: 0 0 54px;
    padding-top: 16px;
    gap: 16px;
}

.passport-rcol-issue-lead {
    font-size: 16px;
}

.passport-rcol-name-value {
    font-size: 48px;
    letter-spacing: 4px;
    line-height: 0.94;
}

.passport-rcol-transit {
    flex: 0 0 30px;
    padding-top: 110px;
    gap: 18px;
}

.passport-rcol-destination {
    flex: 0 0 38px;
    padding-top: 18px;
    gap: 18px;
}

.passport-rcol-destination .passport-rcol-value {
    font-size: 30px;
}

.passport-rcol-request-tail {
    margin-top: auto;
    margin-bottom: 32px;
}

.passport-rcol-support {
    flex: 0 0 34px;
    padding-top: 10px;
}

.passport-rcol-formal {
    font-size: 18px;
    color: rgba(61, 51, 40, 0.92);
}

.passport-rcol-closing {
    flex: 0 0 26px;
    padding-top: 128px;
}

.passport-rcol-date {
    flex: 0 0 42px;
    padding-top: 16px;
    gap: 12px;
}

.passport-rcol-date .passport-rcol-value {
    font-size: 20px;
    letter-spacing: 2px;
}

.passport-side-note {
    font-size: 12px;
    letter-spacing: 1px;
}

.passport-rcol-note {
    flex: 0 0 24px;
    padding-top: 18px;
}

.passport-rcol-fees {
    flex: 0 0 18px;
    justify-content: flex-start;
    padding-top: 212px;
    padding-bottom: 0;
}

.passport-side-fee-wrap {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
}

.passport-side-fee {
    width: auto;
    font-size: 12px;
    letter-spacing: 1px;
    text-align: center;
}

.passport-sign-box {
    margin-top: 0;
    padding: 8px 0 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    border-top: none;
}

.passport-sign-box::before {
    content: "";
    width: 82%;
    height: 1px;
    background: rgba(63, 54, 47, 0.72);
    margin-bottom: 6px;
}

.passport-sign-note {
    margin-bottom: 6px;
    line-height: 1;
}

.passport-sign-row {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    width: auto;
    max-width: 82%;
}

.passport-sign-cn {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    font-size: 19px;
    letter-spacing: 0;
    line-height: 0.82;
    margin-bottom: 0;
}

.passport-sign-cn-track {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    min-width: 68px;
    gap: 8px;
}

.passport-sign-cn-track > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.passport-sign-en {
    font-family: var(--passport-sign-en-font);
    font-size: 22px;
    line-height: 0.9;
    letter-spacing: 0;
}

.passport-template-alt {
    display: none;
}

.passport-ticket[data-template="classic"] .passport-right-page .passport-page-sheet {
    inset: 48px 22px 14px 10px;
}

.passport-ticket[data-template="classic"] .passport-left-lower-alt,
.passport-ticket[data-template="classic"] .passport-template-beiping {
    display: none !important;
}

.passport-ticket[data-template="classic"] .passport-right-sheet {
    display: block;
    padding: 18px 16px 10px 16px;
}

.passport-ticket[data-template="classic"] .passport-template.passport-classic-only {
    position: relative;
    display: grid;
    grid-template-rows: minmax(0, 1fr) 122px;
    height: 100%;
}

.passport-ticket[data-template="classic"] .passport-left-stamp-classic {
    left: 46px;
    top: 38px;
    width: 164px;
    height: 164px;
}

.passport-ticket[data-template="classic"] .passport-right-stamp-classic {
    right: 8px;
    top: 144px;
    width: 154px;
    height: 226px;
}

.passport-ticket[data-template="beiping"] .passport-classic-only {
    display: none !important;
}

.passport-ticket[data-template="beiping"] .passport-left-lower-alt {
    display: flex;
}

.passport-ticket[data-template="beiping"] .passport-template-beiping {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}

.passport-ticket[data-template="beiping"] .passport-left-sheet {
    inset: 16px 12px 12px 18px;
    padding: 10px 14px 10px 18px;
}

.passport-ticket[data-template="beiping"] .passport-photo-frame,
.passport-ticket[data-template="beiping"] .passport-left-lower-alt {
    position: relative;
    z-index: 1;
}

.passport-ticket[data-template="beiping"] .passport-decor {
    font-family: "ZhaohuaMinA", "朝華標題A", serif;
}

.passport-ticket[data-template="beiping"] .passport-alt-right-line,
.passport-ticket[data-template="beiping"] .passport-alt-right-line-text,
.passport-ticket[data-template="beiping"] .passport-alt-right-signnote,
.passport-ticket[data-template="beiping"] .passport-alt-right-date,
.passport-ticket[data-template="beiping"] .passport-alt-right-note,
.passport-ticket[data-template="beiping"] .passport-alt-right-agency-row,
.passport-ticket[data-template="beiping"] .passport-alt-right-agency-city,
.passport-ticket[data-template="beiping"] .passport-alt-right-agency-name,
.passport-ticket[data-template="beiping"] .passport-alt-right-agency-tail {
    font-family: "ZhaohuaMinA", "朝華標題A", serif;
}

.passport-ticket[data-template="beiping"] .passport-photo-frame {
    width: 192px;
    height: 266px;
    margin: 16px auto 24px;
    padding: 8px;
    border-color: rgba(87, 69, 45, 0.8);
    background: rgba(248, 238, 209, 0.68);
}

.passport-ticket[data-template="beiping"] .passport-photo-area {
    background: rgba(236, 224, 181, 0.82);
}

.passport-ticket[data-template="beiping"] .passport-photo-placeholder {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    letter-spacing: 1px;
    font-size: 15px;
}

.passport-left-lower-alt {
    position: relative;
    min-height: 232px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 8px 0 0;
}

.passport-ticket[data-template="beiping"] .passport-left-stamp-alt {
    left: 50%;
    top: 56px;
    width: 200px;
    height: 168px;
    transform: translateX(-50%);
    opacity: 0.28;
}

.passport-left-alt-watermark {
    position: absolute;
    inset: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: upright;
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
    font-size: 72px;
    line-height: 0.9;
    letter-spacing: 3px;
    color: rgba(186, 128, 42, 0.16);
    pointer-events: none;
    z-index: 0;
}

.passport-left-list-alt {
    position: relative;
    z-index: 1;
    width: 228px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.passport-left-row-alt {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 10px;
    align-items: end;
}

.passport-left-row-label,
.passport-left-row-value {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
}

.passport-left-row-label {
    font-size: 18px;
    letter-spacing: 2px;
    color: rgba(58, 48, 38, 0.96);
}

.passport-left-row-value {
    min-height: 24px;
    padding: 0 0 2px;
    border-bottom: 1px dotted rgba(72, 57, 39, 0.62);
    font-size: 21px;
    line-height: 1.08;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: anywhere;
}

.passport-left-row-alt-seal .passport-left-row-label {
    font-size: 16px;
}

.passport-left-row-value-empty {
    border-bottom-style: solid;
}

.passport-ticket[data-template="beiping"] .passport-right-page .passport-page-sheet {
    inset: 18px 14px 12px 10px;
}

.passport-ticket[data-template="beiping"] .passport-right-sheet {
    display: flex;
    flex-direction: column;
    grid-template-rows: none;
    height: 100%;
    overflow: visible;
    padding: 0;
}

.passport-ticket[data-template="beiping"] .passport-right-sheet::before {
    display: none;
}

.passport-alt-right-header {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 10px;
    margin: 0 8px 6px 0;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
}

.passport-alt-right-header-prefix,
.passport-alt-right-header-suffix {
    font-size: 24px;
    letter-spacing: 2px;
}

.passport-alt-right-header-number {
    font-family: "ZhaohuaMinA", "朝華標題A", serif;
    font-size: 27px;
    font-weight: 700;
    letter-spacing: 3px;
}

.passport-alt-right-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: none;
    min-height: 0;
    height: calc(100% - 42px - 10px);
    border: none;
    box-shadow: none;
    background: url("../2x/frame2.png") center / 100% 100% no-repeat;
    padding: 30px 28px 22px;
    overflow: hidden;
}

.passport-ticket[data-template="beiping"] .passport-right-stamp-alt {
    right: 6px;
    top: 142px;
    width: 188px;
    height: 268px;
    opacity: 0.24;
}

.passport-alt-right-agency-row {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    width: 100%;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    font-size: 31px;
    line-height: 1.05;
    margin: 14px 28px 20px 0;
    font-weight: 700;
    color: #1d1712;
}

.passport-alt-right-agency-title {
    display: inline-flex;
    align-items: flex-end;
    gap: 6px;
}

.passport-alt-right-agency-city,
.passport-alt-right-agency-name,
.passport-alt-right-agency-tail {
    display: inline-flex;
    align-items: flex-end;
}

.passport-alt-right-agency-tail {
    margin-left: 6px;
}

.passport-alt-right-lines {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 14px;
}

.passport-alt-right-line {
    display: grid;
    align-items: flex-end;
    width: 100%;
    column-gap: 10px;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    font-size: 20px;
    line-height: 1.15;
    letter-spacing: 1px;
    color: #201913;
}

.passport-alt-right-line-long {
    display: block;
}

.passport-alt-right-line-text {
    font-family: inherit;
    letter-spacing: 2px;
}

.passport-alt-right-line-issue {
    grid-template-columns: auto minmax(0, 1fr);
}

.passport-alt-right-line-age {
    grid-template-columns: auto max-content auto minmax(0, 1fr);
}

.passport-alt-right-line-destination {
    grid-template-columns: auto minmax(0, 1fr) auto;
}

.passport-alt-right-line-destination .passport-alt-right-line-text:last-child {
    justify-self: end;
}

.passport-alt-right-fill {
    display: inline-flex;
    align-items: flex-end;
    justify-content: flex-start;
    min-width: 90px;
    min-height: 28px;
    width: 100%;
    padding: 0 6px 2px;
    border-bottom: 1px dotted rgba(72, 57, 39, 0.72);
    font-size: 24px;
    line-height: 1;
    letter-spacing: 4px;
    color: #1f1813;
}

.passport-alt-right-fill-short {
    min-width: 44px;
}

.passport-alt-right-line-long .passport-alt-right-line-text {
    display: block;
    padding-bottom: 2px;
    border-bottom: 1px dotted rgba(72, 57, 39, 0.72);
}

.passport-alt-right-lower {
    position: relative;
    z-index: 1;
    margin-top: auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.passport-alt-right-signnote {
    position: relative;
    z-index: 1;
    margin-top: 0;
    text-align: center;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    font-size: 24px;
    letter-spacing: 2px;
}

.passport-alt-right-sign {
    position: relative;
    z-index: 1;
    margin-top: 12px;
    text-align: center;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    font-size: 58px;
    line-height: 1;
}

.passport-alt-right-footer {
    position: relative;
    z-index: 1;
    width: 100%;
    margin-top: 16px;
    padding-top: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.passport-alt-right-date,
.passport-alt-right-note {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
}

.passport-alt-right-date {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    font-size: 18px;
    letter-spacing: 1px;
}

.passport-alt-right-date-value {
    font-size: 24px;
    line-height: 1;
}

.passport-alt-right-note {
    text-align: center;
    line-height: 1.15;
}

.passport-alt-right-note {
    font-size: 16px;
    letter-spacing: 1px;
}

/* -------------------------------------------
   MOBILE BOTTOM NAV BAR
   ------------------------------------------- */
.mobile-nav {
    display: none;
    /* Hidden on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 60px;
    background: rgba(31, 33, 32, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-family: var(--font-ui);
}

.nav-btn.active {
    color: var(--text-primary);
}

.nav-btn.active svg {
    stroke: var(--ticket-red);
}

.nav-btn svg {
    transition: stroke 0.2s ease;
}

.nav-export {
    background: var(--ticket-red);
    color: white !important;
    border-radius: 12px;
    padding: 8px 18px;
}

.nav-export svg {
    stroke: white !important;
}

.nav-export:active {
    transform: scale(0.95);
}

.site-records {
    position: fixed;
    right: 16px;
    bottom: 10px;
    z-index: 20;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
    text-align: right;
}

.site-records a {
    color: inherit;
    text-decoration: none;
}

.site-records a:hover {
    color: var(--text-primary);
}

.site-records p:last-child a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
}

.site-records img {
    width: 16px;
    height: 16px;
    vertical-align: middle;
}
/* -------------------------------------------
   MOBILE RESPONSIVE LAYOUT
   ------------------------------------------- */
@media (max-width: 768px) {
    .mobile-nav {
        display: flex;
    }

    body {
        overflow: auto;
        height: auto;
    }

    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    }

    .site-records {
        position: static;
        padding: 12px 16px calc(72px + env(safe-area-inset-bottom, 0px));
        text-align: center;
    }
    .entry-overlay {
        padding: 18px;
    }

    .entry-overlay-panel {
        padding: 24px 18px 20px;
    }

    .entry-overlay-panel h1 {
        font-size: 28px;
    }

    .entry-choice-grid {
        grid-template-columns: 1fr;
    }

    /* --- Editor Sidebar (mobile) --- */
    .editor-sidebar {
        width: 100%;
        height: auto;
        overflow-y: visible;
        padding: 24px 20px 30px 20px;
        box-shadow: none;
        display: none;
        /* hidden by default, shown via JS */
    }

    .editor-sidebar.mobile-active {
        display: block;
    }

    .editor-sidebar header {
        margin-bottom: 24px;
    }

    .editor-sidebar h1 {
        font-size: 20px;
    }

    .form-actions {
        position: static;
        padding: 0;
        background: transparent;
        display: flex;
    }

    #download-btn {
        display: none;
    }

    /* --- Preview Area (mobile) --- */
    .preview-area {
        width: 100%;
        padding: 20px;
        overflow-x: auto;
        overflow-y: auto;
        justify-content: flex-start;
        align-items: flex-start;
        min-height: 60vh;
        display: none;
        /* hidden by default, shown via JS */
    }

    .preview-area.mobile-active {
        display: flex;
    }

    /* Keep tickets at fixed width - allow horizontal scroll */
    .ticket-canvas-wrapper {
        flex-shrink: 0;
        min-width: max-content;
        margin: 0 auto;
    }

    .idcard-ticket,
    .passport-ticket,
    .regcard-ticket,
    .idc-spread,
    .idc-page,
    .passport-spread,
    .passport-page,
    .regcard-spread,
    .regcard-page {
        flex-shrink: 0;
    }

    .form-row {
        flex-wrap: wrap;
    }

    .form-group.half,
    .form-group.third {
        min-width: 120px;
    }
}

/* -------------------------------------------
   PRINT / EXPORT STYLES
   ------------------------------------------- */
@media print {
    @page {
        margin: 0;
    }

    body {
        background: white !important;
        overflow: visible !important;
        height: auto !important;
    }

    /* Hide everything except the ticket */
    .editor-sidebar,
    .mobile-nav,
    .entry-overlay,
    .ticket-canvas-wrapper>.inactive-ticket {
        display: none !important;
    }

    .app-container {
        display: block !important;
        height: auto !important;
        padding: 0 !important;
    }

    .preview-area {
        display: flex !important;
        background: none !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        justify-content: center !important;
        align-items: flex-start !important;
    }

    .ticket-canvas-wrapper {
        box-shadow: none !important;
        transform: none !important;
    }

    /* Active ticket: ensure it prints at full fidelity */
    .active-ticket {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
}
