/* Main page specific styles */

body {
    overflow-x: hidden;
}

.smiley-face {
    position: fixed;
    top: 80px;
    left: 30px;
    z-index: 999;
    transition: all 0.3s ease;
    cursor: pointer;
}

.smiley-face:hover {
    transform: scale(1.1);
}

.smiley-face.biting {
    animation: bite 0.3s ease-in-out;
}

@keyframes bite {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2) rotate(5deg); }
}

.pencil-crumb {
    position: fixed;
    width: 4px;
    height: 4px;
    background: var(--text-primary);
    border-radius: 50%;
    pointer-events: none;
    z-index: 998;
    animation: fall 1.5s ease-out forwards;
}

.pencil-crumb.wood {
    background: var(--text-primary);
    border-radius: 0;
    width: 3px;
    height: 6px;
}

@keyframes fall {
    0% {
        opacity: 1;
        transform: translateY(0) translateX(0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100px) translateX(var(--fall-x, 0px)) rotate(360deg);
    }
}

.hero {
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 60px 20px 20px;
    max-width: 100vw;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle at 2px 2px, var(--text-primary) 1px, transparent 0);
    background-size: 40px 40px;
    opacity: 0.03;
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
    text-align: center;
}

.hero-content {
    animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 4rem;
    line-height: 0.8;
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
    user-select: none;
}

.logo-line-1 {
    display: block;
    letter-spacing: 0.1em;
}

.logo-line-2 {
    display: block;
    letter-spacing: 0.1em;
    margin-left: 0.2em;
}

.logo-line-2.diva-mode {
    margin-left: -1.2em;
}

.logo-line-2.adey-mode {
    margin-left: -1.9em;
}

.interactive-letter {
    display: inline-block;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    cursor: grab;
    position: relative;
    z-index: 9998;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.interactive-letter.dragging {
    z-index: 10000;
    transition: none;
}

.logo .special-oo {
    position: relative;
}

.logo .special-oo:hover {
    animation: wiggle 0.5s ease-in-out;
}

.logo .special-u {
    position: relative;
}

.logo .special-u:hover {
    animation: bounce 0.6s ease-in-out;
}

.logo .special-middle {
    position: relative;
}

.logo .special-middle:hover {
    animation: bounce 0.6s ease-in-out;
}

.logo .special-middle.diva-i:hover {
    animation: none;
}

[data-theme="dark"] .special-oo,
[data-theme="dark"] .special-u,
[data-theme="dark"] .special-middle {
    color: #ffffff;
}

[data-theme="dark"] .special-middle.diva-i {
    color: #000000;
}

[data-theme="dark"] .interactive-letter:not(.special-oo):not(.special-u):not(.special-middle) {
    color: #000000;
}

@keyframes wiggle {
    0%, 100% { transform: scale(1.3) rotate(10deg) translateY(-10px); }
    25% { transform: scale(1.4) rotate(15deg) translateY(-15px); }
    50% { transform: scale(1.3) rotate(5deg) translateY(-8px); }
    75% { transform: scale(1.4) rotate(12deg) translateY(-12px); }
}

@keyframes bounce {
    0%, 100% { transform: scale(1.3) rotate(10deg) translateY(-10px); }
    50% { transform: scale(1.5) rotate(-5deg) translateY(-20px); }
}

.subtitle {
    font-size: 1.2rem;
    margin-bottom: 3rem;
    color: var(--text-secondary);
    font-weight: 300;
}

.problem-input-container {
    margin-top: 2rem;
    position: relative;
}

.problem-input {
    width: 100%;
    max-width: 410px;
    padding: 20px 25px;
    font-size: 1.1rem;
    border: 2px solid var(--text-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
    resize: none;
    min-height: 120px;
}

.problem-input::placeholder {
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0.6;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    10% { opacity: 0.6; }
    90% { opacity: 0.6; }
    100% { opacity: 0; }
}

.problem-input:focus {
    box-shadow: 0 0 0 4px var(--shadow);
    transform: translateY(-2px);
}

.budget-slider-container {
    margin-top: 2rem;
    max-width: 460px;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
    padding: 0;
}

.range-slider {
    position: relative;
    width: 100%;
    height: 8px;
    margin: 40px 0;
}

.slider-track {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 5px;
    background: var(--text-secondary);
}

.budget-slider {
    position: absolute;
    top: -6px;
    width: 100%;
    height: 20px;
    background: none;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
}

.min-slider {
    z-index: 2;
}

.max-slider {
    z-index: 1;
}

.budget-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
    border: 2px solid var(--bg-primary);
    box-shadow: 0 2px 4px var(--shadow);
    pointer-events: auto;
}

.budget-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
    border: 2px solid var(--bg-primary);
    box-shadow: 0 2px 4px var(--shadow);
    pointer-events: auto;
}

