@font-face {
  font-family: 'AIAEverest'; /* set name */
  src: url(../fonts/AIAEverest-Regular.ttf); /* url of the font */
}
@font-face {
  font-family: 'AIAEverest'; /* set name */
  src: url(../fonts/AIAEverest-Bold.ttf); /* url of the font */
  font-weight: 700;
}
@font-face {
  font-family: 'AIAEverest'; /* set name */
  src: url(../fonts/AIAEverest-Medium.ttf); /* url of the font */
  font-weight: 500;
}
@font-face {
  font-family: 'AIAEverest'; /* set name */
  src: url(../fonts/AIAEverest-ExtraBold.ttf); /* url of the font */
  font-weight: 800;
}
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap');

:root {
    --color-primary: #d31e47;
    --color-primary-hover: #d0486c;
    --color-secondary: #231f20;
    --color-secondary-hover: #494646;
    --color-error: #c62828;
    --color-gray: #6d6b80;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #ffffff;
    font-family: "Noto Sans", -apple-system, Arial, sans-serif;
    color: var(--color-secondary);
}
.text-primary {
    color: var(--color-primary);
}
.text-secondary {
    color: var(--color-secondary);
}

.screen {
    width: 100%;
    min-height: 100dvh;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    cursor: pointer;
    height: 100%;
}

.top-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-top:20px;
    padding-left:15px;
    border-bottom: 2px solid #eee;
}
.photobooth-page .top-area {
    padding-top: 50px;
    padding-left: 50px;
}

.logo-link {
    display: inline-flex;
    margin-top: 6px;
}

.logo {
    width: min(70vw, 300px);
    height: auto;
    display: block;
}
.photobooth-page .logo {
    width: 70dvw;
}
.start-btn {
    border: none;
    background: transparent;
    font-size: 26px;
    font-weight: 700;
    color: var(--color-gray);
    cursor: pointer;
    padding: 4px 10px;
    line-height: 1;
    text-align: center;
}

.start-btn small {
    display: block;
    margin-top: 4px;
    font-size: 26px;
    line-height: 1;
    font-weight: 700;
    font-family: "AIAEverest", "Noto Sans", -apple-system, Arial, sans-serif;
}

.start-btn:hover {
    opacity: 0.75;
}

.name-form-wrap {
    width: 100%;
    display: none;
    padding: 30px;
}

.intro-wrap {
    width: 100%;
    display: none;
    padding: 30px;
    font-size: 20px;
    line-height: 1.7;
    text-align: left;
    font-weight: 400;
    color: var(--color-gray);
}

.hero-wrap {
    width: 100%;
    display: block;
    margin-top: 18px;
    padding: 24px 14px;
    text-align: center;
    position: relative;
}

.hero-wrap.hidden {
    display: none;
}

.hero-title-zh {
    margin: 0;
    font-size: clamp(45px, 15dvw, 80px);
    line-height: 1;
    font-weight: 700;
    color: var(--color-secondary);
}
.photobooth-page .hero-title-zh {
    font-size: clamp(80px, 20dvw, 160px);
    margin-top:50px;
}
.hero-title-en {
    margin: 0;
    font-size: clamp(35px, 14dvw, 60px);
    line-height: 1;
    font-weight: 700;
    color: var(--color-primary);
    font-family: "AIAEverest", "Noto Sans", -apple-system, Arial, sans-serif;
}
.photobooth-page .hero-title-en {
    font-size: clamp(60px, 18dvw, 140px);
}

.homepage-avatars {
    width: min(80vw, 200px);
    height: auto;
}
.photobooth-page .homepage-avatars {
    width: 580px;
}

.content-area {
    display: flex;
    width: 100%;
    align-items: center;
    flex-direction: column;
    height: 100%;
    flex: 1;
}

.footer {
    background: #f5f5f5;
    width: 100%;
    padding: 16px 24px;
    text-align: center;
    display: flex;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
}
.footer-logo {
    width: min(80px, 10vw);
    height: auto;
    display: block;
    margin: 0 auto;
}
.footer p {
    margin: 0;
    font-size: 6px;
    color: var(--color-gray);
}
.intro-wrap.active {
    display: block;
}

.intro-wrap p {
    margin: 0 0 18px;
}

.intro-wrap p:last-child {
    margin-bottom: 0;
}

.name-form-wrap.active {
    display: block;
}

.name-label {
    display: block;
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--color-gray);
    text-align: center;
}

.name-input {
    width: 100%;
    border: 2px solid var(--color-gray);
    padding: 18px 14px;
    font-size: 26px;
    border-radius: 4px;
    font-weight: 500;
    color: var(--color-secondary);
    text-align: center;
    font-family: "AIAEverest", "Noto Sans", -apple-system, Arial, sans-serif;
}
.name-input[name="username"] {
    text-transform: uppercase;
}
.name-input[name="district"] {
    text-transform: uppercase;
}
.form-avatars {
    display: none;
    overflow: hidden;
    width: 70dvw;
    height: 65dvw;
    align-self: flex-start;
}
.form-avatars img {
    width: 100%;
    height: auto;
    display: block;
}
.error-text {
    min-height: 20px;
    margin-top: 6px;
    font-size: 18px;
    color: var(--color-error);
    text-align: center;
}

.character-wrap {
    width: 100%;
    display: none;
    padding: 30px;
}

.character-wrap.active {
    display: block;
}

