/* 画布背景色圆圈选择器样式 */
.bg-color-circle {
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 4px 0 rgb(0 0 0 / 6%);
    position: relative;
}
.bg-color-circle.selected {
    border-color: #2196F3 !important;
    box-shadow: 0 0 0 2px #2196F333;
}
.bg-color-circle:hover {
    border-color: #2196F3;
}
.bg-color-circle input[type=color] {
    cursor: pointer;
}
.overflow-hidden {
    overflow: hidden
}

.block {
    display: block
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0
}

.mb-2 {
    margin-bottom: .5rem
}

.mb-4 {
    margin-bottom: 1rem
}

.mb-6 {
    margin-bottom: 1.5rem
}

.border-t {
    border-top-width: 1px
}

.border-gray-200 {
    --tw-border-opacity: 1;
    border-color: rgb(229 231 235 / var(--tw-border-opacity))
}

.pt-4 {
    padding-top: 1rem
}

.mt-4 {
    margin-top: 1rem
}

.w-full {
    width: 100%
}

.text-center {
    text-align: center
}

.p-1 {
    padding: .25rem
}

.border {
    border-width: 1px;
    border-style: solid
}

.rounded {
    border-radius: .25rem
}

.font-medium {
    font-weight: 500
}

.text-sm {
    font-size: .875rem;
    line-height: 1.25rem
}

.grid {
    display: grid
}

.grid-cols-2 {
    grid-template-columns: repeat(2,minmax(0,1fr))
}

.grid-cols-3 {
    grid-template-columns: repeat(3,minmax(0,1fr))
}

.grid-cols-4 {
    grid-template-columns: repeat(4,minmax(0,1fr))
}

.gap-2 {
    gap: .5rem
}

.flex {
    display: flex
}

.flex-col {
    flex-direction: column
}

.space-y-3>:not([hidden])~:not([hidden]) {
    margin-top: .75rem
}

.fixed {
    position: fixed
}

.bottom-5 {
    bottom: 1.25rem
}

.right-5 {
    right: 1.25rem
}

.text-white {
    color: #fff
}

.py-2 {
    padding-top: .5rem;
    padding-bottom: .5rem
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem
}

.shadow-xl {
    box-shadow: 0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a
}

.translate-x-120 {
    transform: translate(120%)
}

.transition-transform {
    transition-property: transform;
    transition-timing-function: cubic-bezier(.4,0,.2,1);
    transition-duration: .15s
}

.duration-300 {
    transition-duration: .3s
}

:root {
    --font-sans: "Inter", "sans-serif";
    --bg-main: #f4f5f7;
    --bg-sidebar: #ffffff;
    --bg-nav: #ffffff;
    --text-primary: #172b4d;
    --text-secondary: #42526e;
    --text-muted: #6b7f99;
    --border-color: #dfe1e6;
    --primary-accent: #808181;
    --primary-accent-hover: #3dc14f;
    --nav-height: 60px;
    --sidebar-width: 320px;
    --shadow-sm: 0 1px 1px rgba(9, 30, 66, .15);
    --shadow-md: 0 4px 8px -2px rgba(9, 30, 66, .25), 0 0 1px rgba(9, 30, 66, .31);
    --radius-sm: 3px;
    --radius-md: 6px
}

*,*:before,*:after {
    box-sizing: border-box
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale
}

body.overflow-hidden {
    overflow: hidden
}

input[type=file] {
    display: none
}

.hidden {
    display: none!important
}

#app-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-height);
    padding: 0 24px;
    background-color: #eeefee;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
     z-index: 1001;
}

.logo-icon {
    height: 80px;
    width: auto;
    object-fit: contain;
    margin-right: 20px;
    margin-top: 11px;

}

.nav-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary)
}

.nav-title a {
    color: var(--text-primary);
    text-decoration: none
}

.nav-links {
    display: flex;
    gap: 28px
}

.nav-links a {
    font-size: .9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color .2s ease
}

.nav-links a:hover {
    color: var(--primary-accent)
}

#app-container {
    display: flex;
    height: 100vh;
    padding-top: var(--nav-height);
    position: relative;
    overflow-x: hidden
}

#left-sidebar,#right-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background-color: var(--bg-sidebar);
    position: relative;
    transition: all .3s ease-in-out;
    height: calc(100vh - var(--nav-height));
    display: flex;
    flex-direction: column
}

#left-sidebar {
    border-right: 1px solid var(--border-color)
}