.budget-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: block;
}

.budget-value {
    font-size: 1.5rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

.submit-button {
    margin-top: 20px;
    padding: 15px 40px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: 2px solid var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.submit-button:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px var(--shadow);
}

.submit-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    transition: left 0.3s;
    z-index: -1;
}

.submit-button:hover::before {
    left: 0;
}

.pencil-section {
    margin-top: 4rem;
    text-align: center;
    opacity: 0.8;
}

.pencil-illustration {
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 8px var(--shadow));
    cursor: grab;
    position: relative;
    z-index: 10;
}

.pencil-illustration:hover {
    transform: scale(1.1) rotate(2deg);
    opacity: 1;
}

.pencil-illustration.dragging {
    cursor: grabbing;
    z-index: 1000;
    position: fixed;
    transition: none;
    transform-origin: center;
    transform: rotate(-15deg) scale(0.4) !important;
}

.pencil-tagline {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
    font-weight: 300;
    margin-top: 0.5rem;
}

.draw-instruction {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    opacity: 0.7;
}

.drawing-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 5;
    opacity: 1;
}

/* Timer Page Styles */
.timer-page {
    display: none;
}

.timer-page.active {
    display: block;
}

.status-container {
    margin-top: 3rem;
    padding: 2rem;
    border: 2px solid var(--text-primary);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.problem-display {
    text-align: left;
    padding: 1.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1rem;
    line-height: 1.8;
}

.status-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.timer-display {
    font-family: 'Courier New', monospace;
    font-size: 3rem;
    font-weight: bold;
    margin: 1rem 0;
    letter-spacing: 0.05em;
}

.countdown-display {
    font-family: 'Courier New', monospace;
    font-size: 2.5rem;
    font-weight: bold;
    margin: 1rem 0;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.status-message {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 1rem;
}

.answer-section {
    margin-top: 2rem;
    padding: 2rem;
    border: 2px solid var(--text-primary);
    text-align: left;
    background: var(--bg-primary);
}

.answer-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.answer-text {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.email-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid var(--text-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
    margin-bottom: 1rem;
}

.email-input::placeholder {
    color: var(--text-secondary);
}

.email-input:focus {
    box-shadow: 0 0 0 3px var(--shadow);
}

.payment-button {
    padding: 15px 40px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: 2px solid var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.payment-button:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px var(--shadow);
}

.calendar-button {
    padding: 12px 30px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    margin-top: 1.5rem;
}

.calendar-button:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
    transform: translateY(-2px);
}

.link-container {
    margin-top: 2rem;
    padding: 1.5rem;
    border: 2px solid var(--text-primary);
    background: var(--bg-primary);
}

.link-display {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--text-secondary);
    margin: 1rem 0;
    word-break: break-all;
}

.copy-button {
    padding: 10px 30px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    margin-top: 1rem;
}

.copy-button:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.floating-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

@media (max-width: 768px) {
    .floating-elements {
        display: none;
    }
}

.floating-element {
    position: absolute;
    opacity: 0.05;
    font-size: 2rem;
    animation: floatAround 15s infinite linear;
}

.floating-element:nth-child(1) {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.floating-element:nth-child(2) {
    top: 60%;
    right: 10%;
    animation-delay: 5s;
}

.floating-element:nth-child(3) {
    bottom: 20%;
    left: 20%;
    animation-delay: 10s;
}

@keyframes floatAround {
    0% { transform: translateY(0px) rotateZ(0deg); }
    25% { transform: translateY(-50px) rotateZ(90deg); }
    50% { transform: translateY(-100px) rotateZ(180deg); }
    75% { transform: translateY(-50px) rotateZ(270deg); }
    100% { transform: translateY(0px) rotateZ(360deg); }
}

@media (max-width: 768px) {
    .hero {
        padding: 70px 15px 15px;
        min-height: auto;
    }
    
    .hero:not(.timer-page) {
        display: block;
    }

    .container {
        padding: 0 15px;
    }

    .logo {
        font-size: 2.5rem;
        margin-bottom: 0.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .problem-input-container {
        margin-top: 1rem;
    }

    .problem-input {
        font-size: 1rem;
        padding: 15px 20px;
        min-height: 100px;
    }

    .timer-display {
        font-size: 2rem;
    }
}

/* Chat/Message Styles */
.messages-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    padding: 12px 16px;
    max-width: 80%;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    transition: all 0.3s ease;
}

.message-user {
    align-self: flex-end;
    background: var(--text-primary);
    color: var(--bg-primary);
    border-bottom-left-radius: 12px;
}

/* Final solution display - styled like admin message */
#finalSolutionDisplay {
    padding: 16px;
    box-sizing: border-box;
}

.final-solution-box {
    width: 100%;
    max-width: 100%;
}

#finalSolutionContent {
    margin-top: 12px;
    font-size: 1.05em;
    line-height: 1.6;
    white-space: pre-wrap;
    text-align: left;
}

