.memory-view {
    --bg-color: #f7f7f9;
    --text-color: #333333;
    position: fixed;
    inset: 0;
    z-index: 1200;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.memory-view[hidden] {
    display: none;
}

.memory-view,
.memory-view * {
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.memory-view *,
.memory-view *::before,
.memory-view *::after {
    box-sizing: content-box;
}

.memory-view p {
    margin: 1em 0;
}

.memory-view button:focus-visible,
.memory-view input:focus-visible,
.memory-view textarea:focus-visible,
.memory-view [role="button"]:focus-visible,
.memory-view [role="tab"]:focus-visible {
    outline: none;
}

body.is-memory-open .desktop-container,
body.is-memory-open .pagination,
body.is-memory-open .dock-container,
body.is-memory-open .system-status-bar {
    visibility: hidden;
    pointer-events: none;
}

.memory-view .container {
    width: 100%;
    max-width: 900px;
    padding: 30px 24px;
    box-sizing: border-box;
}

.memory-view .header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    position: relative;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.memory-view .header::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background-color: #d0d0d0;
}

.memory-view .header h1 {
    font-size: 24px;
    font-weight: 300;
    letter-spacing: 4px;
    color: #555;
    margin: 0;
}

.memory-view .back-btn {
    position: absolute;
    left: 0;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, color 0.3s ease;
    padding: 10px;
    display: flex;
    align-items: center;
}

.memory-view .back-btn:hover {
    color: #333;
}

.memory-view .header.show-back .back-btn {
    opacity: 1;
    pointer-events: auto;
}

.memory-view .add-btn {
    position: absolute;
    right: 0;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 10px;
    display: flex;
    align-items: center;
    transition: color 0.3s ease;
}

.memory-view .add-btn:hover {
    color: #333;
}

.memory-view .view-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
}

.memory-view .view {
    transition: opacity 0.5s ease, transform 0.5s ease;
    width: 100%;
    display: flex;
    justify-content: center;
}

.memory-view .view.hidden {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 0;
    transform: translateY(20px);
}

.memory-view .view.active {
    opacity: 1;
    pointer-events: auto;
    position: relative;
    transform: translateY(0);
}

.memory-view .stamps-group {
    position: relative;
    width: 100%;
    max-width: 450px;
    height: 280px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    cursor: pointer;
}

.memory-view .stamps-group:hover {
    transform: translateY(-8px) scale(1.02);
}

.memory-view .stamps-group:hover .stamp-container {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.12)) drop-shadow(0 12px 24px rgba(0, 0, 0, 0.1));
}

.memory-view .stamps-group:hover .clip-front {
    filter: drop-shadow(2px 6px 4px rgba(0, 0, 0, 0.25));
}

.memory-view .stamp-container {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15)) drop-shadow(0 8px 16px rgba(0, 0, 0, 0.08));
    transition: filter 0.5s ease;
}

.memory-view [data-memory-home] .stamp-container {
    position: absolute;
}

.memory-view [data-memory-home] .stamp-left {
    transform: rotate(-3deg) translateX(-85px) translateY(5px);
    z-index: 3;
}

.memory-view [data-memory-home] .stamp-right {
    transform: rotate(4deg) translateX(85px) translateY(-2px);
    z-index: 2;
}

.memory-view .stamp {
    background-color: rgba(255, 255, 255, 0.8);
    -webkit-mask:
        linear-gradient(black, black) center / calc(100% - 8px) calc(100% - 8px) no-repeat,
        radial-gradient(circle, transparent 4px, black 4.5px) -6px -6px / 12px 12px repeat;
    mask:
        linear-gradient(black, black) center / calc(100% - 8px) calc(100% - 8px) no-repeat,
        radial-gradient(circle, transparent 4px, black 4.5px) -6px -6px / 12px 12px repeat;
    padding: 16px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
}

.memory-view .stamp-home {
    width: 216px;
    height: 216px;
}

