:root {
    --bg-oled: #0B0D10;
    --glass-bg: rgba(24, 28, 36, 0.85);
    --glass-bg-elevated: rgba(30, 35, 46, 0.88);
    --glass-bg-recessed: rgba(13, 16, 22, 0.82);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-strong: rgba(255, 255, 255, 0.14);
    --accent-blue: #2997FF;
    --accent-blue-glow: rgba(41, 151, 255, 0.35);
    --accent-green: #30D158;
    --accent-green-glow: rgba(48, 209, 88, 0.35);
    --accent-red: #FF453A;
    --accent-yellow: #FFD60A;
    --accent-amber: #FF9F0A;
    --text-primary: #F5F7FA;
    --text-secondary: #C7CBD6;
    --text-muted: #8E8E93;
    --radius-card: 20px;
    --radius-pill: 14px;
}

* {
    box-sizing: border-box;
    -webkit-user-select: none;
    user-select: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hidden {
    display: none !important;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    background-color: #050608;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(41, 151, 255, 0.10), transparent 42%),
        radial-gradient(circle at 80% 80%, rgba(48, 209, 88, 0.08), transparent 42%);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    overscroll-behavior: none;
}

button, select {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    font-family: inherit;
}

/* Tabular numbers для стабильной ширины всех числовых значений */
.tabular-nums,
#dayNum,
#workoutNum,
#quickWeightReduceValueBadge,
#numWheelV1,
#numWheelV2,
.wheel-item,
.date-badge,
.tempo-side-badge,
#tableBody td:nth-child(6),
#tableBody td:nth-child(7),
#tableBody td:nth-child(8) {
    font-variant-numeric: tabular-nums;
}

/* =========================================================
   Десктопная рамка iPhone 13 Landscape (844x390)
   ========================================================= */
.iphone-container {
    position: relative;
    background-color: var(--bg-oled);
    background-image:
        radial-gradient(ellipse 65% 55% at 14% 0%, rgba(41, 151, 255, 0.14), transparent 65%),
        radial-gradient(ellipse 55% 55% at 92% 100%, rgba(48, 209, 88, 0.10), transparent 65%),
        radial-gradient(ellipse 40% 40% at 50% 50%, rgba(255, 255, 255, 0.02), transparent 70%);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 30px 70px -15px rgba(0, 0, 0, 0.85),
        0 0 0 1px rgba(255, 255, 255, 0.08),
        0 0 50px rgba(41, 151, 255, 0.08);
    width: 844px;
    height: 390px;
    border: 11px solid #161920;
    border-radius: 48px;
}

.desktop-notch {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 24px;
    height: 156px;
    background-color: #161920;
    border-top-right-radius: 16px;
    border-bottom-right-radius: 16px;
    z-index: 80;
    display: block;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
}

.desktop-home-indicator {
    position: absolute;
    bottom: 50%;
    right: 7px;
    transform: translateY(50%) rotate(90deg);
    width: 134px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    z-index: 80;
    display: block;
    pointer-events: none;
}

.app-layer {
    padding-top: 8px;
    padding-bottom: 8px;
    padding-left: calc(env(safe-area-inset-left, 0px) + 32px);
    padding-right: calc(env(safe-area-inset-right, 0px) + 18px);
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: transparent;
    position: relative;
    overflow: hidden;
}

/* =========================================================
   Стекломорфизм, карточки и объёмные кнопки
   ========================================================= */
.glass-panel {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-card);
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.glass-subcard {
    background: rgba(16, 19, 26, 0.72);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.glass-btn {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.11) 0%, rgba(255, 255, 255, 0.04) 100%);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: var(--text-primary);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.30),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
    transition: transform 0.14s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.glass-btn:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.07) 100%);
    border-color: rgba(255, 255, 255, 0.16);
}
.glass-btn:active {
    transform: scale(0.97);
}

