:root {
    --bg-color: #f2f2f7;
    --card-bg: #ffffff;
    --text-primary: #000000;
    --text-secondary: #8e8e93;
    --accent-color: #e0a320;
    /* Typical Notes Yellow/Gold */
    --separator-color: #c6c6c8;
    --danger-color: #ff3b30;
    --overlay-bg: rgba(0, 0, 0, 0.85);
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #000000;
        --card-bg: #1c1c1e;
        --text-primary: #ffffff;
        --text-secondary: #8e8e93;
        --separator-color: #38383a;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-stack);
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    /* App-like feel */
    height: 100vh;
    width: 100vw;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    background-color: var(--bg-color);
}

.screen.active {
    display: flex;
}

/* Headers */
.app-header {
    height: 44px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    background-color: var(--bg-color);
    /* Translucent in real iOS, solid here for simplicity */
    z-index: 10;
}

.large-title {
    padding: 10px 16px;
}

.large-title h1 {
    font-size: 34px;
    font-weight: 700;
}

/* Buttons */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 17px;
    color: var(--accent-color);
}

.text-btn {
    font-weight: 400;
}

.text-danger {
    color: var(--danger-color);
}

.primary-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
}

/* Search Bar */
.search-bar-container {
    padding: 0 16px 10px;
}

.search-bar {
    background-color: rgba(118, 118, 128, 0.12);
    border-radius: 10px;
    height: 36px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    color: var(--text-secondary);
}

.search-bar i {
    font-size: 14px;
    margin-right: 6px;
}

.search-bar input {
    background: none;
    border: none;
    width: 100%;
    font-size: 17px;
    color: var(--text-primary);
    outline: none;
}

/* List View */
.notes-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 100px 16px;
    /* Extra padding for fixed footer */
    -webkit-overflow-scrolling: touch;
}

.notes-group {
    background-color: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
}

#notes-list {
    list-style: none;
    padding-left: 16px;
    /* Indent separator */
}

.note-item {
    padding: 12px 16px 12px 0;
    border-bottom: 0.5px solid var(--separator-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.note-item:last-child {
    border-bottom: none;
}

.note-content-wrapper {
    flex: 1;
    overflow: hidden;
}

.note-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-preview {
    font-size: 15px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-lock-icon {
    margin-left: 10px;
    color: var(--text-secondary);
}

.note-time {
    margin-right: 6px;
    font-weight: 400;
    color: var(--text-secondary);
    /* Usually lighter, but keeping consistent */
}

/* Footer */
.app-footer {
    height: 80px;
    background-color: var(--bg-color);
    /* Ensure opaque background */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 0.5px solid var(--separator-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 16px;
    font-size: 11px;
    color: var(--text-primary);

    /* Mobile Fix */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 20;
    padding-bottom: env(safe-area-inset-bottom, 20px);
    /* iPhone Home Bar */
}

.app-footer.left-handed {
    flex-direction: row-reverse;
}

.footer-status {
    flex-grow: 1;
    text-align: center;
    padding-top: 6px;
    font-size: 11px;
    color: var(--text-primary);
}

#new-note-btn {
    font-size: 22px;
}

/* Editor View */
#editor-screen {
    background-color: var(--card-bg);
    /* Editor is usually full white/black */
}

.editor-container {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

#note-editor {
    width: 100%;
    height: 100%;
    border: none;
    resize: none;
    font-family: var(--font-stack);
    font-size: 18px;
    line-height: 1.5;
    background: transparent;
    color: var(--text-primary);
    outline: none;
}

/* Modals & Overlays */
.overlay,
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.overlay {
    background-color: var(--overlay-bg);
    color: white;
}

.overlay.active,
.modal.active {
    display: flex;
}

.overlay-content {
    text-align: center;
    padding: 20px;
    max-width: 80%;
}

.modal {
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: var(--card-bg);
    width: 90%;
    max-width: 320px;
    border-radius: 12px;
    padding: 20px;
    padding: 20px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Condition Icon Grid */
.condition-icon-grid {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    justify-content: space-around;
}

.condition-icon-option {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.condition-icon-option:hover {
    background: rgba(255, 255, 255, 0.2);
}

.condition-icon-option.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.4);
}

/* Weather & Operator Toggles */
.weather-opt {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

.weather-opt.active {
    background: var(--accent-color);
    color: white;
}

.op-toggle {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
}

.op-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Stylish Cancel Button */
.stylish-cancel-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 8px 24px;
    border-radius: 20px;
    font-size: 14px;
    backdrop-filter: blur(4px);
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 20px;
}

.stylish-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Animations */
@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
}

.analyzing-anim {
    animation: pulse-ring 1.5s infinite ease-in-out;
    color: var(--accent-color);
}

.success-text {
    color: #4cd964;
    font-size: 28px;
    font-weight: bold;
    animation: pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop-in {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-content h3 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 18px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--separator-color);
    border-radius: 6px;
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-size: 16px;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.condition-text {
    font-size: 18px;
    margin-bottom: 10px;
}

.current-status {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 20px;
}

.mb-4 {
    margin-bottom: 16px;
}

/* Utilities */
.header-actions {
    display: flex;
    gap: 16px;
}

/* Status Bar */
.status-bar {
    background-color: #333;
    color: white;
    padding: 8px 16px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-item i {
    color: var(--accent-color);
}

/* Delete Button in List */
.delete-note-btn {
    margin-left: 15px;
    /* Separate from lock icon */
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
    position: relative;
    /* For tooltip */
    padding: 8px;
    /* Hit area */
}

.delete-note-btn:hover {
    color: var(--danger-color);
}

/* Tooltip for Delete Icon */
.delete-note-btn:hover::after {
    content: "メモを削除 (Delete)";
    position: absolute;
    bottom: 100%;
    right: 0;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
    pointer-events: none;
    margin-bottom: 5px;
}