#right-sidebar {
    border-left: 1px solid var(--border-color)
}

#center-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    height: calc(100vh - var(--nav-height));
    overflow: auto
}

.collage-wrapper {
    background-color: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md)
}

#layout-wrapper {
    display: flex;
    width: 100%;
    max-height: 100%
}

#layout-grid {
    flex: 1;
    display: grid;
    position: relative
}

#stitching-wrapper {
    display: inline-block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    overflow: auto
}

#stitching-grid {
    display: inline-flex;
    width: auto;
    height: auto
}

#stitching-grid.horizontal {
    flex-direction: row;
    align-items: flex-start
}

#stitching-grid.vertical {
    flex-direction: column;
    align-items: center
}

#stitching-grid.horizontal img {
    height: 400px;
    width: auto
}

#stitching-grid.vertical img {
    width: 600px;
    height: auto
}

#stitching-grid.is-sortable>img:hover {
    cursor: grab
}

#stitching-grid>img.dragging {
    opacity: .5;
    cursor: grabbing;
    transform: scale(1.03);
    box-shadow: 0 10px 20px #0003
}

.stitched-image-container {
    position: relative;
    display: block;
    line-height: 0
}

.delete-stitched-image-btn,.add-stitched-image-btn {
    position: absolute;
    top: 10px;
    z-index: 10;
    width: 28px;
    height: 28px;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 22px;
    font-weight: 700;
    line-height: 26px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s ease-in-out,transform .2s ease-in-out;
    transform: scale(.8)
}

.stitched-image-container:hover .delete-stitched-image-btn,.stitched-image-container:hover .add-stitched-image-btn {
    opacity: 1;
    transform: scale(1)
}

.delete-stitched-image-btn {
    right: 10px;
    background-color: #0009
}

.delete-stitched-image-btn:hover {
    background-color: #ff0000b3
}

.add-stitched-image-btn {
    right: 48px;
    background-color: #008000b3;
    font-size: 24px;
    line-height: 25px
}

.add-stitched-image-btn:hover {
    background-color: #009600e6
}

.stitched-image-container.drag-over {
    opacity: .5;
    transition: opacity .2s ease-in-out
}

.grid-cell.dragging {
    opacity: .4;
    border: 2px dashed var(--primary-accent)
}

#mode-switcher {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1.5rem
}

#mode-switcher button {
    flex: 1;
    padding: .625rem 0;
    font-weight: 500;
    font-size: .9rem;
    background-color: var(--bg-sidebar);
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: background-color .2s,color .2s
}

#mode-switcher button:first-child {
    border-right: 1px solid var(--border-color)
}

#mode-switcher button.active {
    background-color: var(--primary-accent);
    color: #fff
}

.panel {
    background-color: transparent;
    border: none;
    box-shadow: none;
    padding: 0
}

.panel-section-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border-color);
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .05em
}

.layout-group-title {
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 1.5rem;
    margin-bottom: .75rem;
    padding-bottom: 0;
    border-bottom: none;
    font-size: .875rem
}

.layout-thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: .75rem
}

.layout-thumbnail {
    border-radius: var(--radius-sm);
    background-color: #fafbfc;
    border: 1px solid transparent;
    cursor: pointer
}

.layout-thumbnail:hover {
    border-color: #c1c7d0
}

.layout-thumbnail.active {
    border-color: var(--primary-accent)
}

.thumbnail-grid {
    display: grid;
    width: 100%;
    aspect-ratio: 1 / 1;
    gap: 3px
}

.thumbnail-cell {
    background-color: #dfe1e6;
    border-radius: 1px
}

.layout-thumbnail.active .thumbnail-cell {
    background-color: var(--primary-accent)
}

#aspect-ratio-btns button,#stitching-direction-btns button {
    padding: .5rem;
    background-color: #fafbfc;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-weight: 500;
    color: var(--text-secondary);
    transition: all .2s ease;
    cursor: pointer
}

#aspect-ratio-btns button:hover,#stitching-direction-btns button:hover {
    background-color: #f4f5f7
}

#aspect-ratio-btns button.active,#stitching-direction-btns button.active {
    background-color: #e9f2ff;
    color: var(--primary-accent);
    border-color: var(--primary-accent);
    font-weight: 600
}

input[type=range] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: #dfe1e6;
    border-radius: 2px
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-accent);
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    cursor: pointer
}

input[type=range]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary-accent);
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    cursor: pointer
}

