/* ============================================================
   BASE
============================================================ */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    background: #f4f5f7;
    color: #242424;
    font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}


/* ============================================================
   HEADER
============================================================ */

.site-header {
    background: #ffffff;
    border-bottom: 1px solid #e2e2e2;
}

.header-inner {
    width: calc(100% - 30px);
    max-width: 1180px;
    margin: 0 auto;
    padding: 16px 0;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo {
    color: #222222;
    text-decoration: none;
    font-size: 22px;
    font-weight: 700;
}

.header-note {
    color: #777777;
    font-size: 13px;
}


/* ============================================================
   PAGE
============================================================ */

.page {
    width: calc(100% - 30px);
    max-width: 1180px;
    margin: 30px auto 60px;
}


/* ============================================================
   INTRO
============================================================ */

.intro {
    margin-bottom: 20px;
    text-align: center;
}

.intro h1 {
    margin: 0 0 12px;
    font-size: 32px;
}

.intro p {
    max-width: 720px;
    margin: 7px auto;

    color: #5e5e5e;

    line-height: 1.55;
}

.privacy-note {
    font-size: 13px;
}


/* ============================================================
   TOOLS NAVIGATION
============================================================ */

.tools-nav {
    margin: 0 0 20px;

    display: flex;
    flex-wrap: wrap;
    justify-content: center;

    gap: 7px;
}

.tool-link {
    padding: 8px 12px;

    border: 1px solid #d7d7d7;
    border-radius: 7px;

    background: #ffffff;

    color: #444444;
    text-decoration: none;

    font-size: 13px;

    transition:
        border-color 0.15s,
        background 0.15s,
        color 0.15s;
}

.tool-link:hover {
    border-color: #236ed8;
    color: #236ed8;
}

.tool-link.active {
    border-color: #236ed8;
    background: #edf4ff;
    color: #236ed8;
}


/* ============================================================
   EDITOR CARD
============================================================ */

.editor-card {
    padding: 25px;

    background: #ffffff;

    border-radius: 14px;

    box-shadow:
        0 3px 18px
        rgba(0, 0, 0, 0.08);
}


/* ============================================================
   UPLOAD
============================================================ */

.upload-box {
    min-height: 300px;

    padding: 25px;

    border: 3px dashed #c6c6c6;
    border-radius: 12px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 12px;

    text-align: center;

    transition:
        border-color 0.15s,
        background 0.15s;
}

.upload-box.drag {
    border-color: #236ed8;
    background: #f4f8ff;
}

.upload-icon {
    width: 55px;
    height: 55px;

    border-radius: 50%;

    background: #edf3fc;
    color: #236ed8;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 35px;
    line-height: 1;
}

.upload-box strong {
    font-size: 21px;
}

.upload-box span,
.upload-box small {
    color: #777777;
}

.upload-button {
    display: inline-block;

    padding: 13px 24px;

    border-radius: 7px;

    background: #236ed8;
    color: #ffffff;

    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.15s,
        transform 0.05s;
}

.upload-button:hover {
    background: #185fbe;
}

.upload-button:active {
    transform: translateY(1px);
}


/* ============================================================
   EDITOR TOOLBAR
============================================================ */

.editor-toolbar {
    margin-bottom: 20px;

    display: flex;
    justify-content: space-between;

    gap: 10px;
}

.secondary-button {
    padding: 10px 15px;

    border: 1px solid #cccccc;
    border-radius: 6px;

    background: #ffffff;
    color: #333333;
}

.secondary-button:hover {
    border-color: #236ed8;
}

.secondary-button.danger {
    color: #a42a2a;
}

.full-button {
    width: 100%;
}


/* ============================================================
   WORKSPACE
============================================================ */

.workspace {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        310px;

    gap: 25px;

    align-items: start;
}

.canvas-column {
    min-width: 0;
}


/* ============================================================
   PREVIEW
============================================================ */

.preview-wrap {
    position: relative;

    width: 100%;
    height: min(68vw, 700px);
    min-height: 500px;

    padding: 25px;

    overflow: hidden;

    border-radius: 10px;

    background:
        repeating-conic-gradient(
            #e7e7e7 0% 25%,
            #f5f5f5 0% 50%
        )
        50% / 24px 24px;

    display: flex;
    align-items: center;
    justify-content: center;
}

#previewCanvas {
    display: block;

    max-width: 100%;
    max-height: 100%;

    background: transparent;

    box-shadow:
        0 2px 14px
        rgba(0, 0, 0, 0.18);

    touch-action: none;
    user-select: none;
    -webkit-user-select: none;

    cursor: grab;
}

