@font-face {
    font-family: 'CorpSrcWinSong';
    src: url('./assets/fonts/CorpSrcWinSong-slim.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    unicode-range: U+4E00-9FFF, U+3000-303F, U+FF00-FFEF;
}

@font-face {
    font-family: 'JetBrains';
    src: url('./assets/fonts/JetBrainsMono-Light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'PolySans';
    src: url('./assets/fonts/PolySans Neutral.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'PolySans';
    src: url('./assets/fonts/PolySans Median Wide.woff') format('woff');
    font-weight: bold;
    font-style: normal;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'PolySansTitle';
    src: url('./assets/fonts/PolySans Neutral Wide.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

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

:root {
    --text-color: #000;
    --bg-color: #fff;
    --cursor-color: #000;
}

@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #fff;
        --bg-color: #000;
        --cursor-color: #fff;
    }
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-color);
    max-width: 640px;
    margin: 0 auto;
    position: relative;
    color: var(--text-color);
}

.loading-screen {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0 20px;
    user-select: none;
    -webkit-user-select: none;
}

.title-container {
    font-family: 'CorpSrcWinSong', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    position: relative;
    text-align: left;
    font-size: clamp(0px, 14vw, 90px);
    line-height: 1.2;
    width: 100%;
    z-index: 1;
}

.title-line, .subtitle-line, .subtitle-line-deco, .final-line-1, .final-line-2, .final-line-3 {
    min-height: clamp(1.2em, 17vw, 90px);
    line-height: 1.2;
    width: fit-content;
    position: relative;
}

.title-line.has-cursor::after, 
.subtitle-line.has-cursor::after,
.final-line-1.has-cursor::after,
.final-line-2.has-cursor::after,
.final-line-3.has-cursor::after {
    content: '';
    display: inline-block;
    width: 2px;
    min-height: clamp(1em, 15vw, 110px);
    line-height: 1;
    background-color: var(--cursor-color);
    margin-left: 4px;
    vertical-align: top;
    animation: blink 1s infinite;
}

.final-text-container {
    display: none;
}


@keyframes tap {
    0% {
        scale: 1;
        translate: 0 0;
    }
    30% {
        scale: 0.9;
        translate: 5% 0;
    }
    100% {  
        scale: 1;
        translate: 0 0;
    }
}

@keyframes blink {
    0%, 45% { opacity: 1; }
    60%, 100% { opacity: 0; }
}

@keyframes ScrollOutLeft {
    from { 
        opacity: 1; 
        transform: translateX(0%) translateY(0%); 
    }
    to { 
        opacity: 0; 
        transform: translateX(-70%) translateY(-20vh); 
    }
}

.scroll-out-left {
    animation: ScrollOutLeft 0.5s cubic-bezier(0.600, 0.000, 0.000, 1.000) forwards;
}

@keyframes ScrollToLeft {
    from { 
        opacity: 1; 
        transform: translateX(0%) translateY(0%); 
    }
    to { 
        opacity: 1; 
        transform: translateX(-70%) translateY(-20vh); 
    }
}

.scroll-to-left {
    animation: ScrollToLeft 0.5s cubic-bezier(0.600, 0.000, 0.000, 1.000) forwards;
}

.loading-trigger {
    z-index: 100;
    position: fixed;
    bottom: 0px;
    left: 0px;
    width: 100%;
    font-size: 16px;
    background-color: var(--text-color);
    color: var(--bg-color);
    cursor: pointer;
    transition: opacity 0.3s;
}

.loading-trigger:hover {
    opacity: 0.8;
}

.onboarding-image-container {
    position: absolute;
    top: 0%;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    z-index: 2;
    overflow: hidden;
}

.image-box-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
}

.image-box {
    width: 100%;
    aspect-ratio: 4/3;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    -webkit-mask-image: url('./assets/svg/cropsvg.svg');
    mask-image: url('./assets/svg/cropsvg.svg');
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-origin: content-box;
    mask-origin: content-box;
}

.image-box.loaded {
    opacity: 1;
    transform: translateY(0);
}

.bottom-row {
    display: flex;
    gap: 20px;
    width: calc(200% + 20px);
    position: relative;
    transform: translateX(-35%);
}

.bottom-row .image-box-wrapper {
    width: 100%;
    aspect-ratio: 4/3;
}

#emma {
    background-image: url('https://cdn.duckduckbake.ltd/IMG_0704.JPG');
}

