.thth-wrapper {
    --primary: #b49c84;
    --primary-light: #f6f3f0;
    --primary-dark: #8e7b68;
    --white: #ffffff;
    --bg-body: #faf9f8;
    --text-main: #3d3d3d;
    --text-muted: #7a7a7a;
    --border-color: #e5e1dc;
    --radius-lg: 20px;
    --radius-md: 12px;
    --shadow-soft: 0 4px 30px rgba(180, 156, 132, 0.08);
    --shadow-bold: 0 25px 60px rgba(180, 156, 132, 0.2);
    
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    position: relative;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.thth-wrapper * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* Header */
.thth-wrapper header.thth-header {
    background-color: var(--white);
    padding: 2rem 5%;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.thth-wrapper .brand h1 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 2.2rem;
    color: var(--primary-dark);
    letter-spacing: -0.02em;
    margin-bottom: 0.1rem;
    line-height: 1.2;
}

.thth-wrapper .brand p {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 400;
}

.thth-wrapper .header-hashtag {
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--primary-dark);
    letter-spacing: -0.02em;
    text-transform: none;
}

/* Layout Grid */
.thth-wrapper .app-container {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
}

@media (min-width: 1100px) {
    .thth-wrapper .app-container {
        grid-template-columns: 520px 1fr;
    }
}

/* Editor Sidebar */
.thth-wrapper .editor-sidebar {
    background: var(--white);
    padding: 3.5rem 10%;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.thth-wrapper .step-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--primary);
    margin-bottom: 1rem;
    display: block;
}

.thth-wrapper .form-group {
    margin-bottom: 0.5rem;
}

.thth-wrapper label {
    display: block;
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 0.6rem;
    color: var(--primary-dark);
}

.thth-wrapper input[type="text"], 
.thth-wrapper textarea {
    width: 100%;
    padding: 1.1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fdfdfd;
    color: var(--text-main);
}

.thth-wrapper input:focus, .thth-wrapper textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(180, 156, 132, 0.1);
}

.thth-wrapper .file-dropzone {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 2.5rem 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: var(--primary-light);
}

.thth-wrapper .file-dropzone:hover {
    border-color: var(--primary);
    background: #fff;
}

.thth-wrapper .file-dropzone input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.thth-wrapper .file-dropzone p {
    font-size: 0.95rem;
    color: var(--primary-dark);
    font-weight: 500;
}

.thth-wrapper .btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    background: var(--primary-dark);
    color: var(--white);
    padding: 1.4rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1.5rem;
    position: relative;
}

.thth-wrapper .btn-primary:hover {
    background: #706152;
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.thth-wrapper .btn-primary:disabled {
    background: #9d8d7e;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.thth-wrapper .btn-primary .btn-text {
    display: flex;
    align-items: center;
    gap: 12px;
}

.thth-wrapper .btn-primary.loading .btn-text {
    display: none;
}

.thth-wrapper .btn-loader {
    display: none;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

.thth-wrapper .btn-primary.loading .btn-loader {
    display: block;
}

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

/* Preview Pane */
.thth-wrapper .preview-pane {
    background: #f4f2ef;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 2rem;
    position: relative;
    overflow: hidden;
}

.thth-wrapper .preview-pane::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(var(--border-color) 1.5px, transparent 1.5px);
    background-size: 40px 40px;
    opacity: 0.4;
}

.thth-wrapper .canvas-wrapper {
    position: relative;
    background: var(--white);
    padding: 15px;
    border-radius: 4px;
    box-shadow: var(--shadow-bold);
    max-width: 100%;
    z-index: 1;
}

.thth-wrapper canvas {
    display: block;
    max-width: 100%;
    height: auto !important;
    border: 1px solid #f2f2f2;
    cursor: default;
}

.thth-wrapper canvas.draggable {
    cursor: move;
}

.thth-wrapper .char-hint {
    display: flex;
    justify-content: flex-end;
    font-size: 0.75rem;
    margin-top: 6px;
    color: var(--text-muted);
    font-weight: 500;
}

.thth-wrapper footer.thth-footer {
    background: var(--white);
    padding: 2rem 5%;
    border-top: 1px solid var(--border-color);
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.thth-wrapper #downloadToast {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--primary-dark);
    color: white;
    padding: 1.2rem 2.5rem;
    border-radius: 12px;
    font-weight: 600;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    box-shadow: 0 15px 35px rgba(0,0,0,0.25);
}

.thth-wrapper #downloadToast.show {
    transform: translateX(-50%) translateY(0);
}

.thth-wrapper .drag-tip {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--primary-dark);
    font-weight: 600;
    opacity: 0.8;
    display: none;
    position: relative;
    z-index: 2;
}