label {
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: left
}

input[type=color] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    padding: 0;
    background-color: transparent;
    cursor: pointer
}

input[type=color]::-webkit-color-swatch-wrapper {
    padding: 4px
}

input[type=color]::-webkit-color-swatch {
    border-radius: var(--radius-sm);
    border: none
}

.action-button {
    font-size: .875rem;
    font-weight: 500;
    padding: .625rem 1rem;
    border-radius: var(--radius-sm);
    transition: all .2s ease-out;
    border: 1px solid transparent;
    text-align: center
}

.action-button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm)
}

.action-button:active {
    transform: translateY(0);
    box-shadow: none
}

#download-btn {
    background-color: var(--primary-accent);
    color: #fff
}

#download-btn:hover {
    background-color: var(--primary-accent-hover)
}

#shuffle-btn,.action-button.secondary {
    background-color: #fafbfc;
    color: var(--text-secondary);
    border: 1px solid var(--border-color)
}

#shuffle-btn:hover:not(:disabled),.action-button.secondary:hover {
    background-color: #f4f5f7;
    border-color: #c1c7d0
}

.action-button:disabled,#shuffle-btn.disabled {
    background: #fafbfc!important;
    color: #a5adba!important;
    border-color: var(--border-color)!important;
    transform: none!important;
    box-shadow: none!important;
    cursor: not-allowed
}

.grid-cell {
    background-color: #f4f5f7;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none
}

.grid-cell.drag-over {
    box-shadow: inset 0 0 0 2px var(--primary-accent)
}

.grid-cell .hidden-file-input {
    display: none
}

.grid-cell.selected {
    outline: 3px solid #007BFF;
    outline-offset: -3px;
    box-shadow: 0 0 15px #007bff80
}

.cell-button-container {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 5px;
    z-index: 10
}

.cell-icon-btn {
    width: 28px;
    height: 28px;
    background-color: #0009;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s ease;
    opacity: 0;
    transform: scale(.8);
    pointer-events: none
}

.remove-btn {
    font-size: 24px;
    line-height: 28px
}

.cell-icon-btn svg {
    width: 16px;
    height: 16px
}

.grid-cell.has-image:hover .cell-icon-btn,.grid-cell.selected .cell-icon-btn {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto
}

.remove-btn:hover {
    background-color: #e53e3e
}

.replace-btn:hover {
    background-color: #007bff;
    transform: scale(1.1) rotate(90deg)
}

/* Ensure replace-style buttons (used by replace/rotate/crop) share the same visuals */
.cell-icon-btn.replace-btn {
    background-color: #0009;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s ease;
}

.cell-icon-btn.replace-btn svg {
    width: 16px;
    height: 16px;
}

.cell-icon-btn.replace-btn:hover {
    background-color: #007bff;
    transform: scale(1.1) rotate(90deg);
}

/* Modal styles for rotate/crop dialogs */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10010;
}

.modal-panel {
    background: #fff;
    padding: 14px;
    border-radius: 10px;
    min-width: 320px;
    max-width: 92vw;
    box-shadow: 0 12px 30px rgba(0,0,0,.28);
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}

.modal-panel.crop-panel {
    max-height: 86vh;
    overflow: auto;
}

.modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.modal-number-input {
    width: 90px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
}

.modal-range {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #e6e9ef;
    border-radius: 6px;
}

.modal-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-accent);
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: var(--shadow-sm);
}

.modal-btn-row, .modal-controls {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.modal-apply-btn {
    background-color: var(--primary-accent);
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.modal-cancel-btn {
    background: #f4f5f7;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.modal-apply-btn:hover { background: var(--primary-accent-hover); }
.modal-cancel-btn:hover { background: #eeeeee; }

.modal-canvas {
    max-width: 80vw;
    max-height: 60vh;
    border: 1px solid #e6e9ef;
    width: 100%;
    height: auto;
}

.modal-label { margin-right: 6px; font-weight: 600; color: var(--text-secondary); }

.zoom-in-btn:hover,.zoom-out-btn:hover {
    background-color: #28a745;
    transform: scale(1.2)
}

.reset-btn:hover {
    background-color: #ffc107;
    transform: scale(1.1) rotate(360deg)
}

.upload-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%
}

.upload-icon {
    width: 32px;
    height: 32px;
    color: var(--primary-accent);
    opacity: .6
}

.gutter {
    position: absolute;
    background: transparent;
    z-index: 20;
    transition: background-color .2s ease
}

.gutter-h {
    cursor: ns-resize;
    height: 10px;
    transform: translateY(-5px)
}

.gutter-v {
    cursor: ew-resize;
    width: 10px;
    transform: translate(-5px)
}

.gutter:hover {
    background: #39f6
}

#toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    color: #fff;
    font-weight: 500;
    z-index: 2000;
    transform: translateY(150%);
    opacity: 0;
    transition: transform .4s ease-in-out,opacity .4s ease-in-out
}

#toast.show {
    transform: translateY(0);
    opacity: 1
}

#toast.info {
    background-color: #263238
}