.btn-accent-blue {
    background: linear-gradient(180deg, #43A7FF 0%, #2997FF 52%, #147CE5 100%);
    border: 1px solid rgba(118, 192, 255, 0.45);
    color: #FFFFFF;
    box-shadow:
        0 6px 18px rgba(41, 151, 255, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.32);
    transition: transform 0.14s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.btn-accent-blue:hover {
    filter: brightness(1.06);
}
.btn-accent-blue:active {
    transform: scale(0.97);
}

.btn-accent-blue-soft {
    background: linear-gradient(180deg, rgba(41, 151, 255, 0.24) 0%, rgba(41, 151, 255, 0.12) 100%);
    border: 1px solid rgba(41, 151, 255, 0.38);
    color: #64B8FF;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transition: transform 0.14s ease, background 0.18s ease;
}
.btn-accent-blue-soft:hover {
    background: linear-gradient(180deg, rgba(41, 151, 255, 0.32) 0%, rgba(41, 151, 255, 0.16) 100%);
}
.btn-accent-blue-soft:active {
    transform: scale(0.97);
}

.btn-accent-green {
    background: linear-gradient(180deg, #45E06C 0%, #30D158 55%, #20B246 100%);
    border: 1px solid rgba(124, 240, 154, 0.45);
    color: #051B0B;
    box-shadow:
        0 6px 18px rgba(48, 209, 88, 0.30),
        inset 0 1px 0 rgba(255, 255, 255, 0.34);
    transition: transform 0.14s ease, filter 0.18s ease;
}
.btn-accent-green:hover {
    filter: brightness(1.05);
}
.btn-accent-green:active {
    transform: scale(0.97);
}

.btn-accent-danger-soft {
    background: linear-gradient(180deg, rgba(255, 69, 58, 0.22) 0%, rgba(255, 69, 58, 0.10) 100%);
    border: 1px solid rgba(255, 69, 58, 0.34);
    color: #FF6961;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.10);
    transition: transform 0.14s ease, background 0.18s ease;
}
.btn-accent-danger-soft:hover {
    background: linear-gradient(180deg, rgba(255, 69, 58, 0.30) 0%, rgba(255, 69, 58, 0.14) 100%);
}
.btn-accent-danger-soft:active {
    transform: scale(0.97);
}

.btn-accent-danger {
    background: linear-gradient(180deg, #FF6259 0%, #FF453A 55%, #D72E24 100%);
    border: 1px solid rgba(255, 138, 130, 0.42);
    color: #FFFFFF;
    box-shadow:
        0 6px 18px rgba(255, 69, 58, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
    transition: transform 0.14s ease, filter 0.18s ease;
}
.btn-accent-danger:active {
    transform: scale(0.97);
}

.btn-accent-amber-soft {
    background: linear-gradient(180deg, rgba(255, 159, 10, 0.22) 0%, rgba(255, 159, 10, 0.10) 100%);
    border: 1px solid rgba(255, 159, 10, 0.34);
    color: #FFB340;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.10);
    transition: transform 0.14s ease, background 0.18s ease;
}
.btn-accent-amber-soft:hover {
    background: linear-gradient(180deg, rgba(255, 159, 10, 0.30) 0%, rgba(255, 159, 10, 0.14) 100%);
}
.btn-accent-amber-soft:active {
    transform: scale(0.97);
}

/* =========================================================
   Верхняя панель приложения (Header)
   ========================================================= */
.app-header {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 6px 10px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.header-selectors-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.header-controls-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.header-field {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(11, 13, 16, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0 8px;
    height: 36px;
    position: relative;
}

.header-field-label {
    font-size: 9px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    pointer-events: none;
}

.header-select-wrap {
    position: relative;
    height: 100%;
    min-width: 82px;
    display: flex;
    align-items: center;
}

.header-select-wrap--day {
    min-width: 34px;
}

.header-select-wrap select {
    width: 100%;
    height: 100%;
    background: transparent;
    color: var(--text-primary);
    border: none;
    cursor: pointer;
}
.header-select-wrap select:disabled {
    cursor: default;
    opacity: 0.88;
}

#bannerContainer {
    flex: 1;
    min-width: 120px;
    height: 36px;
    border-radius: 12px;
    background: linear-gradient(180deg, #3DA6FF 0%, #2997FF 55%, #137AE3 100%);
    border: 1px solid rgba(128, 198, 255, 0.45);
    box-shadow:
        0 4px 16px rgba(41, 151, 255, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.30);
    position: relative;
    overflow: hidden;
    transition: transform 0.14s ease, box-shadow 0.18s ease;
}
#bannerContainer:active {
    transform: scale(0.97);
}
#bannerContainer select {
    color: #FFFFFF;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* Переключатель режима редактирования (динамические классы app.js) */
.readonly-toggle-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 8px 0 10px;
    border-radius: 12px;
    background: rgba(11, 13, 16, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.14s ease, border-color 0.2s ease;
}
.readonly-toggle-pill:active {
    transform: scale(0.97);
}

#switchBg.bg-neutral-200 {
    background: rgba(255, 255, 255, 0.16) !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
}
#switchBg.bg-\[\#34c759\] {
    background: linear-gradient(180deg, #3CE066 0%, #30D158 100%) !important;
    box-shadow: 0 0 12px rgba(48, 209, 88, 0.45);
}
#readonlyStatusText.text-\[\#007aff\] {
    color: var(--accent-blue) !important;
}
#readonlyStatusText.text-\[\#8e8e93\] {
    color: var(--text-muted) !important;
}

select {
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    text-align: center;
    text-align-last: center;
}
select option {
    background-color: #181C24;
    color: #F5F7FA;
}

/* =========================================================
   Основная область контента и таблица-плашки
   ========================================================= */
.main-content-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 6px 0 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    min-height: 0;
}
.main-content-wrapper::-webkit-scrollbar,
.table-scroll-wrapper::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
.main-content-wrapper::-webkit-scrollbar-thumb,
.table-scroll-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
}

.table-scroll-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    background: transparent;
    border: none;
    border-radius: 0;
    flex-shrink: 0;
}

