*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #1a1817;
    touch-action: none;
    font-family: 'Courier Prime', sans-serif;
}

/* Infinite Canvas Area */
#world {
    position: absolute;
    width: 3000px;
    height: 3000px;
    transform-origin: 0 0;
}

/* Card Common Style */
.card {
    position: absolute;
    cursor: grab;
    overflow: visible !important;
}

body.edit .card {
    cursor: grab;
}

/* Rotation handle style */
.rotate-handle {
    position: absolute;
    right: -12px;
    bottom: -12px;
    width: 26px;
    height: 26px;
    background: #fff;
    border: 2px solid #333;
    border-radius: 50%;
    cursor: alias;
    display: none;
    /* 기본 숨김 */
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 30;
    user-select: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Show rotary handle only when in edit mode */
body.edit .rotate-handle {
    display: flex;
}

.rotate-handle:hover {
    background: #eee;
    transform: scale(1.1);
}

/* Edit mode-only UI control */
.edit-only {
    display: none !important;
}

body.edit .edit-only {
    display: flex !important;
}

/* Toolbar style */
#toolbar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    z-index: 9999;
}

.edit-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tb-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ccc;
    padding: 7px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: 0.2s;
}

.tb-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Yellow Masking Tape Style */
.tape {
    position: absolute;
    background-color: rgba(245, 230, 150, 0.6);
    background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.02));
    backdrop-filter: blur(1px);
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.1);
    border-left: 1px dashed rgba(0, 0, 0, 0.08);
    border-right: 1px dashed rgba(0, 0, 0, 0.08);
    z-index: 10;
    pointer-events: none;
}

/* a note card */
.note-card {
    padding: 15px;
    box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.3);
}

.note-content {
    outline: none;
    min-height: 1em;
    white-space: pre-wrap;
    font-size: 16px;
}

/* delete button */
.del-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 20px;
    height: 20px;
    background: #cc3333;
    color: #fff;
    border-radius: 50%;
    text-align: center;
    line-height: 18px;
    cursor: pointer;
    display: none;
    font-family: sans-serif;
    z-index: 20;
}

body.edit .del-btn {
    display: block;
}

/* Top Status UI */
#zoom-badge {
    position: fixed;
    top: 16px;
    right: 20px;
    color: rgba(255, 255, 255, 0.2);
    font-size: 13px;
    pointer-events: none;
}

#hint {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.3);
    font-size: 13px;
    pointer-events: none;
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 99998;
    opacity: 0;
    transition: opacity 0.3s;
}

#loading-overlay span {
    color: rgba(255, 255, 255, 0.25);
    font-size: 14px;
    letter-spacing: 0.08em;
    font-family: 'Noto Sans KR', sans-serif;
}

/* a photo card */
.photo-card {
    background: #f4ede0;
    padding: 10px 10px 10px;
    box-shadow: 3px 5px 15px rgba(0, 0, 0, 0.3);
}

.photo-img-wrap img {
    width: 100%;
    display: block;
    border-radius: 2px;
}

.photo-caption {
    margin-top: 8px;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 12px;
    color: #555;
    text-align: center;
    line-height: 1.4;
    word-break: break-all;
    padding-bottom: 4px;
    outline: none;
    min-height: 1em;
}

.photo-caption:empty::before {
    content: attr(data-placeholder);
    color: #bbb;
    pointer-events: none;
}

body.edit .photo-img-wrap {
    cursor: pointer;
}

body.edit .photo-img-wrap:hover img,
body.edit .photo-img-wrap:hover .photo-placeholder {
    opacity: 0.75;
}

.photo-placeholder {
    width: 100%;
    height: 140px;
    background: #e0d8cc;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-placeholder span {
    font-size: 28px;
    color: #b0a898;
    line-height: 1;
}

.color-panel {
    position: absolute;
    top: -60px;
    left: 0;
    display: none;
    gap: 6px;
    padding: 6px 8px;
    background: rgba(30, 30, 30, 0.9);
    border-radius: 10px;
    backdrop-filter: blur(6px);
    z-index: 50;
}

.color-panel input {
    width: 28px;
    height: 28px;
    border: none;
    cursor: pointer;
}

body.edit .card.active .color-panel {
    display: flex;
}