:root {
    color-scheme: light dark;
    --bg-color: Canvas;
    --text-color: CanvasText;
    --card-bg: rgba(150, 150, 150, 0.12);
    --border-color: rgba(150, 150, 150, 0.22);
    --accent-color: AccentColor;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Header Controls */
.top-bar {
    position: absolute;
    top: 24px;
    left: 24px;
    right: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.weather-widget {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    font-size: 0.95rem;
}

.weather-widget svg {
    width: 18px;
    height: 18px;
}

#settings-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    transition: opacity 0.2s, transform 0.2s;
}

#settings-btn:hover {
    opacity: 1;
    transform: rotate(30deg);
}

#settings-btn svg {
    width: 22px;
    height: 22px;
}

/* Main Display */
.main-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

h1 {
    font-weight: 400;
    font-size: 2.8rem;
    letter-spacing: -0.03em;
    margin: 0;
}

#time {
    opacity: 0.6;
}

/* Human Design Favorites Grid */
.favorites-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    max-width: 640px;
}

.fav-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    user-select: none;
}

.fav-card:hover {
    background: rgba(150, 150, 150, 0.22);
    transform: translateY(-2px);
}

.fav-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.fav-edit-btn {
    opacity: 0;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    transition: opacity 0.15s;
}

.fav-card:hover .fav-edit-btn {
    opacity: 0.6;
}

.fav-edit-btn:hover {
    opacity: 1 !important;
}

.fav-add-card {
    border-style: dashed;
    opacity: 0.7;
}

.fav-add-card:hover {
    opacity: 1;
}

/* Sticky Note Pad */
.pad-container {
    position: absolute;
    bottom: 24px;
    left: 24px;
}

.sticky-pad {
    width: 130px;
    height: 100px;
    background: rgba(255, 235, 140, 0.7);
    color: #333;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1), inset 0 -4px 0 rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    user-select: none;
    transition: transform 0.15s, background 0.2s;
}

.sticky-pad:hover {
    background: rgba(255, 235, 140, 0.9);
    transform: translateY(-2px);
}

.sticky-note {
    position: fixed;
    width: 220px;
    height: 180px;
    background: rgba(255, 235, 140, 0.95);
    color: #333;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    z-index: 50;
}

.sticky-header {
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    font-size: 0.85rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    opacity: 0.75;
}

.sticky-title {
    display: flex;
    align-items: center;
    gap: 4px;
}

.note-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    color: #333;
    opacity: 0.6;
}

.note-close-btn:hover {
    opacity: 1;
}

.sticky-content {
    flex: 1;
    background: transparent;
    border: none;
    resize: none;
    padding: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    color: #222;
    outline: none;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.iframe-card {
    max-width: 85vw;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.iframe-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.iframe-container {
    flex: 1;
    width: 100%;
    margin-top: 15px;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

iframe {
    width: 100%;
    height: 100%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.input-group label {
    font-size: 0.85rem;
    opacity: 0.8;
}

input[type="text"], input[type="url"], select {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: inherit;
    outline: none;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

button.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 9px 16px;
    border-radius: 8px;
    border: none;
    background: var(--accent-color, #007acc);
    color: white;
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
}

button.btn-danger {
    padding: 9px 16px;
    border-radius: 8px;
    border: none;
    background: #ff4d4f;
    color: white;
    cursor: pointer;
    font-weight: 500;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 14px 0;
}

.hidden {
    display: none !important;
}

.icon-small {
    width: 14px;
    height: 14px;
}

.icon-inline {
    width: 14px;
    height: 14px;
    margin-left: 4px;
}