.table-scroll-wrapper table {
    width: 100%;
    min-width: 680px;
    table-layout: fixed;
    border-collapse: separate !important;
    border-spacing: 0 8px;
}

.table-scroll-wrapper thead tr {
    background: transparent !important;
    border: none !important;
}

.table-scroll-wrapper thead th {
    color: var(--text-muted);
    font-size: 9.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 6px 4px;
    border: none !important;
    background: transparent !important;
}

/* Строки таблицы как раздельные стеклянные плашки */
tr.table-row-item {
    position: relative;
    --row-bg: rgba(24, 28, 36, 0.85);
    --row-border: rgba(255, 255, 255, 0.08);
    background-color: transparent !important;
    border: none !important;
    transition: transform 0.14s ease, opacity 0.2s ease, filter 0.18s ease;
}

/* Переопределение светлых цветов строк из COLOR_MAP (app.js) на тёмные стеклянные оттенки */
tr.table-row-item[style*="rgb(255, 255, 255)"],
tr.table-row-item[style*="#ffffff"] {
    --row-bg: rgba(24, 28, 36, 0.85);
    --row-border: rgba(255, 255, 255, 0.08);
}
tr.table-row-item[style*="rgb(147, 197, 253)"],
tr.table-row-item[style*="#93c5fd"] {
    --row-bg: rgba(41, 151, 255, 0.16);
    --row-border: rgba(41, 151, 255, 0.34);
}
tr.table-row-item[style*="rgb(187, 247, 208)"],
tr.table-row-item[style*="#bbf7d0"] {
    --row-bg: rgba(48, 209, 88, 0.15);
    --row-border: rgba(48, 209, 88, 0.32);
}
tr.table-row-item[style*="rgb(216, 180, 254)"],
tr.table-row-item[style*="#d8b4fe"] {
    --row-bg: rgba(191, 90, 242, 0.17);
    --row-border: rgba(191, 90, 242, 0.34);
}
tr.table-row-item[style*="rgb(254, 240, 138)"],
tr.table-row-item[style*="#fef08a"] {
    --row-bg: rgba(255, 214, 10, 0.14);
    --row-border: rgba(255, 214, 10, 0.32);
}
tr.table-row-item[style*="rgb(153, 246, 228)"],
tr.table-row-item[style*="#99f6e4"] {
    --row-bg: rgba(90, 200, 250, 0.15);
    --row-border: rgba(90, 200, 250, 0.32);
}
tr.table-row-item[style*="rgb(254, 215, 170)"],
tr.table-row-item[style*="#fed7aa"] {
    --row-bg: rgba(255, 159, 10, 0.16);
    --row-border: rgba(255, 159, 10, 0.34);
}

tr.table-row-item > td {
    background-color: var(--row-bg);
    border-top: 1px solid var(--row-border);
    border-bottom: 1px solid var(--row-border);
    height: 48px;
    vertical-align: middle;
    padding-top: 6px;
    padding-bottom: 6px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

tr.table-row-item > td:first-child {
    border-left: 1px solid var(--row-border);
    border-top-left-radius: 18px;
    border-bottom-left-radius: 18px;
    padding-left: 6px;
}

tr.table-row-item > td:last-child {
    border-right: 1px solid var(--row-border);
    border-top-right-radius: 18px;
    border-bottom-right-radius: 18px;
    padding-right: 8px;
}

tr.table-row-item:active {
    transform: scale(0.97);
}

tr.table-row-item.dragging-active > td {
    opacity: 0.4;
    background-color: rgba(41, 151, 255, 0.22) !important;
}

tr.table-row-item.drag-over-target > td {
    border-top: 3px solid var(--accent-blue) !important;
}

/* Тач-зоны и цвета текста внутри динамических ячеек таблицы */
#tableBody td button,
#tableBody td .cursor-pointer {
    transition: transform 0.14s ease, opacity 0.15s ease;
}
#tableBody td button:active,
#tableBody td .cursor-pointer:active {
    transform: scale(0.97);
}

#tableBody td .text-black,
#tableBody td.text-black {
    color: var(--text-primary) !important;
    font-weight: 600;
}

#tableBody td.text-neutral-600 {
    color: var(--text-secondary) !important;
}

#tableBody td .text-\[\#007aff\] {
    color: var(--accent-blue) !important;
}

#tableBody td .text-slate-400 {
    color: var(--text-muted) !important;
}

/* Кнопка «Готово» */
#tableBody td:nth-child(2) button {
    width: 24px;
    height: 24px;
}
#tableBody td:nth-child(2) button.bg-\[\#34c759\] {
    background: linear-gradient(180deg, #42DF69 0%, #30D158 100%) !important;
    border-color: #30D158 !important;
    box-shadow: 0 0 12px var(--accent-green-glow);
}
#tableBody td:nth-child(2) button.border-\[\#cbd5e1\] {
    border-color: rgba(255, 255, 255, 0.24) !important;
    background: rgba(255, 255, 255, 0.04) !important;
}

