/* =========================================================
   RESET & BASE
========================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body.twibbon-standalone {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(180deg, #f8fafc, #eef2f7);
    color: #111827;
}

/* =========================================================
   LAYOUT WRAPPER
========================================================= */
.twb-app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

/* =========================================================
   HEADER
========================================================= */
.twb-header {
    text-align: center;
    margin-bottom: 24px;
}

.twb-title {
    font-size: clamp(22px, 3vw, 32px);
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.02em;
}

.twb-author {
    margin-top: 6px;
    font-size: 14px;
    color: #6b7280;
}

/* =========================================================
   EDITOR LAYOUT
========================================================= */
.twb-editor-app {
    display: flex;
    gap: 24px;
    align-items: stretch;
}

/* Mobile */
@media (max-width: 768px) {
    .twb-editor-app {
        flex-direction: column;
    }
}

/* =========================================================
   CANVAS AREA
========================================================= */
.twb-canvas-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 16px;
}

#twbCanvas {
    width: 100%;
    max-width: 480px;
    height: auto;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.06);
    touch-action: none;
}

/* =========================================================
   CONTROL PANEL
========================================================= */
.twb-panel {
    width: 280px;
    background: #ffffff;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Mobile panel */
@media (max-width: 768px) {
    .twb-panel {
        width: 100%;
    }
}

/* =========================================================
   FORM ELEMENTS
========================================================= */
.twb-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.twb-field label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.twb-panel input[type='text'] {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.twb-panel input[type='text']:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.twb-panel input[type='color'] {
    width: 100%;
    height: 44px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    padding: 4px;
    cursor: pointer;
}

/* =========================================================
   BUTTONS
========================================================= */
.twb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 999px;
    border: 1px solid transparent;
    background: #f3f4f6;
    color: #111827;
    cursor: pointer;
    transition: all 0.2s ease;
}

.twb-btn:hover {
    background: #e5e7eb;
}

.twb-btn:active {
    transform: translateY(1px);
}

/* Variants */
.twb-btn.primary {
    background: #2563eb;
    color: #ffffff;
}

.twb-btn.primary:hover {
    background: #1e40af;
}

.twb-btn.success {
    background: #16a34a;
    color: #ffffff;
}

.twb-btn.success:hover {
    background: #15803d;
}

.twb-btn.outline {
    background: #ffffff;
    border-color: #d1d5db;
}

.twb-btn.outline:hover {
    background: #f9fafb;
}

/* Small buttons */
.twb-btn.small {
    flex: 1;
    padding: 9px 12px;
    font-size: 13px;
}

/* =========================================================
   ROW & DIVIDER
========================================================= */
.twb-row {
    display: flex;
    gap: 10px;
}

.twb-panel hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 6px 0;
}

/* =========================================================
   HANDLE VISUAL (OPTIONAL FUTURE STYLE)
========================================================= */
canvas {
    cursor: grab;
}

canvas:active {
    cursor: grabbing;
}

/* =========================================================
   FOOTER SPACING (SAFE AREA)
========================================================= */
@media (max-width: 768px) {
    .twb-app {
        padding-bottom: 60px;
    }
}
.twb-btn:disabled,
.twb-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}