.message-admin {
    align-self: flex-start;
    background: var(--bg-secondary, rgba(0,0,0,0.1));
    color: var(--text-primary);
    border: 1px solid var(--text-secondary);
    border-bottom-right-radius: 12px;
}

/* When conversation is completed, make older messages smaller and faded */
.message.previous-message,
.hidden-previous {
    opacity: 0.2;
    font-size: 0.85em;
}

/* Final message in completed conversation - full width and larger */
.message-admin.final-message {
    max-width: 100% !important;
    align-self: stretch !important;
    margin: 0 !important;
    font-size: 1.05em;
    padding: 16px 20px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.85em;
    opacity: 0.8;
}

.message-sender {
    font-weight: bold;
}

.message-time {
    font-size: 0.9em;
    margin-left: 8px;
}

.message-content {
    line-height: 1.5;
    white-space: pre-wrap;
    text-align: left;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.message-input-container textarea:focus {
    outline: none;
    border-color: var(--text-primary);
}

.message-input-container button:hover {
    opacity: 0.9;
}

.message-input-container button:active {
    transform: scale(0.98);
}

[data-theme="dark"] .message-admin {
    background: rgba(255,255,255,0.1);
}

[data-theme="light"] .message-admin {
    background: rgba(0,0,0,0.05);
}

/* Collapsible Chat History - Plus/Minus Indicator */
.chat-toggle-indicator {
    text-align: center;
    padding: 8px 0;
    margin: 0.5rem 0;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

.chat-toggle-indicator:hover {
    transform: scale(1.2);
}

.chat-toggle-indicator .toggle-icon {
    font-size: 2rem;
    color: var(--text-secondary);
    display: inline-block;
    transition: all 0.3s ease;
    font-weight: 300;
    line-height: 1;
}

.chat-toggle-indicator:hover .toggle-icon {
    color: var(--text-primary);
}

.chat-history-container {
    position: relative;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    cursor: pointer;
}

.chat-history-container.expanded {
    max-height: 500px;
    opacity: 1;
    margin-bottom: 1rem;
}

.chat-scroll-wrapper {
    position: relative;
}

.chat-fade-top,
.chat-fade-bottom {
    position: absolute;
    left: 0;
    right: 0;
    height: 40px;
    pointer-events: none;
    z-index: 5;
}

.chat-fade-top {
    top: 0;
    background: linear-gradient(to bottom, var(--bg-primary) 0%, transparent 100%);
}

.chat-fade-bottom {
    bottom: 0;
    background: linear-gradient(to top, var(--bg-primary) 0%, transparent 100%);
}