/* Индикатор заметки в строке */
#tableBody td:nth-child(5) > div {
    width: 18px;
    height: 18px;
}
#tableBody td:nth-child(5) > div.bg-\[\#ff3b30\] {
    background: var(--accent-red) !important;
    border-color: var(--accent-red) !important;
    box-shadow: 0 0 10px rgba(255, 69, 58, 0.5);
}

/* Ячейки веса и подходов: крупная тач-зона минимум 44px */
#tableBody td:nth-child(6) > span,
#tableBody td:nth-child(7) > span,
#tableBody td:nth-child(8) > div {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 12px;
    font-weight: 700;
}

/* Кубики прогресса в таблице */
#tableBody td:nth-child(9) .rounded-md {
    border-color: rgba(255, 255, 255, 0.14) !important;
    border-radius: 8px;
}
#tableBody td:nth-child(9) .bg-transparent {
    background-color: rgba(255, 255, 255, 0.05) !important;
}
#tableBody td:nth-child(9) .bg-\[\#34c759\] {
    background-color: var(--accent-green) !important;
    box-shadow: 0 0 8px rgba(48, 209, 88, 0.45);
}
#tableBody td:nth-child(9) .bg-\[\#ff3b30\] {
    background-color: var(--accent-red) !important;
    box-shadow: 0 0 8px rgba(255, 69, 58, 0.45);
}
#tableBody td:nth-child(9) .bg-\[\#ffcc00\] {
    background-color: var(--accent-yellow) !important;
    box-shadow: 0 0 8px rgba(255, 214, 10, 0.4);
}
#tableBody td:nth-child(9) .bg-white {
    background-color: rgba(41, 151, 255, 0.20) !important;
    color: var(--accent-blue) !important;
    border-color: rgba(41, 151, 255, 0.45) !important;
}

.clamp-3-lines {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
    white-space: pre-wrap;
    min-height: 44px;
    padding: 4px 0;
    line-height: 1.3;
}

.drag-handle-btn {
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    color: rgba(142, 142, 147, 0.75) !important;
}

/* =========================================================
   Модальные окна: Dark OLED Glassmorphism + 2 колонки в Landscape
   ========================================================= */
.modal-backdrop-glass {
    background: rgba(6, 8, 12, 0.72);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.modal-fullscreen-glass {
    background: rgba(11, 13, 16, 0.94);
    background-image:
        radial-gradient(ellipse 65% 55% at 10% 0%, rgba(41, 151, 255, 0.13), transparent 60%),
        radial-gradient(ellipse 55% 55% at 90% 100%, rgba(48, 209, 88, 0.09), transparent 60%);
    -webkit-backdrop-filter: blur(22px);
    backdrop-filter: blur(22px);
}

/* Отступы модальных окон на десктопной рамке iPhone 13 Landscape */
#inputPanel,
#weightReduceWheelModal,
#tempoWheelModal {
    padding-top: 8px;
    padding-bottom: 8px;
    padding-left: calc(env(safe-area-inset-left, 0px) + 32px);
    padding-right: calc(env(safe-area-inset-right, 0px) + 18px);
}

#settings-modal,
#delete-confirm-modal {
    padding-top: 8px;
    padding-bottom: 8px;
    padding-left: calc(env(safe-area-inset-left, 0px) + 34px);
    padding-right: calc(env(safe-area-inset-right, 0px) + 22px);
}

/* 2-колоночный каркас для модалок Настроек, Удаления и Барабанов */
.modal-two-col-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
    gap: 14px;
    align-items: stretch;
    width: 100%;
    max-width: 680px;
}

.modal-two-col-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(200px, 0.75fr);
    gap: 14px;
    align-items: stretch;
    flex: 1;
    min-height: 0;
    width: 100%;
}

.modal-col-left,
.modal-col-right {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

/* Стилизация #inputPanel и всех динамически генерируемых блоков из app.js */
#inputPanel #panelHeaderRow {
    background: transparent !important;
    border-bottom: 1px solid var(--glass-border) !important;
    padding-bottom: 6px;
    margin-bottom: 6px;
}

#inputPanel #panelTitle {
    color: var(--text-primary) !important;
    letter-spacing: 0.08em;
}

/* Динамические светлые фоны и тексты из app.js внутри #inputPanel */
#inputPanel .bg-\[\#f2f2f7\] {
    background: var(--glass-bg) !important;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border) !important;
    border-radius: 20px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

#inputPanel .bg-white,
#inputPanel .bg-white\/80 {
    background: rgba(30, 35, 46, 0.86) !important;
    border-color: var(--glass-border) !important;
    color: var(--text-primary);
}

#inputPanel .border-\[\#e5e5ea\],
#inputPanel .border-slate-100,
#inputPanel .border-slate-200,
#inputPanel .border-slate-300 {
    border-color: var(--glass-border) !important;
}

#inputPanel .text-black {
    color: var(--text-primary) !important;
}

