/* Toolbar */
.practice-toolbar{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin:8px 0 12px; flex-wrap:wrap; }
.practice-toolbar .toolbar-left, .practice-toolbar .toolbar-right{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.toolbar-select {
    padding: 4px 6px;
    border: 1px solid var(--ptp-panel-border);
    border-radius: 4px;
    background: var(--ptp-panel-bg);
    color: var(--ptp-panel-text);
    max-width: 100%;
    cursor: pointer;
}
.btn{ padding:6px 10px; border:1px solid var(--ptp-panel-border); border-radius:4px; background:var(--ptp-panel-bg); color:var(--ptp-panel-text); cursor:pointer; transition:background-color 0.2s ease, border-color 0.2s ease; }
.btn:hover{ background:rgba(255, 255, 255, 0.08); border-color:var(--ptp-link); }

.difficulty-legend {
  display: flex;
  gap: .5rem;
  margin-top: .25rem;
  flex-wrap: wrap;
}
.badge {
  display: inline-block;
  font-size: .75rem;
  padding: .15rem .4rem;
  border-radius: .35rem;
  border: 1px solid rgba(0,0,0,.15);
}
.difficulty-toggle {
    cursor: pointer;
    background: none;
    border: none;
    color: inherit;
    font-weight: 300;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    appearance: none;
    box-shadow: inset var(--darkreader-background-00000033, rgb(114 113 113 / 60%)) 0px 0px 4px 1px;
}
.difficulty-toggle:focus-visible {
    outline: 2px solid var(--ptp-link);
    outline-offset: 2px;
}
.difficulty-toggle.is-active {
    border-color: var(--ptp-link);
    box-shadow: 0 0 0 2px rgba(15, 98, 254, 0.35);
    transform: translateY(-1px);
}
.tier-beginner {
    background: #fff3cd;
    color: #664d03;
}

.tier-average {
    background: #d1e7dd;
    color: #0f5132;
}

.tier-fast {
    background: #cfe2ff;
    color: #084298;
}

.tier-pro {
    background: #e0cffc;
    color: #3c096c;
}

/* Admin textareas: full width and tall */
#pcText, #newText{ width:100%; min-height:500px; box-sizing:border-box; display:block; }
.pc-textarea-lg{ min-height:500px; }

/* Root container */
.practice-root {
    position: relative;
    padding: 8px 0;
    max-width: 96%;
    margin-inline: auto;
    margin: 15px auto;
}
 
.toolbar-left{
    margin-top: 10px;
    margin-bottom: 10px;
}
 
.toolbar-left,
.toolbar-right {
    margin-left: 15px;
}

.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.05);
    z-index: 5;
}

.lesson.texture {
    border: 1px solid var(--ptp-panel-border);
    border-radius: 8px;
    padding: 12px;
    background: var(--ptp-lesson-texture);
    margin: 3px 10px;
}

.pause-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.6);
    color: var(--ptp-text);
    z-index: 3;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

    .pause-overlay[aria-hidden="false"] {
        opacity: 0.5;
        pointer-events: auto;
        top: auto;
    }

