/* Practice Timer — MusEdLab */

.pt-container [hidden],
.pt-container[hidden] { display: none !important; }

.pt-container { max-width: 1200px; }

.pt-header h1 {
    font-size: 2.25rem;
}
.pt-header h1 .ti {
    color: var(--color-primary);
    margin-right: 0.25rem;
}

.pt-main {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.pt-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-lg);
}

/* Sign-in banner */
.pt-signin-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-info-bg);
    color: var(--color-info);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}
.pt-signin-link {
    background: var(--color-info);
    color: #fff;
    padding: 0.4rem 0.95rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}
.pt-signin-link:hover { filter: brightness(1.05); }

/* Global controls */
.pt-globals-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    justify-content: flex-start;
}

/* Buttons */
.pt-btn {
    min-height: 44px;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface);
    color: var(--color-text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: background var(--transition-fast), border-color var(--transition-fast),
                transform var(--transition-fast), box-shadow var(--transition-fast);
}
.pt-btn:hover { background: var(--color-background); }
.pt-btn:active { transform: translateY(1px); }
.pt-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.pt-btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: #fff;
    border-color: transparent;
}
.pt-btn-primary:hover { filter: brightness(1.05); background: linear-gradient(135deg, var(--color-primary), var(--color-accent)); }

.pt-btn-secondary {
    background: var(--color-surface);
    color: var(--color-primary);
    border-color: var(--color-border-strong);
}

.pt-btn-danger {
    background: var(--color-error);
    color: #fff;
    border-color: transparent;
}
.pt-btn-danger:hover { filter: brightness(1.05); background: var(--color-error); }

.pt-btn-danger-outline {
    color: var(--color-error);
    border-color: var(--color-error);
    background: var(--color-surface);
}
.pt-btn-danger-outline:hover { background: var(--color-error-bg); }

.pt-btn-small {
    min-height: 38px;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
}

/* Saved sets */
.pt-sets-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    gap: var(--space-sm);
    flex-wrap: wrap;
}
.pt-sets-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--color-text-primary);
}
.pt-save-form {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}
.pt-input {
    flex: 1 1 240px;
    min-height: 44px;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    font: inherit;
    color: var(--color-text-primary);
    background: var(--color-surface);
}
.pt-input:focus { outline: 2px solid var(--color-primary-light); outline-offset: 1px; }

.pt-sets-row {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
    padding-bottom: 0.25rem;
    min-height: 44px;
    align-items: center;
}
.pt-sets-empty {
    color: var(--color-text-tertiary);
    font-style: italic;
    font-size: 0.9rem;
}
.pt-set-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: 0.35rem 0.4rem 0.35rem 0.85rem;
    min-height: 40px;
}
.pt-set-chip-load {
    background: transparent;
    border: none;
    color: var(--color-text-primary);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 0.25rem 0.25rem 0.25rem 0;
    max-width: 18ch;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}
.pt-set-chip-del {
    border: none;
    background: transparent;
    color: var(--color-text-tertiary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pt-set-chip-del:hover { background: var(--color-error-bg); color: var(--color-error); }
.pt-set-chip-confirm {
    background: var(--color-error);
    color: #fff;
    border: none;
    border-radius: var(--radius-full);
    padding: 0.25rem 0.7rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
}

/* Board grid */
.pt-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-lg);
}
@media (max-width: 1024px) {
    .pt-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
    .pt-board { grid-template-columns: 1fr; }
}

