/* Scratchpad Panel */
@keyframes scratchpadNudge {
    0% { transform: translateY(-50%) translateX(0); }
    15% { transform: translateY(-50%) translateX(-6px); }
    30% { transform: translateY(-50%) translateX(0); }
    45% { transform: translateY(-50%) translateX(-4px); }
    60% { transform: translateY(-50%) translateX(0); }
    75% { transform: translateY(-50%) translateX(-2px); }
    100% { transform: translateY(-50%) translateX(0); }
}
@keyframes scratchpadShimmer {
    0% { box-shadow: -2px 0 8px rgba(0,0,0,0.15); }
    30% { box-shadow: -2px 0 16px rgba(81,127,122,0.5), -4px 0 24px rgba(81,127,122,0.25); }
    100% { box-shadow: -2px 0 8px rgba(0,0,0,0.15); }
}
.scratchpad-handle {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9998;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    background: #38524F;
    color: white;
    padding: 16px 10px;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    transition: background 0.2s ease, right 0.3s ease;
    user-select: none;
    box-shadow: -2px 0 8px rgba(0,0,0,0.15);
    animation: scratchpadNudge 0.8s ease-out 1.5s 1, scratchpadShimmer 1.2s ease-out 1.5s 1;
}
/* Tooltip shown on first visit */
.scratchpad-tooltip {
    position: fixed;
    right: 48px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9997;
    background: #2E2244;
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 13px;
    line-height: 1.4;
    max-width: 220px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    opacity: 0;
    pointer-events: none;
    animation: tooltipFadeIn 0.4s ease-out 2.2s forwards;
}
.scratchpad-tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #2E2244;
}
@keyframes tooltipFadeIn {
    0% { opacity: 0; transform: translateY(-50%) translateX(8px); }
    100% { opacity: 1; transform: translateY(-50%) translateX(0); }
}
.scratchpad-handle:hover {
    background: #577F7B;
}
.scratchpad-handle.panel-open {
    right: 400px;
}

.scratchpad-overlay {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100%;
    z-index: 9999;
    background: #f8f9fa;
    border-left: 3px solid #38524F;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    font-family: Georgia, 'Times New Roman', serif;
}
.scratchpad-overlay.open {
    right: 0;
}

.scratchpad-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #38524F;
    color: white;
}
.scratchpad-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}
.scratchpad-header-buttons {
    display: flex;
    gap: 8px;
}
.scratchpad-header button {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-family: Georgia, 'Times New Roman', serif;
    transition: background 0.2s ease;
}
.scratchpad-header button:hover {
    background: rgba(255,255,255,0.25);
}

.scratchpad-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}
.scratchpad-textarea {
    flex: 1;
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    padding: 16px 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #1e293b;
    background: #f8f9fa;
}
.scratchpad-textarea::placeholder {
    color: #94a3b8;
}

.scratchpad-footer {
    padding: 10px 20px;
    background: #e2e8f0;
    font-size: 11px;
    color: #64748b;
    text-align: center;
    border-top: 1px solid #cbd5e1;
}

/* Entry flash animation */
@keyframes scratchpadFlash {
    0% { background-color: #d1fae5; }
    100% { background-color: #f8f9fa; }
}
.scratchpad-textarea.flash {
    animation: scratchpadFlash 0.8s ease-out;
}

/* Copy button pair styles */
.copy-btn-group {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.copy-btn-clipboard,
.copy-btn-scratchpad {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 5px;
    padding: 8px 14px;
    cursor: pointer;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}
.copy-btn-clipboard {
    background-color: #577F7B;
    color: white;
}
.copy-btn-clipboard:hover {
    opacity: 0.9;
}
.copy-btn-scratchpad {
    background-color: #38524F;
    color: white;
}
.copy-btn-scratchpad:hover {
    opacity: 0.9;
}

/* Small inline copy buttons (for multiplier-getter etc.) */
.copy-btn-sm-group {
    display: inline-flex;
    gap: 4px;
    margin-top: 4px;
}
.copy-btn-sm {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-family: Georgia, 'Times New Roman', serif;
    transition: opacity 0.2s ease;
}
.copy-btn-sm:hover {
    opacity: 0.85;
}
.copy-btn-sm.clipboard {
    background: #577F7B;
    color: white;
}
.copy-btn-sm.scratchpad {
    background: #38524F;
    color: white;
}

/* ═══════════════════════════════════════ */
/* Quick Calculator (bottom of scratchpad) */
/* ═══════════════════════════════════════ */
.scratchpad-calc {
    border-top: 2px solid #38524F;
}
.scratchpad-calc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: #38524F;
    color: white;
    cursor: pointer;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 14px;
    font-weight: 600;
    user-select: none;
}
.scratchpad-calc-header:hover {
    background: #476b67;
}
.scratchpad-calc-body {
    padding: 12px 16px;
    background: #eef1f0;
}
.scratchpad-calc-display {
    background: white;
    border: 2px solid #38524F;
    border-radius: 6px;
    padding: 10px 14px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    text-align: right;
    margin-bottom: 10px;
    min-height: 28px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.scratchpad-calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}
.calc-btn {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 5px;
    padding: 12px 0;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    text-align: center;
}
.calc-btn:active {
    transform: scale(0.95);
}
.calc-btn.num {
    background: white;
    color: #1e293b;
    border: 1px solid #d1d5db;
}
.calc-btn.num:hover {
    background: #f3f4f6;
}
.calc-btn.op {
    background: #517F7A;
    color: white;
}
.calc-btn.op:hover {
    background: #6B9E99;
}
.calc-btn.eq {
    background: #2E2244;
    color: white;
}
.calc-btn.eq:hover {
    background: #463560;
}
.scratchpad-calc-actions {
    display: flex;
    gap: 6px;
}
.calc-action-btn {
    flex: 1;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 12px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    padding: 8px 0;
    cursor: pointer;
    background: #38524F;
    color: white;
    transition: opacity 0.2s ease;
}
.calc-action-btn:hover {
    opacity: 0.85;
}

/* Copy feedback message */
.copy-feedback-msg {
    font-size: 0.875rem;
    font-weight: 600;
    color: #16a34a;
    opacity: 1;
    transition: opacity 0.3s ease;
}