#toast.success {
    background-color: #28a745
}

#toast.error {
    background-color: #dc3545
}

#canvas-action-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px #0000000d
}

#canvas-action-toolbar .action-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500
}

.toolbar-group-left {
    display: flex;
    align-items: center;
    gap: 12px
}

body.stitching-mode #canvas-action-toolbar #shuffle-btn {
    display: none
}

#stitching-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 250px;
    height: 150px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color .2s,border-color .2s;
    margin: 2rem
}

#stitching-placeholder:hover {
    background-color: #fafbfc;
    border-color: var(--primary-accent)
}

#stitching-placeholder span {
    margin-top: .5rem;
    font-weight: 500
}

#stitching-placeholder.hidden {
    display: none
}

#canvas-hint {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translate(-50%);
    background-color: #172b4dcc;
    color: #fff;
    padding: .5rem 1rem;
    border-radius: var(--radius-md);
    font-size: .8rem;
    white-space: nowrap;
    opacity: 0;
    transform: translate(-50%,10px);
    transition: opacity .3s ease,transform .3s ease;
    pointer-events: none;
    z-index: 200
}

#layout-wrapper:hover~#canvas-hint {
    opacity: 1;
    transform: translate(-50%)
}

#quality-selector .action-button.active {
    background-color: #e9f2ff;
    color: var(--primary-accent);
    border-color: var(--primary-accent);
    font-weight: 600;
    box-shadow: inset 0 1px 2px #0000001a
}

@media (max-width: 768px) {
    #canvas-hint {
        display:none
    }
}

.text-element-container {
    position: absolute;
    transform: translate(-50%,-50%);
    padding: 10px;
    border: 2px dashed transparent;
    transition: border-color .2s ease
}

.text-element-container:hover {
    border-color: #0ea5e980
}

.text-element-container.selected {
    border-color: #0ea5e9;
    z-index: 10
}

.text-content {
    cursor: move;
    padding: 8px 12px;
    white-space: pre-wrap;
    outline: none;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,.5)
}

.text-content:focus {
    cursor: text
}

.text-toolbar,.delete-text-button {
    display: none
}

.text-element-container.selected .text-toolbar,.text-element-container.selected .delete-text-button {
    display: flex
}

.text-toolbar {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translate(-50%);
    margin-bottom: 8px;
    background: #2d3748;
    color: #fff;
    padding: 8px;
    border-radius: 6px;
    box-shadow: 0 4px 12px #0000004d;
    align-items: center;
    gap: 10px;
    z-index: 20
}

.text-toolbar input[type=number] {
    width: 60px;
    background-color: #4a5568;
    border: 1px solid #718096;
    color: #fff;
    padding: 4px;
    border-radius: 4px
}

.text-toolbar input[type=color] {
    width: 32px;
    height: 32px;
    padding: 2px;
    border: none;
    background: none;
    border-radius: 4px;
    cursor: pointer
}

.delete-text-button {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: #ef4444;
    color: #fff;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    font-family: sans-serif;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 20
}

.arrow-container {
    position: absolute;
    cursor: move;
    z-index: 5
}

.arrow-container.selected {
    z-index: 15
}

.arrow-container svg {
    width: 100%;
    height: 100%;
    overflow: visible
}

.arrow-handle {
    display: none;
    position: absolute;
    width: 14px;
    height: 14px;
    background-color: #fff;
    border: 2px solid #0ea5e9;
    border-radius: 50%;
    cursor: pointer;
    transform: translate(-50%,-50%)
}

.arrow-container.selected .arrow-handle {
    display: block
}

.arrow-container .text-toolbar,.arrow-container .delete-text-button {
    display: none
}

.arrow-container.selected .text-toolbar,.arrow-container.selected .delete-text-button {
    display: flex
}

