:root {
    --tiny-note-size: 120px;
}

.tiny-note {
    width: var(--tiny-note-size);
    height: var(--tiny-note-size);
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
    user-select: none;
}

.tiny-note-thumb {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
}

.tiny-note-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tiny-note-overlays {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 8px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    pointer-events: none;
}

.tiny-note-scope {
    pointer-events: none;
}

.tiny-note-rating {
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 12px;
    line-height: 1;
}

/* 0 = gris, >0 = blanco (mismo estilo visual que el overlay de NoteCard) */
.tiny-note-rating.is-zero {
    color: rgba(230, 237, 246, 0.55);
}

.tiny-note-rating.is-active {
    color: rgba(230, 237, 246, 0.92);
}

.tiny-note-rating-star {
    font-size: 12px;
    transform: translateY(-0.5px);
}

.tiny-note-rating-num {
    font-weight: 700;
}

.tiny-note-title {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 6px 7px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: rgba(230, 237, 246, 0.92);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tiny-note.is-draggable {
    cursor: grab;
}

.tiny-note.is-draggable:active {
    cursor: grabbing;
}

.tiny-note-drag-handle {
    pointer-events: auto;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(230, 237, 246, 0.75);
    font-size: 12px;
    line-height: 1;
}

/* =========================================================
   Shared UI — ScopeBadge
   Keep the exact icon + palette used in notes_explorer.css.
   TinyNote uses ScopeBadge in compact mode and Story Map pages
   don't include notes_explorer.css, so styles must live here too.
   ========================================================= */

.scope-badge {
    display: inline-flex;
    align-items: center;
    /* icon + text vertically centered */
    gap: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    /* less rounded as requested */
    border: 1px solid transparent;
    font-size: 13px;
    line-height: 1;
    font-family: inherit;
    font-weight: 700;
    /* badge text bold */
    color: inherit;
    vertical-align: middle;
    white-space: nowrap;
    flex: none;
    /* do not stretch; only occupy content width */
}

.scope-badge.is-compact {
    padding: 4px 8px;
    gap: 6px;
    font-size: 12px;
}

.scope-badge.is-compact .scope-icon,
.scope-badge.is-compact .scope-label {
    font-size: 12px;
}

.scope-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    line-height: 1;
}

.scope-label {
    display: inline-block;
    font-size: 13px;
    line-height: 1;
    color: inherit;
    font-weight: 700;
    /* ensure label is bold */
}

/* Per-scope exact palette (no shadows, no gradients) */
.scope-badge[data-scope="episode"] {
    background: #dec0f3;
    border-color: rgb(219, 187, 247);
    color: #6e3f8a;
}

.scope-badge[data-scope="act"] {
    background: #cabaf7;
    border-color: #D6C9FF;
    color: #4f31af;
}

.scope-badge[data-scope="sequence"] {
    background: #bacff7;
    border-color: #BFD3FF;
    color: #2F5FB3;
}

.scope-badge[data-scope="scene"] {
    background: #E9F7EF;
    border-color: #BFE3CF;
    color: #166A43;
}

.scope-badge[data-scope="note"] {
    background: #F2F2F2;
    border-color: #D6D6D6;
    color: #555555;
}

.scope-badge[data-scope="unassigned"] {
    background: #2b2b2b;
    border-color: rgba(255, 255, 255, 0.20);
    color: rgba(255, 255, 255, 0.85);
}

.scope-badge[data-scope="episode"],
.scope-badge[data-scope="act"] {
    border-width: 2px;
}

.scope-badge[data-scope="sequence"],
.scope-badge[data-scope="scene"],
.scope-badge[data-scope="note"] {
    border-width: 1px;
}

/* Click preview popover */
.tiny-note-popover {
    position: fixed;
    width: 260px;
    max-width: calc(100vw - 16px);
    background: rgba(20, 25, 33, 0.98);
    color: rgba(230, 237, 246, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
    z-index: 9999;
    overflow: hidden;
}

.tiny-note-popover-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 10px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.tiny-note-popover-title {
    font-size: 13px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tiny-note-popover-close {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(230, 237, 246, 0.90);
    border-radius: 10px;
    width: 30px;
    height: 28px;
    cursor: pointer;
}

.tiny-note-popover-body {
    padding: 10px;
}

.tiny-note-popover-text {
    white-space: pre-wrap;
    font-size: 12px;
    color: rgba(230, 237, 246, 0.80);
}