#previewCanvas.dragging {
    cursor: grabbing;
}

.canvas-help {
    margin: 10px 0 0;

    color: #777777;

    text-align: center;

    font-size: 12px;
    line-height: 1.5;
}


/* ============================================================
   SETTINGS
============================================================ */

.settings {
    display: flex;
    flex-direction: column;

    gap: 12px;
}

.settings-block {
    padding: 15px;

    border-radius: 9px;

    background: #f6f7f8;
}

.settings-block h3 {
    margin: 0 0 13px;

    font-size: 15px;
}


/* ============================================================
   MODE BUTTONS
============================================================ */

.mode-buttons {
    display: grid;

    grid-template-columns:
        1fr
        1fr;

    gap: 7px;
}

.mode-buttons button {
    padding: 10px;

    border: 1px solid #cccccc;
    border-radius: 6px;

    background: #ffffff;
    color: #333333;

    font-size: 13px;
    font-weight: 600;
}

.mode-buttons button:hover {
    border-color: #236ed8;
}

.mode-buttons button.active {
    border-color: #236ed8;

    background: #edf4ff;

    color: #236ed8;
}


/* ============================================================
   FIELD LABEL
============================================================ */

.field-label {
    display: block;

    margin-top: 12px;
}

.field-label > span {
    display: block;

    margin-bottom: 6px;

    color: #555555;

    font-size: 12px;
}

.two-fields {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 1fr);

    gap: 9px;
}


/* ============================================================
   TEXTAREA
============================================================ */

.watermark-textarea {
    display: block;

    width: 100%;
    min-height: 72px;

    padding: 10px;

    border: 1px solid #cccccc;
    border-radius: 6px;

    background: #ffffff;
    color: #333333;

    resize: vertical;

    line-height: 1.4;
}

.watermark-textarea:focus {
    border-color: #236ed8;
    outline: none;
}


/* ============================================================
   SELECT
============================================================ */

.full-select {
    display: block;

    width: 100%;

    padding: 10px;

    border: 1px solid #cccccc;
    border-radius: 6px;

    background: #ffffff;
    color: #333333;
}

.full-select:hover {
    border-color: #aaaaaa;
}

.full-select:focus {
    border-color: #236ed8;
    outline: none;
}


/* ============================================================
   COLOR
============================================================ */

.color-row {
    display: grid;

    grid-template-columns:
        42px
        minmax(0, 1fr);

    gap: 6px;
}

#textColor {
    width: 42px;
    height: 39px;

    padding: 2px;

    border: 1px solid #cccccc;
    border-radius: 6px;

    background: #ffffff;

    cursor: pointer;
}

#textColorValue {
    min-width: 0;
    width: 100%;

    padding: 9px 7px;

    border: 1px solid #cccccc;
    border-radius: 6px;

    background: #ffffff;

    font-family:
        Consolas,
        Monaco,
        monospace;

    font-size: 12px;
}

#textColorValue:focus {
    border-color: #236ed8;
    outline: none;
}


/* ============================================================
   STYLE BUTTONS
============================================================ */

.style-buttons {
    display: grid;

    grid-template-columns:
        1fr
        1fr;

    gap: 6px;
}

.style-buttons button {
    min-height: 39px;

    padding: 7px;

    border: 1px solid #cccccc;
    border-radius: 6px;

    background: #ffffff;
    color: #333333;

    font-size: 15px;
    font-weight: 700;
}

.style-buttons button:hover {
    border-color: #236ed8;
}

.style-buttons button.active,
.style-buttons button[aria-pressed="true"] {
    border-color: #236ed8;

    background: #edf4ff;

    color: #236ed8;
}


/* ============================================================
   LOGO
============================================================ */

.logo-upload-button {
    display: block;

    width: 100%;

    padding: 11px;

    border: 1px solid #236ed8;
    border-radius: 6px;

    background: #ffffff;
    color: #236ed8;

    text-align: center;

    font-size: 13px;
    font-weight: 700;

    cursor: pointer;
}

.logo-upload-button:hover {
    background: #edf4ff;
}

