:root {
    --bg-color: var(--tg-theme-bg-color, #ffffff);
    --secondary-bg: var(--tg-theme-secondary-bg-color, #f4f4f7);
    --text-color: var(--tg-theme-text-color, #000000);
    --hint-color: var(--tg-theme-hint-color, #999999);
    --link-color: var(--tg-theme-link-color, #2481cc);
    --button-color: var(--tg-theme-button-color, #2481cc);
    --button-text: var(--tg-theme-button-text-color, #ffffff);
    --card-bg: var(--tg-theme-bg-color, #ffffff);
}

body {
    background-color: var(--secondary-bg);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

header {
    padding: 16px;
    display: flex;
    align-items: center;
    background-color: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

h1 {
    font-size: 18px;
    margin: 0;
    flex-grow: 1;
    font-weight: 700;
}

#back-button {
    background: none;
    border: none;
    color: var(--link-color);
    font-size: 16px;
    cursor: pointer;
    padding: 8px 8px 8px 0;
    margin-right: 4px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

#delete-button {
    background: none;
    border: none;
    color: #ff3b30; /* Красный цвет удаления */
    font-size: 16px;
    cursor: pointer;
    padding: 8px 0 8px 8px;
    font-weight: 500;
}

.list {
    padding: 12px;
    display: block; /* Убираем flex gap для надежности в Safari */
}

/* Сама карточка */
.note-item {
    padding: 16px;
    background-color: var(--card-bg);
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    position: relative;
    border: 1px solid rgba(0,0,0,0.03);
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.note-item:active {
    background-color: var(--bg-color);
}

.note-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background-color: var(--secondary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--link-color);
}

.note-icon.youtube {
    color: #ff0000;
}

.note-icon.article {
    color: var(--link-color);
}

.note-content {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.note-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    line-height: 1.3;
}

.note-preview {
    font-size: 13px;
    color: var(--hint-color);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    opacity: 0.85;
}

.note-footer {
    display: flex;
    justify-content: flex-start;
    margin-top: 8px;
}

.note-date {
    font-size: 12px;
    color: var(--hint-color);
}

#youtube-player-container {
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16/9;
    background: #000;
    position: relative;
}

.play-button-lite {
    width: 68px;
    height: 48px;
    transition: filter 0.1s cubic-bezier(0.4, 0, 1, 1);
}

.play-button-bg {
    fill: #212121;
    fill-opacity: 0.8;
}

#youtube-player-container:hover .play-button-bg {
    fill: #ff0000;
    fill-opacity: 1;
}

#youtube-player-container:active .play-button-bg {
    fill: #ff0000;
    fill-opacity: 1;
}

.content-wrapper {
    padding: 12px;
}

.content-card {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 20px;
    line-height: 1.6;
    font-size: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

#detail-meta {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding-bottom: 24px;
}

#detail-url, .danger-link {
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 10px;
}

#detail-url {
    color: var(--link-color);
    background-color: rgba(36, 129, 204, 0.1);
}

.danger-link {
    color: #ff3b30;
    background: none;
    border: none;
    cursor: pointer;
}

.danger-link:active {
    background-color: rgba(255, 59, 48, 0.1);
}

.hidden {
    display: none !important;
}

.loading, .empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--hint-color);
}

.content-card br {
    content: "";
    display: block;
    margin-top: 8px;
}

b, strong { font-weight: 700; color: var(--text-color); }
i, em { font-style: italic; }
