/* latin-ext */
@font-face {
  font-family: 'Courier Prime';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/u-450q2lgwslOqpF_6gQ8kELaw9pWt_-.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Courier Prime';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/u-450q2lgwslOqpF_6gQ8kELawFpWg.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Special Elite';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/XLYgIZbkc4JPUL5CVArUVL0ntn4OSEFt.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Special Elite';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/XLYgIZbkc4JPUL5CVArUVL0ntnAOSA.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}



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

        body {
            background: linear-gradient(to bottom, #e8dcc4 0%, #d4c4a8 100%);
            font-family: 'Courier Prime', monospace;
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 15px;
            position: relative;
            overflow-x: hidden;
            transition: background 0.5s ease;
        }

        body::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: 
                repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,.02) 2px, rgba(0,0,0,.02) 4px);
            pointer-events: none;
        }

        body::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: 
                radial-gradient(circle at 20% 30%, rgba(139, 115, 85, 0) 0%, rgba(139, 115, 85, 0) 100%),
                radial-gradient(circle at 80% 70%, rgba(80, 60, 40, 0) 0%, rgba(80, 60, 40, 0) 100%),
                radial-gradient(circle at 40% 80%, rgba(100, 80, 60, 0) 0%, rgba(100, 80, 60, 0) 100%);
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.5s ease;
        }

        body.degraded::after {
            opacity: 1;
        }

        .container {
            max-width: 700px;
            width: 100%;
            position: relative;
            z-index: 1;
            max-height: 95vh;
            display: flex;
            flex-direction: column;
        }

        .counter {
            text-align: center;
            margin-bottom: 12px;
            font-size: 13px;
            color: #666;
            font-family: 'Special Elite', cursive;
            text-transform: uppercase;
            letter-spacing: 2px;
            animation: glitch 3s infinite;
        }

        @keyframes glitch {
            0%, 90%, 100% {
                opacity: 1;
                transform: translateX(0);
            }
            91% {
                opacity: 0.8;
                transform: translateX(-2px);
            }
            92% {
                opacity: 1;
                transform: translateX(2px);
            }
            93% {
                opacity: 0.9;
                transform: translateX(0);
            }
        }

        .letter {
            background: linear-gradient(to bottom, #f5ede0 0%, #ebe3d5 100%);
            padding: 35px 40px;
            box-shadow: 
                0 4px 6px rgba(0,0,0,0.1),
                0 1px 3px rgba(0,0,0,0.08),
                inset 0 0 100px rgba(0,0,0,0.03);
            border: 1px solid rgba(139, 115, 85, 0.3);
            position: relative;
            animation: paperAppear 0.5s ease-out;
            transition: all 0.5s ease;
            flex: 1;
            overflow-y: auto;
            max-height: calc(95vh - 200px);
        }

        @keyframes paperAppear {
            from {
                opacity: 0;
                transform: translateY(-20px) rotate(-1deg);
            }
            to {
                opacity: 1;
                transform: translateY(0) rotate(0deg);
            }
        }

        .letter::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: 
                radial-gradient(circle at 20% 50%, rgba(139, 115, 85, 0.03) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(139, 115, 85, 0.02) 0%, transparent 50%);
            pointer-events: none;
            transition: opacity 0.5s ease;
        }

        .letter::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image:
                radial-gradient(circle at 15% 25%, rgba(101, 67, 33, 0) 0%, rgba(101, 67, 33, 0) 2%, transparent 3%),
                radial-gradient(circle at 85% 15%, rgba(120, 80, 50, 0) 0%, rgba(120, 80, 50, 0) 3%, transparent 4%),
                radial-gradient(circle at 70% 80%, rgba(90, 60, 40, 0) 0%, rgba(90, 60, 40, 0) 2.5%, transparent 3.5%),
                radial-gradient(circle at 25% 70%, rgba(110, 75, 45, 0) 0%, rgba(110, 75, 45, 0) 1.8%, transparent 2.8%),
                radial-gradient(circle at 50% 40%, rgba(95, 65, 35, 0) 0%, rgba(95, 65, 35, 0) 2.2%, transparent 3.2%),
                linear-gradient(135deg, transparent 48%, rgba(0,0,0,0) 49%, rgba(0,0,0,0) 51%, transparent 52%),
                linear-gradient(45deg, transparent 48%, rgba(0,0,0,0) 49%, rgba(0,0,0,0) 51%, transparent 52%);
            background-position: 15% 25%, 85% 15%, 70% 80%, 25% 70%, 50% 40%, 90% 10%, 20% 90%;
            background-size: 100% 100%;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.5s ease;
        }

        .letter.degraded::after {
            opacity: 1;
        }

        .letterhead {
            text-align: center;
            margin-bottom: 25px;
            font-family: 'Special Elite', cursive;
        }

        .logo {
            font-size: 40px;
            font-weight: bold;
            letter-spacing: 8px;
            color: #2c2c2c;
            margin-bottom: 5px;
            animation: logoGlitch 5s infinite;
            transition: all 0.5s ease;
            position: relative;
        }

        @keyframes logoGlitch {
            0%, 96%, 100% {
                text-shadow: 0 0 0 transparent;
            }
            97% {
                text-shadow: 2px 0 #ff00ff, -2px 0 #00ffff;
            }
            98% {
                text-shadow: -2px 0 #ff00ff, 2px 0 #00ffff;
            }
        }

        .subtitle {
            font-size: 10px;
            letter-spacing: 3px;
            color: #666;
            text-transform: uppercase;
        }

        .content {
            line-height: 1.6;
            color: #333;
            font-size: 14px;
            margin-bottom: 25px;
            min-height: 200px;
        }

        .content p {
            margin-bottom: 15px;
        }

        .salutation {
            margin-bottom: 20px;
        }

        .body-text {
            margin-bottom: 20px;
            animation: typeIn 1s steps(40) forwards;
            overflow: hidden;
        }

        @keyframes typeIn {
            from {
                max-height: 0;
                opacity: 0;
            }
            to {
                max-height: 500px;
                opacity: 1;
            }
        }

        .signature {
            margin-top: 25px;
            font-style: italic;
        }

        .inputs {
            display: flex;
            gap: 10px;
            margin-bottom: 12px;
            flex-wrap: wrap;
        }

        input {
            flex: 1;
            min-width: 150px;
            padding: 10px 12px;
            border: 2px solid #8b7355;
            background: #f5ede0;
            font-family: 'Courier Prime', monospace;
            font-size: 13px;
            color: #333;
            transition: all 0.3s ease;
        }

        input:focus {
            outline: none;
            background: #fff;
            box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.2);
        }

        input::placeholder {
            color: #999;
        }

        .button {
            width: 100%;
            padding: 12px;
            background: #2c2c2c;
            color: #f5ede0;
            border: none;
            font-family: 'Special Elite', cursive;
            font-size: 14px;
            letter-spacing: 2px;
            text-transform: uppercase;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .button:hover {
            background: #1a1a1a;
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.3);
        }

        .button:active {
            transform: translateY(0);
        }

        .button::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 0;
            height: 0;
            background: rgba(255,255,255,0.1);
            border-radius: 50%;
            transform: translate(-50%, -50%);
            transition: width 0.6s, height 0.6s;
        }

        .button:active::before {
            width: 300px;
            height: 300px;
        }

        .footer {
            text-align: center;
            margin-top: 12px;
            font-size: 10px;
            color: #888;
            font-style: italic;
            letter-spacing: 0.5px;
            line-height: 1.4;
        }

        .dialog-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.7);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 1000;
            animation: fadeIn 0.3s ease;
        }

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

        .dialog-box {
            background: #f5ede0;
            border: 3px solid #2c2c2c;
            padding: 40px;
            max-width: 500px;
            width: 90%;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
            position: relative;
            animation: slideIn 0.3s ease;
        }

        @keyframes slideIn {
            from {
                transform: translateY(-50px) scale(0.9);
                opacity: 0;
            }
            to {
                transform: translateY(0) scale(1);
                opacity: 1;
            }
        }

        .dialog-title {
            font-family: 'Special Elite', cursive;
            font-size: 20px;
            letter-spacing: 3px;
            text-align: center;
            margin-bottom: 20px;
            color: #2c2c2c;
            text-transform: uppercase;
            border-bottom: 2px solid #2c2c2c;
            padding-bottom: 15px;
        }

        .dialog-content {
            font-family: 'Courier Prime', monospace;
            font-size: 15px;
            line-height: 1.7;
            color: #333;
            margin-bottom: 25px;
            text-align: center;
        }

        .dialog-button {
            width: 100%;
            padding: 12px;
            background: #2c2c2c;
            color: #f5ede0;
            border: none;
            font-family: 'Special Elite', cursive;
            font-size: 14px;
            letter-spacing: 2px;
            text-transform: uppercase;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .dialog-button:hover {
            background: #1a1a1a;
        }

        .save-button {
            width: 100%;
            padding: 10px;
            background: #5a4a3a;
            color: #f5ede0;
            border: 2px solid #8b7355;
            font-family: 'Courier Prime', monospace;
            font-size: 13px;
            letter-spacing: 1px;
            text-transform: uppercase;
            cursor: pointer;
            transition: all 0.3s ease;
            margin-top: 12px;
        }

        .save-button:hover {
            background: #4a3a2a;
            border-color: #6a5a45;
            transform: translateY(-1px);
            box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        }

        .save-button:active {
            transform: translateY(0);
        }

        @media (max-width: 600px) {
            .letter {
                padding: 40px 30px;
            }
            
            .logo {
                font-size: 36px;
            }
            
            .content {
                font-size: 14px;
            }
            
            .footer {
                font-size: 10px;
            }

            .dialog-box {
                padding: 30px 20px;
            }

            .dialog-title {
                font-size: 16px;
            }

            .dialog-content {
                font-size: 13px;
            }
        }
    