.memory-view .stamp-inner {
    width: 100%;
    height: 100%;
    border: 1px solid rgba(0, 0, 0, 0.04);
    background-color: rgba(250, 250, 250, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.memory-view .stamp-image-placeholder {
    width: 85%;
    height: 85%;
    background-color: rgba(240, 240, 240, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #d5d5d5;
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.memory-view .stamp-value {
    position: absolute;
    bottom: 10px;
    right: 14px;
    font-size: 14px;
    color: #aaa;
    font-family: Georgia, serif;
    letter-spacing: 1px;
}

.memory-view .paperclip {
    position: absolute;
    top: 12px;
    left: 50%;
    width: 32px;
    height: 85px;
    transform: translateX(-50%) rotate(12deg);
    pointer-events: none;
}

.memory-view .clip-back {
    z-index: 1;
    filter: drop-shadow(1px 2px 1px rgba(0, 0, 0, 0.08));
}

.memory-view .clip-front {
    z-index: 4;
    filter: drop-shadow(1.5px 3px 2px rgba(0, 0, 0, 0.35));
    transition: filter 0.5s ease;
}

.memory-view .detail-layout {
    width: 100%;
    max-width: 348px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

.memory-view .detail-header {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    width: 100%;
}

.memory-view .detail-header > .stamp-container:last-child {
    flex: 1;
    min-width: 0;
}

.memory-view .stamp-avatar {
    width: 108px;
    height: 108px;
    flex-shrink: 0;
    padding: 8px;
}

.memory-view .stamp-rect {
    width: 100%;
    height: 108px;
    padding: 8px;
    box-sizing: border-box;
    -webkit-mask: none;
    mask: none;
    border-radius: 10px;
}

.memory-view .stamp-rect .stamp-inner {
    border-radius: 6px;
}

.memory-view .stamp-avatar .stamp-image-placeholder {
    width: 85%;
    height: 85%;
    font-size: 9px;
    border-radius: 0;
}

.memory-view .card-tag {
    position: absolute;
    top: -8px;
    left: 16px;
    background-color: #e5e5e5;
    color: #777;
    font-size: 7px;
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: 1px;
    font-weight: bold;
    z-index: 10;
}

.memory-view .stats-box {
    background-color: #f1f2f4;
    border-radius: 14px;
    padding: 8px 30px;
    display: flex;
    justify-content: space-around;
    margin-bottom: 24px;
    width: 100%;
    box-sizing: border-box;
}

.memory-view .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.memory-view .stat-label {
    font-size: 10px;
    letter-spacing: 1px;
    color: #999;
    text-transform: uppercase;
}

.memory-view .stat-value {
    font-size: 24px;
    font-weight: 800;
    font-style: italic;
    color: #444;
    font-family: Nunito, Quicksand, ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", sans-serif;
    letter-spacing: 0;
    line-height: 1.2;
}

.memory-view .tabs-container {
    width: 100%;
}

.memory-view .tabs-nav {
    display: flex;
    justify-content: space-between;
    padding-bottom: 12px;
    position: relative;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    width: 100%;
}

.memory-view .tab-item {
    font-size: 12px;
    color: #999;
    cursor: pointer;
    padding: 2px 0;
    transition: color 0.3s ease;
    user-select: none;
    white-space: nowrap;
}

.memory-view .tab-item:hover {
    color: #666;
}

.memory-view .tab-item.active {
    color: #333;
    font-weight: 500;
}

.memory-view .tabs-indicator-bar {
    position: absolute;
    bottom: -1px;
    height: 3px;
    background-color: #d0d0d0;
    border-radius: 3px;
    transition: left 0.4s cubic-bezier(0.25, 1, 0.5, 1), width 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.memory-view .tab-content {
    padding: 24px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.8;
    width: 100%;
    box-sizing: border-box;
}

.memory-view .fade-in {
    animation: memory-fade-in 0.4s ease;
}

@keyframes memory-fade-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.memory-view .tab-pane {
    display: none;
    width: 100%;
}

.memory-view .tab-pane.active {
    display: block;
    animation: memory-fade-in 0.3s ease;
}

.memory-view .settings-section {
    background-color: rgba(240, 240, 242, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.memory-view .settings-header {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.memory-view .settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.memory-view .settings-row:last-child {
    border-bottom: none;
}

.memory-view .settings-row.clickable {
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.memory-view .settings-row.clickable:hover {
    opacity: 0.7;
}

.memory-view .settings-label {
    font-size: 13px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 8px;
}

.memory-view .settings-sublabel {
    font-size: 10px;
    color: #aaa;
    margin-top: 4px;
}

.memory-view .toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.memory-view .toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.memory-view .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e4e4e4;
    transition: 0.3s;
    border-radius: 20px;
}

.memory-view .slider::before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.memory-view input:checked + .slider {
    background-color: #bbb;
}

.memory-view input:checked + .slider::before {
    transform: translateX(16px);
}

.memory-view .collapse-area {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease;
    opacity: 0;
}

.memory-view .collapse-area.expanded {
    max-height: 200px;
    opacity: 1;
    padding-top: 4px;
}

.memory-view .inline-input {
    width: 36px;
    border: none;
    border-bottom: 1px solid #ddd;
    background: transparent;
    font-size: 13px;
    color: #333;
    text-align: center;
    font-family: inherit;
    margin: 0 4px;
    padding: 2px;
    transition: border-color 0.3s;
    -moz-appearance: textfield;
}

.memory-view .inline-input::-webkit-outer-spin-button,
.memory-view .inline-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.memory-view .inline-input:focus {
    outline: none;
    border-bottom-color: #999;
}

.memory-view .action-btn {
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 16px;
    padding: 6px 16px;
    font-size: 11px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.memory-view .action-btn:hover {
    background-color: #000;
    transform: scale(1.02);
}

.memory-view .action-btn:active {
    transform: scale(0.98);
}

.memory-view .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.memory-view .modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.memory-view .modal-card {
    background: rgba(240, 240, 242, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    width: 90%;
    max-width: 320px;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.memory-view .modal-overlay.active .modal-card {
    transform: translateY(0) scale(1);
}

.memory-view .modal-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
}

.memory-view .modal-textarea {
    width: 100%;
    height: 120px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    color: #555;
    resize: none;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.4);
    font-family: inherit;
    line-height: 1.6;
}

.memory-view .modal-textarea:focus {
    outline: none;
    border-color: rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.7);
}

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

.memory-view .modal-btn {
    background: none;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 6px;
    transition: background 0.2s;
}

.memory-view .modal-btn.cancel {
    color: #999;
}

.memory-view .modal-btn.cancel:hover {
    background: #f5f5f5;
}

.memory-view .modal-btn.save {
    color: #fff;
    background: #333;
}

.memory-view .modal-btn.save:hover {
    background: #000;
}

.memory-view .anniversary-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 10px;
}

.memory-view .anniversary-item {
    display: flex;
    gap: 12px;
    align-items: stretch;
    animation: memory-fade-in 0.3s ease;
}

.memory-view .anniversary-cal {
    width: 52px;
    height: 54px;
    background: #fff;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.memory-view .anniversary-cal::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 16px;
    background-color: #f0f2f5;
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.memory-view .anniversary-cal::after {
    content: "";
    position: absolute;
    top: -3px;
    left: 14px;
    width: 4px;
    height: 10px;
    background: #b0b0b0;
    border-radius: 2px;
    box-shadow: 20px 0 0 #b0b0b0;
    z-index: 2;
}

.memory-view .anniversary-cal-month {
    font-size: 9px;
    font-weight: 600;
    color: #777;
    margin-top: 3px;
    z-index: 1;
    letter-spacing: 0.5px;
}

.memory-view .anniversary-cal-day {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin-top: 4px;
}

.memory-view .anniversary-card {
    flex: 1;
    background: rgba(240, 240, 242, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 14px 16px;
    border: 1px solid rgba(0, 0, 0, 0.03);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.memory-view .anniversary-text {
    font-size: 13px;
    color: #444;
    line-height: 1.5;
    padding-right: 40px;
}

.memory-view .anniversary-actions {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.memory-view .anniversary-item:hover .anniversary-actions {
    opacity: 1;
}

@media (hover: none) {
    .memory-view .anniversary-actions {
        opacity: 1;
    }
}

.memory-view .icon-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.memory-view .icon-btn:hover {
    color: #333;
}

.memory-view .icon-btn.delete:hover {
    color: #e55353;
}

.memory-view .modal-input {
    width: 100%;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 8px 4px;
    font-size: 14px;
    color: #333;
    background: transparent;
    font-family: inherit;
    margin-bottom: 16px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.memory-view .modal-input:focus {
    outline: none;
    border-color: #999;
    background: rgba(255, 255, 255, 0.7);
}

.memory-view .modal-input[type="date"] {
    color: #555;
    text-transform: uppercase;
}

.memory-view .plan-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 10px;
}

.memory-view .plan-card {
    background: rgba(240, 240, 242, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(0, 0, 0, 0.03);
    animation: memory-fade-in 0.3s ease;
    position: relative;
}

.memory-view .plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.memory-view .plan-type-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
}

.memory-view .plan-type-badge.suspense {
    background: #333;
    color: #fff;
}

.memory-view .plan-type-badge.plan {
    background: #e0e0e0;
    color: #555;
}

.memory-view .plan-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.memory-view .plan-date {
    font-size: 11px;
    color: #999;
}

.memory-view .plan-stars {
    display: flex;
    gap: 2px;
}

.memory-view .plan-stars svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: #ccc;
    stroke-width: 2;
}

.memory-view .plan-stars svg.filled {
    fill: #666;
    stroke: #666;
}

.memory-view .plan-content {
    font-size: 13px;
    color: #444;
    line-height: 1.6;
    margin-bottom: 12px;
}

.memory-view .plan-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.memory-view .plan-tag {
    background: #f1f2f4;
    color: #666;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
}

.memory-view .type-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.memory-view .type-pill {
    flex: 1;
    text-align: center;
    padding: 8px;
    background: rgba(0, 0, 0, 0.03);
    color: #666;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.memory-view .type-pill.active {
    background: #333;
    color: #fff;
    font-weight: 500;
}

.memory-view .star-rating-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
}

.memory-view .star-rating-selector svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: #ccc;
    stroke-width: 1.5;
    cursor: pointer;
    transition: all 0.2s;
}

.memory-view .star-rating-selector svg.filled {
    fill: #555;
    stroke: #555;
}

@media (max-width: 500px) {
    .memory-view .stamps-group {
        transform: scale(0.85);
    }

    .memory-view .stamps-group:hover {
        transform: scale(0.85) translateY(-8px);
    }
}

@media (max-width: 400px) {
    .memory-view .stamps-group {
        transform: scale(0.7);
    }

    .memory-view .stamps-group:hover {
        transform: scale(0.7) translateY(-8px);
    }
}