.shape-container {
    position: absolute;
    border: 1px dashed transparent;
    transition: border-color .2s;
    z-index: 5
}

.shape-container.selected {
    border-color: #0ea5e9;
    z-index: 15
}

.shape-element {
    width: 100%;
    height: 100%;
    cursor: move
}

.shape-toolbar {
    display: none;
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translate(-50%);
    background: #2d3748;
    color: #fff;
    padding: 8px;
    border-radius: 6px;
    box-shadow: 0 4px 12px #0000004d;
    align-items: center;
    gap: 10px;
    z-index: 20
}

.shape-container.selected .shape-toolbar {
    display: flex
}

.shape-toolbar input[type=number] {
    width: 60px;
    background-color: #4a5568;
    border: 1px solid #718096;
    color: #fff;
    padding: 4px;
    border-radius: 4px
}

.shape-toolbar input[type=color] {
    width: 32px;
    height: 32px;
    padding: 2px;
    border: none;
    background: none;
    border-radius: 4px;
    cursor: pointer
}

.resize-handle {
    display: none;
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #fff;
    border: 2px solid #007bff;
    border-radius: 50%;
    transform: translate(-50%,-50%);
    z-index: 25
}

.shape-container.selected .resize-handle {
    display: block
}

.resize-handle.n {
    top: 0;
    left: 50%;
    cursor: ns-resize
}

.resize-handle.ne {
    top: 0;
    right: 0;
    transform: translate(50%,-50%);
    cursor: nesw-resize
}

.resize-handle.e {
    top: 50%;
    right: 0;
    transform: translate(50%,-50%);
    cursor: ew-resize
}

.resize-handle.se {
    bottom: 0;
    right: 0;
    transform: translate(50%,50%);
    cursor: nwse-resize
}

.resize-handle.s {
    bottom: 0;
    left: 50%;
    transform: translate(-50%,50%);
    cursor: ns-resize
}

.resize-handle.sw {
    bottom: 0;
    left: 0;
    transform: translate(-50%,50%);
    cursor: nesw-resize
}

.resize-handle.w {
    top: 50%;
    left: 0;
    transform: translate(-50%,-50%);
    cursor: ew-resize
}

.resize-handle.nw {
    top: 0;
    left: 0;
    cursor: nwse-resize
}

.rotation-handle {
    display: none;
    position: absolute;
    left: 50%;
    top: -25px;
    transform: translate(-50%);
    width: 16px;
    height: 16px;
    background-color: #f59e0b;
    border: 2px solid white;
    border-radius: 50%;
    cursor: alias
}

.rotation-handle:before {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translate(-50%);
    width: 2px;
    height: 15px;
    background-color: #f59e0b
}

.arrow-container.selected .rotation-handle {
    display: block
}

.toolbar-delete-btn {
    background: #ef4444;
    color: #fff;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    transition: background-color .2s
}

.toolbar-delete-btn:hover {
    background: #dc2626
}

.action-button.danger {
    background-color: #ef4444;
    color: #fff
}

.action-button.danger:hover {
    background-color: #dc2626
}

.mobile-nav-btn {
    display: none;
    background: none;
    border: none;
    padding: 4px;
    color: var(--text-primary);
    cursor: pointer
}

#mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #091e4280;
    z-index: 999;
    transition: opacity .3s ease
}

#mobile-overlay.hidden {
    opacity: 0;
    pointer-events: none
}

body.sidebar-open {
    overflow: hidden
}

.sidebar-content-wrapper {
    width: 100%;
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0
}

#left-sidebar,#right-sidebar,#pc-toggle-left,#pc-toggle-right {
    transition: all .3s ease-in-out
}

.pc-sidebar-toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 48px;
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 50;
    color: var(--text-muted)
}

.pc-sidebar-toggle:hover {
    background-color: var(--primary-accent);
    color: #fff;
    border-color: var(--primary-accent)
}

#pc-toggle-left {
    left: calc(var(--sidebar-width) - 2px);
    border-radius: 0 6px 6px 0
}

#pc-toggle-right {
    right: calc(var(--sidebar-width) - 2px);
    border-radius: 6px 0 0 6px
}

#app-container.left-sidebar-collapsed #left-sidebar {
    margin-left: calc(-1 * var(--sidebar-width))
}

#app-container.left-sidebar-collapsed #pc-toggle-left {
    left: -2px
}

#app-container.left-sidebar-collapsed #pc-toggle-left svg {
    transform: scaleX(-1)
}