#inputPanel .text-slate-700,
#inputPanel .text-slate-600 {
    color: var(--text-secondary) !important;
}

#inputPanel .text-slate-500,
#inputPanel .text-slate-400,
#inputPanel .text-neutral-400 {
    color: var(--text-muted) !important;
}

#inputPanel .text-\[\#007aff\] {
    color: var(--accent-blue) !important;
}

#inputPanel .text-emerald-700,
#inputPanel .text-emerald-600 {
    color: var(--accent-green) !important;
}

/* Модификаторы веса/подходов и кнопки действий в #inputPanel */
#inputPanel #modifiersContainer button.bg-slate-100 {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.11) 0%, rgba(255, 255, 255, 0.04) 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.10) !important;
    color: var(--text-primary) !important;
    min-height: 44px;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transition: transform 0.14s ease, background 0.18s ease, box-shadow 0.18s ease;
}
#inputPanel #modifiersContainer button.\!bg-\[\#007aff\] {
    background: linear-gradient(180deg, #43A7FF 0%, #2997FF 52%, #147CE5 100%) !important;
    border-color: rgba(118, 192, 255, 0.5) !important;
    color: #FFFFFF !important;
    min-height: 44px;
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(41, 151, 255, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}
#inputPanel #modifiersContainer button:active {
    transform: scale(0.97);
}

#inputPanel .bg-blue-50 {
    background: linear-gradient(180deg, rgba(41, 151, 255, 0.24) 0%, rgba(41, 151, 255, 0.12) 100%) !important;
    border: 1px solid rgba(41, 151, 255, 0.38) !important;
    color: #64B8FF !important;
    min-height: 40px;
}
#inputPanel .bg-rose-50 {
    background: linear-gradient(180deg, rgba(255, 69, 58, 0.22) 0%, rgba(255, 69, 58, 0.10) 100%) !important;
    border: 1px solid rgba(255, 69, 58, 0.36) !important;
    color: #FF6961 !important;
    min-height: 40px;
}
#inputPanel #btnSendCopy.bg-amber-500 {
    background: linear-gradient(180deg, #FFB340 0%, #FF9F0A 55%, #D98200 100%) !important;
    color: #161005 !important;
    border: 1px solid rgba(255, 204, 128, 0.45);
    min-height: 40px;
    box-shadow: 0 5px 14px rgba(255, 159, 10, 0.30);
}
#inputPanel #btnSendCopy.bg-emerald-600 {
    background: linear-gradient(180deg, #45E06C 0%, #30D158 100%) !important;
    color: #061A0B !important;
    min-height: 40px;
}

#inputPanel #targetWorkoutSelect {
    background: rgba(11, 13, 16, 0.78) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: var(--text-primary) !important;
    min-height: 40px;
}

#inputPanel #numWheelV1,
#inputPanel #numWheelV2 {
    color: var(--text-primary) !important;
}

/* Выбранные элементы палитр и кубиков прогресса (переопределение чёрных рамок из app.js) */
.row-color-square-btn,
.cycle-shape-btn,
.cube-status-btn {
    transition: transform 0.14s ease, box-shadow 0.18s ease, outline 0.15s ease;
}
.row-color-square-btn:active,
.cycle-shape-btn:active,
.cube-status-btn:active {
    transform: scale(0.95);
}

.row-color-square-btn[style*="outline: 3px"],
.row-color-square-btn[style*="outline:3px"],
.cycle-shape-btn[style*="outline: 3px"],
.cycle-shape-btn[style*="outline:3px"] {
    outline: 2.5px solid var(--accent-blue) !important;
    outline-offset: 2px;
    box-shadow: 0 0 12px rgba(41, 151, 255, 0.65);
}

.cube-status-btn {
    min-width: 56px;
    min-height: 56px;
    border-radius: 16px !important;
}
.cube-status-btn[style*="1px solid"] {
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
}
.cube-status-btn[style*="3px solid"] {
    border: 2.5px solid var(--accent-blue) !important;
    box-shadow: 0 0 18px rgba(41, 151, 255, 0.55) !important;
    transform: scale(1.06);
}
.cube-status-btn[data-status="0"] {
    background: rgba(255, 255, 255, 0.05) !important;
}
.cube-status-btn[data-status="1"] {
    background: linear-gradient(180deg, #43DF6A 0%, #30D158 100%) !important;
}
.cube-status-btn[data-status="2"] {
    background: linear-gradient(180deg, #FF6259 0%, #FF453A 100%) !important;
}
.cube-status-btn[data-status="3"] {
    background: linear-gradient(180deg, #FFE047 0%, #FFD60A 100%) !important;
}
.cube-status-btn[data-status="4"],
.cube-status-btn[data-status="5"] {
    background: linear-gradient(180deg, rgba(41, 151, 255, 0.24) 0%, rgba(41, 151, 255, 0.12) 100%) !important;
    color: var(--accent-blue) !important;
}

/* =========================================================
   2 колонки в Landscape для ВСЕХ режимов #inputPanel
   ========================================================= */

/* 1. Вес и Подходы: слева барабаны, справа панель модификаторов (+/-, .5, ИЛИ, ЦИКЛ) */
#inputPanel:not(.text-panel-mode) #panelScrollContent:has(#modifiersContainer:not(:empty)) {
    flex-direction: row;
    align-items: stretch;
    gap: 12px;
}
#inputPanel:not(.text-panel-mode) #panelScrollContent:has(#modifiersContainer:not(:empty)) #panelContentContainer {
    flex: 1.15;
    min-width: 0;
}
#inputPanel:not(.text-panel-mode) #panelScrollContent:has(#modifiersContainer:not(:empty)) #modifiersContainer {
    flex: 0 0 42%;
    max-width: 320px;
    height: 100%;
    display: flex;
    align-items: center;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 12px;
}
#inputPanel:not(.text-panel-mode) #panelScrollContent:has(#modifiersContainer:not(:empty)) #modifiersContainer > div {
    width: 100%;
    border-top: none !important;
    padding-top: 0 !important;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