.character-title {
    font-size: 26px;
    margin-bottom: 10px;
    color: var(--color-gray);
    text-align: center;
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.character-btn {
    border: 0;
    background: #f5f5f5;
    padding: 0;
    cursor: pointer;
}

.character-btn img {
    display: block;
    width: 100%;
    height: auto;
}

.character-btn.selected {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

.item-wrap {
    width: 100%;
    display: none;
    margin-top: 20px;
}

.item-wrap.active {
    display: block;
}

.item-title {
    font-size: 26px;
    margin-bottom: 10px;
    color: var(--color-gray);
    text-align: center;
}

.item-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 15px 15px 30px 15px;
}

.item-btn {
    border: 1px solid #888;
    background: #f5f5f5;
    padding: 0;
    cursor: pointer;
}

.item-btn img {
    display: block;
    width: 100%;
    height: auto;
}

.item-btn img.item-lazy-image {
    opacity: 0.3;
    filter: saturate(0.9);
    transition: opacity 0.28s ease, filter 0.28s ease;
}

.item-btn img.item-lazy-image.item-image-loading {
    opacity: 0.4;
}

.item-btn img.item-lazy-image.item-image-loaded {
    opacity: 1;
    filter: none;
}

.item-btn.selected {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

.btn {
    background: var(--color-primary);
    font-size: 24px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    padding: 8px 16px;
    display: inline-flex;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    border: none;
}
.btn:hover {
    background: var(--color-primary-hover);
}
.next-btn {
    display: none;
}

.next-btn.active {
    display: inline-flex;
}

.action-area {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 0 0 20px 0;
}




.qr-title {
    font-size: 26px;
    margin-bottom: 10px;
    color: var(--color-gray);
    text-align: center;
    margin-top: 30px;
}
.qr-box {
    width: 100%;
    margin: 15px auto;
    overflow: hidden;
    background: #fff;
}
.qr-image {
    width: 50dvw;
    height: 50dvw;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.result-qr-image {
    width: clamp(80px, 30dvw, 300px);
    height: clamp(80px, 30dvw, 300px);
    object-fit: contain;
    display: block;
    margin: 15px auto;
}

.unique-number {
    color: var(--color-primary);
    width: 50dvw;
    font-size: 37px;
    letter-spacing: 1px;
    text-align: right;
    font-weight: 700;
}
.photobooth-page .unique-number {
    font-size: 120px;
    text-align:center;
}

.unique-number-label {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.2;
    color: var(--color-secondary);
    width: 48dvw;
    text-align: right;
    font-weight: 700;
}
.photobooth-page .unique-number-label {
    margin-top: 60px;
    font-size: 60px;
    text-align:center;
}

.refresh-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-top:30px;
}

.refresh-btn {
    border: none;
    gap:0.5rem;
}
.refresh-btn svg {
    width: 24px;
    height: 24px;
}
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 40;
}

.loading-overlay.active {
    display: flex;
}

.loading-box {
    width: min(90vw, 300px);
    background: #fff;
    border-radius: 12px;
    padding: 18px;
    border: 1px solid #ddd;
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 10px;
    border: 4px solid #e2e2e2;
    border-top-color: #111;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-title {
    font-size: 18px;
    margin: 0;
}

.loading-message {
    margin: 8px 0 0;
    font-size: 14px;
    color: #444;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 45;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    width: min(90vw, 320px);
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #ddd;
    text-align: center;
}

.modal-title {
    font-size: 18px;
    margin: 0 0 8px;
}

.modal-message {
    margin: 0;
    font-size: 15px;
    color: #333;
}

.modal-btn {
    margin-top: 14px;
    border: 1px solid #888;
    background: #f5f5f5;
    padding: 8px 16px;
    cursor: pointer;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


.scan-hint-box {
    width: 100%;
}

.scan-hint-box.hidden {
    display: none;
}

.scan-hint {
    position:absolute;
    width:22dvw;
    height: auto;
    right: 50px;
    top: 40%;
    font-size: 36px;
    font-weight: 600;
    line-height: 1.05;
    text-align: right;
    color: var(--color-gray);
}
.scan-hint svg {
    width: 8dvw;
    height: auto;
}

.scan-hint-arrow {
    display: inline-block;
    margin-left: 8px;
}

.status {
    width: 100%;
    margin-top: 14px;
    min-height: 24px;
    text-align: center;
    color: var(--color-primary);
    font-size: 16px;
    text-align: right;
}


.retakeBtn {
    width: 24dvw;
    background: #f5f4f2;
    color: var(--color-gray);
    text-decoration: none;
    font-size: 30px;
    font-weight: 700;
    gap: 10px;
    padding: 16px;
}
.retakeBtn:hover {
    background: #bebdbc;
}
.retakeBtn svg {
    width: 30px;
    height: 30px;
}
.photobooth-page #nextBtn {
    width: 24dvw;
    background: var(--color-primary);
    color: #fff;
    font-size: 30px;
    font-weight: 700;
    gap: 10px;
    padding: 16px;
}
.photobooth-page #nextBtn:hover {
    background: var(--color-primary-hover);
}
.photobooth-page #nextBtn svg {
    width: 30px;
    height: 30px;
}
.photobooth-page .footer p {
    font-size: 12px;
    color: var(--color-gray);
    width: 70%;
    margin: 0 auto;
}
.photobooth-page .footer-logo {
    margin: 10px auto;
}

.photobooth-page .home-btn {
    width: 24dvw;
    background: var(--color-primary);
    color: #fff;
    font-size: 30px;
    font-weight: 700;
    gap: 10px;
    padding: 16px;
    text-decoration: none;
    margin-top: 30px;
}
.photobooth-page .home-btn:hover {
    background: var(--color-primary-hover);
}
