* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Root variables for consistent theming */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #333333;
    --text-secondary: #666666;
    --accent: #000000;
    --border: #dddddd;
    --warning-bg: #fff8e1;
    --warning-border: #ffcc02;
    --success: #28a745;
    --danger: #dc3545;
}

/* Body and Main Layout */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px 20px;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 500px;
    text-align: center;
    animation: fadeIn 0.6s ease-out;
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Typography */
h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 24px;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.tagline {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    letter-spacing: 0.2px;
    font-weight: 400;
}

h3 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 24px;
    text-align: left;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

/* Timer Display */
.timer {
    font-size: 52px;
    font-weight: 200;
    margin: 32px 0;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Courier New', monospace;
    letter-spacing: 3px;
    color: var(--text-primary);
}

/* Info trigger and panel */
.timer-container {
    position: relative;
    display: inline-block;
}

.info-trigger {
    position: absolute;
    top: -8px;
    right: -25px;
    width: 24px;
    height: 24px;
    font-size: 12px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    margin: 0;
}


.info-trigger:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
    color: var(--text-primary);
}

.info-panel {
    font-size: 11px;
    color: var(--text-secondary);
    margin: 16px 0;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    line-height: 1.4;
    text-align: left;
    overflow-wrap: anywhere;
    word-break: break-word; 
}

/* Status and Deadline */
.status {
    font-size: 14px;
    margin-bottom: 24px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Courier New', monospace;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.deadline {
    font-size: 16px;
    margin-bottom: 32px;
    color: var(--text-secondary);
    letter-spacing: 0.2px;
}

/* Buttons */
button {
    background: var(--accent);
    color: #ffffff;
    border: none;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    margin: 8px;
    font-family: inherit;
    text-transform: lowercase;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: none;
    letter-spacing: 0.3px;
}

button:hover {
    background: #333333;
    transform: none;
    box-shadow: none;
}

button:active {
    transform: none;
    box-shadow: none;
}

button:disabled {
    background: #333333;
    color: #666666;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Small/Secondary buttons */
button[style*="font-size: 14px"] {
    font-size: 14px !important;
    padding: 12px 20px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    box-shadow: none;
}

button[style*="font-size: 14px"]:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
    color: var(--text-primary);
}

/* Copy buttons in key displays */
.key-display button {
    font-size: 14px;
    padding: 8px 16px;
    margin: 0;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    box-shadow: none;
    border-radius: 6px;
}

.key-display button:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

/* Input Fields */
input, textarea {
    width: 100%;
    padding: 16px;
    margin: 12px 0;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    outline: none;
}

input::placeholder, textarea::placeholder {
    color: #666666;
}

input:focus, textarea:focus {
    border-color: var(--accent);
    background: var(--bg-secondary);
    box-shadow: none;
}

textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.warning {
    border: 1px solid var(--warning-border);
    background: var(--warning-bg);
    padding: 8px 12px;
    margin: 12px 0;
    text-align: left;
    font-size: 14px;
    border-radius: 4px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.warning strong {
    color: var(--text-primary);
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

/* Sections */
.section {
    margin: 24px 0;
}

.key-section {
    margin: 20px 0;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* Key Display */
.key-display {
    margin: 16px 0;
    text-align: left;
}

.key-display label {
    font-size: 14px;
    display: block;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* desktop-friendly defaults */
.key-value {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Courier New', monospace;
    font-size: 13px;
    word-break: normal;          /* keep tokens intact on wide screens */
    overflow-wrap: anywhere;     /* break only if truly needed */
    overflow-x: auto;            /* horizontal scroll inside box if overflow */
    border: 1px solid var(--border);
    padding: 16px;
    margin-bottom: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    color: var(--text-primary);
    line-height: 1.6;
    letter-spacing: 0.5px;
    user-select: all;            /* makes copy-paste easier */
}

/* mobile override: always break to avoid tiny scrollbars */
@media (max-width: 600px) {
  .key-value {
    word-break: break-all;       /* never overflow on small screens */
    overflow-x: visible;         /* no scrollbars on mobile */
  }
}

/* Hidden key styling */
.key-value[data-hidden="true"] {
    letter-spacing: 2px;
    color: var(--text-secondary);
    user-select: none;
}

.key-toggle-btn {
    font-size: 12px !important;
    padding: 6px 12px !important;
    margin-right: 8px !important;
    background: transparent !important;
    border: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
}

.key-toggle-btn:hover {
    background: var(--bg-primary) !important;
    border-color: var(--accent) !important;
    color: var(--text-primary) !important;
}

/* Hidden State */
.hidden {
    display: none;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Additional Polish */
::selection {
  background: var(--accent);
  color: #fff; /* clear, high-contrast selection text */
}


/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus visible for accessibility */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


/* Loading or transition states */
.status[data-state="sending"] {
    color: var(--accent);
}

.status[data-state="sent"] {
    color: var(--success);
}

.status[data-state="failed"] {
    color: var(--danger);
}

/* Timer screen specific styling */
#timerScreen {
    animation: fadeIn 0.6s ease-out;
}

#timerScreen button:first-of-type {
    margin-top: 0;
    font-size: 18px;
    padding: 18px 32px;
    font-weight: 600;
}

/* Setup screen spacing */
#setupScreen .section:last-child {
    margin-bottom: 0;
}

/* Improve readability for monospace elements */
.timer,
.status,
.key-value {
    -webkit-font-feature-settings: "tnum";
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

/* Back button styling */
.back-button {
    font-size: 14px !important;
    padding: 8px 16px !important;
    background: transparent !important;
    border: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
    margin-bottom: 20px !important;
}

.timer-selection {
    margin: 12px 0;
    text-align: left;
    line-height: 0;
}

.timer-selection > span {
    line-height: 1.6;
    display: inline-block;
    margin-bottom: 8px;
}

/* Desktop timer buttons */
.timer-btn {
    font-size: 14px !important;
    padding: 10px 16px !important;
    margin: 0 6px 0 0 !important;
    background: var(--bg-secondary) !important;
    border: 1.5px solid var(--text-secondary) !important;
    color: var(--text-primary) !important;
    border-radius: 6px !important;
    min-width: 50px;
    transition: all 0.1s ease !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

.timer-btn:hover {
    background: var(--bg-primary) !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
}

/* Disable hover effects on touch devices */
@media (hover: none) and (pointer: coarse) {
    .timer-btn:hover {
        background: var(--bg-secondary) !important;
        border-color: var(--text-secondary) !important;
        color: var(--text-primary) !important;
    }
}

.timer-btn.selected {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #ffffff !important;
}

.timer-btn.selected:hover {
    background: #333333 !important;
}

.back-button:hover {
    background: var(--bg-secondary) !important;
    border-color: var(--accent) !important;
    color: var(--text-primary) !important;
}

/* Connection info link styling */
.connection-info-link {
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    margin: 16px 0;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    display: inline-block;
    transition: all 0.2s ease;
}

.connection-info-link:hover {
    color: var(--text-primary);
    border-bottom-color: var(--border);
}

.info-text {
    font-weight: 500;
    letter-spacing: 0.2px;
}

.connection-details {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    margin: 12px 0;
    text-align: left;
    font-size: 11px;
    overflow-wrap: anywhere;  
    word-break: break-word;
}

.detail-header {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.detail-text {
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Nostr attribution */
.nostr-attribution {
    margin-top: 32px;
    font-size: 16px;
    color: var(--text-secondary);
    text-align: center;
}

.attribution-text {
    letter-spacing: 0.2px;
    font-weight: 400;
}

.nostr-purple {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Contextual security guidance */
.security-context {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    letter-spacing: 0.2px;
    font-weight: 400;
}

.validation-message {
    font-size: 14px;
    color: var(--danger);
    margin-top: 12px;
    text-align: center;
    letter-spacing: 0.2px;
}

.import-warning {
    font-size: 13px;
    color: var(--danger);
    margin-bottom: 12px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

#publicPostReminder {
    font-weight: 500;
}

.browser-warning {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    letter-spacing: 0.2px;
    font-weight: 400;
}

.app-footer {
    margin: 24px auto 16px;
    max-width: 720px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-secondary);
    text-align: center;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
}

.app-footer a {
    color: inherit;
    text-decoration: underline;
}

.disclaimer {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 16px;
    line-height: 1.4;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

#backupContent{
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow-x: auto;
  /* keep your current inline font-size/line-height; no change needed here */
}

/* Mobile Responsive Adjustments */
@media (max-width: 480px) {
    body {
        padding: 20px 16px;
    }
    
    h1 {
        font-size: 28px;
        margin-bottom: 32px;
    }
    
    .timer {
        font-size: 48px;
        margin: 32px 0;
    }
    
    button {
        padding: 14px 20px;
        font-size: 15px;
        margin: 6px;
        min-height: 44px;
    }
    
    .key-section {
        padding: 24px 20px;
    }
    
    .warning {
        padding: 20px;
        margin: 24px 0;
    }
    
   /* Enhanced timer button styling for mobile */
    .timer-btn {
        min-width: 70px !important;
        min-height: 44px !important;
        max-height: 44px !important;
        padding: 12px 16px !important;
        margin: 8px 6px !important;
        background: #ffffff !important;
        border: 2px solid var(--accent) !important;
        color: var(--accent) !important;
        font-weight: 500 !important;
        font-size: 14px !important;
        border-radius: 8px !important;
        display: inline-block !important;
        vertical-align: middle !important;
        line-height: 1.2 !important;
        transition: none !important;
        /* Kill all iOS artifacts */
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        -webkit-appearance: none !important;
        touch-action: manipulation !important;
    }

    .timer-btn:focus {
        outline: none !important;
    }

    .timer-btn:active {
        /* Instant feedback without lingering effects */
        transform: scale(0.96) !important;
        transition: transform 0.05s ease !important;
    }

    .timer-btn.selected {
        background: var(--accent) !important;
        color: #ffffff !important;
        border: 2px solid var(--accent) !important;
    }

    .timer-btn.selected:active {
        background: var(--accent) !important;
        transform: scale(0.96) !important;
        transition: transform 0.05s ease !important;
    }

    /* Fix key display overflow */
    .key-value {
        font-size: 11px;
        padding: 12px;
        overflow: hidden;
        word-break: break-all;
        white-space: normal;
        text-overflow: ellipsis;
    }
    
    .key-value[data-hidden="true"] {
        letter-spacing: 1px;
        overflow: hidden;
    }
    
    /* Ensure key display buttons don't overlap */
    .key-display button {
        margin-right: 8px !important;
        margin-bottom: 8px !important;
    }
    
    /* Footer adjustments */
        .app-footer {
            margin: 16px auto 8px;
            padding: 12px 8px;
            font-size: 11px;
        }

        /* Override desktop hover behavior on mobile */
        .timer-btn.selected:hover {
            background: var(--accent) !important;
        }
}