/* Timer themes — Rose, Violet, Teal, Amber, Indigo, Sage */
.pt-timer-card[data-theme="0"] { --pt-theme: #e11d48; --pt-theme-soft: rgba(225,29,72,0.18); }
.pt-timer-card[data-theme="1"] { --pt-theme: #8b5cf6; --pt-theme-soft: rgba(139,92,246,0.18); }
.pt-timer-card[data-theme="2"] { --pt-theme: #14b8a6; --pt-theme-soft: rgba(20,184,166,0.18); }
.pt-timer-card[data-theme="3"] { --pt-theme: #f59e0b; --pt-theme-soft: rgba(245,158,11,0.22); }
.pt-timer-card[data-theme="4"] { --pt-theme: #4f46e5; --pt-theme-soft: rgba(79,70,229,0.18); }
.pt-timer-card[data-theme="5"] { --pt-theme: #65a30d; --pt-theme-soft: rgba(101,163,13,0.18); }

/* Timer card */
.pt-timer-card {
    position: relative;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    overflow: hidden;
    transition: box-shadow var(--transition-base);
}
.pt-card-accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--pt-theme);
}
.pt-timer-card.is-running {
    box-shadow: 0 0 0 1px var(--pt-theme), 0 8px 28px var(--pt-theme-soft);
}
.pt-timer-card.is-warning {
    animation: pt-pulse 1s ease-in-out infinite;
}
.pt-timer-card.is-done {
    animation: pt-flash 0.5s ease-in-out 0s 3;
}
@keyframes pt-pulse {
    0%, 100% { box-shadow: 0 0 0 1px var(--pt-theme), 0 8px 28px var(--pt-theme-soft); }
    50% { box-shadow: 0 0 0 3px var(--pt-theme), 0 12px 36px var(--pt-theme-soft); }
}
@keyframes pt-flash {
    0%, 100% { box-shadow: 0 0 0 1px var(--color-border); }
    50% { box-shadow: 0 0 0 4px var(--pt-theme), 0 0 36px var(--pt-theme); }
}

.pt-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.pt-name-input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    padding: 0.4rem 0.6rem;
    border: 1px solid transparent;
    background: transparent;
    border-radius: var(--radius-md);
    font: inherit;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--color-text-primary);
}
.pt-name-input:hover { background: var(--color-background); }
.pt-name-input:focus { outline: 2px solid var(--pt-theme); outline-offset: 1px; background: var(--color-surface); border-color: var(--color-border); }

.pt-icon-btn {
    width: 44px; height: 44px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-tertiary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.pt-icon-btn:hover { background: var(--color-error-bg); color: var(--color-error); }

.pt-delete-confirm {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--color-error-bg);
    color: var(--color-error);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.pt-type-toggle {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.25rem;
    background: var(--color-background);
    border-radius: var(--radius-md);
    align-self: flex-start;
}
.pt-toggle {
    min-height: 36px;
    padding: 0.3rem 0.85rem;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.pt-toggle.is-active {
    background: var(--color-surface);
    color: var(--pt-theme);
    box-shadow: var(--shadow-xs);
}

/* Ring */
.pt-ring-wrap {
    position: relative;
    width: 100%;
    max-width: 260px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
}
.pt-ring {
    width: 100%;
    height: 100%;
    display: block;
}
.pt-ring-track {
    fill: none;
    stroke: var(--color-border);
    stroke-width: 10;
}
.pt-ring-progress {
    fill: none;
    stroke: var(--pt-theme);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 553;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.25s linear, stroke 0.2s ease;
}
.pt-time-display {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.pt-time-text {
    font-family: var(--font-display);
    font-size: 2.75rem;
    font-weight: 700;
    color: var(--color-text-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.pt-times-up {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pt-theme);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.6rem;
    border-radius: 50%;
    text-align: center;
}

/* Duration set */
.pt-duration-set {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.pt-duration-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.pt-mmss-input {
    flex: 1 1 auto;
    min-height: 44px;
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    font: inherit;
    font-variant-numeric: tabular-nums;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    background: var(--color-surface);
}
.pt-mmss-input:focus { outline: 2px solid var(--pt-theme); outline-offset: 1px; }
.pt-mmss-input:disabled { opacity: 0.55; }
.pt-mmss-help {
    color: var(--color-text-tertiary);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}
.pt-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.pt-preset {
    flex: 1 1 auto;
    min-width: 44px;
    min-height: 36px;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.pt-preset:hover {
    background: var(--pt-theme);
    color: #fff;
    border-color: var(--pt-theme);
}
.pt-preset:disabled { opacity: 0.45; cursor: not-allowed; }

/* Card actions */
.pt-card-actions {
    display: flex;
    gap: 0.5rem;
}
.pt-start-btn {
    flex: 1 1 auto;
    min-height: 48px;
    font-size: 1rem;
    background: var(--pt-theme);
    border-color: transparent;
}
.pt-start-btn:hover { background: var(--pt-theme); filter: brightness(1.08); }
.pt-start-btn.is-running { background: var(--color-text-secondary); }
.pt-reset-btn {
    flex: 0 0 auto;
    min-width: 44px;
}

/* Alert */
.pt-alert-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: space-between;
}
.pt-alert-label {
    color: var(--color-text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
}
.pt-alert-select {
    min-height: 40px;
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    font: inherit;
    color: var(--color-text-primary);
    cursor: pointer;
}

/* Add tile */
.pt-add-tile {
    border: 2px dashed var(--color-border-strong);
    background: transparent;
    border-radius: var(--radius-lg);
    min-height: 280px;
    color: var(--color-text-tertiary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font: inherit;
    font-weight: 600;
    font-size: 1rem;
    transition: background var(--transition-fast), border-color var(--transition-fast),
                color var(--transition-fast);
}
.pt-add-tile .ti { font-size: 2rem; }
.pt-add-tile:hover { background: var(--color-background); border-color: var(--color-primary); color: var(--color-primary); }
.pt-add-tile:disabled { opacity: 0.5; cursor: not-allowed; }
.pt-add-tile:disabled:hover { background: transparent; border-color: var(--color-border-strong); color: var(--color-text-tertiary); }

/* Modal */
.pt-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}
.pt-modal[hidden] { display: none; }
.pt-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}
.pt-modal-content {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-xl);
}
.pt-modal-content h3 {
    margin: 0 0 var(--space-sm);
    font-family: var(--font-display);
    color: var(--color-text-primary);
}
.pt-modal-content p {
    margin: 0 0 var(--space-lg);
    color: var(--color-text-secondary);
}
.pt-modal-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
}

/* Collapsible shortcuts */
.pt-collapse-toggle {
    width: 100%;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--color-text-primary);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
    min-height: 44px;
}
.pt-chev { transition: transform var(--transition-base); }
.pt-collapse-toggle[aria-expanded="true"] .pt-chev { transform: rotate(180deg); }
.pt-collapse-panel {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
}
.pt-shortcuts-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.4rem 1rem;
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}
.pt-shortcuts-list dt { font-weight: 600; }
.pt-shortcuts-list kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: var(--color-background);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    padding: 0.1rem 0.4rem;
    font-size: 0.85rem;
    color: var(--color-text-primary);
}

/* Full screen */
.pt-fs-exit {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    padding: 0.6rem 1rem;
    min-height: 44px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.pt-fs-exit[hidden] { display: none; }

/* Pseudo-fullscreen fallback */
body.pt-pseudo-fullscreen {
    overflow: hidden;
}
body.pt-pseudo-fullscreen .pt-container.pt-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--color-background);
    overflow: auto;
    padding: var(--space-xl);
    max-width: none;
}

/* Fullscreen layout overrides — hide chrome, scale up */
.pt-container.pt-fullscreen .pt-header,
.pt-container.pt-fullscreen .pt-globals-card,
.pt-container.pt-fullscreen .pt-sets-card,
.pt-container.pt-fullscreen .pt-shortcuts-card,
.pt-container.pt-fullscreen .pt-add-tile,
.pt-container.pt-fullscreen .pt-card-header,
.pt-container.pt-fullscreen .pt-type-toggle,
.pt-container.pt-fullscreen .pt-duration-set,
.pt-container.pt-fullscreen .pt-alert-row,
.pt-container.pt-fullscreen .pt-delete-confirm {
    display: none !important;
}
.pt-container.pt-fullscreen .pt-card-actions {
    margin-top: var(--space-md);
    gap: var(--space-md);
}
.pt-container.pt-fullscreen .pt-start-btn {
    min-height: 64px;
    font-size: 1.25rem;
}
.pt-container.pt-fullscreen .pt-reset-btn {
    min-height: 64px;
    min-width: 64px;
    font-size: 1.1rem;
}
.pt-container.pt-fullscreen .pt-board {
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: var(--space-xl);
}
.pt-container.pt-fullscreen .pt-timer-card {
    min-height: 60vh;
    justify-content: center;
    padding: var(--space-2xl);
}
.pt-container.pt-fullscreen .pt-ring-wrap {
    max-width: min(520px, 70vh);
}
.pt-container.pt-fullscreen .pt-time-text {
    font-size: clamp(72px, 11vw, 160px);
}
.pt-container.pt-fullscreen .pt-times-up {
    font-size: clamp(36px, 4.5vw, 64px);
}
.pt-container.pt-fullscreen .pt-name-fs {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--color-text-primary);
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--space-md);
}

/* Hide name fallback element when not in fullscreen */
.pt-name-fs { display: none; }
.pt-container.pt-fullscreen .pt-name-fs { display: block; }

/* Native fullscreen */
.pt-container:fullscreen {
    background: var(--color-background);
    overflow: auto;
    padding: var(--space-xl);
    max-width: none;
    width: 100%;
    height: 100%;
}

/* Mobile */
@media (max-width: 600px) {
    .pt-container { padding: var(--space-md); }
    .pt-card { padding: var(--space-md); }
    .pt-time-text { font-size: 2.25rem; }
    .pt-globals-row .pt-btn { flex: 1 1 calc(50% - var(--space-sm)); }
}