#app-container.right-sidebar-collapsed #right-sidebar {
    margin-right: calc(-1 * var(--sidebar-width))
}

#app-container.right-sidebar-collapsed #pc-toggle-right {
    right: -2px
}

#app-container.right-sidebar-collapsed #pc-toggle-right svg {
    transform: scaleX(-1)
}

.grid-cell.has-image {
    cursor: grab
}

.grid-cell.has-image.is-panning {
    cursor: grabbing
}

@media (max-width: 768px) {
    body,body.overflow-hidden {
        overflow:auto
    }

    .pc-sidebar-toggle {
        display: none
    }

    #app-nav {
        padding: 0 16px;
        justify-content: space-between
    }

    .nav-title {
        font-size: 1.1rem;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%,-50%);
        max-width: calc(100% - 120px);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .nav-links {
        display: none
    }

    .mobile-nav-btn {
        display: block
    }

    #app-container {
        flex-direction: column;
        height: auto;
        padding-top: var(--nav-height)
    }

    #center-content {
        order: 1;
        padding: 1rem;
        min-height: 50vh;
        height: auto
    }

    #left-sidebar {
        order: 2
    }

    #right-sidebar {
        order: 3
    }

    #left-sidebar,#right-sidebar {
        width: 280px;
        height: 100%;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1000;
        border: none;
        padding-top: var(--nav-height);
        box-shadow: var(--shadow-md);
        transform: translate(-100%);
        transition: transform .3s ease-in-out
    }

    #right-sidebar {
        left: auto;
        right: 0;
        transform: translate(100%)
    }

    #left-sidebar.is-open,#right-sidebar.is-open {
        transform: translate(0)
    }

    #stitching-grid.vertical img {
        width: 100%;
        height: auto
    }

    #stitching-grid.horizontal img {
        height: 200px;
        width: auto
    }

    .layout-thumbnail-grid {
        grid-template-columns: repeat(auto-fill,minmax(65px,1fr))
    }

    .action-button,#mode-switcher button {
        padding: .8rem 1rem
    }

    #aspect-ratio-btns {
        grid-template-columns: repeat(auto-fill,minmax(80px,1fr))
    }

    #canvas-action-toolbar .action-button span {
        display: none
    }

    #canvas-action-toolbar .action-button {
        padding: 10px;
        justify-content: center;
        gap: 0
    }
}

/* ===== 右侧设置卡片样式（来自 zh/index.html 内联样式已迁移） ===== */
#right-sidebar .settings-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06), 0 2px 6px rgba(2,6,23,0.04);
    border: 1px solid rgba(15, 23, 42, 0.05);
    transition: transform 120ms ease, box-shadow 120ms ease;
}

@media (max-width: 640px) {
    #right-sidebar .settings-card { padding: 10px; border-radius: 8px; }
}

#right-sidebar .settings-card > .panel-section-title,
#right-sidebar .settings-card h3.panel-section-title {
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
    display: block;
}

#right-sidebar .settings-card .mb-4 { margin-bottom: 12px; }
#right-sidebar .settings-card .grid { gap: 8px; }

#right-sidebar .settings-card .bg-color-circle { box-shadow: 0 1px 2px rgba(2,6,23,0.06); }

#right-sidebar .settings-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(15,23,42,0.08); }

/* ===== end migrated card styles ===== */

/* 通用 settings-card（适用于左右侧栏） */
.settings-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06), 0 2px 6px rgba(2,6,23,0.04);
    border: 1px solid rgba(15, 23, 42, 0.05);
    transition: transform 120ms ease, box-shadow 120ms ease;
}

@media (max-width: 640px) {
    .settings-card { padding: 10px; border-radius: 8px; }
}

.settings-card > .panel-section-title,
.settings-card h3.panel-section-title {
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
    display: block;
}

.settings-card .mb-4 { margin-bottom: 12px; }
.settings-card .grid { gap: 8px; }

.settings-card .bg-color-circle { box-shadow: 0 1px 2px rgba(2,6,23,0.06); }

.settings-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(15,23,42,0.08); }

/* 将布局缩略图也呈现为卡片式小面板 */
.layout-thumbnail {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease;
}
.layout-thumbnail:hover { transform: translateY(-4px); box-shadow: 0 10px 22px rgba(15,23,42,0.06); }
.layout-thumbnail.active { border-color: var(--primary-accent); box-shadow: 0 8px 18px rgba(2,78,255,0.06); }