.pause-message {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.lesson.paused{ opacity:0.98 }
.lesson.blocked{ box-shadow:0 0 0 2px #e74c3c inset; }

/* Editor area */
pre.code{ white-space:pre; overflow:auto; font-family:Consolas, "SFMono-Regular", Menlo, Monaco, monospace; font-size:14px; line-height:1.6; min-height:180px; margin:0; border-radius:6px; position:relative; }
#codeArea{ counter-reset: line; padding:8px 0; }
.code-line{ display:flex; align-items:flex-start; gap:10px; }
.line-number{ width:36px; min-width:36px; text-align:right; padding-right:6px; color:#95a5a6; user-select:none; }
.line-content{ flex:1; white-space:pre; }

/* Invisible input used for typing */
.invisibleInput{ position:absolute; opacity:0; width:1px; height:1px; left:-10000px; top:auto; }

.bottom-bar{ display:flex; align-items:center; gap:12px; margin-top:8px; flex-wrap:wrap; }
.freezeCountdown2{ height:3px; background:#3498db; width:100%; border-radius:2px; flex:1 1 100%; }
.timer{ font-weight:600; font-family:monospace; }

/* Token classes (IDE-like) */
.tok-id {
    color: var(--ptc-tok-id);
}
.tok-num{ color:#e67e22; }
.tok-punct {
    color: #8e44ad;
}
.tok-space{ color:#95a5a6; }
.tok-str{ color:#d35400; }
.tok-other{ color:#34495e; }
.return{ color:#7f8c8d; display:inline-block; min-width:6px; }

/* State classes */
.initial {
    
}

.char-active {
    background: #ffeaa7;
    outline: 1px dashed #fdcb6e;
}

.correct {
    /* preserve token-based colors for typed text */
}

.incorrect {
    color: #f13723;
    text-decoration: underline;
}
.collateral{ background:#f9e9e9; }
.revert{ background:#ecf0f1; }
.frozen{ background:#c8d6e5; }

.blocked-error-message{ display:none; margin:8px 0; color:#e74c3c; font-weight:600; }
.untypeable{ display:none; margin:8px 0; }
.untypeableDialog{ display:none; position:fixed; top:20%; left:50%; transform:translateX(-50%); background:#fff; border:1px solid #ccc; box-shadow:0 6px 24px rgba(0,0,0,.15); padding:16px; z-index:10; max-width:92vw; }
.untypeableDialog .close{ cursor:pointer; float:right; }
.untypeableDialog .title{ font-weight:700; margin-bottom:8px; }

/* Control group: Start/Pause/Stop */
.btn-control-group{ display:inline-flex; align-items:center; gap:0; margin:0 6px; }
.control-btn{ border-radius:0; border-left:1px solid #888; padding:6px 8px; display:flex; align-items:center; justify-content:center; }
.control-btn:first-child{ border-top-left-radius:4px; border-bottom-left-radius:4px; border-left:1px solid #888; }
.control-btn:last-child{ border-top-right-radius:4px; border-bottom-right-radius:4px; }
    .control-btn i {
        width: 18px;
        height: 18px;
        display: inline-block;
        text-align: center;
        line-height: 18px;
    }
.control-btn.active{ background:#4a90e2; color:#fff; }
.control-btn:not(.active){ filter: grayscale(100%); opacity:0.85; }

.online-counter{ position:fixed; bottom:16px; right:16px; display:flex; align-items:center; gap:6px; padding:8px 14px; border-radius:999px; background:rgba(15,15,15,0.9); color:#fff; font-weight:600; box-shadow:0 4px 16px rgba(0,0,0,0.25); z-index:30; pointer-events:none; }
.online-counter-label{ font-size:.85rem; opacity:.85; }

/* Responsive */
@media (max-width: 768px){
  .practice-root{ padding:6px; }
  pre.code{ font-size:13px; min-height:140px; }
  .btn{ padding:6px 8px; }
}
@media (max-width: 480px){
  .practice-toolbar{ gap:8px; }
  .toolbar-select{ width:100%; }
  .lesson.texture{ padding:10px; }
  pre.code{ font-size:12px; min-height:120px; }
}

/* Layout refresh inspired by provided mockup */
.code-practice-page{ padding:24px 0 48px; }
.code-practice-stage{
    background:var(--ptp-surface-bg);
    border:1px solid var(--ptp-border);
    border-radius:28px;
    padding:32px;
    max-width:1200px;
    margin:0 auto 40px;
    box-shadow:0 25px 60px rgba(0,0,0,0.35);
    color:var(--ptp-text);
}
.practice-toolbar{
    display:flex;
    flex-direction:column;
    gap:24px;
    margin:0;
}
.toolbar-grid{
    display:grid;
    grid-template-columns:minmax(220px,260px) 1fr;
    gap:14px;
}
@media(max-width:980px){ .toolbar-grid{ grid-template-columns:1fr; } }

.toolbar-card {
    background: var(--ptp-panel-bg);
    border: 1px solid var(--ptp-panel-border);
    border-radius: 26px;
    padding: 10px 15px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.25);
    color: var(--ptp-panel-text);
}
.choose-card{ display:flex; flex-direction:column; gap:12px; }
.choose-card-label {
    font-size: 1.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    display: block;
}
.choose-exec-btn {
    width: 100%;
    justify-content: center;
    font-size: 1rem;
    padding: 14px;
    border-radius: 14px;
    letter-spacing: 0.04em;
    background: var(--ptp-link);
    border: 1px solid var(--ptp-panel-border);
    color: #fff;
    box-shadow: 0 12px 24px rgba(0,0,0,0.25);
    margin-top: 5px;
    cursor: pointer;
}
.choose-exec-btn:hover{ filter:brightness(1.08); }
.choose-helper {
    margin: 5px 0;
    color: var(--ptp-text);
    opacity: 0.9;
    font-size: 0.9rem;
}

.btn-Create-Own {
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-top: 0px;
}

.code-practice-stage .btn {
    background: var(--ptp-link);
    border: 1px solid var(--ptp-panel-border);
    color: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}
.code-practice-stage .btn:hover{ filter:brightness(1.08); }

.btn-next-exercise {
    justify-content: center;
    font-size: 1rem;
    padding: 8px;
    background: var(--ptp-link) !important;
    border: 1px solid var(--ptp-panel-border) !important;
    border-radius: 12px !important;
}

.controls-card{ display:flex; flex-direction:column; gap:10px; }
.controls-buttons {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-top: auto;
}
.controls-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    place-self: center;
}
.metric-pill{
    background:var(--ptp-panel-bg);
    border:1px solid var(--ptp-panel-border);
    border-radius:20px;
    padding: 5px 18px;
    min-width:115px;
    text-align:center;
    color:var(--ptp-panel-text);
    font-weight:600;
    box-shadow:inset 0 0 0 1px rgba(255,255,255,0.05);
}
.metric-label{ display:block; font-size:0.78rem; text-transform:uppercase; letter-spacing:0.08em; color:var(--ptp-link); }
.metric-value{ font-size:1.35rem; font-weight:700; }

.selectors-grid {
    display: grid;
    grid-template-columns: 2fr 1.2fr 0.7fr;
    gap: 8px;
}
.selector-card{ background:var(--ptp-panel-bg); border:1px solid var(--ptp-panel-border); border-radius:20px; padding:18px; display:flex; flex-direction:column; gap:10px; color:var(--ptp-panel-text); }
.selector-label{ font-size:0.85rem; letter-spacing:0.08em; text-transform:uppercase; color:var(--ptp-link); }
.selector-form{ display:flex; flex-direction:column; gap:10px; }
.toolbar-select{ width:100%; border-radius:16px; padding:12px 14px; background:var(--ptp-panel-bg); color:var(--ptp-panel-text); border:1px solid var(--ptp-panel-border); box-shadow:inset 0 0 0 1px rgba(255,255,255,0.05); }
.toolbar-select:focus{ outline:2px solid var(--ptp-link); }
.difficulty-legend{ background:var(--ptp-surface-bg); padding:10px; border-radius:14px; border:1px solid var(--ptp-panel-border); }
.goal-info {
    margin-top: .35rem;
    font-size: .85rem;
    letter-spacing: .08em;
    color: var(--ptp-text);
    opacity: .85;
    display: contents;
}

.selector-card-difficulty {
    padding: 18px 12px;
}

.btn-control-group .control-btn {
    background: var(--ptp-panel-bg);
    border-color: var(--ptp-panel-border);
    color: var(--ptp-panel-text);
}

.code-panels{ display:flex; flex-direction:column; gap:24px; margin-top:10px; }
.panel{ background:var(--ptp-panel-bg); border:1px solid var(--ptp-panel-border); border-radius:28px; box-shadow:0 25px 45px rgba(0,0,0,0.25); color:var(--ptp-panel-text); }
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px 0;
    color: var(--ptp-link);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    justify-self: center;
    width: 90%;
}
.panel-body {
    padding: 24px 32px 32px;
    color: var(--ptp-panel-text);
    max-width: 990px;
}
.panel-status{ display:flex; align-items:center; gap:8px; color:var(--ptp-text); font-weight:500; }
.status-dot{ width:10px; height:10px; border-radius:50%; background:#ffb347; box-shadow:0 0 12px rgba(255,179,71,0.7); transition:background 0.2s ease, box-shadow 0.2s ease; }
.status-dot.status-ready{ background:#95a5a6; box-shadow:0 0 12px rgba(149,165,166,0.55); }
.status-dot.status-running{ background:#2ecc71; box-shadow:0 0 14px rgba(46,204,113,0.65); }
.status-dot.status-paused{ background:#f1c40f; box-shadow:0 0 14px rgba(241,196,15,0.65); }
    .status-dot.status-finished {
        background: #9b1cab;
        box-shadow: 0 0 14px rgba(133,60,231,0.65);
    }
.description-panel {
    justify-content: right;
}
.panel-description-title {
    justify-content: right;
    margin-bottom: 8px;
}

.code-panel .practice-root {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    max-width: none;
}
.code-panel .lesson.texture{ background:var(--ptp-panel-bg); border:1px solid var(--ptp-panel-border); box-shadow:inset 0 0 0 3px rgba(0,0,0,0.06); border-radius:20px; }
.code-panel pre.code{ background:var(--ptp-editor-bg); color:var(--ptp-editor-text); font-size:15px; }

.description-body{ background:var(--ptp-surface-bg); border-radius:20px; border:1px solid var(--ptp-panel-border); padding:24px; color:var(--ptp-panel-text); box-shadow:inset 0 0 0 1px rgba(255,255,255,0.04); }
.description-title{ font-size:1.2rem; font-weight:700; margin-bottom:0.4rem; }
.description-meta{ display:flex; flex-wrap:wrap; gap:14px; font-size:0.9rem; color:var(--ptp-text); margin-bottom:1rem; }
.description-copy{ margin:0; color:var(--ptp-text); }
#algorithmDescriptionViewbox .description-section{ margin-top:12px; }
#algorithmDescriptionViewbox .description-label{ margin:0 0 6px; color:var(--ptp-link); font-size:0.9rem; }
#algorithmDescriptionViewbox .description-pseudocode {
    margin: 0;
    background: var(--ptp-editor-bg);
    border: 1px solid var(--ptp-editor-border);
    border-radius: 12px;
    padding: 12px;
    margin: 0 -5px;
    color: var(--ptp-editor-text);
    font-family: "SFMono-Regular",Consolas,"Liberation Mono",Menlo,monospace;
    white-space: pre-wrap;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}
#algorithmDescriptionViewbox .description-copy{ line-height:1.5; }

.blocked-error-message{ background:#f05d5e; color:#fff; padding:8px 16px; border-radius:999px; text-align:center; }
 

.selector-pulse{ animation:selectorPulse 0.8s ease-out; }
@keyframes selectorPulse{
    0%{ box-shadow:0 0 0 0 rgba(127,177,255,0.9); }
    100%{ box-shadow:0 0 0 18px rgba(127,177,255,0); }
}

/* Blue theme: keep legacy Code page palette for consistency */
[data-theme="blue"] .code-practice-stage {
    background: var(--pc-legacy-stage-bg);
    border: 1px solid var(--pc-legacy-stage-border);
    box-shadow: var(--pc-legacy-stage-shadow);
    color: #dbe7ff;
}

[data-theme="blue"] .toolbar-card {
    background: linear-gradient(135deg, var(--pc-legacy-card-bg-1) 0%, var(--pc-legacy-card-bg-2) 60%, var(--pc-legacy-card-bg-3) 100%);
    border: 1px solid var(--pc-legacy-card-border);
    box-shadow: 0 18px 40px rgba(2,5,19,0.65);
    color: var(--pc-legacy-card-text);
}

[data-theme="blue"] .code-practice-stage .btn,
[data-theme="blue"] .choose-exec-btn {
    background: var(--pc-legacy-btn-bg);
    border: 1px solid var(--pc-legacy-btn-border);
    color: #fff;
    box-shadow: 0 10px 25px rgba(0,0,0,0.45);
}

[data-theme="blue"] .choose-exec-btn,
[data-theme="dark"] .choose-exec-btn {
    background: var(--pc-legacy-next-btn-bg) !important;
}

[data-theme="dark"] .choose-exec-btn,
[data-theme="dark"] .btn-next-exercise {
    background: #1432a2 !important;
}

[data-theme="blue"] .btn-next-exercise {
    background: var(--pc-legacy-next-btn-bg) !important;
    border: 1px solid var(--pc-legacy-btn-border) !important;
}

[data-theme="blue"] .controls-metrics .metric-pill {
    background: var(--pc-legacy-metric-bg);
    border: 1px solid var(--pc-legacy-metric-border);
    color: var(--pc-legacy-metric-text);
}

[data-theme="blue"] .panel {
    background: var(--pc-legacy-stage-bg);
    border: 1px solid var(--pc-legacy-stage-border);
    box-shadow: 0 25px 45px rgba(0,0,0,0.55);
    color: #dbe7ff;
}

[data-theme="blue"] .panel-header {
    color: #9cc1ff;
}

[data-theme="blue"] .panel-status { color: #8bb7ff; }

[data-theme="blue"] .code-panel .lesson.texture {
    background: #a3c4ff;
    border: 0;
    box-shadow: inset 0 0 0 3px rgba(5,22,52,0.2);
}

[data-theme="blue"] .code-panel pre.code {
    background: transparent;
    color: #0a1030;
}

[data-theme="blue"] .description-body {
    background: var(--pc-legacy-description-bg);
    border: 1px solid var(--pc-legacy-pseudocode-border);
    color: var(--pc-legacy-description-text);
}

[data-theme="blue"] #algorithmDescriptionViewbox .description-label { color: #9cc1ff; }

[data-theme="blue"] #algorithmDescriptionViewbox .description-pseudocode {
    background: var(--pc-legacy-pseudocode-bg);
    border: 1px solid var(--pc-legacy-pseudocode-border);
    color: #dfe8ff;
}

[data-theme="blue"] .pause-overlay {
    background: var(--pc-legacy-pause-overlay);
    color: #fff;
}

[data-theme="light"] .selector-card {
    background: var(--pc-inner-panel-bg);
}

[data-theme="blue"] .selector-card {
    background: var(--pc-inner-panel-bg);
}

[data-theme="dark"] .selector-card {
    background: var(--pc-inner-panel-bg);
}

[data-theme="blue"] .toolbar-select,
[data-theme="blue"] .toolbar-select {
    background: var(--ptp-legacy-panel-bg);
    color: var(--pc-legacy-card-text);
}

[data-theme="blue"] .current-exercise-title {
    color: var(--pc-legacy-current-exercise-title);
}

.favorite-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 9, 26, 0.78);
    z-index: 80;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.favorite-modal.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.favorite-modal__backdrop {
    position: absolute;
    inset: 0;
}

.favorite-modal__panel {
    position: relative;
    width: min(92vw, 640px);
    max-height: 80vh;
    background: var(--ptp-panel-bg);
    color: var(--ptp-panel-text);
    border-radius: 24px;
    border: 1px solid var(--ptp-panel-border);
    box-shadow: 0 30px 60px rgba(0,0,0,0.35);
    padding: 28px;
    overflow: hidden;
    z-index: 1;
}

.favorite-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.favorite-modal__body {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 6px;
}

.favorite-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.favorite-item {
    background: var(--ptp-editor-bg);
    border: 1px solid var(--ptp-panel-border);
    border-radius: 18px;
    padding: 16px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}

.favorite-item__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.favorite-action {
    min-width: auto;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.favorite-action--play {
    background: var(--ptp-link);
    border-color: var(--ptp-panel-border);
    color: #fff;
}

.favorite-action--toggle {
    background: transparent;
    border-color: var(--ptp-panel-border);
}

.favorite-item__code-wrapper {
    border-radius: 14px;
    border: 1px solid var(--ptp-editor-border);
    background: var(--ptp-editor-bg);
    padding: 0;
}

.favorite-item__code-wrapper.is-collapsed {
    display: none;
}


.favorite-item__meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
    color: var(--ptp-text);
}

.favorite-item__meta strong {
    font-size: 1rem;
    color: var(--ptp-panel-text);
}

    .favorite-item__meta span {
        font-size: .85rem;
        opacity: .85;
        color: #858586;
    }

.favorite-item__code {
    margin: 0;
    padding: 12px 14px;
    font-size: .85rem;
    white-space: pre-wrap;
    max-height: 220px;
    overflow: auto;
}

.favorite-empty-state {
    margin: 0 0 16px;
    font-size: .95rem;
    color: var(--ptp-text);
    text-align: center;
}

.favorite-modal__close {
    min-width: auto;
    padding: 6px 10px;
    font-size: 1.2rem;
}

.btn-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.4);
}

.btn-favorite-saved {
    background: #0a8f48;
    border-color: #57f1a8;
}

.favorite-modal-open {
    overflow: hidden;
}

.custom-exercise-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 9, 26, 0.78);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.custom-exercise-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.custom-exercise__backdrop {
    position: absolute;
    inset: 0;
}

.custom-exercise__panel {
    position: relative;
    width: min(94vw, 760px);
    max-height: 88vh;
    background: var(--ptp-panel-bg);
    color: var(--ptp-panel-text);
    border-radius: 22px;
    border: 1px solid var(--ptp-panel-border);
    box-shadow: 0 28px 64px rgba(0,0,0,0.36);
    padding: 24px;
    overflow-y: auto;
    z-index: 1;
}

.custom-exercise__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.custom-exercise__eyebrow {
    font-size: .85rem;
    color: var(--ptp-text-muted);
    margin: 0 0 4px;
}

.custom-exercise__close {
    background: transparent;
    border: none;
    color: var(--ptp-panel-text);
    font-size: 2.4rem;
    line-height: 1;
    cursor: pointer;
}

.custom-exercise__body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.custom-exercise__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.custom-exercise__label {
    font-weight: 600;
    color: var(--ptp-panel-text);
}

.custom-exercise__input,
.custom-exercise__textarea {
    background: var(--ptp-editor-bg);
    border: 1px solid var(--ptp-editor-border);
    border-radius: 10px;
    color: var(--ptp-panel-text);
    padding: 10px 12px;
    font: inherit;
}

.custom-exercise__textarea {
    resize: vertical;
    min-height: 160px;
}

.custom-exercise__hint {
    margin: 0;
    font-size: .85rem;
    color: var(--ptp-text-muted);
}

.custom-exercise__consent {
    display: inline-block;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    font-size: .95rem;
    padding: 10px;
    border: 1px solid var(--ptp-editor-border);
    border-radius: 10px;
    background: var(--ptp-editor-bg);
}

.custom-exercise__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.custom-exercise__validation {
    min-height: 24px;
}

.custom-exercise__validation-text {
    margin: 0;
    font-size: .95rem;
}

.custom-exercise__validation-text.is-error {
    color: #ff7a7a;
}

    .custom-exercise__validation-text.is-ok {
        color: #0d9e6c;
    }

.custom-exercise__preview {
    border: 1px solid var(--ptp-editor-border);
    border-radius: 10px;
    background: var(--ptp-editor-bg);
    padding: 10px;
}

.custom-exercise__actions button {
    background: var(--ptp-button);
    color: #dde1e6;
    border: 1px solid transparent;
    padding: 0.65rem 1.1rem;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
}

.custom-exercise__publish {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--ptp-editor-border);
}

.custom-exercise__publish.is-hidden {
    display: none;
}

.custom-exercise__publish-title {
    margin: 0 0 4px;
    font-weight: 700;
    color: var(--ptp-panel-text);
}

.custom-exercise__publish-hint {
    margin: 0 0 8px;
    font-size: .9rem;
    color: var(--ptp-text-muted);
}

.custom-exercise__field-error {
    margin: 0;
    min-height: 16px;
    font-size: .85rem;
    color: #ff7a7a;
}

.custom-exercise__preview-label {
    margin: 0 0 6px;
    color: var(--ptp-text-muted);
    font-size: .9rem;
    font-style: italic;
}

.custom-exercise__preview pre {
    margin: 0;
    white-space: pre-wrap;
    max-height: 240px;
    overflow: auto;
}

.custom-exercise__preview code {
    color: var(--ptp-text);
}

.required {
    color: #ff8e53;
    font-weight: 600;
}

.notRequired {
    color: #0a9d34;
    font-weight: 600;
    margin-left: 6px;
}

#customExerciseTitle {
    margin: 0;
}

#customConsent {
    transform: scale(1.4);
    cursor: pointer;
}

.custom-exercise__consent a {
    margin-left: 5px;
    font-size: small;
}

@media(max-width:768px) {
    .code-practice-stage {
        padding: 18px;
    }

    .panel-header, .panel-body {
        padding: 18px;
    }

    .controls-buttons {
        flex-direction: column;
        align-items: flex-start;
    }

    .controls-metrics {
        flex-direction: column;
    }
}