#inputPanel:not(.text-panel-mode) #panelScrollContent:has(#modifiersContainer:not(:empty)) #modifiersContainer > div:has(> button:only-child) {
    grid-template-columns: minmax(0, 1fr);
}

/* 2. Цвет и Цикл строки (num): слева палитры, справа радар и кнопки управления строкой */
#inputPanel #panelContentContainer > div:has(#radarSlotsGrid) {
    display: grid !important;
    grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.92fr);
    grid-template-rows: auto auto 1fr;
    gap: 8px 12px !important;
    align-content: start;
    padding: 2px !important;
}
#inputPanel #panelContentContainer > div:has(#radarSlotsGrid) > :nth-child(1) {
    grid-column: 1;
    grid-row: 1;
}
#inputPanel #panelContentContainer > div:has(#radarSlotsGrid) > :nth-child(2) {
    grid-column: 1;
    grid-row: 2 / span 2;
}
#inputPanel #panelContentContainer > div:has(#radarSlotsGrid) > :nth-child(3) {
    grid-column: 2;
    grid-row: 1;
}
#inputPanel #panelContentContainer > div:has(#radarSlotsGrid) > :nth-child(4) {
    grid-column: 2;
    grid-row: 2;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}
#inputPanel #panelContentContainer > div:has(#radarSlotsGrid) > :nth-child(5) {
    grid-column: 2;
    grid-row: 3;
    align-self: start;
}

/* 3. Прогресс (cube): слева заголовок и управление окном, справа сетка кубиков прогресса */
#inputPanel #modalLayoutWrapper:has(.cube-status-btn) {
    display: grid !important;
    grid-template-columns: minmax(210px, 0.78fr) minmax(0, 1.22fr);
    gap: 14px;
    align-items: stretch;
}
#inputPanel #modalLayoutWrapper:has(.cube-status-btn) #panelHeaderRow {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding: 14px !important;
    background: var(--glass-bg) !important;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
#inputPanel #modalLayoutWrapper:has(.cube-status-btn) #panelHeaderRow > div {
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    height: 100%;
    gap: 12px;
}
#inputPanel #modalLayoutWrapper:has(.cube-status-btn) #panelTitleGroup {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}
#inputPanel #modalLayoutWrapper:has(.cube-status-btn) #panelTitle {
    font-size: 15px;
}
#inputPanel #modalLayoutWrapper:has(.cube-status-btn) #panelActionButtons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}
#inputPanel #modalLayoutWrapper:has(.cube-status-btn) #panelActionButtons button {
    width: 100%;
    min-height: 44px;
    justify-content: center;
}
#inputPanel #modalLayoutWrapper:has(.cube-status-btn) .cube-status-btn {
    width: 68px;
    height: 68px;
}
#inputPanel #modalLayoutWrapper:has(.cube-status-btn) #panelContentContainer > div > div {
    display: grid !important;
    grid-template-columns: repeat(3, 68px);
    gap: 14px !important;
    justify-content: center;
}