.logo-info {
    margin: 9px 0;

    padding: 9px;

    overflow: hidden;

    border-radius: 6px;

    background: #ffffff;

    color: #777777;

    font-size: 11px;

    text-align: center;

    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ============================================================
   RANGE
============================================================ */

.range-control {
    display: block;
}

.range-control > span {
    margin-bottom: 8px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;

    color: #555555;

    font-size: 13px;
}

.range-control input[type="range"] {
    display: block;

    width: 100%;

    margin: 0;
}

.margin-top {
    margin-top: 14px;
}


/* ============================================================
   SMALL BUTTONS
============================================================ */

.small-buttons {
    margin-top: 11px;

    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 6px;
}

.small-buttons button {
    padding: 8px 3px;

    border: 1px solid #cccccc;
    border-radius: 5px;

    background: #ffffff;
    color: #333333;

    font-size: 12px;
}

.small-buttons button:hover {
    border-color: #236ed8;
}

.small-buttons button.active {
    border-color: #236ed8;

    background: #edf4ff;

    color: #236ed8;
}


/* ============================================================
   POSITION GRID
============================================================ */

.position-grid {
    width: 138px;
    max-width: 100%;

    margin: 0 auto;

    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 5px;
}

.position-grid button {
    position: relative;

    aspect-ratio: 1;

    min-width: 0;

    padding: 0;

    border: 1px solid #cccccc;
    border-radius: 5px;

    background: #ffffff;
}

.position-grid button::after {
    content: "";

    position: absolute;

    width: 8px;
    height: 8px;

    border-radius: 50%;

    background: #888888;
}

.position-grid button:hover {
    border-color: #236ed8;
}

.position-grid button:hover::after {
    background: #236ed8;
}

.position-grid button.active {
    border-color: #236ed8;

    background: #edf4ff;
}

.position-grid button.active::after {
    background: #236ed8;
}


/* top left */

.position-grid
[data-position="top-left"]::after {
    left: 6px;
    top: 6px;
}


/* top center */

.position-grid
[data-position="top-center"]::after {
    left: 50%;
    top: 6px;

    transform: translateX(-50%);
}


/* top right */

.position-grid
[data-position="top-right"]::after {
    right: 6px;
    top: 6px;
}


/* middle left */

.position-grid
[data-position="middle-left"]::after {
    left: 6px;
    top: 50%;

    transform: translateY(-50%);
}


/* center */

.position-grid
[data-position="center"]::after {
    left: 50%;
    top: 50%;

    transform:
        translate(-50%, -50%);
}


/* middle right */

.position-grid
[data-position="middle-right"]::after {
    right: 6px;
    top: 50%;

    transform: translateY(-50%);
}


/* bottom left */

.position-grid
[data-position="bottom-left"]::after {
    left: 6px;
    bottom: 6px;
}


/* bottom center */

.position-grid
[data-position="bottom-center"]::after {
    left: 50%;
    bottom: 6px;

    transform: translateX(-50%);
}


/* bottom right */

.position-grid
[data-position="bottom-right"]::after {
    right: 6px;
    bottom: 6px;
}


/* ============================================================
   SWITCH
============================================================ */

.switch-row {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 12px;

    color: #444444;

    font-size: 13px;

    cursor: pointer;
}

.switch-row input {
    width: 19px;
    height: 19px;

    flex: 0 0 auto;

    accent-color: #236ed8;
}

.repeat-settings {
    margin-top: 15px;
}


/* ============================================================
   EXPORT QUALITY
============================================================ */

.export-quality {
    margin-top: 15px;
}


/* ============================================================
   SETTING HINT
============================================================ */

.setting-hint {
    margin: 10px 0 0;

    color: #777777;

    font-size: 11px;
    line-height: 1.45;
}


/* ============================================================
   DISABLED BLOCK
============================================================ */

.settings-block.disabled {
    opacity: 0.55;

    pointer-events: none;
}


/* ============================================================
   EXPORT
============================================================ */

.export-section {
    margin-top: 30px;
    padding-top: 25px;

    border-top: 1px solid #dddddd;
}

.export-section h2 {
    margin: 0 0 14px;

    text-align: center;

    font-size: 20px;
}

.result-info {
    min-height: 18px;

    margin: 10px auto 0;

    color: #777777;

    text-align: center;

    font-size: 12px;
}

.download-button {
    display: block;

    width: 100%;
    max-width: 500px;

    margin: 16px auto 0;

    padding: 15px;

    border: 0;
    border-radius: 7px;

    background: #16813b;
    color: #ffffff;

    font-size: 17px;
    font-weight: 700;
}

.download-button:hover:not(:disabled) {
    background: #116c30;
}

.download-button:disabled {
    cursor: wait;

    opacity: 0.65;
}


/* ============================================================
   TEXT CONTENT
============================================================ */

.text-content {
    width: 100%;
    max-width: 850px;

    margin: 35px auto 0;
    padding: 25px;

    border-radius: 10px;

    background: #ffffff;
}

.text-content h2 {
    margin: 25px 0 10px;

    font-size: 22px;
}

.text-content h2:first-child {
    margin-top: 0;
}

.text-content p,
.text-content li {
    color: #555555;

    line-height: 1.65;
}

.text-content ol {
    padding-left: 22px;
}


/* ============================================================
   FOCUS
============================================================ */

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
.upload-button:focus-visible,
.logo-upload-button:focus-visible,
.tool-link:focus-visible {
    outline: 2px solid #236ed8;
    outline-offset: 2px;
}


/* ============================================================
   TABLET
============================================================ */

@media (max-width: 950px) {

    .workspace {
        grid-template-columns:
            minmax(0, 1fr)
            275px;

        gap: 15px;
    }

}


/* ============================================================
   MOBILE
============================================================ */

@media (max-width: 800px) {

    body {
        background: #ffffff;
    }


    .header-inner {
        padding: 13px 0;
    }


    .header-note {
        display: none;
    }


    .page {
        width: 100%;

        margin:
            20px
            0
            0;
    }


    .intro {
        padding:
            0
            15px;
    }


    .intro h1 {
        font-size: 26px;
    }


    .tools-nav {
        padding:
            0
            15px;

        justify-content: flex-start;

        flex-wrap: nowrap;

        overflow-x: auto;

        -webkit-overflow-scrolling: touch;

        scrollbar-width: thin;
    }


    .tool-link {
        flex: 0 0 auto;

        white-space: nowrap;
    }


    .editor-card {
        padding: 15px;

        border-radius: 0;

        box-shadow: none;
    }


    .workspace {
        grid-template-columns:
            1fr;

        gap: 18px;
    }


    .preview-wrap {
        height: min(105vw, 620px);
        min-height: 420px;

        padding: 18px;

        border-radius: 7px;
    }


    .settings {
        display: grid;

        grid-template-columns:
            1fr
            1fr;

        gap: 10px;
    }


    .settings-block:last-child {
        grid-column:
            1 /
            -1;
    }


    .text-content {
        margin-top: 20px;

        border-radius: 0;
    }

}


/* ============================================================
   SMALL MOBILE
============================================================ */

@media (max-width: 520px) {

    .page {
        margin-top: 16px;
    }


    .intro {
        margin-bottom: 16px;
    }


    .intro h1 {
        font-size: 24px;
    }


    .intro p {
        font-size: 14px;
    }


    .editor-card {
        padding: 12px;
    }


    .editor-toolbar {
        flex-direction: column;
    }


    .secondary-button {
        width: 100%;
    }


    .upload-box {
        min-height: 240px;

        padding:
            25px
            15px;
    }


    .upload-box strong {
        font-size: 19px;
    }


    .preview-wrap {
        height: min(112vw, 520px);
        min-height: 330px;

        padding: 12px;
    }


    .canvas-help {
        padding:
            0
            5px;
    }


    .settings {
        grid-template-columns:
            1fr;
    }


    .settings-block:last-child {
        grid-column: auto;
    }


    .settings-block {
        padding: 13px;
    }


    .two-fields {
        grid-template-columns:
            1fr;
    }


    .position-grid {
        width: 150px;
    }


    .download-button {
        font-size: 16px;
    }


    .text-content {
        padding:
            20px
            16px;
    }


    .text-content h2 {
        font-size: 20px;
    }

}


/* ============================================================
   VERY SMALL MOBILE
============================================================ */

@media (max-width: 360px) {

    .preview-wrap {
        min-height: 290px;
    }


    .mode-buttons {
        grid-template-columns:
            1fr;
    }


    .small-buttons {
        grid-template-columns:
            1fr
            1fr
            1fr;
    }

}