#jeff {
    transform: translateX(100%) translateY(0%);
    position: relative;
    opacity: 0;
    transition: none;
    -webkit-mask-image: url('assets/svg/cropsvg.svg');
    mask-image: url('assets/svg/cropsvg.svg');
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-origin: content-box;
    mask-origin: content-box;
}

#jeff::before {
    display: none;
}

#jeff.loaded {
    transform: translateX(70%) translateY(0%);
    opacity: 1;
    transition: transform 1s cubic-bezier(0.600, 0.000, 0.000, 1.000), opacity 0.5s ease-in-out;
}

#jeff.focused {
    transform: translateX(0%) translateY(-20vh);
    transition: transform 0.5s cubic-bezier(0.600, 0.000, 0.000, 1.000), opacity 0.5s ease-in-out;
}

#randy {
    background-image: url('https://cdn.duckduckbake.ltd/IMG_4224.PNG');
}

#lucy {
    background-image: url('https://cdn.duckduckbake.ltd/IMG_4225.PNG');
}

/* Ticket Card Styles */
.ticket-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  height: 90%;
  background: none;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  padding: 4% 1% 1% 1%;
  box-sizing: border-box;
  z-index: 3;
  font-family: 'CorpSrcWinSong', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  justify-content: flex-start;
  font-size: 2.2vw;
  background: linear-gradient(to bottom, #000000, #666666);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ticket-title-input {
  font-family: 'CorpSrcWinSong', 'PolySansTitle', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(1em, 10vw, 64px);
  font-weight: normal;
  background: linear-gradient(to bottom, #000000, #666666);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  border: none;
  outline: none;
  width: 100%;
  margin-bottom: clamp(0px, 11vw, 70px);
  padding: 0;
  text-align: left;
  letter-spacing: 0.02em;
  caret-color: #444;
  font-feature-settings: "locl";
  font-language-override: "CHN";
  -webkit-text-fill-color: transparent;
}

.ticket-title-input:disabled {
  opacity: 1;
  -webkit-text-fill-color: transparent;
  background: linear-gradient(to bottom, #000000, #666666);
  -webkit-background-clip: text;
  background-clip: text;
}

.ticket-title-input::placeholder {
  background: linear-gradient(to bottom, #000000, #666666);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0.5;
  font-weight: 400;
}

.ticket-info-row {
  display: flex;
  align-items: baseline;
  gap: 0.3em;
  font-size: clamp(0px, 4vw, 25.6px);
  margin-bottom: clamp(0px, 1vw, 6px);
  font-family: 'PolySans', sans-serif;
  background: linear-gradient(to bottom, #000000, #666666);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ticket-label {
  font-weight: bold;
  letter-spacing: 0.04em;
  background: linear-gradient(to bottom, #000000, #666666);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 1em;
}

.ticket-content {
  font-weight: normal;
  background: linear-gradient(to bottom, #000000, #666666);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 1em;
}

.ticket-code-row {
  position: absolute;
  right: clamp(0px, 1vw, 6px);
  bottom: clamp(0px, 2.7vw, 17.28px);
  font-size: clamp(0px, 2.8vw, 17.92px);
  letter-spacing: 0.04em;
  font-family: 'PolySans', sans-serif;
  font-weight: normal;
  background: linear-gradient(to bottom, #000000, #666666);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ticket-code-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.ticket-buttons {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    flex-direction: column;
    gap: 12px;
    width: calc(100% - 40px);
    max-width: 600px;
    z-index: 10;
    padding: 0 20px;
    opacity: 0;
}

.ticket-buttons.visible {
    display: flex;
    animation: fadeIn 0.5s ease forwards;
}

.ticket-buttons.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

.ticket-button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-family: 'PolySans', sans-serif;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: var(--bg-color);
}

.continue-button {
    background-color: var(--text-color);
    color: var(--bg-color);
}

.continue-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.skip-button {
    background-color: transparent;
    color: var(--text-color);
}

.ticket-button:hover:not(:disabled) {
    opacity: 0.8;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideUp {
    from { 
        translate: 0 0;
    }
    to { 
    translate: 0 -150%;
    }
}

#jeff.slide-up {
    animation: slideUp 0.8s cubic-bezier(0.600, 0.000, 0.000, 1.000) forwards;
}

.loading-screen.fade-out {
    display: none;
}

.level-select-screen {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 20px;
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
}

.test-text {
    font-family: 'CorpSrcWinSong', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--text-color);
}

.onboarding-image-container-level {
    position: absolute;
    top: 0%;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    z-index: 2;
    overflow: hidden;
}

#jeff-level {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateX(0%) translateY(-80%);
    transition: transform 0.8s cubic-bezier(0.600, 0.000, 0.000, 1.000);
    opacity: 0;
    -webkit-mask-image: url('assets/svg/cropsvg.svg');
    mask-image: url('assets/svg/cropsvg.svg');
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-origin: content-box;
    mask-origin: content-box;
}

#jeff-level.loaded {
    opacity: 1;
}

.simple-jeff {
    width: calc(100% - 40px);
    aspect-ratio: 4/3;
    position: absolute;
    top: 0;
    left: 20px;
    transform: translateX(0%) translateY(-100%);
    background-image: url('https://cdn.duckduckbake.ltd/IMG_4223.PNG');
    background-size: cover;
    background-position: center;
    -webkit-mask-image: url('assets/svg/cropsvg.svg');
    mask-image: url('assets/svg/cropsvg.svg');
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    transition: transform 0.8s cubic-bezier(0.600, 0.000, 0.000, 1.000);
}

.simple-jeff.loaded {
    transform: translateX(0%) translateY(-65%);
}

.simple-jeff .ticket-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    height: 90%;
    display: flex;
    flex-direction: column;
    padding: 4% 1% 1% 1%;
    box-sizing: border-box;
    font-family: 'CorpSrcWinSong', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    justify-content: flex-start;
    font-size: clamp(0px, 2.2vw, 14px);
    background: linear-gradient(to bottom, #000000, #666666);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.simple-jeff .ticket-title-input {
    font-family: 'CorpSrcWinSong', 'PolySansTitle', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: clamp(1em, 10vw, 64px);
    font-weight: normal;
    background: linear-gradient(to bottom, #000000, #666666);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    border: none;
    outline: none;
    width: 100%;
    margin-bottom: clamp(0px, 11vw, 70px);
    padding: 0;
    text-align: left;
    letter-spacing: 0.02em;
    caret-color: #444;
    font-feature-settings: "locl";
    font-language-override: "CHN";
    -webkit-text-fill-color: transparent;
}

.simple-jeff .ticket-info-row {
    display: flex;
    align-items: baseline;
    gap: 0.3em;
    font-size: clamp(0px, 4vw, 25.6px);
    margin-bottom: clamp(0px, 1vw, 6px);
    font-family: 'PolySans', sans-serif;
    background: linear-gradient(to bottom, #000000, #666666);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.simple-jeff .ticket-code-row {
    position: absolute;
    right: clamp(0px, 1vw, 6px);
    bottom: clamp(0px, 2.7vw, 17.28px);
    font-size: clamp(0px, 2.8vw, 17.92px);
    letter-spacing: 0.04em;
    font-family: 'PolySans', sans-serif;
    font-weight: normal;
    background: linear-gradient(to bottom, #000000, #666666);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.level-cards {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    margin-top: clamp(0px, calc(48vw - 18px), 286px);
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 20px;
    box-sizing: border-box;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.level-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.8s ease-out;
    pointer-events: none;
    z-index: 1;
}

.level-overlay.active {
    opacity: 1;
}

.hint-prompt {
    position: fixed;
    top: calc(clamp(0px, calc(48vw - 18px), 286px) + calc((min(100vw, 640px) - 40px) * 176 / 337 + 10px));
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 640px;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.600, 0.000, 0.000, 1.000);
    z-index: 2;
    cursor: pointer;
}

.hint-prompt.active {
    opacity: 1;
}

.hint-prompt img {
    width: 100%;
    height: auto;
    display: block;
}

#level1 {
    cursor: pointer;
}

.level-card {
    position: relative;
    width: 100%;
    height: calc((min(100vw, 640px) - 40px) * 176 / 337);
    opacity: 0;
    transform: translateY(400%);
    transition: all 1.2s cubic-bezier(0.600, 0.000, 0.000, 1.000);
    margin: 0;
    padding: 0;
    line-height: 0;
    font-size: 0;
}

.level-card:not(:first-child)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1;
    opacity: 0;
    transition: opacity 1.2s cubic-bezier(0.600, 0.000, 0.000, 1.000);
    transition-delay: 0.4s;
}

.level-card:not(:first-child).loaded::before {
    opacity: 1;
}

.level-card:not(:first-child).no-overlay::before {
    opacity: 0;
}

.level-text {
    position: absolute;
    top: clamp(0px, calc(7vw - 6px), 41px);
    right: clamp(0px, calc(5vw - 3px), 29px);
    z-index: 2;
    text-align: right;
    font-family: 'JetBrains', monospace;
    font-weight: 300;
    color: #000000;
}

.level-number {
    font-size: clamp(0px, 6vw, 39px);
    letter-spacing: -0.06em;
    font-weight: 300;
    line-height: 1;
    margin-bottom: clamp(0px, 2.5vw, 16px);
}

.item-found {
    font-size: clamp(0px, 6vw, 39px);
    line-height: 1;
    font-weight: 300;
}

.level-card:last-child {
    margin-bottom: 0;
}

.level-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    margin: 0;
    padding: 0;
    vertical-align: top;
}

.level-card.loaded {
    opacity: 1;
    transform: translateY(0);
    transition: transform 1.2s cubic-bezier(0.600, 0.000, 0.000, 1.000);
}

.level-card:nth-child(1).loaded,
.level-card:nth-child(2).loaded,
.level-card:nth-child(3).loaded {
    transition-delay: 0s;
}

/* ===== Level Screen ===== */
.level-screen {
    position: fixed;
    inset: 0;
    max-width: 640px;
    margin: 0 auto;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    z-index: 0;
}

.illustration-layer {
    position: relative;
    width: 100%;
    margin-top: clamp(10px, 2vw, 20px);
}
.scene-img {
    width: 100%;
    display: block;
}
.scene-extension {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    transform: translateY(-50%);
}

.items-layer {
    position: absolute;
    top: clamp(10px, 2vw, 20px);
    left: 0;
    width: 100%;
    pointer-events: none; /* items handle events individually */
}
.item {
    position: absolute;
    inset: 0;
    pointer-events: auto;
    cursor: pointer;
}
.item-foreground,
.item-spotlight {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.4s ease-out;
}
.item-foreground { opacity: 0.01; }
.item-spotlight { opacity: 0; }
.item-found .item-foreground { opacity: 1; }
.item-found .item-spotlight { opacity: 1; }

/* Hint Bar */
.hint-bar {
    position: fixed;
    right: clamp(10px, 3vw, 24px);
    bottom: clamp(10px, 3vw, 24px);
    padding: clamp(8px, 2vw, 16px) clamp(12px, 3vw, 20px);
    background-color: var(--bg-color);
    border-radius: clamp(20px, 6vw, 60px);
    box-shadow: 0 0 10px rgba(0,0,0,0.15);
    font-family: 'JetBrains', monospace;
    display: flex;
    gap: clamp(8px, 2vw, 16px);
    z-index: 3;
}
.hint-item {
    font-size: clamp(12px, 3vw, 20px);
    color: var(--text-color);
    opacity: 0.5;
    transition: opacity 0.3s;
}
.hint-item.found { opacity: 1; color: var(--text-color); }

/* Back Button */
.back-btn {
    position: fixed;
    left: clamp(10px, 3vw, 24px);
    bottom: clamp(10px, 3vw, 24px);
    background: var(--bg-color);
    color: var(--text-color);
    border: 2px solid var(--text-color);
    border-radius: clamp(20px, 6vw, 60px);
    padding: clamp(8px, 2vw, 16px) clamp(16px, 4vw, 24px);
    font-family: 'JetBrains', monospace;
    font-size: clamp(12px, 3vw, 20px);
    cursor: pointer;
    z-index: 3;
}

/* Jeff overlay */
.jeff-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    opacity: 0;
    transition: opacity 0.4s ease-out;
    pointer-events: none;
    z-index: 4;
}
.jeff-overlay.active { opacity: 1; pointer-events: auto; }

/* Tutorial */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    max-width: 640px;
    margin: 0 auto;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tutorial-mask {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
}
.progress-hint,
.bar-hint {
    position: absolute;
    width: 100%;
    height: auto;
    display: block;
}
.progress-hint { top: 20%; }
.bar-hint { bottom: 15%; }