/* 4. Редактор заметок / упражнения / описания: слева текст, справа панель управления и темпы */
#inputPanel.text-panel-mode {
    overflow: hidden;
    overscroll-behavior: none;
    overflow-anchor: none;
}
#inputPanel.text-panel-mode #modalLayoutWrapper,
#inputPanel.text-panel-mode #panelScrollContent,
#inputPanel.text-panel-mode #panelContentContainer {
    min-height: 0;
    overflow: hidden;
    overflow-anchor: none;
}
#inputPanel.text-panel-mode #panelHeaderRow {
    flex: 0 0 auto;
    position: relative;
    z-index: 30;
}
#inputPanel.text-panel-mode .text-panel-layout {
    height: 100%;
    min-height: 0;
    align-items: stretch;
}
#inputPanel.text-panel-mode .text-panel-editor {
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    overflow-anchor: none;
    touch-action: pan-y;
    color: var(--text-primary) !important;
    caret-color: var(--accent-blue);
    line-height: 1.5;
}
#inputPanel.text-panel-mode .text-panel-sidebar {
    flex: 0 0 13.5rem;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    position: relative;
    z-index: 25;
    background: var(--glass-bg) !important;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border) !important;
    border-radius: 20px;
    padding: 8px !important;
}
#inputPanel.text-panel-mode #textPanelControlsHost {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 0 0 auto;
    padding-bottom: 6px;
}
#inputPanel.text-panel-mode #panelActionButtons {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 5px;
    width: 100%;
    white-space: normal;
}
#inputPanel.text-panel-mode #panelActionButtons button {
    min-width: 0;
    padding: 4px 6px;
    white-space: nowrap;
    line-height: 1.15;
    min-height: 36px;
    justify-content: center;
}
#inputPanel.text-panel-mode #quickWeightBar:not(.hidden) {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 6px;
    width: 100%;
    background: rgba(11, 13, 16, 0.72) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 14px !important;
    padding: 4px !important;
}
.compact-wheel-shell {
    width: 58px;
    min-height: 44px;
    flex-shrink: 0;
}
#inputPanel.text-panel-mode #tempoSideList {
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
#inputPanel.text-panel-mode #btnAddSideTempo {
    background: linear-gradient(180deg, #45E06C 0%, #30D158 100%) !important;
    color: #051A0A !important;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(48, 209, 88, 0.35);
}

/* =========================================================
   Бейджи дат, редактируемое поле, карточки темпа
   ========================================================= */
.date-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: rgba(41, 151, 255, 0.16) !important;
    color: #64B8FF !important;
    border: 1px solid rgba(41, 151, 255, 0.36) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    padding: 2px 7px !important;
    border-radius: 8px !important;
    margin: 1px 4px 1px 0 !important;
    vertical-align: baseline !important;
    white-space: nowrap !important;
    cursor: pointer;
    user-select: none !important;
    -webkit-user-select: none !important;
}

.date-badge-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 900;
    color: #FF6961;
    margin-left: 2px;
    padding: 0 2px;
    border-radius: 4px;
    line-height: 1;
}

.editable-field {
    user-select: text !important;
    -webkit-user-select: text !important;
    white-space: pre-wrap;
    word-break: break-word;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.tempo-side-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, rgba(48, 209, 88, 0.16) 0%, rgba(48, 209, 88, 0.08) 100%);
    border: 1px solid rgba(48, 209, 88, 0.32);
    color: #E7FAEC;
    border-radius: 12px;
    padding: 5px 7px;
    min-height: 36px;
    font-size: 11px;
    font-weight: 800;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    width: 100%;
    transition: transform 0.14s ease, opacity 0.15s ease, background 0.15s ease;
    position: relative;
}
.tempo-side-badge:active {
    transform: scale(0.97);
}
.tempo-side-badge .text-emerald-800 {
    color: #E7FAEC !important;
}
.tempo-side-badge .text-rose-500 {
    color: #FF6961 !important;
}

.tempo-side-badge.tempo-dragging-active {
    opacity: 0.35;
    background-color: rgba(48, 209, 88, 0.28) !important;
}

.tempo-side-badge.tempo-drag-over-target {
    border-top: 3px solid var(--accent-green) !important;
}

.tempo-drag-handle {
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
    color: rgba(255, 255, 255, 0.45) !important;
}
.tempo-drag-handle:active {
    cursor: grabbing;
}

/* =========================================================
   Барабаны прокрутки (Wheel Pickers) с маской и стеклянной линзой
   ========================================================= */
.wheel-drum-frame {
    background: rgba(11, 13, 16, 0.88) !important;
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    border-radius: 16px !important;
    box-shadow:
        inset 0 12px 24px rgba(0, 0, 0, 0.55),
        inset 0 -12px 24px rgba(0, 0, 0, 0.55);
}

#inputPanel .relative.overflow-hidden:has(.wheel-picker-container) {
    background: rgba(11, 13, 16, 0.88) !important;
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    border-radius: 16px !important;
    box-shadow:
        inset 0 12px 24px rgba(0, 0, 0, 0.55),
        inset 0 -12px 24px rgba(0, 0, 0, 0.55);
}

.wheel-picker-container {
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;
    scrollbar-width: none;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    touch-action: pan-y !important;
    overscroll-behavior-x: none !important;
    overscroll-behavior-y: contain;
    width: 100% !important;
    max-width: 100% !important;
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 0, 0, 0.42) 22%,
        #000000 42%,
        #000000 58%,
        rgba(0, 0, 0, 0.42) 78%,
        transparent 100%
    );
    mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 0, 0, 0.42) 22%,
        #000000 42%,
        #000000 58%,
        rgba(0, 0, 0, 0.42) 78%,
        transparent 100%
    );
}

.wheel-picker-container::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.wheel-item {
    scroll-snap-align: center;
    height: 48px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: rgba(245, 247, 250, 0.4);
    transition: transform 0.15s ease, opacity 0.15s ease, color 0.15s ease;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Переопределение классов выделения из updateWheelContainerVisuals (app.js) */
.wheel-item.text-black {
    color: #FFFFFF !important;
    text-shadow: 0 0 14px rgba(41, 151, 255, 0.42);
}
.wheel-item.text-neutral-400 {
    color: rgba(220, 226, 238, 0.56) !important;
}
.wheel-item.text-neutral-300 {
    color: rgba(142, 142, 147, 0.34) !important;
}

.wheel-selection-indicator {
    position: absolute;
    top: 50%;
    left: 6px;
    right: 6px;
    height: 48px;
    transform: translateY(-50%);
    border-top: 1px solid rgba(41, 151, 255, 0.45);
    border-bottom: 1px solid rgba(41, 151, 255, 0.45);
    background: linear-gradient(180deg, rgba(41, 151, 255, 0.18) 0%, rgba(41, 151, 255, 0.07) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        0 0 18px rgba(41, 151, 255, 0.14);
    border-radius: 12px;
    pointer-events: none;
    z-index: 10;
}

/* =========================================================
   Адаптив под реальный iPhone 13 (Портрет и Альбом)
   ========================================================= */
@media (max-device-width: 900px), (max-width: 600px) {
    body {
        background-color: var(--bg-oled);
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100dvh;
    }
    .iphone-container {
        width: 100% !important;
        height: 100dvh !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }
    .desktop-notch,
    .desktop-home-indicator {
        display: none !important;
    }

    .app-layer,
    #inputPanel,
    #weightReduceWheelModal,
    #tempoWheelModal,
    #settings-modal,
    #delete-confirm-modal {
        padding-top: env(safe-area-inset-top, 12px);
        padding-bottom: env(safe-area-inset-bottom, 12px);
        padding-left: calc(env(safe-area-inset-left, 0px) + 12px);
        padding-right: calc(env(safe-area-inset-right, 0px) + 12px);
    }
}

/* Портретная ориентация: одноколоночные карточки и двухрядный хедер */
@media (orientation: portrait) {
    .app-layer,
    #inputPanel,
    #weightReduceWheelModal,
    #tempoWheelModal,
    #settings-modal,
    #delete-confirm-modal {
        padding-top: calc(env(safe-area-inset-top, 44px) + 4px);
        padding-bottom: calc(env(safe-area-inset-bottom, 34px) + 4px);
        padding-left: 12px;
        padding-right: 12px;
    }

    .app-header {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 8px;
    }
    .header-selectors-group {
        width: 100%;
    }
    .header-field {
        flex: 1;
        justify-content: space-between;
    }
    .header-controls-group {
        width: 100%;
    }

    .modal-two-col-card,
    .modal-two-col-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    #inputPanel:not(.text-panel-mode) #panelScrollContent:has(#modifiersContainer:not(:empty)) {
        flex-direction: column;
    }
    #inputPanel:not(.text-panel-mode) #panelScrollContent:has(#modifiersContainer:not(:empty)) #modifiersContainer {
        flex: 0 0 auto;
        max-width: none;
        width: 100%;
        height: auto;
    }
    #inputPanel #panelContentContainer > div:has(#radarSlotsGrid) {
        display: flex !important;
        flex-direction: column;
    }
    #inputPanel #modalLayoutWrapper:has(.cube-status-btn) {
        display: flex !important;
        flex-direction: column;
    }
    #inputPanel #modalLayoutWrapper:has(.cube-status-btn) #panelHeaderRow {
        padding: 0 0 8px 0 !important;
        background: transparent !important;
        border: none !important;
        border-bottom: 1px solid var(--glass-border) !important;
        border-radius: 0;
    }
    #inputPanel #modalLayoutWrapper:has(.cube-status-btn) #panelHeaderRow > div {
        flex-direction: row;
        align-items: center;
    }
    #inputPanel #modalLayoutWrapper:has(.cube-status-btn) #panelActionButtons {
        flex-direction: row;
        width: auto;
    }
    #inputPanel #modalLayoutWrapper:has(.cube-status-btn) #panelActionButtons button {
        width: auto;
        min-height: 34px;
    }
    #inputPanel.text-panel-mode .text-panel-layout {
        flex-direction: column;
    }
    #inputPanel.text-panel-mode .text-panel-sidebar {
        flex: 0 0 auto;
        width: 100%;
        max-height: 44%;
    }
}

/* Альбомная ориентация на реальном девайсе: освобождаем верх/низ (pt-2 pb-2 = 8px), отступы под чёлку слева/справа */
@media (max-device-width: 900px) and (orientation: landscape) {
    .app-layer,
    #inputPanel,
    #weightReduceWheelModal,
    #tempoWheelModal,
    #settings-modal,
    #delete-confirm-modal {
        padding-top: 8px;
        padding-bottom: 8px;
        padding-left: calc(env(safe-area-inset-left, 44px) + 8px);
        padding-right: calc(env(safe-area-inset-right, 34px) + 8px);
    }
}
